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.
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
- Bug fix brief for a coding agent
Find the root cause of a bug, fix it minimally and prove it with a regression test.
- Plan a feature before coding
Get an implementation plan with files, steps and tests to review before the agent writes code.
- Review a change before merging
A focused review of a diff for bugs, security and missing tests, ranked by severity.
- Write tests for existing code
Add tests that pin down current behaviour, following the project’s test conventions.