CODE REVIEW / Anthropic
Expert Rust Code Reviewer
Reviews a Rust diff for ownership, unsafe invariants, concurrency, error handling and public APIs, with compiler or Clippy checks for testable findings.
“Expert Rust code reviewer. Reviews Rust code for quality, safety, idioms, performance, maintainability, readability, and API ergonomics. Has read-only git access (`git diff`/`log`/`blame`/`show`) for scoping a review to the changed lines, and `cargo check`/`cargo clippy` for verifying findings mechanically.”
01 / THE REASONING
Why this made the selection.
- The source covers ownership, unsafe contracts, async cancellation, lock ordering, secret-bearing Debug output and dependency/MSRV concerns in one review checklist.
- It requires concrete file:line findings and confirmation of suspected compiler or Clippy diagnostics before reporting them.
02 / THE REVIEW RECORD
What we actually inspected.
Source review has boundaries.
A clear record is more useful than a “safe” badge.
Material inspected
- .claude/agents/rust-code-reviewer.md (complete frontmatter and body)
- LICENSE
- Claude Code custom-subagent configuration
- Cargo build-script lifecycle
- Round 2: pinned definition, output contract and permission/dependency boundaries reread on 2026-10-14
Our findings
- The definition has 18 numbered review categories, including unsafe code, dependencies, async patterns and observability.
- The required report has an executive summary, findings by category, critical issues, prioritised improvements and positive observations. Findings are reported rather than applied.
- The shell restrictions are written into the prompt. The inspected tool list itself is Read, Glob, Grep and Bash.
- The review explicitly checks unbounded allocations from untrusted input and sensitive values exposed by Debug.
- Its API ergonomics section tests fallibility granularity and whether must_use is applied where discarded results are mistakes.
Not established by this review
- The agent was not executed; model behaviour, host compatibility and task outcomes were not runtime-tested.
The review applies to the material and revision named here. A newer upstream release can change its behavior.
03 / PUT IT TO WORK
Use the role in your project.
- Place rust-code-reviewer.md into `.claude/agents/rust-code-reviewer.md` in the target repository.
- Invoke the subagent from Claude Code for Rust PR or branch reviews.
Before you start
- Claude Code CLI
- Rust / Cargo installed
04 / FOLLOW THE EVIDENCE
The source trail.
Our notes are separate from the original resource.
Check upstream before adopting a new version.
https://github.com/anthropics/buffa/blob/5fed61b257d36dac48525a73c0fcb1e9fd8b5299/.claude/agents/rust-code-reviewer.md
Supports: summary, upstreamDescription, whySelected, limitations
https://github.com/anthropics/buffa/blob/5fed61b257d36dac48525a73c0fcb1e9fd8b5299/LICENSE
Supports: license
https://code.claude.com/docs/en/sub-agents
Supports: Installation, Host capability boundaries
https://doc.rust-lang.org/cargo/reference/build-scripts.html
Supports: Build-script execution, Build-output writes