database-design
Skill206 starsChanged 3 months agoMITView on GitHub
Design schemas and migrations when persistent data structures change.
42 other projects use a version of this.
Adopted by
Most recently taken up by
- vekzz-dev/opencode-skillstheir own version, first seen Oct 3, 2026
- hemapriyan-rk/claude-rigor-skillstheir own version, first seen Sep 26, 2026
- ZeroTokenClaw/agents-skillstheir own version, first seen Sep 21, 2026
- RealDougEubanks/ClaudeMarketplacetheir own version, first seen Sep 10, 2026
- VoDaiLocz/kilo-kit-mcptheir own version, first seen Aug 21, 2026
- TheHiddenDeveloper/jarvis-skillstheir own version, first seen Aug 19, 2026
Used with
Projects with it also use intelligent-routing, i18n-localization and 10 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.
tiendatworkSkillintelligent-routing
Automatic agent selection and intelligent task routing. Analyzes user requests and automatically selects the best specialist agent(s) without requiring explicit user mentions.
Also in 3 projects that use this
xfstudioSkilli18n-localization
Internationalization and localization patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.
Also in 5 projects that use this
xfstudioSkillbehavioral-modes
AI operational modes (brainstorm, implement, debug, review, teach, ship, orchestrate). Use to adapt behavior based on task type.
Also in 3 projects that use this
GenerativeAgentsSkillarchitecture-design
アーキテクチャ設計書を作成するための詳細ガイドとテンプレート。アーキテクチャ設計時にのみ使用。
Also in 8 projects that use this
- +8 more from xfstudio
Other versions42 projects use a version of this.
Word for word · 1
- KbWen/agent-virtual-office★ 35100% same
Edited · 0
None found.
Wrote their own version · 41
- CloudAI-X/claude-workflow-v2★ 1.4ksame name
- MoizIbnYousaf/ai-agent-skills★ 1.1ksame name
- thiientv/godmode★ 96same name
- VoDaiLocz/kilo-kit-mcp★ 27same name
- krzysztofsurdy/code-virtuoso★ 22same name
- DauQuangThanh/hanoi-rainbow★ 17same name
- ishandutta2007/Awesome-Claude-Skills★ 15same name
- svngoku/coding-agents-skills★ 11same name
- xfstudio/skills★ 9same name
- roanbrasil/engineer-grade-agent-skills★ 8same name
31 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 repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- llms.txtllms.txt
- api-designSkill
- auth-securitySkill
- dispatching-parallel-agentsSkill
- doc-lookupSkill
- frontend-patternsSkill
- karpathy-principlesSkill
- production-readinessSkill
- red-team-adversarialSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- using-git-worktreesSkill
- verification-before-completionSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. 0 are common, 11 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 40 edited versions we read keep these.
11
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 21
Every table MUST have: id (primary key), created_at, updated_at
- Distinctive: line 22
Use UUIDs or auto-increment IDs consistently (per ADR decision)
- Distinctive: line 36
Every foreign key column MUST have an index
- Distinctive: line 40
DO NOT over-index: every index slows writes
- Very specific: line 44
Migrations MUST be reversible: every up must have a corresponding down
- Distinctive: line 45
Never modify a shipped migration: create a new migration instead
- Very specific: line 47
Test rollback: after writing migration, verify down works cleanly
- Distinctive: line 50
Use parameterized queries / ORM bindings — NEVER string concatenation for SQL
- Very specific: line 52
Add LIMIT to all list queries (even if paginated — belt and suspenders)
- Distinctive: line 53
Use transactions for multi-table writes
- Distinctive: line 58
NOT NULL on required fields (don't rely on application validation alone)
- Distinctive: line 59
CHECK constraints for enum-like fields or value ranges
- Distinctive: line 60
Default values for fields that have sensible defaults
- Distinctive: line 96
Missing indexes on FK: Every foreign key needs an index.
- Distinctive: line 101
Trusting application-only validation: No DB constraints means bad data WILL get in eventually.
“Common” is measured: kept by at least 6 in 10 of the 40 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
<!-- This is a SCAFFOLD skill -->Database Design
When to Apply
- Classification: feature (if new tables/columns), architecture-change (schema redesign), hotfix (data-related bug)
- Phase: /plan (schema design), /implement (migration creation), /review (schema review), /test (data integrity)
- Trigger: Task involves creating tables, modifying schema, writing migrations, or changing data access patterns
Conventions
Customize after /app-init: Replace these generic conventions with your project's ADR and ORM-specific patterns.
Table Design
- Every table MUST have:
id(primary key),created_at,updated_at - Use UUIDs or auto-increment IDs consistently (per ADR decision)
- Soft delete: add
deleted_atcolumn if ADR specifies soft delete - Table names: plural, snake_case (e.g.,
users,order_items) - Column names: snake_case (e.g.,
first_name,is_active)
Relationship Patterns
| Relationship | Implementation | Example |
| One-to-Many | Foreign key on "many" side | orders.user_id → users.id |
| Many-to-Many | Junction table | user_roles (user_id, role_id) |
| One-to-One | Foreign key + unique constraint | user_profiles.user_id (UNIQUE) → users.id |
| Self-referencing | Foreign key to same table | categories.parent_id → categories.id |
Index Strategy
- Every foreign key column MUST have an index
- Columns used in WHERE clauses frequently → add index
- Composite indexes: put the most selective column first
- Unique constraints for business uniqueness rules (email, username, etc.)
- DO NOT over-index: every index slows writes
Migration Rules
- One migration per logical change (don't mix table creation with data backfill)
- Migrations MUST be reversible: every
upmust have a correspondingdown - Never modify a shipped migration: create a new migration instead
- Data migrations separate from schema migrations: schema first, data second
- Test rollback: after writing migration, verify
downworks cleanly
Query Patterns
- Use parameterized queries / ORM bindings — NEVER string concatenation for SQL
- Limit SELECT columns:
SELECT id, namenotSELECT * - Add
LIMITto all list queries (even if paginated — belt and suspenders) - Use transactions for multi-table writes
- Batch inserts for bulk operations (not one INSERT per row)
Data Integrity
- Foreign key constraints enforced at DB level (not just application level)
- NOT NULL on required fields (don't rely on application validation alone)
- CHECK constraints for enum-like fields or value ranges
- Default values for fields that have sensible defaults
Checklist
During /plan:
- Schema changes documented in spec (new tables, modified columns)
- Indexes planned for query patterns
- Migration rollback strategy defined
- Data backfill plan (if modifying existing tables with data)
During /implement:
- Migration file created (not manual SQL against DB)
- Foreign keys have indexes
- NOT NULL and DEFAULT constraints set appropriately
- Migration tested: up → verify → down → verify → up
- No raw SQL string concatenation (use parameterized queries)
During /review:
- No N+1 queries (use eager loading / JOIN where appropriate)
- Transaction boundaries correct (all-or-nothing for related writes)
- No schema changes without migration file
- Backward compatibility: old code can still function until deployed together
- Sensitive data columns identified (for encryption/hashing per security guardrails)
Heading-Scoped Read Note
For phase-entry loading, read only:
When to ApplyChecklist
Load Conventions, Anti-Patterns, and References on full read or cache miss only.
Anti-Patterns
- Schema via ORM only: Relying on ORM auto-sync without migration files. No rollback, no history, no review.
- God table: One table with 30+ columns. Normalize or split by domain.
- Missing indexes on FK: Every foreign key needs an index. Databases don't add them automatically (except some).
- String-typed everything: Using VARCHAR for dates, numbers, booleans. Use proper types.
- No migration rollback: Writing
upwithoutdown. You will need to rollback someday. - Mixing DDL and DML: Schema changes and data backfill in the same migration. Split them.
- SELECT * in production code: Fetching all columns when you need two. Wastes memory and bandwidth.
- Trusting application-only validation: No DB constraints means bad data WILL get in eventually.
References
- Project ADR:
docs/adr/ADR-002-project-architecture.md§ Database Design - Security guardrails:
.agent/rules/security_guardrails.md(A03: SQL Injection, A02: Secrets in connection strings) - Spec template:
.agentcortex/templates/spec-app-feature.md§ Database 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.

