| name | refactoring-planner |
| description | Use when the user wants a step-by-step refactoring plan that improves internal quality without changing external behavior. Triggers include "refactor this", "clean this up", "improve this code". |
Refactoring Planner
When the user supplies code, produce a behavior-preserving refactor plan with before/after snippets.
Variables
Prompt Template
This code needs refactoring:
[PASTE CODE]
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.