Skip to content
Back to skills

Migration Plan

ASecurity

Plan a schema or data change that is safe to deploy and to undo: split it into expand / backfill / switch / contract steps that each work with old and new code running at once, write a rollback for every step, rehearse on a copy of real data with row counts, and set the checks that decide go or stop. Use for "add/rename/drop a column", "migrate this data", "change the schema", "backfill", "change a file or message format", "is this migration safe", or any change to stored data.

  • 9 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 14, 2026
ai-agentsgodatabase

Security analysis

A100/100

Scanned November 14, 2026

npx -y skills add ychampion/ystack --skill migration-plan --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Migration Plan?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Migration Plan
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ychampion-migration-plan/badge)](https://www.skillsdirectory.com/skills/ychampion-migration-plan)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: migration-plan
description: >-
  Plan a schema or data change that is safe to deploy and to undo: split it into expand / backfill /
  switch / contract steps that each work with old and new code running at once, write a rollback for
  every step, rehearse on a copy of real data with row counts, and set the checks that decide go or
  stop. Use for "add/rename/drop a column", "migrate this data", "change the schema", "backfill",
  "change a file or message format", "is this migration safe", or any change to stored data.
---

# Migration plan

Code rolls back in a minute. Data, once rewritten, often can't. Plan every data change so that each
step can be deployed alone, can run while old code is still live, and has a way back.

## When it applies

- Any change to a database schema, stored file format, cache layout, queue message shape or index.
- A backfill or bulk rewrite of existing data.

## Procedure

### 1. State the change and the data

Write the before and after shape, how many rows or files are affected (query it), and who reads and
writes this data: services, jobs, other repos, analytics, backups.

### 2. Split into steps that each stand alone

Use expand and contract. A rename of `email` to `contact_email`, for example:

| Step | Change | Old code still works? | Rollback |
| --- | --- | --- | --- |
| 1 Expand | add `contact_email`, nullable | yes | drop the column |
| 2 Dual write | code writes both columns | yes | deploy previous code |
| 3 Backfill | copy `email` to `contact_email` in batches | yes | none needed: old column intact |
| 4 Switch reads | code reads `contact_email` | yes | deploy previous code |
| 5 Contract | stop writing `email`, later drop it | no: point of no return | restore from backup only |

Each step ships separately. Mark the point of no return and put it last, after a waiting period.

### 3. Make the risky steps safe

- **Locks:** know whether the change locks the table on your database and size; use the online or
  concurrent form where it exists (adding indexes, adding columns with defaults).
- **Backfills:** batches of a fixed size, resumable from the last id, safe to run twice, throttled.
- **Defaults and nulls:** decide what old rows get; never let "null" silently mean something new.
- **Backup:** confirm a restorable backup exists before the point of no return. Check the restore,
  not just the backup file.

### 4. Rehearse on a copy

Run the steps on a copy of real data (or a realistic sample at scale). Record time per step and row
counts before and after. Run the rollback for each step and check the data matches the start.

### 5. Set go and stop checks

For each step: the query or metric that shows it worked (row counts match, no nulls where none are
allowed, error rate flat), and the condition that means stop and roll back.

## Output

```
Change: <before -> after>   Affected: <n rows/files>   Readers/writers: <list>
Steps: <the table, with rollback per step>
Point of no return: step <n>, after <wait condition>
Rehearsal: <time per step, counts before/after, rollback tested yes/no>
Checks: <per step: go signal / stop signal>
```

## Rules

- Every step before the point of no return has a tested rollback.
- No step requires old and new code to be deployed at the same instant.
- Never rewrite data in place without a copy or backup you have restored at least once.
- Running the plan against production is the user's call; hand over the plan.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.