Skip to content
Back to skills

Migration Architect

ASecurity

Builds a phased migration plan from a JSON spec, diffs two schema versions for breaking changes, and writes a rollback runbook from the plan. Use when planning a database, API, service or infrastructure migration, checking a schema change before cutover, or preparing a rollback runbook.

  • 1,271 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added May 27, 2026
data-aipythongobashsqldebuggingrefactoringapidatabasedocumentation

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 20 files and shows the line behind each finding

Scanned December 4, 2026

npx -y skills add borghei/Claude-Skills --skill migration-architect --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Migration Architect?

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

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

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-architect
description: >
  Builds a phased migration plan from a JSON spec, diffs two schema versions
  for breaking changes, and writes a rollback runbook from the plan. Use when
  planning a database, API, service or infrastructure migration, checking a
  schema change before cutover, or preparing a rollback runbook.
license: MIT + Commons Clause
metadata:
  version: 1.2.0
  author: borghei
  category: engineering
  domain: infrastructure
  tier: POWERFUL
  updated: 2026-11-08
  tags:
    - migrations
    - zero-downtime
    - rollback
    - database-migration
    - infrastructure
---
# Migration Architect

Generates phased migration plans with risk assessment, compatibility analysis, and rollback runbooks for database, service, infrastructure, and API migrations. Validates schema compatibility, detects breaking changes, and produces rollback procedures with trigger conditions and communication templates.

## Core Capabilities

- **Phased planning** — generate risk-assessed, multi-phase migration plans with validation gates, timelines, and stakeholder structures from a JSON spec.
- **Compatibility analysis** — diff before/after database or REST/JSON schemas to detect breaking changes, type mismatches, and constraint violations, with migration + rollback scripts.
- **Rollback runbooks** — phase-by-phase reversal steps, automated trigger conditions, data-recovery plans, escalation matrices, and communication templates.
- **Pattern catalog** — Expand-Contract, Dual-Write, CDC, Strangler Fig, Parallel Run, Canary, Blue-Green.
- **Risk frameworks** — technical, business, operational, and compliance risk categories.

## When to Use

- Migrating databases, APIs, infrastructure, or services between platforms or versions.
- Validating schema/API compatibility and detecting breaking changes before cutover.
- Building rollback runbooks and zero-downtime execution plans.

## Clarify First

Before planning the migration, settle the inputs below. When one is missing or vague and would change the result, ask about it; when it wouldn't, use a sensible default and say which one you used.

- **What's migrating:** database, API, infrastructure, or service (sets `--type` and which pattern catalog applies).
- **Deliverable:** phased plan, compatibility diff, or rollback runbook (selects `migration_planner.py` vs `compatibility_checker.py` vs `rollback_generator.py`).
- **Downtime budget & pattern:** zero-downtime requirement and which pattern (expand-contract, dual-write, strangler fig, blue-green) (drives the phases and cutover technique).

Ask about the two or three inputs that matter most for this request, not the whole list. If the user wants a result straight away, produce it and state your assumptions at the top.

## Tools Overview

| Tool | Purpose | Command |
|------|---------|---------|
| `migration_planner.py` | Phased plan from a spec (`type`, `source`, `target`, optional `constraints`) | `python3 scripts/migration_planner.py --input assets/sample_database_migration.json --output plan.json --format json` |
| `compatibility_checker.py` | Diff two schemas (`tables` for `--type database`, `paths`/`components.schemas` for `--type api`) | `python3 scripts/compatibility_checker.py --before assets/database_schema_before.json --after assets/database_schema_after.json` |
| `rollback_generator.py` | Rollback runbook from the planner's plan JSON (not the spec); contacts only from `--contacts` | `python3 scripts/rollback_generator.py --input plan.json --contacts assets/sample_contacts.json` |

All three take `--format text|json` (default text; `--json` is an alias).

## Exit codes

| Code | Meaning |
|------|---------|
| 0 | Plan/runbook written, or the schemas have no breaking or potentially breaking change |
| 1 | `compatibility_checker.py` only: breaking or potentially breaking changes found (last line `FIX n issues`) |
| 2 | Unusable input: missing file, invalid JSON, spec with an unknown `type`, schema with no tables/paths, a runbook input with no `phases` (for example the spec instead of the plan) |

## Quick Start

```bash
python3 scripts/compatibility_checker.py --before assets/database_schema_before.json --after assets/database_schema_after.json
```

Real output (excerpt):

```
Breaking Changes: 0
Potentially Breaking: 4
...
• New check constraint 'phone IS NULL OR LENGTH(phone) >= 10' added to table 'users'
  Impact: New check constraint may reject existing data
  Migration: Validate existing data complies with new constraint
...
FIX 4 issues: 0 breaking, 4 potentially breaking
```

Chain the tools: spec, then plan, then runbook.

```bash
python3 scripts/migration_planner.py --input assets/sample_database_migration.json --output plan.json --format json
python3 scripts/rollback_generator.py --input plan.json --contacts assets/sample_contacts.json
```

## Notes on what the tools do not know

