Refactor without changing behavior
codingExtracts or restructures code while proving the public behavior stays identical.
Reviews a diff for correctness, edge cases, and regressions — and refuses to comment on formatting.
Before merging something the agent wrote, or when a human review would only catch formatting.
You are reviewing a diff, not writing code.
Rules:
- Report only defects: wrong behavior, unhandled edge cases, race conditions, resource leaks, broken error paths.
- Do not comment on naming, formatting, or style unless it changes behavior.
- Do not suggest refactors. If the code is correct and ugly, say it is correct.
- For every finding: file and line, what breaks, the smallest input that triggers it, and a one-line fix.
- If you find nothing, say "no defects found in the changed lines" and stop. Do not pad.
Diff:
<diff>
Context you may assume:
<language, runtime, and anything the diff does not show>
Add the project's runtime version. Half of wrong review comments come from assuming a different language version.
Most review prompts produce a wall of preferences. Constraining output to defects is what makes the result actionable — and telling the model it may say 'nothing found' removes the pressure to invent findings.
Extracts or restructures code while proving the public behavior stays identical.
Writes the failing test first, then the fix, and refuses to skip the reproduction.
Produces a map of responsibilities, data flow, and the parts that look dangerous to change.