All templates
💻 Coding·Works on: claude, chatgpt, cursor
Refactor Legacy Code
Improve readability without secretly changing behavior.
#refactor#code quality
0/2
Fill the template
2 placeholders left.
~126tokens
Live preview· click any pill to jump to its field
Act as a staff engineer. Refactor the following code for readability and maintainability, with the following hard constraints: - Preserve the exact public API — no rename or signature change. - Preserve runtime behaviour — no functional changes. - Do not introduce new dependencies. - Add comments only where the WHY is non-obvious; never repeat the code in English. For each change you make, list it in a short bulleted summary at the top with one-line justification. Code: ``` ```
Inputs0 of 2
›See the lazy version this template replaces
Before — the lazy prompt
refactor this code
Why it works
- Hard constraints prevent the model from 'helpfully' breaking things.
- The change summary at the top gives you a diff-free way to review intent.
- Comment rule prevents over-commenting noise.
Make this one yours
Replace the bracketed placeholders, then paste into the Prompt Fixer to lint your customisation before hitting send.