design-database-schema — Claude Code command: schema design
This command plans database structures around requirements, relationships, and query patterns. Use it to draft a schema or rethink an existing one.
npx claude-code-templates@latest --command setup/design-database-schemaWhat design-database-schema does
The command examines project requirements, data entities, and access patterns, then proposes tables or collections with keys, relationships, and constraints. You can request a relational, NoSQL, or hybrid design, or focus on normalization. It can use project documentation and an existing schema as context.
Its output includes DDL scripts, ER diagrams, performance analysis, and a migration plan. The design process also covers indexes, partitioning, access control, and audit trails. The command has access to Read, Write, Edit, and Bash. Expected scale and query patterns inform its performance choices, so include those details in the project requirements.
What it helps with
- map application requirements to tables and relationships
- choose a relational, NoSQL, or hybrid data model
- set keys, constraints, and a normalization approach
- draft DDL and a migration plan for an existing database
Example prompts for the agent
- Design a relational schema from the requirements in
requirements/ - Plan a hybrid database structure based on the current codebase
- Normalize this schema and prepare DDL plus a migration plan
How to install design-database-schema
1claude-code-templates
npx claude-code-templates@latest --command setup/design-database-schema2Manually: put the files in place
.claude/commands/design-database-schema.mdCall it with /design-database-schema. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/design-database-schema.mdCall it with /prompts:design-database-schema. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/design-database-schema.prompt.mdManually: put the files in place
.gemini/commands/design-database-schema.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about design-database-schema
How do I install design-database-schema in Claude Code?
Run npx claude-code-templates@latest --command setup/design-database-schema. This installs the design-database-schema command.
What does design-database-schema do?
It plans a database schema using project requirements and context. The result can include DDL scripts, ER diagrams, performance analysis, and a migration plan.
Can I choose the schema type?
Yes. Specify a schema type or use --relational, --nosql, --hybrid, or --normalize.
Source text
design-database-schema.md · MIT
--- allowed-tools: Read, Write, Edit, Bash argument-hint: "[schema-type] | --relational | --nosql | --hybrid | --normalize" description: Design optimized database schemas with proper relationships, constraints, and performance considerations --- # Design Database Schema Design optimized database schemas with comprehensive data modeling: **$ARGUMENTS** ## Current Project Context - Application type: Based on $ARGUMENTS or codebase analysis - Data requirements: @requirements/ or project documentation - Existing schema: @prisma/schema.prisma or @migrations/ or database dumps - Performance needs: Expected scale, query patterns, and data volume ## Task Design comprehensive database schema with optimal structure and performance: **Schema Type**: Use $ARGUMENTS to specify relational, NoSQL, hybrid approach, or normalization level **Design Framework**: 1. **Requirements Analysis** - Business entities, relationships, data flow, and access patterns 2. **Entity Modeling** - Tables/collections, attributes, primary/foreign keys, constraints 3. **Relationship Design** - One-to-one, one-to-many, many-to-many associations 4. **Normalization Strategy** - Data consistency vs performance trade-offs 5. **Performance Optimization** - Indexing strategy, query optimization, partitioning 6. **Security Design** - Access control, data encryption, audit trails **Advanced Patterns**: Implement temporal data, soft deletes, JSONB fields, full-text search, audit logging, and scalability patterns. **Validation**: Ensure referential integrity, data consistency, query performance, and future extensibility. **Output**: Complete schema design with DDL scripts, ER diagrams, performance analysis, and migration strategy.
© davila7 · MIT · davila7/claude-code-templates