design-schema
Skill1 starsChanged 2 months agoMITView on GitHub
Design a table or collection before the migration — model the entities and relationships, pick keys and indexes for the real access patterns, decide normalization vs denormalization, name columns to match the domain and the wire layer. Postgres / Mongo / Prisma. Use when adding a feature that needs new storage, when asked to "design the schema / data model", or before writing a migration.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- evgenii-studitskikh/Claude-Code-SaaS-Studiotheir own version, first seen Jun 10, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- evgenii-studitskikh/Claude-Code-SaaS-Studio★ 1same name
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 repository73 other files it gives its agents.
- AGENTS.mdAGENTS.md
- bigquery-analyticsSkill
- cache-invalidationSkill
- mongo-aggregationSkill
- mongo-modelingSkill
- postgres-aggregationSkill
- postgres-indexingSkill
- redis-coordinationSkill
- redis-patternsSkill
- review-querySkill
- code-migrationSkill
- cut-releaseSkill
- data-migrationSkill
- deploy-serviceSkill
- hotfixSkill
- rollbackSkill
- design-endpointSkill
- design-eventSkill
- evolve-contractSkill
- scaffold-nestjs-moduleSkill
- scaffold-projectSkill
- incident-responseSkill
- investigate-bugSkill
- on-callSkill
- postmortemSkill
- audit-skillsSkill
- distill-review-styleSkill
- write-skillSkill
- debug-with-tracesSkill
- define-alertsSkill
- instrument-serviceSkill
- evaluate-dependencySkill
- grillSkill
- handoffSkill
- orientSkill
- phased-deliverySkill
- spikeSkill
- to-questionnaireSkill
- write-adrSkill
- write-prdSkill
- devops-pr-reviewSkill
- go-backend-pr-reviewSkill
- nestjs-backend-pr-reviewSkill
- python-backend-pr-reviewSkill
- react-frontend-pr-reviewSkill
- bisectSkill
- break-couplingSkill
- dead-code-sweepSkill
- deslopifySkill
- extract-moduleSkill
- rebase-cleanSkill
- resolve-merge-conflictsSkill
- split-commitSkill
- tddSkill
- wait-whatSkill
- wide-renameSkill
- bullmqSkill
- kafkaSkill
- sqs-consumerSkill
- audit-dependenciesSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Do this before deployment/data-migration.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Design a schema
Do this before deployment/data-migration. Start from the access patterns,
not the entities — how will this data be read and written, how often, by what.
Work through
- Entities & relationships — what are the nouns, how do they relate (1:1, 1:N, N:M), what owns what. Draw it.
- Keys — natural vs surrogate. Prefer a surrogate PK (
id), add unique constraints for the natural keys. UUID vs auto-increment: UUID if IDs are exposed or generated client-side or across services; sequential otherwise. - Access patterns → indexes — for each query the feature needs, name the
WHERE/ORDER BY/ join columns. Composite index column order = equality columns first, then range/sort. Don't index speculatively; do index the patterns you know. - Normalize by default; denormalize deliberately. A denormalized/derived
column is fine when the read path is hot and the write path can keep it
consistent — say so in a comment.
isNewAccountdoesn't need a column if it'screated_at > X. - Nullability & defaults —
NULLmeans "unknown/absent", not "zero". Every non-null column needs a default or a value at insert. Timestamps: store UTC,timestamptz. - Constraints in the DB — FKs,
CHECK,UNIQUE,NOT NULL. The DB is the last line; don't rely only on app validation. - Enums — a lookup table or a native enum, values matching the domain
vocabulary and the wire layer (
snake_caseat the wire/DB layer, don't mix). - Mongo — embed when the sub-doc is always loaded with the parent and bounded
in size; reference when it's large, unbounded, or queried independently. Set
the indexes explicitly (
MONGO_AUTO_INDEX=falsein prod). - Growth — will this table need partitioning / archival / a TTL? Note it now even if you don't build it.
Output
The schema (DDL or Prisma model or Mongo schema), the indexes with the query each
serves, and any denormalization decision with its rationale. Hand to
deployment/data-migration to sequence the change.
Anti-patterns
- ❌ Designing entities without listing the queries first.
- ❌ Indexing every column, or no columns.
- ❌ Denormalizing with no plan to keep the copy consistent.
- ❌ Naming that doesn't match the domain language (
CONTEXT.mdglossary). - ❌ Validation only in the app, none in the schema.
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.

