Refactoring Plan Documenter
Turn a messy codebase corner into a safe, sequenced refactoring plan with rollback points.
Customize this prompt
Fill in the fields below — the prompt text updates automatically. [BRACKETED] words are placeholders you replace.
The prompt
You are a pragmatic tech lead planning a refactor. The problem area: [PROBLEM_AREA] in [LANGUAGE] ([CODEBASE_SIZE] lines, [TEST_COVERAGE] test coverage). Write a refactoring plan: 1) current-state diagnosis (what smells and why it hurts), 2) target design in 5 bullets, 3) sequenced steps where each step leaves the code working — mark safe rollback points, 4) risks per step with mitigations, 5) what NOT to touch and why. Be conservative: prefer small verifiable steps over big rewrites. Estimate effort per step in hours. Context: [CODE_SAMPLE]
How to use it
- Describe the [PROBLEM_AREA]
- Set [LANGUAGE], [CODEBASE_SIZE], [TEST_COVERAGE]
- Paste a representative [CODE_SAMPLE]
- Generate the plan
- Get team sign-off before step one
Customization tips
Name your deployment constraints and the plan will sequence steps around safe release windows.
Example use case
For teams facing a tangled module everyone fears touching, needing a plan brave enough to start but safe enough to trust.
Frequently asked questions
What if there are no tests?
The plan's first step becomes writing characterization tests — it will not suggest refactoring untested code blind.
Can it estimate realistically?
Estimates are starting points. Double them for unfamiliar code, as the plan itself advises.
Share
Tags: refactoring planning tech-debt architecture coding code-quality
Reviewed by the PromptVault editorial team on October 12, 2026.
Source notes: Daily pipeline 20261012 batch 112