Skip to main content
command

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.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --command setup/design-database-schema
Open on GitHub

What 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-schema

2Manually: put the files in place

.claude/commands/design-database-schema.md

Call it with /design-database-schema. For all projects use ~/.claude/commands/

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

Similar slash commands

All slash commands for Data and databases →

From the same set205

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor