Refactor for readability without changing behavior
Proposes small, behavior-preserving refactorings for a function and lists the tests that must still pass.
Prompts are text you copy into your own assistant. KitLocal does not run them.
Fill in the variables
What you type stays in this browser. It is not added to the URL, saved, or sent anywhere.
Preview
Still needed: Code to refactor, Language
Refactor this {{language}} code for readability WITHOUT changing behavior.
Give a list of small steps, each independently reviewable, with the resulting code for the
final step only. Call out any step that could change behavior (ordering, errors, side effects)
and the test that would reveal it. If the existing tests are missing or weak, say which
characterization tests to write first.
Code:
{{code}}
Existing tests:
Purpose
Improve structure while keeping behavior identical and verifiable.
When to use it
- A function is hard to read and you want safe, reviewable steps.
What to prepare
- The code and the tests that cover it, if any.
Expected output
Steps with risk notes, then the final code.
About this catalog
Bundled snapshot · published Nov 15, 2026, 6:05 AM · Catalog revision 5bc079fe355af2214bc0
Showing the snapshot bundled with this app (no content source is configured). Newer content may exist at the source.