MODULE 12 / 18 · PART 4 · SHIP & SUSTAIN
Legacy & Migration
Prefer incremental coexistence to a heroic big-bang rewrite.
THE SHORT ANSWER
What this module changes.
Legacy code must be read from behavior, not documentation. Capture current behavior, find seams, and make every stage shippable.
Legacy prompts should favor incremental over heroic. The strangler pattern beats the big bang almost every time.
The Excel workbook that runs the business is legacy code. So is the Access database, the WordPress plugin and the PHP script nobody wants to touch. Treat their formulas, exceptions and month-end rituals as requirements before you replace them.
THE MODULE PROMPT LIBRARY
20 prompts for legacy & migration.
Copy any prompt, replace the [bracketed] slots with your own project context, and attach the files the agent needs. Use “Copy all prompts” when you want the full module in one place.
20 copy-ready prompts. Bracket text is a slot for your own context — replace it before you send the prompt.
How do I migrate this incrementally? Give me the steps, the intermediate states, and what is shippable at each one.
Why it worksIncremental migration keeps the system working throughout.
Write the characterization tests for this legacy code before we touch it: [code]. Capture the current behavior, bugs included.
Why it worksYou cannot safely change code you cannot verify.
What does this legacy code actually do? Explain it as if the original author is unavailable and the comments are lies.
Why it worksLegacy code must be read from behavior, not from documentation.
Identify the seams in this legacy module where we can introduce a new implementation behind an interface.
Why it worksSeams are what make strangler-fig migration possible.
Design the strangler fig for [legacy system]: the routing, the coexistence period, and the cutover criteria.
Why it worksCoexistence and cutover criteria are what make the migration finishable.
What is the riskiest part of this migration, and how do we de-risk it first?
Why it worksFront-loading the riskiest step prevents late-stage surprises.
How do we run the old and new implementations in parallel and compare their outputs?
Why it worksShadow comparison is the strongest evidence that a migration is correct.
What data migration is required, and how do we handle records written during the migration window?
Why it worksThe dual-write window is where most migrations lose data.
Write the rollback plan for this migration at each stage, including the point of no return.
Why it worksKnowing where you can no longer go back changes how carefully you step.
Which parts of this legacy system can we simply delete rather than migrate?
Why it worksThe cheapest migration is the one you do not have to do.
What is the business logic hidden in this legacy code that is not documented anywhere?
Why it worksUndocumented behavior is the real risk in any migration.
Propose the interface that lets new and old code coexist without either knowing about the other.
Why it worksAn anti-corruption layer keeps the new system clean.
How do we freeze the legacy system so it stops growing while we migrate it?
Why it worksA moving target cannot be migrated.
Estimate the migration effort by component and identify the long pole.
Why it worksMigrations are usually gated by one component; find it early.
What tests do we need before, during, and after the migration to prove nothing broke?
Why it worksMigration testing is a sequence, not a single gate.
Write the cutover runbook for [migration]: the sequence, the checks, the abort criteria, and the owners.
Why it worksCutover is a procedure; procedures need runbooks.
What is the cost of doing nothing? Quantify the ongoing maintenance burden of the legacy system.
Why it worksJustifies the migration investment in terms the business understands.
How do we handle the legacy data model's inconsistencies during migration?
Why it worksLegacy data is almost never as clean as the schema claims.
Propose the phased plan for [migration] with a value delivery at the end of each phase.
Why it worksPhases that deliver value survive budget reviews.
What would make us abandon this migration halfway, and how do we avoid that state?
Why it worksThe half-migrated system is the worst possible outcome.
PRACTICE · 20–30 MINUTES
Try it on a project you actually own.
Draw the strangler path for one legacy workflow: seam, facade, coexistence, cutover and rollback. Mark the point of no return.
- Pick one prompt from this module that matches a real task.
- Replace every bracketed slot with context from the feature you are working on now.
- Attach only the files the agent needs. Keep secrets, credentials and personal data out of the chat.
- Ask for the artifact — a spec, diff, test, runbook or decision note — and the evidence that it works.
- Record what changed and what remains unverified in the repository.
Want the same prompts across every module? Search the full prompt library or return to the course overview.