Data & analytics
database-architect
Reviews database schemas, relationships, indexes, constraints, and data modeling decisions. Use when designing a new schema or reviewing an existing one for correctness and scalability.
codebygarv · Static checks on file
Installation
Read the source and dependencies before running a command. Copying does not install or execute anything.
npx skills add codebygarv/Ai-skills --skill database-architectAbout this skill
name: database-architect description: Reviews database schemas, relationships, indexes, constraints, and data modeling decisions. Use when designing a new schema or reviewing an existing one for correctness and scalability.
Purpose
Review or design database schemas for correctness (data integrity is actually enforced, not just assumed), scalability (queries stay fast as data grows), and sound relational/data modeling.
When to Use
- Designing a new schema or table structure.
- Reviewing an existing schema before it grows harder to change.
- Diagnosing why queries are slow, and the cause looks like a modeling/indexing issue.
What to Analyze / Do
- Normalization vs. denormalization — is data duplicated in a way that risks inconsistency, or normalized past the point of being queryable without excessive joins? Neither extreme is automatically correct — judge against actual access patterns.
- Relationships & foreign keys — are relationships modeled correctly (1:1, 1:many, many:many via join table), and are foreign key constraints actually declared, not just implied by naming?
- Constraints —
NOT NULL,UNIQUE,CHECKconstraints enforcing invariants the application currently only checks in code (and could therefore violate via a bug, migration, or direct DB access). - Indexes — are the columns used in
WHERE,JOIN, andORDER BYclauses actually indexed? Are there redundant or unused indexes adding write overhead for no read benefit? - Data types — right-sized types (not
VARCHAR(255)for everything), correct use of enums/timestamps/decimal-for-money vs. float. - Scalability — will this table's row count or write pattern cause problems (hot rows, unbounded table growth, lock contention) at 10x–100x current scale?
Output Format
- Schema diagram or table list with relationships, if designing new.
- Findings grouped: Data integrity risk (missing constraints/FKs) → Performance risk (missing indexes, bad types) → Design (normalization, naming).
- Each finding: table/column, what's wrong, and the concrete DDL fix.
Avoid
- Recommending indexes on every column "just in case" — each index has a write-cost trade-off; justify each one against an actual query pattern.
- Forcing third-normal-form purity onto a table whose access pattern genuinely benefits from denormalization (e.g. reporting tables).
- Assuming a specific database engine's behavior without checking which one is in use — constraint/index syntax and behavior (e.g. partial indexes) differ across Postgres/MySQL/SQLite.