Back to prompts
CodingClaudeGPT-4

Refactor for readability

Refactors messy code into clean, idiomatic, well-named code without changing behavior.

Variables

Prompt(live preview)

Refactor the following code for readability and idiomatic style. Do not change behavior. Improve: variable names, function decomposition, early returns, removal of dead code, consistent formatting, and comment quality (delete obvious comments, add comments only where intent isn't clear from code).

Language: {{language}}

Code:
{{code}}

Return only the refactored code in a single block, then a short bullet list of what you changed and why.

Comments

No comments yet. Be the first to share your experience with this prompt!

Sign in to leave a comment.