Skip to content
AI Skill Index
DataVersion 1.0.0

Migration safety checker

Finds the database migrations that will lock a table or break running code.

Works with: Claude Code, Cursor, Any agent

Reads a migration against the deploy that will run alongside it. The failures it looks for are the ones that only appear in production: a lock held long enough to time out requests, and a schema change that breaks the version of the app still running during a rolling deploy.

Files in this package

---
name: migration-safety-checker
description: Review a database migration for locking and rolling-deploy hazards before it is applied to production.
---

# Migration safety checker

## When this applies

Any migration heading for a database with real data and live traffic. On an empty dev database none of this matters, which is exactly why it goes unnoticed until it does.

## The two questions

### 1. What does it lock, and for how long?

- Adding a column with a **volatile default** or a **NOT NULL without a default** may rewrite the whole table.
- Adding an index without `CONCURRENTLY` (Postgres) blocks writes for the build.
- Adding a foreign key takes a lock on **both** tables while it validates.
- Any `ALTER TABLE` queues behind running transactions — and everything else queues behind it. A long-running read can turn a fast migration into an outage.

Estimate against the real row count, not the dev one. Ask for it if unknown.

### 2. Does the currently-running code survive it?

During a rolling deploy the old and new versions run at the same time. Therefore:

- **Dropping or renaming a column** breaks the old version instantly. Split it: stop writing, deploy, then drop in a later release.
- **Adding NOT NULL** breaks old inserts that do not supply it.
- **Narrowing a type** breaks old writes that were valid a minute ago.

## Output

State the risk, the mechanism, and the safe sequence. Where a change needs splitting across releases, write out the releases.

## Never

- Never approve a destructive change because it looks small. Dropping a column is one line and unrecoverable without a backup.
- Never assume a maintenance window exists. Ask.

How to install

Unzip into .claude/skills/ in your project, or ~/.claude/skills/ to make it available everywhere. The agent picks it up from the folder name and the description in the front matter. There is no registration step.

ShareXLinkedIn

Related skills

Data

Data cleaner

Profiles a messy dataset and proposes fixes before changing anything.

Cookies

We use only the cookies this site needs to work. Optional analytics helps us see which content is worth writing more of — nothing loads until you say yes.

Read the privacy policy