rust-review
Expert-level Rust audits covering ownership, concurrency, unsafe blocks, traits, and Cargo dependencies. Use for Rust-specific code review.
When & Why to Use This Skill
The Rust Review skill is an expert-level auditing tool designed to ensure the safety, performance, and idiomatic correctness of Rust codebases. It provides deep technical analysis of ownership, lifetimes, and concurrency patterns, while specifically auditing unsafe blocks and Cargo dependencies. By automating complex borrow-checker analysis and security scans, it helps developers maintain high-quality, memory-safe software and streamline the peer review process.
Use Cases
- Safety Audits: Conducting rigorous reviews of 'unsafe' code blocks to document invariants and ensure memory safety compliance.
- Concurrency Analysis: Verifying async patterns and synchronization primitives to detect potential race conditions or deadlocks in multi-threaded applications.
- Performance Optimization: Analyzing ownership and borrowing patterns to eliminate unnecessary allocations and improve runtime efficiency.
- Dependency Security: Scanning Cargo dependencies for known vulnerabilities and ensuring optimal crate management.
- Idiomatic Code Review: Evaluating error handling (Result/Option) and trait implementations to ensure adherence to Rust community best practices.
| name | rust-review |
|---|---|
| description | Expert-level Rust audits covering ownership, concurrency, unsafe blocks, traits, and Cargo dependencies. Use for Rust-specific code review. |
| category | code-review |
| tags | [rust, ownership, concurrency, unsafe, traits, cargo] |
| tools | [borrow-checker-analyzer, unsafe-auditor, dependency-scanner] |
| complexity | advanced |
| estimated_tokens | 400 |
| progressive_loading | true |
| - pensive | shared |
| - imbue | evidence-logging |
Rust Review Workflow
Expert-level Rust code audits with focus on safety, correctness, and idiomatic patterns.
Quick Start
/rust-review
When to Use
- Reviewing Rust code changes
- Auditing unsafe blocks
- Analyzing concurrency patterns
- Dependency security review
- Performance optimization review
Required TodoWrite Items
rust-review:ownership-analysisrust-review:error-handlingrust-review:concurrencyrust-review:unsafe-auditrust-review:cargo-depsrust-review:evidence-log
Progressive Loading
Load modules as needed based on review scope:
Quick Review (ownership + errors):
- @include ownership-analysis.md
- @include error-handling.md
Concurrency Focus:
- @include concurrency-patterns.md
Safety Audit:
- @include unsafe-audit.md
Dependency Review:
- @include cargo-dependencies.md
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
- All unsafe blocks documented with SAFETY comments
- FFI boundaries properly wrapped
- Memory safety invariants maintained
Correctness
- Error handling complete
- Concurrency patterns sound
- Tests cover critical paths
Performance
- No unnecessary allocations
- Borrowing preferred over cloning
- Async properly non-blocking
Idioms
- Standard traits implemented
- Error types well-designed
- Documentation complete
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
Exit Criteria
- All unsafe blocks audited
- Concurrency patterns verified
- Dependencies scanned
- Evidence logged
- Action items assigned