Using LLMs for Legacy Code Migration and Refactoring
On this page
- Migrated [N] modules from [old stack] to [new stack] using LLM-assisted refactoring with test coverage reaching [X]%; no critical regressions in [period].
- Generated characterisation tests for undocumented code, uncovering [N] hidden behaviours before changes.
- Documented [N] legacy services with AI-assisted summaries reviewed by owners, cutting onboarding time for new engineers by [X].
Include these in your resume to pass automated screening:
Software engineers at every level can add this skill. If you maintain older systems, document one migration you did safely, with tests and metrics, and share the approach.
- Tests are the safety net. Without them, you are asking a model to change behaviour you cannot verify. Characterisation tests capture what the code does today.
- Small diffs, always reviewed. Ask for one function or module at a time and read every line before merging.
- Give context, not just code. Include language versions, conventions, constraints and examples of the target style.
- Explain first, change second. Ask the model to summarise what the code does, then compare with what you know before asking for changes.
- Pasting proprietary or sensitive code into tools that your company does not allow.
- Merging large generated changes without tests or review.
- Accepting new dependencies or licences without checking.
- Assuming the model knows your internal libraries and business rules.
- How would you migrate a 15-year-old module with no tests?
- How do you review AI-generated code for security issues?
- What context do you give a model before asking for a refactor?
- How do you decide when not to use an AI tool on a codebase?
- Describe a time a test caught a subtle behaviour change.
- Step 1. Choose a small module and ask the model to explain it. Verify the explanation against the code and with its owner.
- Step 2. Write characterisation tests (with AI help) that capture current behaviour, and run them.
- Step 3. Refactor in small steps, one change per prompt, running tests after each.
- Step 4. Run static analysis and security checks. Review the full diff.
- Step 5. Document the approach and results, and roll out gradually behind a flag or in staging.
- Refactoring (Martin Fowler): the standard reference on safe code changes
- OWASP Top 10 for LLM Applications: risks when using or building with LLMs
- OpenAI: prompt engineering guide: general prompting strategies
- Google AI for Developers: prompting strategies: guidance for Gemini models
What this skill really is
Legacy code is code that matters and is hard to change safely. LLMs are good at reading, summarising and drafting, which makes them useful helpers for understanding old systems and doing repetitive conversions. They are not a replacement for design, testing and review.
A safe workflow
Understand (ask for explanations and verify), protect (write tests that capture current behaviour), change (small steps, one prompt per change), verify (tests, static analysis, review), release (gradually, with monitoring). The discipline matters more than any single prompt.
How to show it on a resume
Describe the system, the migration goal, how you protected behaviour (tests), how AI was used and the measured result: fewer defects, faster migration, better coverage, easier onboarding. Mention reviews and security checks. For pay research, see the Bureau of Labor Statistics Occupational Outlook Handbook for software developers, and compare current postings in your market.
Ready to stand out as Developer-Centric Prompting?
Upload your resume — get a live interactive profile with ATS score and QR code in 10 seconds.
📄 Build My Profile → FreeFind real job openings matching this role on top job boards:
💡 Pro tip: Combine insights from this guide with real job descriptions to craft your application.