Get Started
Coding

Plan a refactor before touching anything

Produces an ordered, individually-safe refactor plan rather than one large rewrite.

Prompt
I want to refactor this code.

Goal: {{goal}}
Constraints: {{constraints}}

```
{{code}}
```

Give me:
1. What this code currently does — confirm your understanding before proposing changes
2. The refactor broken into steps that are each independently safe to ship
3. For each step: what could break, and how I'd know
4. What to verify before starting (tests, usages, callers)
5. Which steps are optional polish versus genuinely necessary

Do not rewrite it yet. I want the plan first.

Flag anything where refactoring would change behavior, not just structure.

Fill these in

Replace each highlighted variable before sending. Leaving them in place is the most common reason these prompts under-perform.

VariableWhat to putExample
{{goal}}Why you're refactoringMake it testable and remove duplication
{{constraints}}What can't changePublic API must stay identical
{{code}}Code to refactorPaste the module

Tips for better output

  • Point 1 catches misunderstandings before they become a broken refactor.
  • Independently shippable steps mean you can stop halfway without leaving a mess.

Works well with

More coding prompts