Tech Lead Migration Prompts Templates
You get a step-by-step migration plan with old-to-new code mappings, the breaking changes that will bite you, and a way to roll out safely. For tech leads there's an extra layer: tech leads need help weighing architecture options, writing design docs and decision records, structuring code review feedback, and breaking large projects into plans a team can execute. The prompt below adds your role context so the answer fits how you work.
Help me migrate code from one version, library or framework to another. ## Migration From: [e.g. moment.js 2.x] To: [e.g. date-fns 3.x] Why: [e.g. bundle size, end of support] ## Codebase Language and size: [e.g. TypeScript, about 40 files use moment] Typical usage: [paste 3 to 5 representative snippets] ## Constraints - Can we run old and new side by side during the move: [yes or no] - Deadline or freeze dates: [if any] ## Instructions - Map each old pattern I pasted to its new equivalent. - List breaking changes and behavior differences that are easy to miss (defaults, time zones, mutability, return types). - Suggest an order of work that keeps the app shippable at every step. - Flag anything that has no direct equivalent. ## Output format 1. Old to new mapping table 2. Gotchas 3. Step-by-step plan 4. How to verify each step About my work - Team and system: [e.g. 6 engineers, Rails monolith, Postgres, 2M monthly users] - Decision or problem: [e.g. whether to split out the billing service] - Constraints: [e.g. ship in one quarter, no new infrastructure vendors]
How to use this prompt
- 1
Copy the prompt
Use the copy button, or type its Retext trigger in any app to paste it.
- 2
Open your AI assistant
Start a new chat in ChatGPT, Claude, Gemini or whichever assistant you use, so earlier messages don't steer the answer.
- 3
Fill in the brackets
Replace every [bracketed] part with your real details. Specific inputs are what make the answer specific.
- 4
Check and refine
Read the result against the goal above, then reply with one change at a time.
Worked example
What you give it
From: moment.js 2.x. To: date-fns 3.x. Why: moment is in maintenance mode and adds a lot to our bundle.
Codebase: React app in TypeScript, about 40 files import moment. Typical usage:
moment(date).format("YYYY-MM-DD")
moment().add(7, "days")
moment(a).isBefore(b)
Side by side: yes. No deadline, but we want it done this quarter.What a good answer looks like (shortened)
1. Mapping
- moment(date).format("YYYY-MM-DD") becomes format(date, "yyyy-MM-dd")
- moment().add(7, "days") becomes addDays(new Date(), 7)
- moment(a).isBefore(b) becomes isBefore(a, b)
2. Gotchas
- Format tokens differ. In date-fns, lowercase yyyy is the calendar year and dd is the day of month. Uppercase YYYY and DD mean different things and throw unless you opt in.
- date-fns works on native Date objects and never mutates them, while moment's add() mutates the moment instance. Check code that relied on mutation.
3. Plan
1. Add date-fns alongside moment.
2. Migrate one folder at a time, starting with formatting helpers.
3. Remove moment once a search for "moment(" returns nothing.
4. Verify: snapshot test formatted dates for a fixed set of inputs before and after each folder.Tips for better results
- •Ask the AI to argue against your preferred option before you commit. A good counterargument now is cheaper than a design doc rewrite after review.
- •Pick the snippets for Typical usage from different parts of the codebase. The odd cases, not the common ones, are where migrations fail.
- •Read the Gotchas section before writing any code. Behavior changes like mutability or default time zones cause bugs that tests often miss.
- •Avoid this: Asking the AI to migrate everything in one pass, which produces a huge diff nobody can review or roll back.
Check before you use it: Check that recommendations fit your team's actual size and operating capacity, since AI often defaults to patterns built for much larger organizations.
Get the free prompt pack
Our best AI prompts in one Markdown file, delivered by email. The templates here stay free either way — the pack just saves you the copying.
Variations
Framework upgrade
Replace Migration with: From [framework] [old version] to [new version]. List deprecated APIs we use and their replacements, in order of risk.
Database migration
Replace Codebase with: Current schema [paste] and target schema [paste]. Write reversible migrations and a backfill plan with no downtime.
Language port
Change Instructions to: Translate [file] from [language A] to [language B] idiomatically, not line by line, and note any library differences.
Save it as a Retext snippet
Retext is a free text expander for Mac. Save this prompt once, then type ;migrate in any app (ChatGPT, Claude, your editor, a browser tab) and the full prompt is pasted in.
- Click Add to Retext. The prompt installs as a snippet with the trigger ;migrate.
- Change the trigger in Retext if you prefer a different one.
- Type the trigger wherever you want the prompt, then fill in the brackets.
Frequently asked questions
Should tech leads use AI to write design docs?
It is useful for structure, listing alternatives and spotting missing sections like rollout and rollback. The tradeoffs and the final recommendation need to reflect what you know about your team and system.
Can AI migrate a whole codebase automatically?
It can convert common patterns quickly, but it misses project-specific behavior and edge cases. Use it to plan and to convert files in small batches that you test as you go.
How do I check that a migration did not change behavior?
Write tests or snapshots of current outputs before you start, then run them after each step. Behavior differences are much easier to spot one folder at a time.
How do I reuse this prompt without copying it every time?
Click Add to Retext to save it as a snippet. Then type ;migrate in any Mac app, including your AI tool, and the full prompt is pasted in.
Related Templates
Get the free prompt pack
Our best AI prompts in one Markdown file, delivered by email. The templates here stay free either way — the pack just saves you the copying.