Code Review
Overview
Review the strongest available evidence first, then report concrete risks and low-cost improvements. Prefer implementation accuracy, behavior regressions, conflicting logic, dead code, and missing validation over style-only commentary.
Workflow
- Determine the review target.
- Gather the smallest set of repo evidence needed.
- Inspect the implementation for correctness and maintainability risks.
- Validate suspicious areas when practical.
- Report findings first, then open questions, then optional cleanup ideas.
Determine The Review Target
- If the user asked to review recent changes, inspect staged and unstaged changes first, then review the latest commit by default unless the user specifies a different range.
- If there are no relevant changes, audit the current repo state instead.
- If the user names a focus area, bias the review toward that code path, but still surface cross-cutting risks when they materially affect behavior.
Gather Evidence
Prefer the highest-signal sources:
- changed files and diffs,
- nearby implementation that the changes depend on,
- tests covering the touched behavior,
- repo instructions and execution docs when they define intended behavior,
- recent commits only when they clarify intent.
Do not read the whole repo by default. Expand only when the evidence suggests a real dependency or risk.
Review Priorities
Prioritize findings in this order:
- implementation bugs or behavioral regressions,
- conflicting logic, duplicated behavior, or stale branches,
- missing guards, validation, error handling, or tests,
- unnecessary complexity or dead code,
- small hardening or optimization opportunities with clear payoff.
Avoid speculative rewrites, broad style commentary, or performance suggestions that are not supported by the code path under review.
Hardening And Optimization Rules
- Prefer low-complexity improvements that reduce real risk.
- Suggest refactors only when they remove duplication, clarify control flow, or reduce maintenance cost.
- Suggest optimizations only when the code shows a plausible hot path, unnecessary work, or avoidable repeated I/O or allocation.
- If an idea adds architecture, abstractions, or new dependencies without strong evidence, reject it.
Validation
- Run focused checks when they materially increase confidence: targeted tests, linters, or small reproductions.
- If you cannot validate a suspected issue, label it as a risk or question rather than a confirmed bug.
- Distinguish clearly between observed facts, likely inferences, and open questions.
Output
When finishing:
- present findings first, ordered by severity, with file references,
- keep each finding concrete: what is wrong, why it matters, and what behavior is affected,
- follow with clarifying questions or assumptions,
- include a short summary of pragmatic hardening or cleanup opportunities,
- state explicitly if no material issues were found,
- mention validation run and any gaps.
- if the user asked for fixes or optimization, apply clear low-risk improvements after the audit and report what changed.
- end with the recommended next step only when more work remains or a decision is blocked.
Review Posture
- Be skeptical of large refactors that claim to simplify things while changing behavior.
- Be willing to say the code is acceptable when no meaningful problems are evident.
- Keep the bar practical: catch bugs, risk, drift, and waste without turning the review into redesign.
- Do not ask a generic follow-up question when the next action is already clear from the request and findings.
1---2name: code-review3description: Audit recent code changes or the current repository for correctness, regression risk, conflicting logic, unnecessary code, and pragmatic hardening opportunities. Use when the user asks to review or audit recent changes, inspect a refactor, review a fresh repo, or assess the current codebase for bugs, cleanup, and low-risk improvements without over-engineering.4---56# Code Review78## Overview910Review the strongest available evidence first, then report concrete risks and low-cost improvements. Prefer implementation accuracy, behavior regressions, conflicting logic, dead code, and missing validation over style-only commentary.1112## Workflow13141. Determine the review target.152. Gather the smallest set of repo evidence needed.163. Inspect the implementation for correctness and maintainability risks.174. Validate suspicious areas when practical.185. Report findings first, then open questions, then optional cleanup ideas.1920## Determine The Review Target2122- If the user asked to review recent changes, inspect staged and unstaged changes first, then review the latest commit by default unless the user specifies a different range.23- If there are no relevant changes, audit the current repo state instead.24- If the user names a focus area, bias the review toward that code path, but still surface cross-cutting risks when they materially affect behavior.2526## Gather Evidence2728Prefer the highest-signal sources:2930- changed files and diffs,31- nearby implementation that the changes depend on,32- tests covering the touched behavior,33- repo instructions and execution docs when they define intended behavior,34- recent commits only when they clarify intent.3536Do not read the whole repo by default. Expand only when the evidence suggests a real dependency or risk.3738## Review Priorities3940Prioritize findings in this order:41421. implementation bugs or behavioral regressions,432. conflicting logic, duplicated behavior, or stale branches,443. missing guards, validation, error handling, or tests,454. unnecessary complexity or dead code,465. small hardening or optimization opportunities with clear payoff.4748Avoid speculative rewrites, broad style commentary, or performance suggestions that are not supported by the code path under review.4950## Hardening And Optimization Rules5152- Prefer low-complexity improvements that reduce real risk.53- Suggest refactors only when they remove duplication, clarify control flow, or reduce maintenance cost.54- Suggest optimizations only when the code shows a plausible hot path, unnecessary work, or avoidable repeated I/O or allocation.55- If an idea adds architecture, abstractions, or new dependencies without strong evidence, reject it.5657## Validation5859- Run focused checks when they materially increase confidence: targeted tests, linters, or small reproductions.60- If you cannot validate a suspected issue, label it as a risk or question rather than a confirmed bug.61- Distinguish clearly between observed facts, likely inferences, and open questions.6263## Output6465When finishing:6667- present findings first, ordered by severity, with file references,68- keep each finding concrete: what is wrong, why it matters, and what behavior is affected,69- follow with clarifying questions or assumptions,70- include a short summary of pragmatic hardening or cleanup opportunities,71- state explicitly if no material issues were found,72- mention validation run and any gaps.73- if the user asked for fixes or optimization, apply clear low-risk improvements after the audit and report what changed.74- end with the recommended next step only when more work remains or a decision is blocked.7576## Review Posture7778- Be skeptical of large refactors that claim to simplify things while changing behavior.79- Be willing to say the code is acceptable when no meaningful problems are evident.80- Keep the bar practical: catch bugs, risk, drift, and waste without turning the review into redesign.81- Do not ask a generic follow-up question when the next action is already clear from the request and findings.