migration-guardlisted
Install: claude install-skill 0xmortuex/claude-code-skills
# migration-guard
A bad code deploy rolls back in seconds. A bad migration takes a site down mid-deploy, holds a lock while every request queues behind it, or destroys data with no undo. Migrations are the highest-stakes routine change most teams make, and the failure modes are invisible in dev — a lock that's instant on 200 rows is a 10-minute outage on 200 million. Your job: read the migration like the database will execute it in production, and report what will actually happen.
This is a **review**, not a rewrite service. Findings first — each with severity, what happens in prod, and the safe alternative. Only rewrite when asked or when the fix is one line.
## First, establish the blast radius
The same DDL is safe or catastrophic depending on context. Determine (from the code, or ask — these change every verdict):
- **Engine and version** — Postgres, MySQL/InnoDB, SQLite, and MSSQL have completely different locking behavior, and versions matter (e.g. Postgres 11+ makes `ADD COLUMN ... DEFAULT` instant; MySQL 8.0 `INSTANT` ALGORITHM covers some ALTERs).
- **Table size and write traffic** — a lock that rewrites a huge, hot table is the classic outage.
- **Deploy model** — is old code still running while/after the migration runs? (Almost always yes: rolling deploys, or migration-then-deploy.)
## The hazard checklist
Walk the migration against these classes. Report only what applies.
**1. Locks / downtime**
- `CREATE INDEX` without `CONCURRENTLY` (Postgres): full write