← Prompt library
CodingFree→ Claude / ChatGPT

Refactor Legacy Function

Untangle an old function without changing its behavior.

What you get: A refactored version of the function plus a short list of what changed and why.

input
output — Claude / ChatGPT
Refactor the function below for readability and maintainability without changing its external behavior. Constraints: {{constraints}} (e.g. must stay synchronous, can't add new dependencies).

Explain each change in one line, and flag anything you weren't fully confident preserves the original behavior.

Function:
{{code}}