Write a Framework Migration Prompt for a Staged Codebase Upgrade
Build a framework migration prompt that inventories usage, maps breaking changes, and stages a reversible rollout across any stack. Copy the structure.
A major-version framework bump is rarely one change. It's forty small ones scattered across services, and the failure mode is doing all forty in a single weekend PR that nobody can review or revert. A framework migration prompt turns that into a staged plan: inventory first, map each breaking change to an edit, ship in reversible increments.
The usual approach is to ask a model to "upgrade this file" one file at a time. That works until file twelve depends on an interface that changed in file three, and now you're debugging a migration you can't roll back. The problem isn't the model's code. It's that there was never a plan, just a pile of edits.
A reusable prompt encodes the plan. You describe the source and target once, and the same structure handles a React 18-to-19 jump or a Rails upgrade without you rewriting the workflow each time.
Why the "migrate this file" loop fails at scale
Migrating file by file feels like progress. Each file compiles, so you move on. The trap is interface drift: a signature you changed in an early file breaks callers you haven't reached yet, and you don't find out until the whole thing is half-converted.
Here's the stance worth defending. The hardest part of a framework migration isn't writing the new code. It's knowing the order. Get the sequence right and each step is boring. Get it wrong and you're holding a branch that's broken in both directions, too far along to revert and too incomplete to ship. A migration prompt's real output isn't code. It's a sequence.
What a framework migration prompt does
A framework migration prompt is a staged planner that reads your source and target framework versions and returns an inventory, a breaking-change map, a rollout sequence, and a rollback per stage. It plans before it touches a line.
Run it to:
- Catalog every place the source framework is used, per service
- Map each breaking change to the exact edit it requires
- Group edits into stages that ship and verify independently
- Define a go/no-go checkpoint between stages
- Produce a concrete rollback path for every stage
- Flag changes that can't be automated and need a human decision
The rollback-per-stage line is what separates a plan from a wish.
Anatomy of the prompt
Variables
{{source_framework}} → current framework + version
{{target_framework}} → target framework + version
{{service_inventory}} → services / packages in scope
{{breaking_changes}} → known breaking changes (or let the model derive)
Prompt
Role: you are a staged migration planner.
Task: plan the migration from {{source_framework}} to {{target_framework}}.
Rules:
- Inventory usage before proposing any edit.
- Each stage must ship and verify independently.
- Every stage needs a rollback path.
Output contract
Return: inventory table + breaking-change map + staged plan + rollbacks.
1. Define source and target
Set {{source_framework}} and {{target_framework}} with versions. "React to React 19" is too vague; "React 18.2 to React 19.0" lets the model pull the right breaking-change set.
2. Scope the inventory
List the services in {{service_inventory}}. The inventory pass is the step people skip, and it's the one that catches the service nobody remembered was on the old version.
3. Read the staged plan
The output sequences edits into stages. Don't reorder them casually. The sequence exists because stage three assumes stage one already shipped.
4. Ship one stage at a time
Each stage is its own PR with its own rollback. Hit the go/no-go checkpoint, verify, then proceed.
The instinct is to batch everything to "get it over with." Resist it. A migration that ships in five reversible stages over a week beats one that ships in a single irreversible PR over a weekend. If stage four breaks, you revert stage four, not the whole migration. The prompt should refuse to collapse independent breaking changes into one stage.
Prompt-craft patterns for staged migrations
Inventory before edits, always. A prompt that proposes edits before it knows the full usage surface will miss callers. Force the inventory pass as a separate, earlier section so the model can't shortcut it.
Use variables for the stack, not hardcoded names. Hardcoding "React" makes the prompt single-use. The {{source_framework}} and {{target_framework}} variables make the same structure reusable across every migration you'll ever run.
Demand a rollback per stage. A migration plan with one rollback at the end is a plan with no rollback. Each stage's reversal has to be stated, or a mid-migration failure leaves you stranded.
Where Claude and ChatGPT diverge on staging
The two models plan migrations differently, and the difference shows up in how they stage. Claude tends to over-stage when you ask for safety: it'll split a migration into more, smaller steps than strictly needed, which is the right error to make. GPT-4o leans toward fewer, larger stages unless the "ship and verify independently" rule sits near the end of the prompt where it stays in attention.
Both models will quietly merge two breaking changes into one stage if the rule isn't explicit. So state it: each stage handles one breaking change or one cohesive group, never two unrelated ones bundled for convenience. Pin the model version too. A migration planner that subtly started batching more aggressively after an update is the kind of regression you won't catch until a stage you can't revert blows up. Restate the staging contract on the final line for GPT-4o; Claude holds it from a dedicated ## Staging rules heading. Neither model knows your deploy cadence, so the go/no-go checkpoint is where your judgment overrides the plan.
How this differs from a cross-language port
A framework migration stays in one language and changes the libraries around it. A cross-language port changes the language itself, which is a different prompt with different failure modes. If you're translating between languages rather than upgrading a framework, the cross-language refactor prompt handles the idiom-preservation problem that a framework bump doesn't have.
Variables you'll set
| Variable | Required | What it is |
|---|---|---|
{{source_framework}} | Yes | Current framework and version |
{{target_framework}} | Yes | Target framework and version |
{{service_inventory}} | Recommended | Services and packages in scope |
{{breaking_changes}} | Optional | Known breaking changes to seed the map |
Getting started
- Copy the staged structure into ChatGPT, Claude, or Gemini.
- Set
{{source_framework}}and{{target_framework}}with exact versions. - List your services in
{{service_inventory}}so the inventory pass is complete. - Run it and read the staged plan before the breaking-change map.
- Ship the stages in order, hitting the go/no-go checkpoint between each.
- Keep the rollback for each stage handy until the next stage is verified.
For a migration spanning many services with go/no-go gates already wired in, the Framework Migration Harness Playbook runs the full sequence.
Browse the migration prompt packs →The Framework Migration Harness Playbook does this end-to-end: a {{source_framework}} and {{target_framework}} pair feeds a breaking-change-mapper prompt that ties each change to an exact edit, then a staged-rollout-plan prompt sequences independently verifiable stages and a rollback-design step defines a recoverable path for each. It's part of The Complete AI Prompts Bundle, a one-time lifetime license to the whole catalog plus future packs, which pays off if you run more than one migration a year.
A framework upgrade often surfaces breaking API changes you'll need to communicate to consumers. The Breaking Change Detection Harness Agent Pack diffs two API surfaces and recommends the semver bump. For the database side of a major upgrade, the safe database migration prompt covers schema changes. New to buying packs versus rolling your own? Start with how to choose a reusable AI prompt pack.
See the breaking-change detection pack →Common questions
What makes a framework migration prompt different from asking the model to 'migrate my code'?
Can one prompt handle migrations across different stacks?
How do you keep a large framework migration reversible?
Get the prompt packs this guide is built on
Ready-to-paste prompts with documented variables and usage guides for ChatGPT, Claude, and Gemini. One-time payment, own it forever.
More prompt guides

Run a Deployment Go/No-Go Review With One Reusable Prompt
The release call starts at 4pm. Six people join, someone shares a checklist, and for twenty minutes the room reads questions out loud: tests green? rollback ready? on-call briefed? Half the answers ar…

A Lint and Format Policy Prompt That Tames AI-Generated Code
AI writes a lot of the code now, and it writes it in whatever style its training data favored. Snake_case sneaks into a camelCase project. A bare lands where your logger should be. Import order scramb…

A Technical Debt Triage Prompt for Engineers, Not Slide Decks
Technical debt conversations usually end one of two ways. Either nothing gets fixed because there's no business case, or everything gets a JIRA ticket and the backlog swells to 200 items nobody will e…