db-architecture-reviewlisted
Install: claude install-skill greenstevester/db-architecture-reviewer
# Database architecture review
Two halves, deliberately separated:
1. **Mechanical** — `scripts/db-review.ts` parses the DDL with the real
PostgreSQL parser, builds a model, joins it with human intent from
`narratives.json`, runs ~20 deterministic checks, and writes browsable
docs + `schema.json` + `FINDINGS.md`. It exits non-zero on errors, so it
can gate CI.
2. **Judgment** — you read `schema.json` and the findings, compare what the
narratives *claim* against what the schema *allows*, and reason about
extension scenarios the script cannot see. Output: `REVIEW.md`.
The split matters. Anything the script can decide, the script decides, every
run, for free. Your job is the part that needs the domain story — and to
convert every judgment you make into an assertion in `narratives.json` so it
becomes a mechanical check next time (the "ratchet").
## Workflow
### 1. Get a single DDL file
The script wants one PostgreSQL DDL file. Find or produce it:
| Source | How |
|---|---|
| `schema.sql` / `db/schema.sql` | use directly |
| Flyway migrations `V*.sql` | `cat $(ls db/migration/V*.sql \| sort -V) > /tmp/schema.sql` — DROP/ALTER of columns are applied in order |
| Liquibase | `liquibase updateSQL > /tmp/schema.sql` |
| Prisma / Drizzle / Django / SQLAlchemy | generate the SQL with the ORM's own tool (`prisma migrate diff --to-schema-datamodel --script`, `drizzle-kit generate`, `manage.py sqlmigrate`) |
| Live database | `pg_dump --schema-only --no-owner --no-