All templates/Development

Code Refactoring Planner

Code refactoring planner with incremental step-by-step approach, testing strategy, and rollout plan.

developmentrefactoringtechnical-debtplanning
Edit View
Prompt
Help me plan a code refactoring for:

What needs refactoring: {{code_module}}
Why: {{refactor_reason}}
Codebase size: {{codebase_size}}
Team size: {{team_size}}
Can we stop feature work?: {{can_pause_features}}

Create a refactoring plan:

1. **Current state assessment**:
   - What's wrong (specific code smells and problems)
   - Impact of not refactoring (what gets worse over time)
   - Risk areas (where bugs are most likely during refactoring)

2. **Target state**: What does the code look like after refactoring?
   - Architecture diagram or description
   - Key patterns to introduce
   - What to remove/simplify

3. **Step-by-step plan** (ordered by dependency and risk):
   For each step:
   - What to change
   - Estimated effort (hours/days)
   - Risk level (high/medium/low)
   - How to verify it didn't break anything
   - Can be done incrementally? (yes/no)

4. **Testing strategy**:
   - Tests to write BEFORE refactoring (golden tests / characterization tests)
   - Tests to update during refactoring
   - Regression testing approach
   - Performance benchmarks to maintain

5. **Rollout strategy**:
   - Feature flags needed
   - Migration path (if data changes)
   - Rollback plan if something goes wrong

6. **Communication**: What to tell stakeholders (the business case for this refactoring)

Save this prompt to your library

Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.