schema-design
Skill3 starsChanged 4 months agoMITView on GitHub
Use when designing a data model for a new feature or bounded context — entities, relationships, normalization, indexing, constraints, partitioning. Triggers on "data model", "schema design", "database design", "ER model", "数据模型", "表结构设计", "数据库设计".
3 other projects use a version of this.
Adopted by
Most recently taken up by
- nahid-sparktales/agent-dispatchertheir own version, first seen Sep 21, 2026
- butterbase-ai/butterbase-skillstheir own version, first seen Jun 10, 2026
- dtsong/agentic-counciltheir own version, first seen Jun 10, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- butterbase-ai/butterbase-skills★ 533same name
- nahid-sparktales/agent-dispatcher★ 59same name
- dtsong/agentic-council★ 0same 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 repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- brainstormSkill
- oss-strategySkill
- specSkill
- researchSkill
- api-designSkill
- architectureSkill
- codebase-designSkill
- design-researchSkill
- domain-modelingSkill
- frontend-designSkill
- imagegenSkill
- image-to-codeSkill
- prompt-engineeringSkill
- prototypeSkill
- auth-implementationSkill
- breakdownSkill
- context-engineeringSkill
- error-handlingSkill
- i18nSkill
- implementSkill
- multi-agent-orchestrationSkill
- cost-optimizationSkill
- performanceSkill
- refactoringSkill
- simplifySkill
- api-testingSkill
- e2e-testingSkill
- load-testingSkill
- tddSkill
- test-generationSkill
- a11y-reviewSkill
- code-reviewSkill
- debuggingSkill
- lintingSkill
- security-reviewSkill
- ci-cdSkill
- deprecation-migrationSkill
- git-workflowSkill
- oss-polishSkill
- shippingSkill
- documentation-auditSkill
- handoffSkill
- incident-responseSkill
- observabilitySkill
- purity-auditSkill
- skill-authoringSkill
- using-skillsSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
1
Distinctive
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 34
Start from the domain model (domain-modeling output / CONTEXT.md) and translate nouns into entities, verbs into relationships.
- Distinctive: line 90
Avoid hot writes to a single sequence (use scattered keys or per-tenant sequences at scale)
“Common” is measured: kept by at least 6 in 10 of the 3 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
Schema Design
Design the data model that sits beneath the API and beside the domain language. architecture
picks the datastore type; domain-modeling sharpens the vocabulary; this skill designs the actual
shape of the data — entities, relationships, indexes, constraints, and how the model scales. A
schema designed reactively (added-to-as-features-arrive) becomes a performance and correctness
liability that is expensive to fix later.
When to use
- Designing entities and relationships for a new feature or bounded context
- Choosing normalization level, indexing strategy, or partitioning for a new model
- Reviewing a proposed schema for correctness, performance, or future evolution
- Triggers on "data model", "schema design", "database design", "ER model", "数据模型", "表结构设计", "数据库设计"
Scope: assumes a relational datastore (Postgres/MySQL/SQLite). For document stores (MongoDB), key-value (DynamoDB), or graph stores, the embedding-vs-referencing and sharding decisions differ — use
architecturefor datastore selection, then adapt these patterns.
Not for: choosing the datastore type (use architecture); ubiquitous-language glossary (use
domain-modeling); API request/response shapes (use api-design); changing an existing schema
in production (use deprecation-migration).
Steps
1. Map entities and relationships
Start from the domain model (domain-modeling output / CONTEXT.md) and translate nouns into
entities, verbs into relationships. For each entity, identify its identity (primary key), its
attributes, and its lifecycle (created, mutated, archived, deleted).
- Draw an ER diagram (Mermaid erDiagram — see
${CLAUDE_PLUGIN_ROOT}/references/mermaid-diagrams.md) - Cardinality for every relationship: one-to-one, one-to-many, many-to-many
- Resolve many-to-many with junction tables; never hide them in a comma-separated column
Verify: every entity in the domain model is represented; every relationship has documented cardinality.
2. Choose normalization level
Normalize by default (3NF / BCNF) — it eliminates anomalies and keeps the model honest. Denormalize deliberately, only when a measured read pattern justifies the write complexity and consistency risk. Document every denormalization as a trade-off: what read it optimizes, what write it complicates, how consistency is maintained.
- Foreign keys for every relationship (enforce referential integrity at the DB level)
- Surrogate keys (UUID/serial) over natural keys unless the natural key is truly immutable
- NULL semantics: every nullable column has a documented meaning — "unknown" vs. "none" vs. "not yet"
Verify: every FK is enforced; every denormalization is documented with its trade-off.
3. Design indexes
Index for the queries, not the columns. Start from the access patterns (how will this data be read?), then create indexes that serve them. Every index has a cost — write amplification and storage — so justify each one against a concrete query.
- Composite indexes ordered by selectivity and equality-before-range
- Covering indexes for hot read paths (include columns to avoid table lookups)
- Partial / filtered indexes for common WHERE predicates (e.g.
WHERE deleted_at IS NULL) - Unique indexes to enforce business invariants (one active subscription per user)
Verify: every index maps to a named query; EXPLAIN on each access pattern uses an index, not a
seq scan.
4. Define constraints and invariants
The database is the last line of defense for data integrity. Push invariants into constraints — they are enforced regardless of application bugs:
NOT NULLunless the column genuinely can be absentCHECKconstraints for range/format invariants (price ≥ 0, status in allowed set)UNIQUEconstraints for business keys (email, slug, active-session-per-user)- Foreign key actions:
ON DELETE/ON UPDATE(RESTRICT / CASCADE / SET NULL) chosen deliberately
Verify: every business invariant is backed by a constraint, not just application logic.
5. Plan for scale and evolution
Design the model to survive growth without a painful migration:
- Partitioning strategy for large tables (range by date, hash by tenant) — decide before the table hits 100M rows, not after
- Avoid hot writes to a single sequence (use scattered keys or per-tenant sequences at scale)
- Soft delete (
deleted_attimestamp) for audit-relevant data; hard delete for ephemeral data — choose per entity, document why - Forward-compatible types:
timestamptz(nottimestamp),UUIDorbigint(notintfor IDs that may exceed 2B)
Verify: partitioning decision is documented; ID types won't overflow; soft/hard-delete policy is stated per entity.
6. Document
Output: docs/design/SCHEMA.md — the data model document: ER diagram, entity definitions with
columns/types/constraints, index plan mapped to access patterns, partitioning strategy, and any
denormalization trade-offs. Reference ADRs for significant model decisions.
Verify
- ER diagram drawn (Mermaid); every entity and relationship documented
- Normalization level stated; every denormalization documented with trade-off
- Foreign keys enforced at DB level; referential integrity does not rely on application code
- Indexes mapped to named queries;
EXPLAINconfirms index usage on access patterns - Business invariants backed by CHECK / UNIQUE constraints
- ID types won't overflow; partitioning strategy stated for growth tables
docs/design/SCHEMA.mdproduced with ER diagram + entity/index/constraint plan
Red flags: comma-separated lists in a column; missing foreign keys; indexing every column (or
no indexes); SELECT * driving the schema; int IDs on tables that will grow; NULL with no
documented meaning; relying solely on application code for integrity; no partitioning plan for a
table that will exceed memory.
References
- ${CLAUDE_PLUGIN_ROOT}/references/engineering-principles.md — shared discipline (surface assumptions, enforce simplicity, verify don't assume)
- ${CLAUDE_PLUGIN_ROOT}/references/mermaid-diagrams.md — Mermaid erDiagram syntax for entity-relationship diagrams
- references/schema-patterns.md — normalization trade-offs, index patterns, partitioning strategies, soft-delete policies
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.

