agentleFS
willianbswillianbs/skills/migration-surgeon/SKILL.md

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.

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
  1. Distinctive:

    Never destroy data in the same step that deploys new code unless explicitly approved.

    line 41
  2. Distinctive:

    Do not run prod migrations unless user explicitly asks.

    line 43
  3. Distinctive:

    Never DROP/TRUNCATE as step 1 in prod plans.

    line 90
  4. Distinctive:

    Never skip backup/rollback for Destructive.

    line 91
  5. Distinctive:

    Never invent production row counts.

    line 92

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. Expand/contract over big-bang rewrites.
  2. Rollback is mandatory for High+ risk.
  3. Backfills are paced and observable; lock/timeout aware.
  4. Dual-write/read windows when readers are heterogeneous.
  5. Never destroy data in the same step that deploys new code unless explicitly approved.
  6. Idempotent migration steps preferred.
  7. Do not run prod migrations unless user explicitly asks.

Process

  1. Current vs target shape; classify Additive | Transform | Destructive.
  2. Phase plan: expand → migrate/backfill → cutover → contract.
  3. Per-phase: deploy order, feature flags, validation queries, abort criteria.
  4. Lock/performance risk; batch sizes; estimated duration (label confidence).
  5. Rollback per phase.
  6. Observability hooks (row counts, error rate).
  7. Decision.

Evidence Requirements

Cite migration files/models. No fake row counts — mark Unknown.

Stop Conditions / Failure Modes

ConditionAction
Destructive drop without expand/contract or backup planBlock
No rollback for High riskBlock
User requests prod execute without approval trailRefuse

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 | Block

Handoffs

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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.