relational-database-design

A guide for designing or reviewing relational database schemas: the structure of tables, how they connect, and the rules controlling stored data.

In plain words
What is it for?
Use it to model a domain, choose relationships and indexes, enforce constraints, and plan database migrations—the controlled steps for changing an existing database.
Why use it?
It helps avoid duplicated, inconsistent, or hard-to-query data before the database is built or changed.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/soulcodex/agentic/relational-database-design
Any agent
npx skills add soulcodex/agentic --skill relational-database-design
Clone the repo
git clone --depth 1 https://github.com/soulcodex/agentic

Made for: Claude Code, Codex.

Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,192 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00055 $0.01192
Opus 5 $0.00028 $0.00596
Sonnet 5 $0.00011 $0.00238
Haiku 4.5 $0.00006 $0.00119

Measured 3d ago against content hash 6692d6c856db, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

relational-database-design scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/data/relational-database-design/SKILL.md · 124 lines

How it starts

The opening of the file, as written. The whole thing — 124 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Relational Database Design Skill

Step 1 — Gather Requirements

Ask (or infer from context) before designing anything:

  • What are the core domain entities and their relationships?
  • What are the primary access patterns (queries the application must answer)?
  • What are the expected data volumes (rows per table, growth rate)?
  • What are the SLA and consistency requirements (read latency, write throughput, ACID)?
  • Are there regulatory or retention requirements (GDPR deletion, audit trails)?
  • Which database engine will be used (PostgreSQL, MySQL, SQLite, …)?

Step 2 — Draft Entity List and Relationships

Enumerate entities and classify relationships:

  • One-to-many: a parent row owns many child rows (ordersline_items).
  • Many-to-many: resolve via a join table (usersroles via user_roles).
  • One-to-one: split tables only when the subset is queried independently or has different access control requirements.

Sketch an ERD in text or ASCII before writing DDL:

users (id, email, created_at)
  └── orders (id, user_id FK, status, placed_at)
        └── line_items (id, order_id FK, product_id FK, quantity, unit_price)
products (id, sku, name, price)

Step 3 — Apply Normalization

Normalize to 3NF as the default:

  1. 1NF: atomic values per column, no repeating groups.
  2. 2NF: every non-key column depends on the entire primary key (relevant for composite PKs).
  3. 3NF: no transitive dependencies — non-key columns depend only on the primary key.

Document any intentional denormalization with a comment explaining the trade-off:

-- Denormalized: product_name copied at order time so historical orders
-- remain readable even if the product is later renamed or deleted.
line_items.product_name TEXT NOT NULL

Step 4 — Define Indexes

Map each identified access pattern to an index strategy:

Access pattern Index type Example
Equality lookup by FK B-tree CREATE INDEX ON orders(user_id)
Range query on timestamp B-tree CREATE INDEX ON orders(placed_at)
Partial: active records only Partial B-tree CREATE INDEX ON orders(user_id) WHERE status = 'active'
Case-insensitive lookup Expression CREATE INDEX ON users(lower(email))
Avoid heap fetch on hot query Covering CREATE INDEX ON orders(user_id) INCLUDE (status, placed_at)

Read the full file on GitHub · 124 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 124 lines · 55 tokens per session scan A 6692d6c856db

Subscribe to this mod's changes

relational-database-design is a skill published in the GitHub repository soulcodex/agentic (10 stars, last pushed 3d ago), licensed MIT. It adds 55 tokens to every session and 1,192 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.