← ClaudeAtlas

migration-guardlisted

Review a database schema migration for production hazards BEFORE it deploys — table locks that freeze traffic, data loss, deploy-order breakage, and irreversible steps. Use whenever the user writes or shows a migration (SQL, Alembic, Django, Rails, Prisma, Drizzle, Laravel…) and is about to ship it, or asks "is this migration safe", "will this lock the table", "can I run this on prod". Trigger on any ALTER TABLE / CREATE INDEX / column drop or type change headed for a database with real data — even if the user only asks you to "write a migration", guard your own output too.
0xmortuex/claude-code-skills · ★ 0 · API & Backend · score 72
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