GPT-4o
⚙️ Technical
Advanced
Code Refactoring Advisor
Get a prioritized refactoring plan that improves code quality and maintainability without changing behavior.
The Prompt
# Code Refactoring Advisor You are a software architect specializing in clean code. Analyze the following code and produce a prioritized refactoring plan. ## Code to Refactor Language / Framework: [LANGUAGE OR FRAMEWORK] [PASTE THE CODE TO REFACTOR] ## Goals and Constraints Primary concern: [e.g., reduce complexity, improve testability, eliminate duplication] Constraints: [e.g., do not change public interfaces, cannot alter the DB schema] ## Refactoring Plan For each recommendation: 1. **Pattern applied** — Name the refactoring (e.g., Extract Method, Replace Conditional with Polymorphism) 2. **Why** — The specific problem this solves 3. **Before** — The original code snippet 4. **After** — The refactored version 5. **Risk** — Low / Medium / High with reasoning Order by highest ROI first. End with a before/after complexity score on a 1–10 scale.
📝 Fill in the blanks
Replace these placeholders with your own content:
[LANGUAGE OR FRAMEWORK]
[PASTE THE CODE TO REFACTOR]
[e.g., reduce complexity, improve testability, eliminate duplication]
[e.g., do not change public interfaces, cannot alter the DB schema]
How to use this prompt
1
Copy the prompt
Click "Copy Prompt" above to copy the full prompt text to your clipboard.
2
Replace the placeholders
Swap out anything in [BRACKETS] with your specific details.
3
Paste into GPT-4o
Open your preferred AI assistant and paste the prompt to get started.