with one click
with one click
Check a PR for review comments, evaluate them, and address valid ones
Post a written review file to GitHub as a proper PR review
Create a GitHub PR review with inline comments, preview before posting
Execute an implementation plan, making changes and committing properly
Create an implementation plan from PR review feedback
Resolve a GitHub issue end-to-end using sequential subagents
| name | code-review |
| description | Review changes or PRs against project guidelines |
| allowed-tools | Read, Write, Grep, Glob, Bash |
Review local changes or pull requests against project guidelines. All output is written locally — never posted to GitHub.
/code-review [target] [--output path]
Specifies what to review. Can be:
HEAD~3..HEAD, abc123..def456)HEAD~1, abc123)main..feature/foo)#123 or 123)--output path or -o path - where to write the review:
.ai/ (e.g., issue-59-add-no-verify-option).ai/issue-59-add-no-verify-option).ai/.ai/ (see step 6)# Auto-detect new commits vs main (writes to .ai/)
/code-review
# Auto-detect, specify output folder
/code-review --output issue-59-add-no-verify-option
/code-review -o .ai/my-feature
# Review specific commits (outputs to conversation)
/code-review HEAD~3..HEAD
/code-review abc123
/code-review main..feature/foo
# Review commits and save to file
/code-review HEAD~5..HEAD --output code-audit
# Review a pull request (auto-saves to .ai/)
/code-review #123
/code-review 123
Parse Arguments
#123 or bare 123 that isn't a valid git ref)--output or -o flag was providedGather Context
For auto-detect mode (no target specified):
.ai/For explicit mode (commit/range target specified):
For PR mode (PR number specified):
gh pr view <number> --json title,author,baseRefName,headRefName,headRefOid,number
Detect and Get Changes
For auto-detect mode:
git config gitflow.branch.main.name (fallback to main)git log <main>..HEAD --onelinegit diff <main>...HEADFor explicit mode:
..): git diff <range> and git log <range> --onelinegit show <commit> --stat and git log -1 <commit>For PR mode:
gh pr diff <number>gh pr view <number> --json commits --jq '.commits[].oid'For all modes:
Review Against Guidelines
Review the code against REVIEW_CRITERIA.md, which covers:
Code Quality Checks (auto-detect mode only)
Skip this step for explicit mode (reviewing historical commits) and PR mode.
For auto-detect mode, run:
# Format check
go fmt ./...
# Vet check
go vet ./...
Determine Output Location
Filename includes revision(s) being reviewed:
# For auto-detect mode: use HEAD short SHA
HEAD_SHA=$(git rev-parse --short HEAD)
FILENAME="review-${HEAD_SHA}.md"
# For commit range (abc123..def456): use both endpoints
START_SHA=$(git rev-parse --short abc123)
END_SHA=$(git rev-parse --short def456)
FILENAME="review-${START_SHA}-${END_SHA}.md"
# For single commit: use that commit's short SHA
COMMIT_SHA=$(git rev-parse --short abc123)
FILENAME="review-${COMMIT_SHA}.md"
# For PR mode: use PR number and head SHA
HEAD_SHA=$(gh pr view <number> --json headRefOid --jq '.headRefOid' | cut -c1-7)
FILENAME="review-pr<number>-${HEAD_SHA}.md"
If --output / -o was provided:
.ai/, use it directly.ai/ (prepend .ai/)<folder>/<filename>If no --output and auto-detect mode:
feature/59-... → 59).ai/issue-<number>-* folder.ai/ folder exists, create one based on the branch name pattern<folder>/<filename>If no --output and PR mode:
.ai/issue-<number>-* folder.ai/pr-<number>/<folder>/<filename>If no --output and explicit mode:
Examples:
c9625f7 → .ai/issue-59-foo/review-c9625f7.mdabc123..def456 with -o issue-59-foo → .ai/issue-59-foo/review-abc123-def456.mdabc123 with -o .ai/my-feature → .ai/my-feature/review-abc123.md#60 at head a1b2c3d → .ai/issue-59-foo/review-pr60-a1b2c3d.mdGenerate Review Report
Write the review to file OR output directly to conversation based on step 6.
Use this format:
# Code Review: <branch-name, commit-range, or PR #number>
## Summary
- Revision(s): `<start-sha>` to `<end-sha>` (or single `<sha>`)
- Files changed: <count>
- Lines added: <count>
- Lines removed: <count>
- Commits reviewed: <count> (list the commit SHAs/subjects)
For PR mode, add PR metadata to the summary:
- PR: #<number> - <title>
- Author: <author>
- Base: <base-branch> ← <head-branch>
Then continue with:
## Checklist Results
### Passed
- <item 1>
- <item 2>
### Must Fix
- [ ] <issue 1> - <file:line> - <description>
- [ ] <issue 2> - <file:line> - <description>
### Should Fix
- <item 1>
## Quality Checks (auto-detect mode only)
- Format: PASS/FAIL
- Vet: PASS/FAIL
## Recommendations
1. <recommendation>
2. <recommendation>
## Ready for PR? (auto-detect mode only)
<YES/NO - explain if NO>
For explicit and PR modes, omit "Quality Checks" and "Ready for PR?" sections.
Report Findings
Categorize findings using the severity levels defined in REVIEW_CRITERIA.md (Must fix, Should fix, Nit).