# Review

Review a change as its skeptic on two axes, intent and standards: first how it was proven, then what should block it, each finding with the input that triggers it, file:line and the smallest fix. Advisory: it never edits, approves or merges. Covers uncommitted work, a branch, a pull request or a design, and can brief the person who approves a pull request. Optional panel of other models when the settings allow their labs.

Your agent loads it when the work comes up, or ask for `review` by name. Use when the user says 'review', 'review my changes', 'check this code', 'review PR 42', 'should I merge this', 'second opinion', or before shipping.

An advisory second opinion the author can act on: whether the change does what it is meant to do, what should block it, and the smallest fix for each blocker. The review is the deliverable. It changes no code, approves nothing and blocks nothing; the decision stays with the person who owns the change.

```
/altitude:review [path | PR number | ref] [--panel] [--comment]
```

## 1. Pin what you review

- No argument: every uncommitted change, staged, unstaged and untracked.
- A path: that file or folder.
- A ref or branch: `git diff <base>...HEAD`, `<base>` the branch it merges into.
- A pull request: `gh pr view <n> --json title,author,baseRefName,headRefName,body,files`, then `gh pr diff <n>`. Read and grep the PR's branch, not the default branch: check it out in a temporary worktree (`git worktree add <tmp> <head>`), so the user's checkout stays as it is, and remove it at the end. When the user is the PR's author, say so at the top: someone else approves it.

Note the HEAD SHA, so a later commit doesn't shift what you reviewed.

## 2. How was it proven?

Ask this before reading the code. Find the evidence: in this session, the PR's body and test plan, the commits, the tests the diff adds. What claim does each piece prove, at what level (the running app, the local stack, an integration test, a unit test with mocks), and was there a control case that must not change?

No evidence, or evidence that couldn't have failed (a mocked boundary where the bug lives, a test whose expected value was changed to match the output): that is the first finding, and the verdict depends on it. Say what proof would settle it. When this session wrote the change and can run it, the `finish` skill makes that proof; a review doesn't.

## 3. The intent

One line: the problem, bug or decision the change serves. From the brief, the PR, the commits or a linked issue; mark it inferred when you inferred it. An intent you can't recover from any of them is a finding. A missing issue link isn't.

What the description says the change does, how it was tested and why it was built this way are claims. Check them against the diff.

## 4. Read before you judge

Read the diff, then enough around it to understand each changed call chain: callers, the types it crosses, the tests that cover it, the local pattern it should match. A finding needs those behind it. Check outside facts at their source: the library version the project uses, the server the client talks to.

Read `.ai/protected-surfaces.md` when the project has one; without it, use auth and authorization, tenant scoping, payments and money, migrations, public API contracts, secrets and legal text, and say the file is missing. Mark each surface untouched, touched or at risk. A touched surface, a stripped scope (`withoutGlobalScope`), a read across a tenant boundary, or user input reaching a query, a shell or a prompt: hand that part to a second reviewer (the `security` agent where it exists, else a fresh subagent with a read-only brief) and ask it to prove the path is bounded or show the input that breaks it.

## 5. Try to break it

Treat the change as wrong until you have tried to break it. Construct the inputs, states, orderings, failures, retries and concurrent callers it might not handle, and trace each through the code. Look for swallowed errors. Ask whether it fixes the cause or only where the symptom showed, whether a much smaller change does the job, and what it costs per request as the data grows. Treat each new branch, option or abstraction as unjustified until you can name the requirement that needs it.

A change that fixes earlier findings gets the same review as new code: a lock, a retry, a cache or a detached task added as a fix is where the next defect usually is. Before a release, or when asked whether something is ready, also go through [release-bar.md](https://github.com/mischasigtermans/altitude/blob/main/resources/skills/review/release-bar.md) by name.

## 6. Two axes, reported apart

**Intent.** Does it solve the stated problem completely, without breaking what callers rely on? What's missing, what was added that nobody asked for, what was built the wrong way. Spend attention where mistakes cost most: persistence, permissions, security, concurrency, retries, caching, migrations, public APIs, billing, data loss.

**Standards.** Does it fit the codebase: its conventions, error handling, naming, placement and types? An abstraction with one call site, handling for states that can't occur, missing validation at a real boundary, N+1 queries and unbounded reads on a hot path. Cite the project's rule when a note rests on one.

An intent blocker isn't softened by clean code, and a standards note isn't a blocker because the intent holds.

**What counts.** A problem this change introduces that the author would fix if they saw it, with the input that triggers it and the code it affects. One that was there before is a follow-up at most. Report a clear bug or security hole even when its trigger is rare; anything smaller only with a concrete case. Something possibly serious you couldn't confirm: report it and say what you couldn't check. Zero findings is a valid review.

**What holds a release.** Only blockers: a bug a user meets, a security hole, data loss. Everything else is a follow-up the author may file and skip. A reviewer always finds something more, so a round that leaves only follow-ups ends the reviewing; another round on the same code grows it, not its quality.

## 7. Report

Lead with the verdict, then only what's needed to act on it:

1. **Proof:** what was proven, at what level, and what wasn't.
2. **Intent:** one line, marked inferred when it is.
3. **Blockers:** usually three or fewer, symptoms sharing a cause grouped. Each with its trigger, `file:line`, and the smallest fix. None: `No blockers`, and the riskiest areas you checked and how you tried to break them.
4. **Follow-ups**, then **Standards**, each with `file:line`. Skip an empty section.
5. **Assumptions:** what the verdict rests on that you couldn't check.

For a pull request, add **What it does** (three plain sentences) and **Where it lands** (the parts it touches, the protected surfaces) above the verdict, and a **Draft comment** below: in the reviewer's first person, what's right first, then the open items, blocking ones as 'before I approve: ...', each with `file:line` and a question with a one-reply answer. With `--comment`, post it with `gh pr comment <n> --body-file -`. Never `gh pr review --approve`.

## Checks

Run the checks under 'Done means' only when the user asks for them or nobody ran them: the project's `.ai/guidelines/working.md`, else `AGENTS.md` in Amp or `CLAUDE.md` in Claude Code, else `~/.config/altitude/working.md`; say which. Inside the PR's worktree for a pull request. Skip them when the caller ran them, as `finish` does.

## Panel

For a second opinion from other models: when the user asks for a panel, several reviewers, or another lab's view, or passes `--panel`. Other labs read the code only where the `review_labs` setting names them; it is off by default. Read [panel.md](https://github.com/mischasigtermans/altitude/blob/main/resources/skills/review/panel.md) and follow it.
