database-design
Installation
SKILL.md
Database Design — Schema & Architecture Mastery
Mandatory Pre-Flight Context Inspection
Before designing schemas or writing SQL migrations, you MUST inspect:
- Timezone Timestamp Standard → Always use
TIMESTAMPTZ; ban bareTIMESTAMP - Primary Key B-Tree Locality → Use
BIGINT GENERATED ALWAYS AS IDENTITYor UUID v7 (RFC 9562); ban random UUID v4 as primary keys on high-insert tables - Foreign Key Indexing → Explicitly create indexes on all foreign key columns (
CREATE INDEX idx_... ON table(fk_id)) to prevent full table locks during cascading operations - Zero-Downtime Migration Pattern → Use the expand-contract pattern; never rename columns or drop columns in a single deploy step
Activation Boundaries
- Activate when: Designing database relational schemas, writing database migrations, indexing query paths, tuning connection pooling, and architecting persistence layers.
- DO NOT activate when: Writing frontend UI components, styling layouts, or handling client-side state.