Coding Intermediate XML Structured

Refactor Opportunity Code Critic

For engineers who want practical refactor suggestions without changing behavior or introducing unnecessary complexity.

๐Ÿ’ป
Rating
4.8
Difficulty
Intermediate
Format
XML Structured
Variables
4
Download Prompt FREE

Best for these models

โ— Claude Opus 4.6 โ— Claude Sonnet 4.6 โ— ChatGPT (GPT-5.4)

๐Ÿ“‹ The Prompt

XML Structured .txt

๐Ÿ”’ Prompt available in download

Get the full prompt text in a downloadable .txt file. Free, no signup required.

Download Prompt

Variables to fill in

{{CODE_DIFF}} โ€” Replace with your input
{{LANGUAGE}} โ€” Replace with your input
{{STYLE_GUIDE}} โ€” Replace with your input
{{PRIORITY}} โ€” Replace with your input

About this prompt

Refactor Opportunity Code Critic is designed to help developers improve code quality without turning a simple review into a rewrite. It looks for duplicated logic, unclear naming, excessive branching, and responsibilities that should be split into smaller units. The goal is to produce maintainable improvements while preserving behavior and minimizing risk.

This template is ideal for staff engineers, tech leads, and code reviewers who want to recommend refactor suggestions that are worth the effort. It helps distinguish genuine design problems from stylistic preferences, so authors can focus on changes that improve readability, testability, and long-term ownership. The output is especially helpful in large codebases where small readability gains can prevent future bugs and reduce onboarding friction.

Customize the prompt with {{CODE_DIFF}}, the language in {{LANGUAGE}}, and your team standards in {{STYLE_GUIDE}}. If you want the model to optimize for a specific goal, set {{PRIORITY}} to readability, reuse, or testability. The response includes a list of refactoring candidates, why each matters, and a recommended order of execution. For best results, use it on medium-sized PRs where the implementation is correct but the structure could be cleaner.

Key features

  • Focuses on high-value refactor suggestions, not cosmetic nitpicks.
  • Improves readability, cohesion, and testability together.
  • Helps teams avoid risky rewrites and preserve behavior.
  • Supports design review in large, evolving codebases.
  • Ranks refactors by value and implementation risk.

Best for

  • โ†’ Staff engineers improving legacy modules
  • โ†’ Tech leads reviewing medium-complexity PRs
  • โ†’ Developers modernizing code without changing behavior

Tips

  • ๐Ÿ’ก Set {{PRIORITY}} to readability when onboarding or testability when stabilizing legacy code.
  • ๐Ÿ’ก Add your style guide in {{STYLE_GUIDE}} to reduce subjective suggestions.
  • ๐Ÿ’ก Use it after functional review so refactor advice stays grounded in actual behavior.

What you'll get

A prioritized refactor list with reasoning, risk, and suggested implementation order. It may recommend extracting functions, simplifying conditionals, renaming unclear variables, or separating responsibilities. The output avoids style-only comments and focuses on changes that improve maintainability and reduce future bugs.

Preparing your download...

Download Prompt

Related prompts