8 min readAI Dev Review
Prompting patterns for large refactors
The refactor prompts that actually work — plus the ones that produce plausible garbage.
PromptingBest Practices
Refactors are the highest-leverage AI use case and the easiest to get wrong. A handful of prompt patterns account for most of the wins.
Patterns that work
- Freeze the interface. Tell the agent what the public API must remain, then let it rework internals.
- Ask for a plan first. Approve or edit it before any file changes.
- Constrain the blast radius. 'Only touch files under src/billing.' Agents obey scope surprisingly well.
Patterns that fail
Open-ended 'clean this up' requests. Multi-goal refactors ('extract this and also add tests and also update docs'). Agents will do all three badly.
Comments
0 repliesJoin the conversation
Sign in to leave a comment on "Prompting patterns for large refactors".
Loading comments…