db-schema

db-schema is a skill for Claude Code from kazdenc/builder-skills. It costs 61 tokens per session (1,942 once invoked), scanned A, original, MIT.

A guide for designing a PostgreSQL database schema, which defines tables, fields, and relationships, from product requirements.

In plain words
What is it for?
Use it to identify entities and relationships and design tables, keys, timestamps, foreign keys, and related database rules.
Why use it?
It translates feature needs into a consistent relational data model before implementation begins.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Good fit Use it to identify entities and relationships and design tables, keys, timestamps, foreign keys, and related database rules.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kazdenc/builder-skills/db-schema
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.

Any agent
npx skills add kazdenc/builder-skills --skill db-schema
Clone the repo
git clone --depth 1 https://github.com/kazdenc/builder-skills

Made for: Claude Code.

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 db-schema

README.md
[![agentmods](https://agentmods.dev/badge/skills/kazdenc/builder-skills/db-schema.svg)](https://agentmods.dev/skills/kazdenc/builder-skills/db-schema)
Your own site
<a href="https://agentmods.dev/skills/kazdenc/builder-skills/db-schema"><img src="https://agentmods.dev/badge/skills/kazdenc/builder-skills/db-schema.svg" alt="Measured on agentmods" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,942 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00061 $0.01942
Opus 5 $0.00030 $0.00971
Sonnet 5 $0.00012 $0.00388
Haiku 4.5 $0.00006 $0.00194

Measured 8d ago against content hash a8e8fd4ecdcc, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

db-schema 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 8d 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.

.claude/skills/dev/setup/db-schema/SKILL.md · 214 lines

How it starts

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

Database Schema Design

Design a Postgres database schema from product requirements. If target is provided, scope to that feature. Otherwise, ask the user what they're building.

Step 1: Identify Entities and Relationships

Read the requirements (PRD, user stories, or conversation). Extract:

  • Nouns = candidate tables (users, projects, comments, invoices)
  • Verbs = candidate relationships (creates, belongs to, has many)
  • Adjectives/states = candidate columns or enums (active, draft, published)

Ask clarifying questions if the requirements are ambiguous. Don't guess at business logic.

Step 2: Design Tables

Follow these conventions on every table:

Convention Rule Example
Table names snake_case, plural user_profiles, org_members
Column names snake_case first_name, created_at
Primary keys uuid, auto-generated id uuid default gen_random_uuid() primary key
Timestamps On every table, non-nullable created_at timestamptz default now() not null
Updated timestamp On every table updated_at timestamptz default now() not null
Foreign keys Named explicitly, with on delete user_id uuid references users(id) on delete cascade
Soft deletes Use deleted_at timestamptz when needed Only when business requires undo/recovery
Booleans Prefix with is_ or has_ is_active, has_verified_email

Postgres Type Recommendations

Data Use Don't use Why
Identifiers uuid serial, integer Non-sequential, safe to expose, no collision across tables
Timestamps timestamptz timestamp Always store timezone-aware. Convert on display.
Money numeric(12,2) or bigint (cents) float, real Floating point causes rounding errors
Email text with check constraint varchar(255) text is faster in Postgres. Constrain with check.
Short strings text varchar(n) Postgres text has no performance penalty. Use check(length(col) <= n) if needed.
Status/enum text with check, or Postgres enum Magic integers check (status in ('draft','published','archived'))
JSON data jsonb json jsonb is indexable and more efficient
IP addresses inet text Native type supports operations
Tags/arrays text[] or junction table CSV in text column Arrays for simple cases, junction table for queryable tags

Read the full file on GitHub · 214 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. 8d ago First seen · 214 lines · 61 tokens per session scan A a8e8fd4ecdcc

Subscribe to this mod's changes

db-schema is a skill published in the GitHub repository kazdenc/builder-skills (45 stars, last pushed 6mo ago), licensed MIT. It adds 61 tokens to every session and 1,942 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-30.

Related

Other skills, from other repositories