rust-review

majiayu000's avatarfrom majiayu000

Expert-level Rust audits covering ownership, concurrency, unsafe blocks, traits, and Cargo dependencies. Use for Rust-specific code review.

⭐0stars🔀0forks📁View on GitHub🕐Updated Jan 5, 2026

When & Why to Use This Skill

This Claude skill provides expert-level Rust code audits, specializing in memory safety, ownership, and concurrency. It automates the detection of vulnerabilities in unsafe blocks, analyzes complex async patterns, and evaluates Cargo dependencies to ensure high-quality, idiomatic Rust development and robust software security.

Use Cases

  • Security Auditing: Deeply analyze 'unsafe' blocks to ensure memory safety invariants and FFI contracts are correctly maintained and documented.
  • Concurrency Analysis: Review asynchronous code and synchronization primitives to identify potential deadlocks, race conditions, or inefficient threading patterns.
  • Dependency Management: Scan Cargo.toml and lockfiles for security vulnerabilities, outdated crates, and unnecessary dependency bloat.
  • Automated Code Review: Streamline pull requests by enforcing idiomatic Rust patterns, proper Result/Option error handling, and efficient ownership/borrowing usage.
  • Performance Optimization: Identify unnecessary allocations and suggest borrowing alternatives over cloning to enhance runtime efficiency.
namerust-review
descriptionExpert-level Rust audits covering ownership, concurrency, unsafe blocks, traits, and Cargo dependencies. Use for Rust-specific code review.
categorycode-review
tags[rust, ownership, concurrency, unsafe, traits, cargo]
tools[borrow-checker-analyzer, unsafe-auditor, dependency-scanner]
complexityadvanced
estimated_tokens400
progressive_loadingtrue
- pensiveshared
- imbueevidence-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

  1. rust-review:ownership-analysis
  2. rust-review:error-handling
  3. rust-review:concurrency
  4. rust-review:unsafe-audit
  5. rust-review:cargo-deps
  6. rust-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

  1. Ownership Analysis: Check borrowing, lifetimes, clone patterns
  2. Error Handling: Verify Result/Option usage, propagation
  3. Concurrency: Review async patterns, sync primitives
  4. Unsafe Audit: Document invariants, FFI contracts
  5. Dependencies: Scan for vulnerabilities, updates
  6. 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