Asking an AI to "refactor this code" directly tends to produce a rewrite you now have to review line by line, with no clear record of what was actually wrong in the original. A more useful sequence is reviewing first — getting a specific, prioritized list of what needs fixing — and only then refactoring with that list as a guide.
Why Review-First Beats Rewrite-First
A code review prompt with severity tags and suggested fixes enabled doesn't just point out problems — it gives you a ranked list of exactly what to change and roughly how. That's effectively a refactoring checklist, generated from the actual code rather than a generic "clean this up" instruction that might reorganize things that were already fine.
Turning Focus Areas Into a Refactor Plan
The code quality and performance focus areas map most directly onto refactoring work:
- Code Quality & Readability — naming, structure, complexity, and whether the code follows the language's own idioms. This is the category that produces classic refactor suggestions: extract this into a function, rename this variable, simplify this conditional.
- Performance & Efficiency — inefficient algorithms, unnecessary computation, likely bottlenecks. These often require more structural changes than a quality fix alone, which is exactly why having them called out separately, with severity attached, helps you judge whether a performance refactor is worth the risk right now.
Combining these two with severity tags and suggested fixes enabled turns the review output into an ordered list: fix the Critical and High items first, treat Medium and Low as a backlog rather than a to-do-right-now.
What This Approach Doesn't Do
This is a review prompt, not a rewrite prompt — it won't hand you a fully refactored file. What it hands you is a specific, prioritized description of what to change and why, which is arguably more useful going into a refactor than a black-box rewrite: you know exactly what changed and can verify each fix independently, rather than diffing an entire file against its previous version and hoping nothing important shifted.
Get a prioritized fix list before you touch a single line
Open the Code Review Prompt Builder