DB Migration Reviewer
Reviews a database migration for safety: locking, backfills, non-reversible operations, downtime risk, and missing rollback steps.
What this skill does
Key features
- Flags dangerous ALTERs that take long-held or exclusive locks
- Detects non-reversible operations and missing rollback paths
- Spots blocking backfills that should run in batches
- Suggests an expand/contract sequence to avoid downtime
Use cases
- Reviewing a migration before it ships to production
- Splitting a risky column change into safe steps
- Checking that a migration can be rolled back
SKILL.md
The skill definition — its metadata and the exact instructions an agent follows. Copy it into a SKILL.md file in your agent's skills folder.
| name | migration-review |
|---|---|
| description | Review a DB migration for locking, downtime, reversibility, and backfill safety, then suggest a safer sequence. |
| allowed-tools | Read, Grep |
| output | risk findings + safer migration plan |
| destructive | never |
Musts
- Read the full migration, including both up and down steps, before reviewing.
- Flag every statement that takes an exclusive or long-held lock on a large table.
- Identify non-reversible operations and any missing or incomplete rollback.
- Call out backfills that run in a single statement and should be batched.
- Never suggest a change that silently drops data without an explicit warning.
Guidelines
- Prefer an expand/contract sequence for column renames, type changes, and NOT NULL additions.
- Recommend adding indexes concurrently (Postgres) or online where the engine supports it.
- Note when a change requires a matching application deploy to stay compatible.
- If the down migration cannot restore prior state, say so plainly.
Output format
## Risk summary
<low | medium | high> — <one line>
## Findings
- [severity] <statement>: <why it is risky>
## Safer plan
1. <expand step>
2. <backfill step>
3. <contract step>
## Rollback
<is it reversible? if not, what is the recovery path>
FAQ
Does it run the migration?
No. It reads the migration file and reviews it statically. Applying or rolling back the migration stays your decision and your command.
What is expand/contract?
A pattern that splits a risky schema change into additive steps first, a backfill, then removal of the old shape, so the app keeps working during the transition.
Before running any skill, read its instructions and the tools it's allowed to use, and test it on a safe target first. See LLM security best practices.