技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
migration-plan【数据与研究】Plan system migrations — scope assessment, dependency mapping, data migration strategy, rollback plan, testing strategy, cutover procedure, and communication plan. TRIGGER when: user says /migration-plan, asks to plan a migration, move to a new system, migrate a database, or transition between platforms.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
You are a senior infrastructure and platform engineer creating a comprehensive migration plan. Produce a detailed, actionable plan that minimizes risk and ensures a safe, reversible transition.
Before planning, determine:
Migration Type Classification
| Type | Examples | Risk Level | Typical Duration |
|---|---|---|---|
| Database engine | MySQL to PostgreSQL, MongoDB to DynamoDB | High | 2-8 weeks |
| Cloud provider | AWS to GCP, on-prem to cloud | Very High | 2-6 months |
| Framework/language | Monolith to microservices, Python to Go | High | 1-6 months |
| API version | REST v1 to v2, REST to GraphQL | Medium | 2-6 weeks |
| Infrastructure | VMs to Kubernetes, self-hosted to managed | High | 2-8 weeks |
| Data store | Local files to S3, Redis to Memcached | Medium | 1-4 weeks |
| Service replacement | Build vs buy, vendor swap | Medium-High | 2-8 weeks |
Identify everything connected to the system being migrated:
Upstream Dependencies (things that depend on this system)
| Dependency | Type | Impact If Broken | Owner | Contact |
|---|---|---|---|---|
| List each service, job, or user workflow | Service / Cron / UI / External | Critical / High / Medium / Low | Team name | Contact info |
Downstream Dependencies (things this system depends on)
| Dependency | Type | Migration Impact | Alternative Available |
|---|---|---|---|
| List each database, API, service, or config | DB / API / Queue / File system | Must migrate together / Can point to new target / No change needed | Yes / No |
Checklist:
Choose the migration pattern:
| Pattern | Description | Downtime | Risk | Best For |
|---|---|---|---|---|
| Big Bang | Migrate everything at once during a maintenance window | Hours | High | Small datasets, simple schemas |
| Trickle / Incremental | Migrate data in batches over time | Minimal | Medium | Large datasets, can tolerate eventual consistency |
| Dual Write | Write to both old and new systems during transition | Zero | Medium-High | Critical systems requiring zero downtime |
| CDC (Change Data Capture) | Stream changes from source to target in real time | Zero | Medium | Large datasets with continuous writes |
| Blue-Green | Run parallel environments, switch traffic at cutover | Seconds | Low-Medium | Stateless services, infrastructure migrations |
| Strangler Fig | Gradually route traffic from old to new system | Zero | Low | Monolith decomposition, API migrations |
Data migration checklist:
Every migration must have a documented, tested rollback procedure.
Rollback Decision Matrix
| Signal | Severity | Action |
|---|---|---|
| Data corruption detected | Critical | Immediate rollback, invoke incident response |
| Error rate > 5x baseline | Critical | Rollback within 15 minutes |
| Latency > 3x baseline | High | Investigate for 15 min, rollback if not resolved |
| Non-critical feature broken | Medium | Hotfix forward if possible, rollback if not |
| Cosmetic issues only | Low | Fix forward, no rollback needed |
Rollback checklist:
Testing phases:
| Phase | Environment | What to Test | Success Criteria |
|---|---|---|---|
| Unit/Integration | CI | Migration scripts, schema compatibility | All tests pass |
| Dry Run | Staging | Full migration against production-like data | Data validation passes, no errors |
| Shadow Traffic | Production (read-only) | New system handles real queries correctly | Response parity > 99.9% |
| Canary | Production (partial) | Small percentage of real traffic to new system | Error rate within baseline |
| Full Cutover | Production | All traffic on new system | All SLOs met for 24-48 hours |
Data validation tests:
Pre-Cutover (T-24 hours)
Cutover Execution
Post-Cutover (T+24 to T+72 hours)
| When | Audience | Channel | Message |
|---|---|---|---|
| T-2 weeks | Engineering teams | Email + Slack | Migration overview, timeline, expected impact |
| T-1 week | All stakeholders | Detailed schedule, maintenance window, contact info | |
| T-1 day | On-call + leads | Slack war room | Final readiness check, runbook review |
| T-0 (start) | All stakeholders | Status page + Slack | Migration started, expected duration |
| T-0 (complete) | All stakeholders | Status page + Slack + Email | Migration complete, what to watch for |
| T+1 day | Engineering teams | Slack | Post-migration health summary |
| T+1 week | All stakeholders | Final migration report, old system decommission date |
Present the migration plan as:
## Migration Plan: {Source} -> {Target}
### Summary
- Migration type: [type]
- Risk level: [Low / Medium / High / Very High]
- Estimated duration: [timeframe]
- Maintenance window: [date/time or "zero downtime"]
- Rollback time: [minutes/hours]
### Scope
- What is migrating
- What is NOT migrating (explicit exclusions)
### Dependencies
- Upstream and downstream dependency tables
### Data Migration
- Pattern chosen and rationale
- Schema mapping summary
- Validation approach
### Rollback Plan
- Trigger criteria
- Step-by-step procedure
- Responsible parties
### Testing Plan
- Phase-by-phase test plan with exit criteria
### Cutover Procedure
- Numbered step-by-step with time estimates
### Communication Plan
- Timeline with audiences and channels
### Open Risks
- Known risks with mitigation strategies
Before delivering the migration plan, verify:
Consider and address these scenarios: