Refactor Code Without Changing Its Behavior
Clean up structure and readability while holding behavior fixed — with a clear summary of what changed and why.
0 likes
0 dislikes
Sign in to rate this prompt
Prompt
Refactor the code below for readability and structure. **Do not change its observable behavior** — the same inputs must produce the same outputs and side effects.
Code:
{{code}}
Goals (optional — e.g. reduce nesting, extract functions, clearer names, remove duplication):
{{goals}}
Please:
1. Return the refactored code.
2. Summarize what you changed and why, as a short bulleted list.
3. Flag anything you were tempted to change but left alone because it might alter behavior.
If a "cleanup" would risk changing behavior, don't make it silently — point it out and let me decide. If the code's intended behavior is unclear in places, ask before assuming.
Why this prompt works
-
How to Deploy an AI Agent
Every deployment problem follows from one property: you don't know how long a run takes, because you didn't write the path. Why the run m...
Read the guide → -
MCP Authorization and OAuth
Optional until you opt in, then very specific. Why the resource parameter is mandatory even when the server ignores it, why PKCE doesn't ...
Read the guide → -
MCP Transports: stdio vs Streamable HTTP
There are two transports now, not three, and the one that vanished is the one most tutorials still document. What each is exposed to, why...
Read the guide →