Refactor Opportunity Code Critic
For engineers who want practical refactor suggestions without changing behavior or introducing unnecessary complexity.
Best for these models
๐ The Prompt
๐ Prompt available in download
Get the full prompt text in a downloadable .txt file. Free, no signup required.
Download PromptVariables 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 PromptRelated prompts
API Contract Review Analyst
For engineers reviewing API changes that may break clients, contracts, or backward compatibility guarantees.
API Mock Server Blueprinter
For teams building mock services that simulate realistic API behavior before backend completion.
API Reference Documentation Forge
For platform teams generating accurate API reference docs from schemas, routes, or endpoint notes.
Backend Test Fixture Architect
For senior engineers creating reusable fixtures and mocks for complex backend test suites.