Design database schemas, plan migrations, optimize queries, and manage data models. Covers relational databases (PostgreSQL, MySQL, SQLite), document databases (MongoDB), and ORM integration (Prisma, Drizzle, TypeORM). Use this skill when designing schemas, reviewing data models, planning migrations, optimizing slow queries, or establishing database patterns for a project. Triggers on "database", "schema", "migration", "model", "query optimization", "index", "normalize/denormalize".
View on GitHubsrstomp/pokayokay
pokayokay
January 23, 2026
Select agents to install to:
npx add-skill https://github.com/srstomp/pokayokay/blob/main/plugins/pokayokay/skills/database-design/SKILL.md -a claude-code --skill database-designInstallation paths:
.claude/skills/database-design/# Database Design Design efficient, maintainable database schemas with safe migration strategies. ## Design Process ``` ┌─────────────────────────────────────────────────────────────────┐ │ DATABASE DESIGN PROCESS │ ├─────────────────────────────────────────────────────────────────┤ │ │ │ 1. REQUIREMENTS 2. MODELING 3. SCHEMA │ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │ │ Entities │ → │ ER diagram │ → │ Tables & │ │ │ │ Attributes │ │ Relations │ │ Columns │ │ │ │ Constraints │ │ Cardinality │ │ Constraints │ │ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │ │ │ 4. INDEXES 5. MIGRATION 6. REVIEW │ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │ │ Query │ → │ Safe changes│ → │ Performance │ │ │ │ patterns │ │ Rollback │ │ Consistency │ │ │ │ Performance │ │ Zero-down │ │ Integrity │ │ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────┘ ``` ## Core Principles ### 1. Data Integrity First Enforce constraints at the database level, not just application. ```sql -- ✅ Database enforces integrity CREATE TABLE orders ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), user_id UUID NOT NULL REFERENCES users(id), total DECIMAL(10,2) NOT NULL CHECK (total >= 0), status VARCHAR(20) NOT NULL DEFAULT 'pending' ); -- ❌ Relying only on application validation CREATE TABLE orders ( id INTEGER, user_id INTEGER, -- no FK total TEXT -- wrong type, no constraint ); ``` ### 2. Normalize by Default, Denormalize with Pur