/fde-migration:refactor-seamsfrom fde-migration
Guides incremental code restructuring using branch-by-abstraction, strangler fig, and adapter insertion. Use when extracting from a monolith, replacing a component incrementally, or when a refactor is too large for one change. Every step keeps the system releasable.
Ships in fde-migration. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Changing the shape of something without stopping it.
The default plan for code that has become hard to change is a rewrite on a branch. It is almost always the wrong plan, and it fails the same way every time: the branch diverges, the main line keeps moving, the merge becomes impossible, and the work is abandoned after months. Everyone involved knew this would happen and did it anyway, because the alternative looked slower.
The alternative genuinely is slower per step, and it finishes. Incremental restructuring behind a seam, with the system releasable at every point, converts an all-or-nothing bet into a series of small safe changes — any one of which can be the last one if priorities shift.
For an FDE this matters twice over. You may not be here long enough to finish a rewrite, and a half-finished rewrite is worse than either state. Every incremental step you ship is value that survives your departure.
safe-changeResolve <workspace> before reading or writing artifacts: use FDE_WORKSPACE if set (report an unavailable explicit path rather than falling back), otherwise the charter's recorded Location (look in .fde/ and ../*-fde/), then an existing .fde/ or ../<repo>-fde/. If none exists, run core fde-orient; do not create a second workspace. All artifact paths below use that location. Follow core workspace conventions for headers; preserve existing sections when appending.
<workspace>/06-blast-radius-*.md — you need to know every callercharacterization-tests first. Restructuring untested code is the single riskiest thing in this portfolio. The tests are what make the refactor verifiable as behavior-preserving.<workspace>/adr/ — the target shape should be a recorded decisionA seam is where you can change behavior without editing the thing you're changing. Find it before planning anything.
Candidates, in rough order of preference:
Where no seam exists, introducing one is your first change — and it must be behavior-preserving, committed separately, and characterized before and after. That commit is the whole first step, and it should look boring in review.
| Pattern | Use when | How it ends |
|---|---|---|
| Branch by abstraction | Replacing an implementation in place | Old implementation deleted once nothing selects it |
| Strangler fig | Replacing a system or subsystem incrementally | Old system dark, then removed, once all routes are diverted |
| Adapter insertion | The new thing has a different shape from the old | Adapter removed once callers migrate, or kept deliberately |
| Parallel run | You must prove equivalence before switching | Old path removed once outputs match for a stated period |
Parallel run needs side-effect isolation. Compare both implementations only when the shadow path is read-only, or its writes, events, notifications, and external calls are redirected to isolated destinations or suppressed. Discarding a response does not undo a charge or a published event. Verify this isolation before using live traffic, bound extra load, and provide a kill switch. If isolation cannot be established, replay policy-approved synthetic or sanitized inputs in a lower environment instead. Record which effects were suppressed and what equivalence remains unverified.
The rule that makes this work: at no point is the system unreleasable.
A typical branch-by-abstraction sequence:
Every step is independently reviewable and independently revertible. Steps 1 and 2 are pure refactors a reviewer can verify by reading; step 4 is where behavior risk begins, and by then everything else is already proven.
The most common way this degrades is bundling a refactor step with a behavior change because it's "obviously fine." It defeats the entire point — a reviewer can no longer verify the refactor by reading, and a bisect can no longer isolate a regression.
Same discipline as safe-change step 5, applied over a longer arc and with more temptation to break it.
The step people skip, leaving both implementations forever. Two code paths, two test paths, permanent confusion about which is real, and a flag nobody dares remove.
Name the condition for deletion up front — "old path removed once the new one has served 100% of traffic for 30 days with no incidents" — and record who owns it. Then actually do it. Every incomplete refactor left behind makes the next one harder and makes the codebase harder to reason about for everyone after you.
Not every refactor should finish. If priorities change and the work is paused, the system must be in a coherent state — that's what shipping every step buys you.
Where you stop mid-way, write down where you stopped, why, and what completing it would take. That goes in handover-pack under unfinished business. A paused refactor that nobody documented becomes an archaeological puzzle for whoever finds it.
ADR for the target shape, plus a tracking note in <workspace>/06b-change-log.md:
## Refactor — extract pricing from the order monolith
**Pattern:** branch by abstraction → strangler
**ADR:** 0011 · **Seam:** `PricingCalculator` interface (introduced in PR #402)
**Characterization:** 34 tests pinning current behavior, PR #401
| Step | State | PR | Behavior change | Shipped |
|---|---|---|---|---|
| 1 Introduce interface over existing impl | done | #402 | none | 03-04 |
| 2 Migrate 14 callers | done | #405–408 | none | 03-08 |
| 3 New impl behind interface, unselected | done | #412 | none | 03-11 |
| 4 Flag on for internal tenants | done | #415 | **yes** | 03-14 |
| 5 Widen to 100% | in progress | — | yes | — |
| 6 Delete old impl + flag | **not started** | — | none | owner: <name>, after 30d clean |
**Parallel run:** both implementations ran on live traffic 03-11 → 03-14, outputs compared.
2 divergences found, both legacy rounding — see ADR-0011 §rejected.
**If paused here:** system is coherent; flag at 100% with the old implementation dormant.
Completing means step 6 only.
Rewriting on a branch. Diverges, becomes unmergeable, gets abandoned. Everyone knows this and does it anyway.
Refactoring without characterization tests. No way to know you preserved behavior. Riskiest thing in the portfolio.
Bundling a refactor step with a behavior change. Defeats the point — the reviewer can no longer verify by reading.
A step that leaves the system unreleasable. Then you have a branch again, just spelled differently.
Never deleting the old path. Two implementations forever, and a flag nobody dares touch.
No stated deletion condition or owner. Guarantees the above.
Shadowing without isolating side effects. A discarded response can still leave a duplicate payment, write, or notification. Isolation and a bounded load budget come before live comparison.
Stopping without documenting where. An archaeological puzzle for whoever finds it.
What SKILL.md sets; muted values are Claude Code's defaults
4 skills in this plugin
/cutover-planPlan the moment two systems swap - data migration and backfill, dual-run and reconciliation, the consistency window, traffic shifting, the point of no return, and what abort means at each stage. Use for any migration or replatform where data moves and both systems briefly coexist, when a legacy system is being replaced, or when a go-live has a defined switchover moment. The hardest artifact in the portfolio, because unlike a deploy the thing being changed is state, and state does not roll back cleanly./decommission-planTurn a system off safely - proving there are no remaining consumers, which is much harder than it sounds, then data retention and archival obligations, a staged darkening sequence, and how long to keep the ability to reverse. Use when a system is being retired, after a migration leaves the old system idle, when someone asks whether something can be switched off, or when a service appears unused. Consumer discovery is the whole job; the switching off is trivial by comparison./dependency-upgradeRun an EOL or version-driven upgrade where the scope is fixed, the deadline is external, and the risk is concentrated in transitive breakage - ordering the upgrade, building a compatibility matrix, cutting over incrementally, and telling a real break from a warning. Use for end-of-life work, runtime or framework major-version jumps, expiring vendor support, security-driven dependency bumps, or when a library upgrade cascades further than expected. Behaves unlike feature work and should not be planned like it.npx claudepluginhub rpraharaj/forward-deployed-engineer --plugin fde-migrationOther plugins' skills for the same job