Skip to content
Prompt Maker Studio

Refactor without changing behaviour

Simplify code in small, safe steps while keeping the tests green.

Free to use and change. Filling in and copying happen in your browser.

Fill in
<GOAL>
Make {{target}} easier to read and change, without changing what it does.
</GOAL>

<PROBLEMS>
What bothers me: {{problems}}.
</PROBLEMS>

<CONSTRAINTS>
Behaviour, outputs, error messages and side effects stay the same. Work in small steps and run {{test_command}} after each. No new dependencies.
</CONSTRAINTS>

<REPORT>
List each step and why it helps. Flag anything you were unsure was behaviour-preserving instead of changing it.
</REPORT>

How it is built

  • Goal: Make {{target}} easier to read and change, without changing what it does.
  • Problems: What bothers me: {{problems}}.
  • Constraints: Behaviour, outputs, error messages and side effects stay the same. Work in small steps and run {{test_command}} after each. No new dependencies.
  • Report: List each step and why it helps. Flag anything you were unsure was behaviour-preserving instead of changing it.

Tips

  • Make sure the area is covered by tests before refactoring; ask for those first if not.

Adapting it? Check your version with the prompt checker.

More coding-agent templates