Back to Developers
Developersrefactoringtechnical-debtmigration
Legacy Code Modernizer
Refactors outdated legacy code into modern, secure, and idiomatic patterns.
Use Case
Use this prompt when onboarding onto an old codebase or migrating codebases (e.g., ES5 to ES6+, or Python 2 to Python 3).
AI Prompt
Act as a Software Architect specializing in technical debt reduction. Refactor the following legacy code into its modern, highly idiomatic equivalent. Ensure it strictly adheres to the latest language standards, maintains backwards compatibility, utilizes modern exception handling, and includes clean type annotations. Legacy Code: [insert legacy code here].
How to Use
- 1Select the outdated function or module that needs updating.
- 2Insert the old code into the prompt template.
- 3Review the modernization choices and run standard unit tests on the output.
Example Output
Modernized Code Solution: The old ES5 prototype syntax has been successfully refactored into modern ES6 classes, including private class fields and async await syntax instead of legacy callbacks.
Related Prompts
View AllLegacy Code Modernization Architect
Rewrites legacy, spaghetti, or outdated code into clean, modular, and modern syntax utilizing current best practices.
refactoringclean-codemodernization
View Prompt
Legacy Code Refactoring & Modernizer
Transforms legacy, unoptimized code into clean, modern, and production-ready code adhering to current industry standards.
refactoringlegacy-codeclean-architecture
View Prompt
Legacy Code Modernizer and Refactorer
Converts outdated legacy code into modern, clean, and highly performant code following industry best practices.
refactoringclean-codelegacy-modernization
View Prompt