Code Review: /review & /ultrareview
/review, a multi-agent review, your own guidelines file, and a CI job that posts the result.Product facts change. Review commands and their options differ between versions./reviewis a built-in command, and/ultrareviewis described here as the multi-agent, cloud-run option that some versions provide (as of October 2026). Type/helpto see what your version has, and check whether a command is billed separately before you automate it. Example outputs below are illustrations, not exact wording.
After this lesson, you will be able to:
- Run `/review` for a fast quality pass: bugs, security, performance, missing tests
- Build a multi-agent review from reviewer subagents, and know where `/ultrareview` fits if your version has it
- Customize review depth and focus with a guidelines file such as `REVIEW.md`
- Wire a Claude Code review into GitHub Actions or GitLab CI so every PR gets automated feedback
Before you start
#/review vs /ultrareview
| Command | Depth | Cost | Best For |
|---|---|---|---|
/review | A single pass by the session you are in | Normal session tokens | A quick sanity check before you commit or open a PR |
/ultrareview (if your version has it) | Several specialist agents in parallel, with their findings merged | Typically a separate, billed run; check your plan | The boundary before merge, when a deeper pass is worth paying for |
| Your own reviewer subagents | Whatever you define in .claude/agents/ | Normal tokens, one context per agent | Teams that want control over the reviewers and no extra service |
Run the cheap pass often and the deep pass at the boundaries. The rest of the lesson shows how to do both.
#/review: Fast Local Pass
> /review
/review 142. A typical result looks like this (illustrative output):🟡 src/api/auth.py:42 - SQL string concatenation; use parameterized query
🟢 src/api/auth.py:68 - Magic constant 86400; consider TOKEN_TTL_SECONDS
🟢 tests/auth.py - Missing test for expired-token path
No critical issues. 3 suggestions.
Options differ between versions, so steer the review with words instead of flags:
> Review my staged changes, security issues only
> Review src/auth/ for missing error handling
> Review everything since I branched from main
/security-review, which looks at the pending changes on your branch.#/ultrareview: Multi-Agent Cloud Review
/ultrareview runs several specialist reviewers in parallel and merges their findings. The idea does not depend on the command, so here is the pattern you can build with the Subagents lesson:1. Collect the diff (current branch vs base, or the PR's diff)
2. Start parallel reviewer subagents, each in its own context:
- security-reviewer (auth, secrets, injection, OWASP)
- performance-reviewer (N+1 queries, blocking I/O, allocations)
- test-reviewer (coverage, edge cases, missing assertions)
- style-reviewer (project conventions, CLAUDE.md compliance)
3. Each reviewer reads the relevant files for context, not just the diff
4. One final pass merges the findings, removes duplicates, ranks by severity
5. Output one report (and optionally a PR comment)
You ask for it in plain words:
> Review this branch against main with the security-reviewer, performance-reviewer
> and test-reviewer subagents in parallel, then merge their findings into one
> list ranked by severity.
Sample merged report (illustrative):
REVIEW - feat/auth-google (12 files)
CRITICAL (2)
src/api/auth.py:42 - SQL injection: f-string in WHERE clause
src/api/auth.py:101 - JWT verified without checking expiry
MAJOR (4)
src/api/auth.py:155 - Missing rate limit on /callback endpoint
tests/auth.py:23 - No test for expired-token branch
...
OVERALL: 2 blockers, 4 should-fix.
Recommendation: do not merge until the critical items are resolved.
#Customizing Review Behavior
REVIEW.md (the name is yours to choose). Then point to it so Claude reads it: add a line to CLAUDE.md such as "When reviewing code, follow REVIEW.md", or name it in your review prompt or command.# Code Review Guidelines
## Severity Bar
- CRITICAL: blocks merge: security, data loss, public API breakage
- MAJOR: should fix: bugs, missing tests, performance regressions
- MINOR: nits: naming, comments, formatting
## Project-Specific Rules
- All API endpoints must have rate limiting (use @rate_limit decorator)
- Database queries must use parameterized statements (no f-strings in SQL)
- TypeScript strict mode: no `any`
- All public functions need JSDoc
## Skip
- Don't flag prettier formatting (CI handles it)
- Don't recommend abstraction unless the duplication exceeds 3 places
## Tests
- Every new endpoint needs at least: happy path, auth failure, validation failure
#Review Slash Command Recipes
Package the reviews you repeat as custom commands (see the Slash Commands & Skills lesson). The file name becomes the command:
---
description: Security-only review of this branch against main
---
Review the changes on this branch against main. Follow REVIEW.md.
Report security issues only, ranked by severity. Do not edit any files.
Extra focus: $ARGUMENTS
.claude/commands/review-security.md and run /review-security auth and session handling. Make a second file with the three-reviewer prompt above and you have a one-word deep review.#CI/CD Integration: GitHub Actions
claude -p (print mode), and post the result as a comment. This sketch uses only the CLI and the GitHub CLI:# .github/workflows/claude-review.yml
name: Claude Code Review
on:
pull_request:
types: [opened, synchronize]
permissions:
contents: read
pull-requests: write
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Claude Code
run: npm install -g @anthropic-ai/claude-code
- name: Review the PR
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
claude -p "Review the changes between origin/main and HEAD. Follow REVIEW.md. List findings by severity." \
--permission-mode dontAsk \
--allowedTools "Read" "Grep" "Glob" "Bash(git diff *)" "Bash(git log *)" > review.md
gh pr comment ${{ github.event.pull_request.number }} --body-file review.md
What this does:
- Triggers on every PR open or push to the PR branch
- Runs a read-only review: the allow list is limited to reading files and
git diff/git log - Posts the result as a PR comment, so engineers see it before the human reviewer arrives
/install-github-app in Claude Code can set it up. Check its README for the current name, version and inputs. Treat the PR content as untrusted input: a PR from a fork can contain text that tries to steer the reviewer, which is why this job gets only read access and no secrets beyond the API key.#CI Integration: GitLab CI
# .gitlab-ci.yml
claude-review:
stage: review
image: node:20
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
script:
- npm install -g @anthropic-ai/claude-code
- git fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
- claude -p "Review the changes against origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME. Follow REVIEW.md." --permission-mode dontAsk --allowedTools "Read" "Grep" "Glob" "Bash(git diff *)" > review.md
- cat review.md
#Pair /ultrareview with Hooks
Auto-run a quick review after every commit Claude makes. A hook is a script that receives JSON on stdin (see the Hooks lesson):
{
"hooks": {
"PostToolUse": [
{
"matcher": "Bash",
"hooks": [{ "type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/review-on-commit.sh" }]
}
]
}
}
#!/usr/bin/env bash
# .claude/hooks/review-on-commit.sh: append a mini review after each git commit
[ -n "$REVIEW_HOOK_RUNNING" ] && exit 0 # do not recurse
cmd=$(jq -r '.tool_input.command // empty')
case "$cmd" in
*"git commit"*)
REVIEW_HOOK_RUNNING=1 claude -p "Review the last commit (git show HEAD). Be brief." \
--permission-mode dontAsk --allowedTools "Read" "Bash(git show *)" >> .claude/review-log.md ;;
esac
exit 0
.claude/review-log.md. Each run is a model call that costs tokens and time, so use it for work that matters and delete the hook if it gets noisy.#Reviewing AI-Generated Code
When Claude wrote the code, you still want a review pass, from a different angle. Say so:
> Review this change assuming it is wrong. Look for hallucinated APIs,
> made-up function signatures, and plausible-but-broken patterns.
Common AI-code failure modes to catch:
- Hallucinated library functions (especially in less-popular packages)
- The wrong API version (trained on older docs)
- Plausible but subtly broken async patterns
- Missing error handling on network calls
- Tests that pass but do not verify the behavior
#Key Takeaways
/reviewis the quick pass: run it often, especially before commits- A multi-agent review is several specialist reviewers plus a merge: build it from subagents, or use
/ultrareviewif your version has it, and check how it is billed - Write your review standards in a file (
REVIEW.md) and point Claude at it - CI:
claude -pin a read-only job posts review comments on every PR. Treat the PR text as untrusted input - For AI-generated code, ask for a skeptical review that looks for hallucinated APIs
#Quick Check
You opened a PR with 8 commits across 14 files. Best review approach?
Pick the cleanest way to plug Claude Code review into a 30-engineer team's PR flow.