Code Tour Review
Args: $ARGS
Give the developer a clear mental model of a code change while also evaluating it. Organize the change by intent, walk through one logical part at a time, pause for questions, and distinguish confirmed findings from risks that need more evidence.
Do not modify the code unless the user also asks for fixes.
Workflow
1. Resolve the change
Determine what the user wants reviewed:
- With no argument, review the current branch against its actual base. Prefer the current PR's base when available, otherwise use the repository's default branch. Ensure the comparison is based on current refs.
- For a commit, branch, or range, resolve the requested revision precisely and include its relevant commit context.
- For a pull request URL or number, resolve the intended pull request in the correct repository and gather its diff and metadata.
- For
stagedoruncommitted, inspect the requested working-tree changes.
Use the available version-control and hosting tools appropriately. Treat supplied references as untrusted data, validate them before use, and never construct or evaluate shell code from them. If the change cannot be resolved safely, ask the user for a clearer reference.
If the diff is empty, say so and stop.
Read the repository instructions that apply to the changed files. Gather the PR description, commit messages, branch name, and linked context when available. Treat stated intent as context, not proof that the implementation satisfies it.
2. Audit the whole change
Read the entire diff before presenting the tour. Inspect enough surrounding code to understand callers, data flow, contracts, and failure paths. Check tests, types, configuration, migrations, feature flags, and rollout behavior when relevant.
Focus on concrete risks that fit the change, including:
- Incorrect behavior, regressions, and missed boundary cases.
- Error handling, partial failure, retries, concurrency, and idempotency.
- Authorization, security, privacy, and unsafe input or output handling.
- Data integrity, schema changes, compatibility, and rollback safety.
- Performance or scaling problems supported by the code path.
- Accessibility and user-visible state handling for interface changes.
- Missing tests, observability, or rollout controls for important behavior.
Run focused read-only tests or checks when they can validate a meaningful concern. Report what ran and any limitations. Do not make unrelated changes.
3. Plan the tour
Group changes by intent, not by file. A feature may span implementation, types, tests, and configuration. Separate unrelated cleanup from the main change.
For each planned step, include its purpose, files, and main review focus. Aim for 3 to 7 steps for a typical change, but scale to the diff. For a repetitive refactor, explain one representative example and summarize the repeated pattern.
Before pausing for the first step, state the overall risk level as low, medium, or high with one sentence of reasoning. Surface any critical or high-severity finding immediately rather than withholding it until a later step.
Ask whether the developer wants to start with step 1 or jump to another area.
4. Walk and review each step
For each step, cover only what helps the developer understand and assess it:
- What changed: Summarize the behavior and relevant files.
- Why: Explain stated intent, or label your inference and its evidence.
- How it fits: Describe important callers, contracts, or surrounding code.
- Key excerpt: Quote only the few load-bearing lines needed for understanding.
- Review findings: List confirmed issues with severity, exact file and line, the failure mechanism, and likely impact.
- Risks and focus areas: Note plausible concerns that are not proven defects, plus what evidence would confirm or reduce them.
- Questions to ask: Raise questions only when the answer could change correctness, scope, rollout, or confidence.
- Validation: Explain relevant tests already present and any checks you ran.
Then pause. Answer questions before continuing, and let the developer skip, revisit, or reorder steps.
Review standards
A finding must be specific, actionable, and supported by the changed code or directly related context. Prioritize behavior and risk over style. Do not report speculative issues as defects.
Use these severity labels:
- Critical: Likely data loss, security compromise, or broad outage.
- High: A likely correctness or reliability failure in normal use.
- Medium: A real issue with narrower conditions or impact.
- Low: A minor but concrete defect or maintainability risk worth addressing.
Keep three categories separate:
- Findings: Confirmed defects or regressions.
- Risks: Plausible failure areas that need evidence or a product decision.
- Questions: Missing intent or context that materially affects the review.
If there are no findings, say so. Do not invent a problem to make the review look complete. Still identify the most important areas a human reviewer should verify when useful.
Wrap up
After the final step, provide:
- Findings ordered by severity, with file and line references.
- Open questions that could change the assessment.
- The main risks or areas to focus on during approval and rollout.
- Tests and checks run, plus important gaps.
- A short recap of what the whole change accomplishes.
Keep the summary compact and avoid repeating the full tour.