migration-surgeon
Skill0 starsChanged 4 months agoMITView on GitHub
Plans safe schema/data migrations with expand/contract, backfill, and rollback. Use for DB/search/queue shape changes. Emits MIGRATION_PLAN. Never recommends destructive one-shot prod migrations without a rollback path.
In this repository27 other files it gives its agents.
- adr-enforcerSkill
- ai-eval-harnessSkill
- api-contract-guardianSkill
- change-impact-analyzerSkill
- code-reviewerSkill
- context-loaderSkill
- defect-analystSkill
- delivery-plannerSkill
- engineering-mentorSkill
- engineering-osSkill
- feature-implementerSkill
- guardrails-configuratorSkill
- incident-commanderSkill
- loop-engineerSkill
- model-routerSkill
- observability-designerSkill
- performance-auditorSkill
- postmortem-writerSkill
- pr-generatorSkill
- quality-gateSkill
- refactoring-advisorSkill
- requirements-grillSkill
- security-auditorSkill
- spec-validatorSkill
- tdd-executorSkill
- test-strategy-designerSkill
- threat-modelerSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 41
Never destroy data in the same step that deploys new code unless explicitly approved.
- Distinctive: line 43
Do not run prod migrations unless user explicitly asks.
- Distinctive: line 90
Never DROP/TRUNCATE as step 1 in prod plans.
- Distinctive: line 91
Never skip backup/rollback for Destructive.
- Distinctive: line 92
Never invent production row counts.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Purpose
Deliver schema and data changes without downtime or irreversible damage.
When to Use / When NOT to Use
Use when: SQL/NoSQL schema changes, backfills, reindexes, dual-writes, storage format changes.
Do not use when: code-only refactors with no data shape change; trivial nullable additive column with no backfill (lite plan OK).
Preconditions
Current schema/model and desired end state (or diff). Prod-size awareness if available.
Inputs / Outputs
Inputs: schema diff / models, IMPACT_REPORT, CONTEXT_PACK, deploy constraints.
Outputs: MIGRATION_PLAN
Upstream / Downstream
Upstream: delivery-planner, change-impact-analyzer, api-contract-guardian.
Downstream: feature-implementer, quality-gate (deploy), observability-designer, pr-generator.
Core Principles
- Expand/contract over big-bang rewrites.
- Rollback is mandatory for High+ risk.
- Backfills are paced and observable; lock/timeout aware.
- Dual-write/read windows when readers are heterogeneous.
- Never destroy data in the same step that deploys new code unless explicitly approved.
- Idempotent migration steps preferred.
- Do not run prod migrations unless user explicitly asks.
Process
- Current vs target shape; classify Additive | Transform | Destructive.
- Phase plan: expand → migrate/backfill → cutover → contract.
- Per-phase: deploy order, feature flags, validation queries, abort criteria.
- Lock/performance risk; batch sizes; estimated duration (label confidence).
- Rollback per phase.
- Observability hooks (row counts, error rate).
- Decision.
Evidence Requirements
Cite migration files/models. No fake row counts — mark Unknown.
Stop Conditions / Failure Modes
| Condition | Action |
| Destructive drop without expand/contract or backup plan | Block |
| No rollback for High risk | Block |
| User requests prod execute without approval trail | Refuse |
Severity + Confidence
Destructive prod data risk → Critical until mitigated.
Output Contract
## MIGRATION_PLAN
Type: Additive | Transform | Destructive
Phases: ...
Backfill: ...
Rollback: ...
Validation: ...
Observability: ...
Decision: Proceed | ProceedWithConditions | Revise | BlockHandoffs
feature-implementer, observability-designer, quality-gate, change-impact-analyzer.
Never
- Never DROP/TRUNCATE as step 1 in prod plans.
- Never skip backup/rollback for Destructive.
- Never invent production row counts.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

