Code Review
Context
Staged diff:
!git diff --cached
Recent commits (for context):
!git log --oneline -10
Arguments
Raw arguments: $ARGUMENTS
Parse the arguments as follows:
- Agent (optional, first argument): The CLI command or agent name to delegate the review to. Recognized values:
claude or self or empty — perform the review directly in this context (default)
- Any other value — treated as a CLI command name (e.g.
codex, aider, goose). The review will be delegated by invoking that command via Bash (see Delegation section).
- Feature (optional, remaining arguments after agent): A description of what part of the codebase to review (e.g. "voting functionality", "authentication", "API endpoints"). When provided, find and review all files related to this feature. When empty/omitted, review staged changes instead.
If only one argument is given and it does NOT match a known agent name (claude, self), treat it as the feature instead, with agent defaulting to claude.
Instructions
Determine what to review
- If a feature is specified — use Glob and Grep to find all files related to the described feature. Read those files and review them as existing code.
- If no feature is specified and there are staged changes — review the staged diff shown above.
- If no feature is specified and there are NO staged changes — tell the user: "Nothing to review. Either stage changes with
git add or specify a feature to review, e.g. /code-review voting functionality." Then stop.
Perform the review
Read surrounding source files as needed to understand context. Organize findings by file, then by severity.
Severity levels
- 🔴 Critical — Bugs, security vulnerabilities, data loss risks, or crashes. Must be fixed.
- 🟠 Error — Logic errors, missing error handling, broken edge cases. Very likely to cause problems.
- 🟡 Warning — Code smells, performance concerns, potential edge cases, maintainability issues.
- 🔵 Suggestion — Better approaches, readability improvements, idiomatic alternatives.
- ⚪ Nitpick — Style, naming, formatting, minor preferences. Totally optional.
Output format
Group findings by severity. Each severity level that has findings should be its own heading (e.g. ## 🔴 Critical, ## 🟠 Error, etc.). Within each severity heading, list the findings. For each finding, include:
- The file and line reference
- A concise description of the issue
- A suggested fix or alternative (when applicable)
Omit severity headings that have no findings.
End with a ## Summary section: overall assessment, whether changes look good to merge (or code looks healthy), and a count of findings per severity level.
Delegation
If the agent is not claude/self/empty, it is treated as a CLI command name. Delegate the review by invoking that command via Bash:
- Build a prompt that includes the review instructions, severity levels, output format, and either the staged diff or the feature description
- Run:
<agent> -q "<prompt>" where <agent> is the CLI command the user specified (e.g. codex, aider, goose)
- When the command returns, relay its findings to the user verbatim
1---2name: code-review3description: Code review staged changes or a specific area of the codebase, optionally delegating to a chosen agent. Use when the user wants a code review.4---56# Code Review78## Context910**Staged diff:**1112!`git diff --cached`1314**Recent commits (for context):**1516!`git log --oneline -10`1718## Arguments1920Raw arguments: $ARGUMENTS2122Parse the arguments as follows:2324- **Agent** (optional, first argument): The CLI command or agent name to delegate the review to. Recognized values:25 - `claude` or `self` or empty — perform the review directly in this context (default)26 - Any other value — treated as a CLI command name (e.g. `codex`, `aider`, `goose`). The review will be delegated by invoking that command via Bash (see Delegation section).27- **Feature** (optional, remaining arguments after agent): A description of what part of the codebase to review (e.g. "voting functionality", "authentication", "API endpoints"). When provided, find and review all files related to this feature. When empty/omitted, review staged changes instead.2829If only one argument is given and it does NOT match a known agent name (`claude`, `self`), treat it as the **feature** instead, with agent defaulting to `claude`.3031## Instructions3233### Determine what to review34351. **If a feature is specified** — use Glob and Grep to find all files related to the described feature. Read those files and review them as existing code.362. **If no feature is specified and there are staged changes** — review the staged diff shown above.373. **If no feature is specified and there are NO staged changes** — tell the user: "Nothing to review. Either stage changes with `git add` or specify a feature to review, e.g. `/code-review voting functionality`." Then stop.3839### Perform the review4041Read surrounding source files as needed to understand context. Organize findings by file, then by severity.4243### Severity levels44451. **🔴 Critical** — Bugs, security vulnerabilities, data loss risks, or crashes. Must be fixed.462. **🟠 Error** — Logic errors, missing error handling, broken edge cases. Very likely to cause problems.473. **🟡 Warning** — Code smells, performance concerns, potential edge cases, maintainability issues.484. **🔵 Suggestion** — Better approaches, readability improvements, idiomatic alternatives.495. **⚪ Nitpick** — Style, naming, formatting, minor preferences. Totally optional.5051### Output format5253Group findings by severity. Each severity level that has findings should be its own heading (e.g. `## 🔴 Critical`, `## 🟠 Error`, etc.). Within each severity heading, list the findings. For each finding, include:54- The file and line reference55- A concise description of the issue56- A suggested fix or alternative (when applicable)5758Omit severity headings that have no findings.5960End with a `## Summary` section: overall assessment, whether changes look good to merge (or code looks healthy), and a count of findings per severity level.6162### Delegation6364If the agent is not `claude`/`self`/empty, it is treated as a CLI command name. Delegate the review by invoking that command via Bash:65- Build a prompt that includes the review instructions, severity levels, output format, and either the staged diff or the feature description66- Run: `<agent> -q "<prompt>"` where `<agent>` is the CLI command the user specified (e.g. `codex`, `aider`, `goose`)67- When the command returns, relay its findings to the user verbatim