Refactor Legacy Code for Modern Standards
Transform outdated code into modern, maintainable software. AI-powered refactoring with best practices, security fixes, and performance optimization.
Prompt Template
Variables to Customize
[PROGRAMMING_LANGUAGE] The programming language of the code to be refactored
Example: Python
[CODE_TO_REFACTOR] The legacy code that needs to be modernized
Example: def processData(data): result = []; for i in range(len(data)): if data[i] != None: result.append(str(data[i]).upper()); return result
[TARGET_VERSION] The target version of the programming language
Example: Python 3.11+
[STYLE_GUIDE] The coding style guide to follow
Example: PEP 8
[FOCUS_AREAS] Specific areas to focus on during refactoring
Example: Type hints, error handling, readability, performance
[PERFORMANCE_REQUIREMENTS] Performance optimization requirements
Example: Optimize for large datasets, reduce memory usage
[SECURITY_REQUIREMENTS] Security considerations for the refactored code
Example: Input validation, SQL injection prevention
Example Output
Pro Tips for Best Results
- Always test refactored code extensively against the original to ensure functionality parity
- Start with smaller, isolated functions before tackling entire modules or classes
- Include the original code's version/commit hash for future reference and rollback capability
- Specify concrete performance metrics or constraints to get more targeted optimization suggestions
- Consider providing sample test cases to help validate the refactored implementation
Tags
Want 500+ Expert Prompts?
Get the Premium Prompt Pack — organized, tested, and ready to use.
Get it for $29Related Prompts You Might Like
Generate a Comprehensive Code Review Checklist
Act as a senior software engineer and create a comprehensive code review checklist for [PROGRAMMING_LANGUAGE] projects. ...
Implement Advanced Caching Strategy
You are a senior performance engineer specializing in caching architectures. I need you to design and implement a compre...
Generate Docker Compose Configuration Files
You are an expert DevOps engineer specializing in containerization and Docker Compose. I need you to create a comprehens...
Debug Network Request Failures
You are an expert network debugging specialist. I need help troubleshooting a network request failure. Please analyze th...
Write Professional API Documentation
You are a technical documentation specialist tasked with creating comprehensive API documentation for [API_NAME]. Create...
Design Production-Ready GraphQL Schema
You are a senior GraphQL architect tasked with designing a comprehensive GraphQL schema for [PROJECT_TYPE]. Create a pro...