db-architect

Generate PostgreSQL schemas, Drizzle ORM TypeScript, migration SQL, and SCHEMA_DECISIONS.md from data requirements.

Updated Mar 30, 2026
One-click install
npx skills add https://github.com/drshailesh88/build_playbook --skill db-architect-drshailesh88
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: db-architect
Source: https://github.com/drshailesh88/build_playbook/tree/main/skills/db-architect
Command: npx skills add https://github.com/drshailesh88/build_playbook --skill db-architect-drshailesh88

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill eliminates risky, ad-hoc database design by turning structured data requirements into a complete, production-ready PostgreSQL schema with documented decisions and migration-safe steps.

Core Features & Use Cases

  • Schema design from requirements: Reads .planning/data-requirements.md and converts data subjects, relationships, lifecycle rules, and access patterns into tables, foreign keys, and constraints.
  • Production-grade Drizzle ORM + migrations: Produces Drizzle ORM TypeScript schemas plus migration SQL and a checklist-friendly output you can review before applying.
  • Safety, validation, and documentation: Enforces PostgreSQL best practices (e.g., timestamptz, bigint identity keys, explicit FK indexes) and generates SCHEMA_DECISIONS.md with rationale and anti-pattern validation.
  • Use cases: Designing a new database for a feature, extending an existing schema safely, or performing a database quality review for performance and correctness.

Quick Start

Run /data-grill to generate data requirements, then ask the db-architect skill to design a new PostgreSQL schema from .planning/data-requirements.md and output Drizzle ORM tables, migration SQL, and SCHEMA_DECISIONS.md.

Frequently Asked Questions about db-architect

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate Drizzle ORM TypeScript schemas and migration SQL from data requirements?

To generate Drizzle ORM TypeScript schemas and migration SQL, structured data requirements must first be converted into PostgreSQL tables, foreign keys, and constraints with enforced best practices like timestamptz and bigint identity keys.

How do I design a future-proof PostgreSQL schema from structured data requirements?

Designing a future-proof PostgreSQL schema requires reading structured data requirements to produce production-grade tables, explicit foreign key indexes, migration-safe steps, and documented design decisions with anti-pattern validation.

Do I need structured data requirements before designing a PostgreSQL database schema?

Yes, you need structured data requirements generated from a prior planning step before designing a PostgreSQL database schema, ensuring the resulting tables and constraints accurately match data subjects, relationships, and access patterns.

What is the best way to ensure migration safety when extending an existing PostgreSQL schema?

The best way to ensure migration safety when extending a PostgreSQL schema is to generate checklist-friendly migration SQL alongside the Drizzle ORM TypeScript definitions, enforcing strict conventions like bigint identity keys and explicit indexing.

Why does my PostgreSQL schema design need explicit indexing for all foreign keys?

Your PostgreSQL schema design needs explicit indexing for all foreign keys to enforce production-grade performance and correctness, preventing query bottlenecks and validating against known database anti-patterns.

Can I review PostgreSQL schema decisions and anti-pattern validation before applying migrations?

Yes, you can review PostgreSQL schema decisions and anti-pattern validation before applying migrations by generating a dedicated SCHEMA_DECISIONS.md file that documents the rationale behind every constraint and table design choice.