- Durations and complexity in the plan come from built-in multipliers (a heuristic, not a benchmark); adjust `constraints` and sanity-check against a rehearsal.
- The runbook never invents contacts: roles missing from `--contacts` print `UNASSIGNED`. Fill them before the migration window.
- Rollback steps are generic per migration type plus a reversal of each plan task; review the SQL/commands against your system before use.

## Reference Documentation

Load the reference that matches the task — keep this file lean and pull detail on demand:

- **[references/workflows-patterns-and-quality.md](references/workflows-patterns-and-quality.md)** — quick-start commands, the three core workflows with validation checkpoints, the migration-pattern catalog table, anti-patterns, troubleshooting, and success criteria. Read when planning a migration.
- **[references/tool-reference.md](references/tool-reference.md)** — full per-tool purpose, usage, flag tables, input formats, and output structures for all three scripts. Read before running or debugging the scripts.
- **[references/migration_patterns_catalog.md](references/migration_patterns_catalog.md)** — deep catalog of migration patterns with mechanics and trade-offs. Read when choosing a pattern.
- **[references/zero_downtime_techniques.md](references/zero_downtime_techniques.md)** — techniques for cutover without downtime (expand-contract, dual-write, traffic shifting). Read when downtime budget is near zero.
- **[references/data_reconciliation_strategies.md](references/data_reconciliation_strategies.md)** — checksum/business-logic validation strategies to confirm data integrity post-migration. Read when verifying migrated data.

## Anti-Patterns

**Mistake:** A migration plan without a tested rollback.
**Why it matters:** The moment you need the rollback is the worst moment to discover it does not work.
**Instead:** Generate the runbook from the plan and rehearse it in staging before cutover.

**Mistake:** Contract changes in one step (rename or drop in the same release that stops writing the old shape).
**Why it matters:** Old and new code run side by side during a deploy; a one-step change breaks whichever version is still live.
**Instead:** Expand, migrate, contract: add the new shape, dual-write and backfill, switch reads, then remove the old shape in a later release.

**Mistake:** Treating a passing compatibility check as proof of safety.
**Why it matters:** The checker compares declared schemas; it cannot see data volume, lock time or consumers it was not told about.
**Instead:** Pair it with a dry run on production-sized data and a consumer inventory.

## Files

| File | Purpose |
|------|---------|
| `scripts/migration_planner.py`, `scripts/compatibility_checker.py`, `scripts/rollback_generator.py` | Stdlib CLIs |
| `assets/sample_database_migration.json`, `assets/sample_service_migration.json` | Migration specs for the planner |
| `assets/database_schema_before.json`, `assets/database_schema_after.json` | Schema pair with potentially breaking changes (exit 1) |
| `assets/database_schema_additive.json` | Additive-only change (exit 0); `malformed_schema.json`, `malformed_migration.json` exit 2 |
| `assets/sample_database_plan.json`, `assets/sample_contacts.json` | Plan and contacts input for the runbook generator |
| `assets/contract.json` | Declared runs checked by `scripts/skill_contract_check.py` |
| `expected_outputs/` | Example outputs |

## Scope & Limitations

**This skill covers:**
- End-to-end migration planning for databases, services, infrastructure, and APIs with phased execution and validation gates.
- Automated compatibility analysis between schema versions (SQL and REST/JSON) including breaking-change detection and migration script generation.
- Rollback runbook generation with trigger conditions, data recovery plans, escalation matrices, and communication templates.
- Risk assessment frameworks covering technical, business, operational, and compliance risk categories.

**This skill does NOT cover:**
- Actual execution of migrations against live systems -- the tools generate plans, reports, and scripts but do not connect to databases or cloud APIs.
- Application-level code refactoring required to support new schemas or APIs; see `engineering/api-design-reviewer` for API contract changes and `engineering/database-designer` for schema design.
- Real-time monitoring, alerting, or dashboard provisioning during migration execution; see `engineering/observability-designer` for observability setup.
- Cloud cost optimization or capacity planning for target infrastructure; see `engineering/ci-cd-pipeline-builder` for deployment pipeline configuration.

Files in this skill

  • README.md11.5 KB
  • SKILL.md16 KB
  • assets/database_schema_after.json9.1 KB
  • assets/database_schema_before.json5.6 KB
  • assets/sample_database_migration.json2.4 KB
  • assets/sample_service_migration.json4.8 KB
  • expected_outputs/rollback_runbook.json23.2 KB
  • expected_outputs/rollback_runbook.txt10.7 KB
  • expected_outputs/sample_database_migration_plan.json9.2 KB
  • expected_outputs/sample_database_migration_plan.txt4.6 KB
  • expected_outputs/sample_service_migration_plan.json8.9 KB
  • expected_outputs/sample_service_migration_plan.txt4.3 KB
  • expected_outputs/schema_compatibility_report.json10.4 KB
  • expected_outputs/schema_compatibility_report.txt4.6 KB
  • references/data_reconciliation_strategies.md46.3 KB
  • references/migration_patterns_catalog.md19.1 KB
  • references/zero_downtime_techniques.md31.1 KB
  • scripts/compatibility_checker.py41.5 KB
  • scripts/migration_planner.py26.5 KB
  • scripts/rollback_generator.py48.9 KB

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 data-ai →

Comments

Loading comments…

Newsletter

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