migration-safety-reviewlisted
Install: claude install-skill sriptcollector/toolbay-skills-claude-code-skill-pack
# Migration Safety Review
## Install
Save this file as `~/.claude/skills/migration-safety-review/SKILL.md`, or
`.claude/skills/migration-safety-review/SKILL.md` to scope it to one repo. Claude
Code auto-discovers it. Invoke with `/migration-safety-review` or by asking "is
this migration safe to run?".
## Why this exists
A migration is the one routine deploy step that can be unrecoverable. Application
bugs get rolled back; a dropped column is gone unless someone happens to have a
backup from before, and knows it, and can restore it under pressure.
Two independent risks, and reviews usually catch only the first:
1. **Data loss.** Destructive and irreversible.
2. **Locks.** Perfectly reversible schema changes that hold an exclusive lock long
enough to stall every query, taking the site down for the length of the
migration on a table large enough to matter.
The second is what turns a two-line change into an outage, and it never shows up
in staging because staging has a thousand rows.
## Step 1 — Read the actual SQL, not the intent
```
# Prisma
npx prisma migrate diff --from-schema-datasource prisma/schema.prisma --to-schema-datamodel prisma/schema.prisma --script
git diff -- '*migration*' '*schema*'
```
Never review a migration from the ORM model diff alone. The generated SQL is what
runs, and generators make destructive choices — a renamed field routinely becomes
DROP plus ADD, which is a rename that deletes every value.
## Step 2 — Classify every statement
**I