Prompt library
Plan a refactor you can ship in slices
Every-slice-ships-alone is the discipline that separates refactoring from a rewrite wearing a refactor's clothes. Naming the not-fixing list and the stop-the-line signals contains the two classic failure modes: silent scope creep and sunk-cost continuation.
Last reviewed July 17, 2026
The prompt
Plan a refactor of the code below. I need to keep shipping while it happens.
Code or description of the current state: {{code}}
What hurts: {{pain}}
Produce:
1. Diagnosis: the structural problem in one paragraph, separated from its symptoms. Name the pattern if it has a name.
2. Target shape: the end-state design and, in one sentence, why it kills the pain rather than relocating it.
3. Migration as 3-7 slices. Each slice: the change, why the system still works after it ships alone, the tests that prove it, and rough size (S/M/L). No slice may require a code freeze.
4. The strangler seam: where old and new coexist and how callers move over incrementally.
5. Stop-the-line signals: what observation mid-refactor means the plan is wrong.
6. What we are explicitly not fixing this round, so scope cannot creep silently.
If a big-bang rewrite is genuinely cheaper, argue it; do not assume.Run in idaptOpens a new chat with the prompt prefilled. Nothing sends until you press send.
Fill in the variables
| Variable | What it is | Example |
|---|---|---|
| {{code}} | The code, or an architecture description | [paste the module or describe the current architecture] |
| {{pain}} | The concrete pain driving the refactor | every new notification type touches 9 files and breaks 2 |