| name | migration-planner |
| description | Database and API migration planning with zero-downtime strategies, rollback procedures, and data transformation |
| layer | utility |
| category | development |
| triggers | ["migration plan","database migration","schema migration","API migration","zero downtime migration","data migration","breaking change"] |
| inputs | [{"current_state":"Current schema, API version, or system architecture"},{"target_state":"Desired end state after migration"},{"constraints":"Downtime tolerance, data volume, rollback requirements"},{"dependencies":"Systems and services affected by the migration"}] |
| outputs | [{"migration_plan":"Step-by-step migration plan with phases"},{"rollback_plan":"How to reverse each phase if something goes wrong"},{"risk_assessment":"Identified risks and mitigation strategies"},{"testing_checklist":"Verification steps for each migration phase"},{"timeline":"Estimated duration and resource requirements"}] |
| linksTo | ["data-modeling","postgresql","drizzle","prisma","api-designer"] |
| linkedFrom | ["plan","data-modeling","ship"] |
| preferredNextSkills | ["data-modeling","drizzle"] |
| fallbackSkills | ["sequential-thinking"] |
| riskLevel | high |
| memoryReadPolicy | selective |
| memoryWritePolicy | selective |
| sideEffects | ["Migration scripts may modify database schema","Data transformations may alter existing records"] |
Migration Planner Skill
Purpose
Plan safe, reversible migrations for databases, APIs, and system architectures. This skill produces step-by-step migration plans that minimize downtime, prevent data loss, and include rollback procedures at every phase. The core principle: every migration step must be independently reversible.
Key Concepts
Migration Safety Levels
SAFE (no downtime, no risk):
- Add a new table
- Add a new nullable column
- Add a new index CONCURRENTLY
- Add a new API endpoint
- Add a new enum value (append only)
CAUTION (requires coordination):
- Add NOT NULL constraint (backfill NULLs first)
- Add UNIQUE constraint (verify no duplicates first)
- Rename a column (expand-contract pattern)
- Change column type (expand-contract pattern)
- Deprecate an API endpoint
DANGEROUS (requires downtime or extreme care):
- Drop a column
- Drop a table
- Remove an API endpoint
- Change primary key type
- Merge or split tables
The Expand-Contract Pattern
The safest pattern for any breaking schema change:
EXPAND PHASE (backward compatible):
1. Add the new column/table alongside the old one
2. Deploy code that writes to BOTH old and new
3. Backfill existing data from old to new
4. Deploy code that reads from new, writes to both
CONTRACT PHASE (remove old):
5. Deploy code that only uses new
6. Drop the old column/table
7. Clean up dual-write code
Each step is independently deployable and reversible.
Workflow
Phase 1: Impact Assessment
## Migration Impact Assessment
### What is changing?
- [ ] Database schema (columns, tables, types, constraints)
- [ ] API contract (endpoints, request/response shapes)
- [ ] Data format (serialization, encoding, structure)
- [ ] Infrastructure (services, databases, queues)
### What depends on the changing component?
- Services: [list all consuming services]
- Clients: [frontend apps, mobile apps, third-party integrations]
- Jobs: [background workers, cron jobs]
- Reports: [analytics queries, dashboards]
### Data volume
- Rows affected: [count]
- Estimated migration time: [duration]
- Can it run online (without locking)? [yes/no]
Zero downtime required? [yes/no]
Maintenance window available? [day/time/duration]