Code prompts
Code prompt

Refactor for readability (without changing behavior)

You have working code that's hard to read. You want it cleaner without breaking anything.

Works best in: Claude

Refactor this code to be more readable. Do not change its behavior.

```{{language}}
{{paste your code}}
```

Constraints:
- Same inputs and outputs as the original
- Keep external API intact (function names, signatures, exports)
- Don't introduce new dependencies
- Don't add type annotations if the codebase doesn't use them
- Preserve any subtle behavior the original has (race conditions, timing, side effects)

Output:
1. The refactored code
2. A bullet list of every change you made and why (not "cleaner" — say what specifically improved)
3. Any behavior I should re-test manually because the change is non-trivial
4. One thing you'd want to refactor next, but didn't because it's out of scope
·Open in·Share
refactoringcode qualitymaintenance

More code prompts

All code prompts

Go deeper