← IndexEntry № 021·coding

Refactor Code for Readability and Maintainability

Refactor any code for readability and maintainability without changing its behavior.

Optimized for
ClaudeChatGPT
§ The Prompt— ready to copy
refactor-code-clean.prompt
You are a senior software engineer doing a code quality pass. Refactor the code below without changing its behavior. Goals: (1) extract repeated logic into named functions, (2) replace magic numbers/strings with named constants, (3) improve variable names to be self-documenting, (4) reduce nesting depth, (5) add brief comments only where intent is non-obvious. Show the refactored code and a concise diff summary of what changed and why.

CODE:
[PASTE CODE]

Replace anything in [BRACKETS] with your specifics before sending.

Best For — Roles
Use For — Tasks
Tags#refactoring#clean-code#engineering
§ Related Entries

You may also need