| name | rust-review |
| description | Audits Rust code for unsafe blocks, ownership issues, and Cargo dependency risks. Use when reviewing Rust code or before merging Rust changes. |
| globs | **/*.rs |
| alwaysApply | false |
| category | code-review |
| tags | ["rust","ownership","concurrency","unsafe","traits","cargo"] |
| tools | [] |
| usage_patterns | ["rust-audit","unsafe-review","dependency-audit","concurrency-analysis"] |
| complexity | advanced |
| model_hint | deep |
| estimated_tokens | 400 |
| progressive_loading | true |
| dependencies | ["pensive:shared","imbue:proof-of-work"] |
| modules | ["ownership-analysis.md","error-handling.md","concurrency-patterns.md","unsafe-audit.md","cargo-dependencies.md","silent-returns.md","collection-types.md","sql-injection.md","cfg-test-misuse.md","error-messages.md","duplicate-validators.md","builtin-preference.md","model-specific-tells.md","iterator-and-allocation-slop.md","test-slop.md","async-slop.md"] |
Table of Contents
Rust Review Workflow
Expert-level Rust code audits with focus on safety, correctness, and idiomatic patterns.
Quick Start
/rust-review
Verification: Run the command with --help flag to verify availability.
When To Use
- Reviewing Rust code changes
- Auditing unsafe blocks
- Analyzing concurrency patterns
- Dependency security review
- Performance optimization review
When NOT To Use
- General code review without Rust - use unified-review
- Performance profiling - use parseltongue:python-performance pattern
Required TodoWrite Items
rust-review:ownership-analysis
rust-review:error-handling
rust-review:concurrency
rust-review:unsafe-audit
rust-review:cargo-deps
rust-review:evidence-log
Progressive Loading
Load modules as needed based on review scope:
Quick Review (ownership and errors):
- See
modules/ownership-analysis.md for borrowing and lifetime analysis
- See
modules/error-handling.md for Result/Option patterns
Concurrency Focus:
- See
modules/concurrency-patterns.md for async and sync primitives
Safety Audit:
- See
modules/unsafe-audit.md for unsafe block documentation
Dependency Review:
- See
modules/cargo-dependencies.md for vulnerability scanning
Idiomatic Patterns:
- See
modules/builtin-preference.md for conversion traits and builtin preference
Core Workflow
- Ownership Analysis: Check borrowing, lifetimes, clone patterns
- Error Handling: Verify Result/Option usage, propagation
- Concurrency: Review async patterns, sync primitives
- Unsafe Audit: Document invariants, FFI contracts
- Dependencies: Scan for vulnerabilities, updates
- Evidence Log: Record commands and findings
Rust Quality Checklist
Safety
Correctness
Performance
Idioms
Output Format
## Summary
Rust audit findings
## Ownership Analysis
[borrowing and lifetime issues]
## Error Handling
[error patterns and issues]
## Concurrency
[async and sync patterns]
## Unsafe Audit
### [U1] file:line
- Invariants: [documented]
- Risk: [assessment]
- Recommendation: [action]
## Dependencies
[cargo audit results]
## Recommendation
Approve / Approve with actions / Block
Verification: Run the command with --help flag to verify availability.
Exit Criteria
- All unsafe blocks audited
- Concurrency patterns verified
- Dependencies scanned
- Evidence logged
- Action items assigned