database-schema-designer
Skill321 starsChanged 2 months agoMITView on GitHub
Designs relational and document database schemas from requirements or an existing app - tables and collections, keys, relationships, constraints, indexes driven by real query patterns, ERDs, and reversible migration scripts - with PostgreSQL (including Supabase) as the default and MySQL, SQLite, and MongoDB supported. Use when the user wants to model data for a new app or feature, review or fix an existing schema, choose keys or indexes, plan multi-tenancy, normalize or denormalize, or write CREATE TABLE statements or migrations, even if they just describe their app and ask "how should I store this". For moving data between database providers, use database-migrator.
17 other projects use a version of this.
Adopted by
Most recently taken up by
- JPeetz/agent-skillstheir own version, first seen Sep 29, 2026
- SkotAlexsander/skillstheir own version, first seen Sep 16, 2026
- MortuisVMain/ai-agent-superpowerstheir own version, first seen Sep 15, 2026
- th-efool/SKILLStheir own version, first seen Aug 8, 2026
- Hassaan146/claude-skillstheir own version, first seen Jul 25, 2026
- mahiunfiltered/claude-code-skillstheir own version, first seen Jul 8, 2026
Used with
Projects with it also use skill-judge, agent-md-refactor and 6 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
bamechoSkillskill-judge
Evaluate Agent Skill design quality against official specifications and best practices. Use when reviewing, auditing, or improving SKILL.md files and skill packages. Provides multi-dimensional scoring and actionable improvement suggestions.
Also in 3 projects that use this
softaworksSkillagent-md-refactor
Refactor bloated AGENTS.md, CLAUDE.md, or similar agent instruction files to follow progressive disclosure principles. Splits monolithic files into organized, linked documentation.
Also in 3 projects that use this
JeffallanSkillrag-architect
Designs and implements production-grade RAG systems by chunking documents, generating embeddings, configuring vector stores, building hybrid search pipelines, applying reranking, and evaluating retrieval quality. Use when building RAG systems, vector databases, or knowledge-grounded AI applications requiring semantic search, document retrieval, context augmentation, similarity search, or embedding-based indexing.
Also in 3 projects that use this
rogue-dev-studioSkillbrowser-automation
Canonical browser automation and web UI verification: Playwright, agent browser CLIs, and CDP-based tooling in one playbook.
Also in 3 projects that use this
lookfreeSkillexcalidraw
Generate architecture diagrams as .excalidraw files from codebase analysis. Use when the user asks to create architecture diagrams, system diagrams, visualize codebase structure, or generate excalidraw files.
Also in 3 projects that use this
ArogyaReddySkillchangelog-generator
Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.
Also in 3 projects that use this
Other versions17 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 17
- softaworks/agent-toolkit★ 2.5ksame name
- nahisaho/MUSUBI★ 77same name
- kumaran-is/claude-code-onboarding★ 36same name
- Hassaan146/claude-skills★ 18same name
- JPeetz/agent-skills★ 10same name
- csiddhant796-blip/claude-skills-collection★ 2same name
- Hussain-Elfalah/Agentic-Skills★ 2same name
- Nikoxkx/Agent-Skills★ 2same name
- digitalspeed/claude-code-skillset★ 1same name
- mahiunfiltered/claude-code-skills★ 1same name
7 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository228 other files it gives its agents.
- accessibility-auditorSkill
- agent-armySkill
- agent-eval-harnessSkill
- agent-swarm-deployerSkill
- agent-team-builderSkill
- agent-to-agentSkill
- ai-coding-guardrailsSkill
- ai-readiness-assessmentSkill
- animateSkill
- api-documentation-writerSkill
- api-endpoint-scaffolderSkill
- api-load-testerSkill
- athlete-social-media-managerSkill
- before-you-buildSkill
- bi-measure-builderSkill
- board-deck-generatorSkill
- bookkeeping-closeSkill
- bracket-predictorSkill
- brand-consistency-checkerSkill
- brand-voice-analyzerSkill
- browser-test-loopSkill
- budget-optimizerSkill
- cash-flow-forecasterSkill
- champion-identifierSkill
- churn-autopsySkill
- claude-design-criticSkill
- claude-design-system-architectSkill
- claude-landing-composerSkill
- claude-md-writerSkill
- client-health-dashboardSkill
- client-proposal-generatorSkill
- code-review-proSkill
- cold-email-sequence-generatorSkill
- color-palette-extractorSkill
- commercial-lease-analyzerSkill
- company-announcement-writerSkill
- competitor-content-analyzerSkill
- competitor-intel-agentSkill
- competitor-price-trackerSkill
- compliance-checkerSkill
- contact-hunterSkill
- content-repurposerSkill
- context-budgetSkill
- contract-analyzerSkill
- contract-redlinerSkill
- conversation-archaeologistSkill
- cowork-calendar-defragSkill
- cowork-contract-renewal-radarSkill
- cowork-data-room-builderSkill
- cowork-deal-roomSkill
- cowork-expense-auditSkill
- cowork-folder-organizerSkill
- cowork-hiring-screenerSkill
- cowork-home-inventorySkill
- cowork-inbox-triageSkill
- cowork-invoice-chaserSkill
- cowork-medical-bill-auditorSkill
- cowork-qbr-builderSkill
- cowork-rfp-responseSkill
- cowork-sop-writerSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 11 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 34
Every query from step 1 is served by a stated index or is explained as a scan that is fine at the expected size.
- Very specific: line 35
Every foreign key has an explicit ON DELETE behavior and an index on the referencing column.
- Very specific: line 36
No timestamp without time zone.
“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Database Schema Designer
Design a schema that enforces the data's rules in the database and makes the app's real queries fast.
Workflow
- Collect requirements. Get from the conversation or codebase, and ask only for what blocks the design:
- Engine and version (default: PostgreSQL 18; check
docker-compose.yml, ORM config, or Supabase project if present) - Entities and how they relate, in plain language
- The 5-10 most frequent or most important queries, including filters and sort order
- Volume and growth (rows per table per year), read/write mix
- Tenancy (single app, multi-tenant by organization), retention, audit, and compliance needs (PII, deletion requests)
- ORM or migration tool in use (Prisma, Drizzle, Rails, Django, Alembic, Supabase migrations, plain SQL)
- Engine and version (default: PostgreSQL 18; check
- Model entities and relationships. List entities, attributes, and cardinality (1:1, 1:N, N:M). Normalize to 3NF by default; denormalize only for a named query that needs it, and say which.
- Choose keys and types using references/postgres.md (or references/other-engines.md for MySQL, SQLite, MongoDB). Defaults for Postgres:
bigint generated always as identityoruuid DEFAULT uuidv7()primary keys,textovervarchar(n),timestamptzfor every timestamp,numericfor money. - Encode the rules as constraints.
NOT NULLwherever a value is required,UNIQUEfor natural keys,CHECKfor ranges and allowed values, foreign keys with a deliberateON DELETEchoice for each. Data rules that live only in app code get broken by the next script or admin fix. - Derive indexes from the queries in step 1, not from a checklist. For each query, name the index that serves it. Index every foreign key column you join or cascade on (Postgres does not do this automatically). Do not add an index a
UNIQUEor primary key already provides. - Write the deliverable: DDL, ERD, index rationale, and migrations with rollback, using references/schema-templates.md and the layout in references/output-format.md. Match the user's migration tool if they have one.
- Verify. If a database is available (local Postgres, Docker
postgres:18, a Supabase branch), run the DDL, insert a few rows, andEXPLAINthe key queries to confirm the planned indexes are used. Otherwise, walk each query from step 1 against the schema by hand. Then check the list below.
Checks before delivering
- Every query from step 1 is served by a stated index or is explained as a scan that is fine at the expected size.
- Every foreign key has an explicit
ON DELETEbehavior and an index on the referencing column. - No timestamp without time zone; no floating point for money; no
varchar(255)by habit. updated_atactually updates: aDEFAULT now()only sets it on insert, so add a trigger or set it in the ORM.- Uniqueness that should ignore case (emails, usernames) is enforced case-insensitively.
- Multi-tenant tables carry
tenant_id(ororg_id), include it in unique constraints and leading index columns, and have row-level security if the database is reachable from clients (always on Supabase). - Migrations that touch large existing tables avoid long locks (see migration safety in references/postgres.md).
- Rollback scripts are real inverses, and destructive rollbacks (dropping a column with data) are called out.
Worked example
Request: "Multi-tenant project tracker: orgs, users who can belong to several orgs, projects per org, tasks per project. The main screen lists a project's open tasks by due date."
- Entities:
orgs,users,org_members(N:M between users and orgs with arole),projects(N:1 org),tasks(N:1 project, optional assignee). - Key query: open tasks for one project ordered by due date, so a partial index
ON tasks (project_id, due_at) WHERE status <> 'done'. - Rules as constraints:
UNIQUE (org_id, user_id)onorg_members;CHECK (role IN ('owner','admin','member'));statuslimited byCHECK; unique project name per org withUNIQUE (org_id, name). - Deletes: removing an org cascades to projects and tasks; deleting a user sets
tasks.assignee_idto null instead of deleting tasks. - Tenancy:
taskscarriesorg_idso row-level security can check membership without a join throughprojects, and a composite foreign key(project_id, org_id) -> projects (id, org_id)keeps the two consistent.
The full DDL for this example is in references/schema-templates.md.
Failure modes
- Designing tables before knowing the queries, then indexing every column "just in case". Each index slows every write.
- Postgres
ENUMtypes for values that will change. Adding a value is easy, but removing or renaming one is painful; aCHECKconstraint or lookup table is easier to evolve. - Soft deletes (
deleted_at) added everywhere by default. They leak into every query and unique constraint. Use them where there is a real restore or audit need, and pair them with partial unique indexes. - Polymorphic foreign keys (
commentable_type+commentable_id) that the database cannot enforce. Prefer separate nullable FKs with aCHECKthat exactly one is set, or separate tables. - Storing structured, queried fields inside
jsonb. JSON is for sparse or truly variable attributes; anything you filter, join, or constrain on deserves a column.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

