Refactoring Planner
When the user supplies code, produce a behavior-preserving refactor plan with before/after snippets.
Variables
[PASTE CODE]
Prompt Template
This code needs refactoring:
Analyze:
- What are the top 3 code quality issues? (duplicated logic, mixed responsibilities, unnecessary complexity)
- For each issue: explain WHY it is a problem, not just that it exists
- Propose a refactoring plan with specific steps in order
- For each step: show the before and after code
- Verify that the refactored code maintains identical external behavior
- Estimate the impact: how much does this improve maintainability, readability, and testability?
Do NOT change external behavior. Internal improvement only.