database-schema-designer/SKILL.md
Design optimized database schemas for SQL and NoSQL databases including tables, relationships, indexes, and constraints. Creates ERD diagrams, migration scripts, and data modeling best practices. Use when users need database design, schema optimization, or data architecture planning.
npx skillsauth add onewave-ai/claude-skills database-schema-designerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Design optimized, scalable database schemas with proper relationships and indexes.
When a user needs database schema design:
Gather Requirements:
Design Schema Following Best Practices:
For SQL Databases:
For NoSQL Databases:
Generate Complete Schema:
SQL Schema Output:
-- [Entity Name] Table
-- Purpose: [Description]
CREATE TABLE [table_name] (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
[field_name] [TYPE] [CONSTRAINTS],
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
deleted_at TIMESTAMP
);
-- Indexes
CREATE INDEX idx_[table]_[field] ON [table]([field]);
CREATE INDEX idx_[table]_[field1]_[field2] ON [table]([field1], [field2]);
-- Foreign Keys
ALTER TABLE [child_table]
ADD CONSTRAINT fk_[constraint_name]
FOREIGN KEY ([foreign_key_field])
REFERENCES [parent_table](id)
ON DELETE CASCADE;
NoSQL Schema Output (MongoDB example):
// [Collection Name]
// Purpose: [Description]
{
_id: ObjectId,
[field_name]: [type],
// Embedded document
[embedded_object]: {
field1: type,
field2: type
},
// Reference
[related_id]: ObjectId, // Ref to [other_collection]
created_at: ISODate,
updated_at: ISODate
}
// Indexes
db.[collection].createIndex({ field: 1 })
db.[collection].createIndex({ field1: 1, field2: -1 })
db.[collection].createIndex({ field: "text" }) // Text search
Create Entity Relationship Diagram (text format):
┌─────────────────────┐
│ users │
├─────────────────────┤
│ id (PK) │
│ email (UNIQUE) │
│ name │
│ created_at │
└──────────┬──────────┘
│
│ 1:N
│
┌──────────▼──────────┐
│ posts │
├─────────────────────┤
│ id (PK) │
│ user_id (FK) │
│ title │
│ content │
│ created_at │
└──────────┬──────────┘
│
│ N:M (via post_tags)
│
┌──────────▼──────────┐
│ tags │
├─────────────────────┤
│ id (PK) │
│ name (UNIQUE) │
└─────────────────────┘
Provide Migration Scripts:
-- Migration: create_users_table
-- Date: 2024-01-15
BEGIN;
CREATE TABLE users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
email VARCHAR(255) NOT NULL UNIQUE,
name VARCHAR(255) NOT NULL,
password_hash VARCHAR(255) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW()
);
CREATE INDEX idx_users_email ON users(email);
CREATE INDEX idx_users_created_at ON users(created_at);
COMMIT;
-- Rollback
BEGIN;
DROP TABLE users;
COMMIT;
Format Complete Output:
🗄️ DATABASE SCHEMA DESIGN
Database: [PostgreSQL/MySQL/MongoDB/etc.]
Domain: [Application type]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📋 ENTITY RELATIONSHIP DIAGRAM
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[ASCII ERD]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 TABLE DEFINITIONS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[SQL CREATE TABLE statements]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔗 RELATIONSHIPS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[Foreign key constraints]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚡ INDEXES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[Index definitions with rationale]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔄 MIGRATION SCRIPTS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[Up and down migrations]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💡 OPTIMIZATION NOTES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Performance Considerations:
• [Index strategy]
• [Partitioning recommendations]
• [Denormalization opportunities]
Scaling Strategy:
• [Sharding approach]
• [Read replicas]
• [Caching layer]
Data Integrity:
• [Constraint strategy]
• [Validation rules]
• [Audit logging]
Schema Design Best Practices:
Naming Conventions:
Data Types:
Indexes:
Relationships:
Performance:
Ensure schemas:
Generate production-ready, optimized database schemas that scale.
development
Custom training plans by goal (strength, cardio, flexibility). Progressive overload programming, rest day optimization, home vs gym adaptations, deload weeks.
tools
Takes a manual business workflow description and designs the automated version. Maps current steps, handoffs, decision points, and bottlenecks. Designs automated flow with triggers, conditions, actions, and error handling. Outputs workflow-automation.md with before/after Mermaid diagrams, tool recommendations, implementation steps, and time savings estimate.
testing
Auto-generates weekly KPI reports from multiple data sources including Supabase analytics, CRM data, financial spreadsheets, and email metrics. Produces executive-ready reports with dashboards, trends, highlights, concerns, and action items.
development
Convert webinar recordings into blog posts, social snippets, email series. Extract key quotes, statistics, and soundbites.