database-schema-designer

database-schema-designer is a skill for Claude Code, Codex from tmj-90/gaffer. It costs 75 tokens per session (1,136 once invoked), scanned A, original, Apache-2.0.

A guide for designing database tables, relationships, indexes, migrations, and generated TypeScript or Python types from requirements.

In plain words
What is it for?
It helps plan new schemas, review normalisation and performance, add multi-tenant data structures, plan breaking migrations, and produce code types.
Why use it?
It helps prevent duplicated data, weak relationships, slow queries, and database changes that are difficult to apply safely.

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/tmj-90/gaffer/database-schema-designer
Any agent
npx skills add tmj-90/gaffer --skill database-schema-designer
Clone the repo
git clone --depth 1 https://github.com/tmj-90/gaffer

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for database-schema-designer

README.md
[![agentmods](https://agentmods.dev/badge/skills/tmj-90/gaffer/database-schema-designer.svg)](https://agentmods.dev/skills/tmj-90/gaffer/database-schema-designer)
Your own site
<a href="https://agentmods.dev/skills/tmj-90/gaffer/database-schema-designer"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/database-schema-designer.svg" alt="Measured on agentmods" height="20"></a>
Per session 75 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,136 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.00075 $0.01136
Opus 5 $0.00037 $0.00568
Sonnet 5 $0.00015 $0.00227
Haiku 4.5 $0.00007 $0.00114

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

Security

Grade A, and why

database-schema-designer 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 5d 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.

runner/skills/database-schema-designer/SKILL.md · 93 lines

How it starts

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

Design schemas that survive production

Normalise first. Index for query patterns. Never sacrifice data integrity for convenience.

Design process

Step 1 — Requirements → Entities

Extract nouns from the requirement. Each noun that has attributes and participates in relationships is likely an entity. Resist making everything a single wide table.

Step 2 — Relationships

Identify cardinality before choosing the table structure:

Relationship Implementation
1:1 Foreign key on the less-common side (or same table if always loaded together)
1:N Foreign key on the N side
M:N Junction table with FK to both sides; add attributes to the junction if needed

Step 3 — Normalisation

Target 3NF for transactional data:

  1. 1NF — atomic values; no repeating groups; primary key identifies each row.
  2. 2NF — no partial dependencies (non-key column depends on the whole PK, not a subset).
  3. 3NF — no transitive dependencies (non-key column depends only on the PK, not on another non-key column).

Denormalise deliberately for read-heavy analytics tables — document the trade-off.

Standard conventions

  • Primary key: id (UUID v7 for distributed systems; BIGSERIAL for single-node).
  • Timestamps: created_at TIMESTAMPTZ DEFAULT now(), updated_at TIMESTAMPTZ DEFAULT now().
  • Soft delete: deleted_at TIMESTAMPTZ nullable — add a partial index WHERE deleted_at IS NULL.
  • Audit trail: separate audit_log table with entity_type, entity_id, action, actor_id, changed_at, before, after.
  • Multi-tenancy: tenant_id on every tenant-scoped table; composite primary key or FK constraint; RLS policy.

Index strategy

  • Index every foreign key (databases do not do this automatically).
  • Add composite indexes for the most common WHERE col1 = ? AND col2 = ? patterns.
  • Partial indexes for filtered queries (WHERE deleted_at IS NULL, WHERE status = 'active').
  • Covering indexes (INCLUDE (col)) to avoid heap lookups on hot read paths.
  • Drop indexes that are never used — they slow writes.

Read the full file on GitHub · 93 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. 5d ago First seen · 93 lines · 75 tokens per session scan A f1c39d70b532

Subscribe to this mod's changes

database-schema-designer is a skill published in the GitHub repository tmj-90/gaffer (2 stars, last pushed 4d ago), licensed Apache-2.0. It adds 75 tokens to every session and 1,136 once invoked, about $0.0004 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.

Related

Other skills, from other repositories

database-query-profiler

Profile database query profiler operations. Auto-activating skill for Performance Testing. Triggers on: database query profiler, database query profiler Part of the Performance Testing skill category. Use when working with database query profiler functionality. Trigger with phrases like "database query profiler"…

nek1987/auto-agent-harness · 64 tokens

database-schema-designer

Build database schema designer operations. Auto-activating skill for Backend Development. Triggers on: database schema designer, database schema designer Part of the Backend Development skill category. Use when working with database schema designer functionality. Trigger with phrases like "database schema designer"…

nek1987/auto-agent-harness · 64 tokens

database-schema-visualizer

Generate database schema visualizer operations. Auto-activating skill for Visual Content. Triggers on: database schema visualizer, database schema visualizer Part of the Visual Content skill category. Use when working with database schema visualizer functionality. Trigger with phrases like "database schema…

nek1987/auto-agent-harness · 71 tokens

database-test-helper

Assist with database test helper operations. Auto-activating skill for Test Automation. Triggers on: database test helper, database test helper Part of the Test Automation skill category. Use when writing or running tests. Trigger with phrases like "database test helper", "database helper", "database".

nek1987/auto-agent-harness · 62 tokens

dbt-test-creator

Create dbt test creator operations. Auto-activating skill for Data Pipelines. Triggers on: dbt test creator, dbt test creator Part of the Data Pipelines skill category. Use when writing or running tests. Trigger with phrases like "dbt test creator", "dbt creator", "dbt".

nek1987/auto-agent-harness · 71 tokens

database-operations

Instructions on how to write database queries with SQLAlchemy.

nek1987/auto-agent-harness · 15 tokens