mcpbeat Sign in

Rust Review Skill for Claude

Audits Rust code for unsafe blocks, ownership issues, and Cargo dependency risks. Use when reviewing Rust code or before merging Rust changes.

32k tokens
context cost
the whole folder, loaded on every use
28
files
instructions only
0
copies elsewhere
how many repositories repackaged it
324
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/athola/claude-night-market --skill rust-review

The instruction itself

16 sections, as written by the author

Table of Contents

  • Quick Start
  • When to Use
  • Required TodoWrite Items
  • Progressive Loading
  • Core Workflow
  • Rust Quality Checklist
  • Safety
  • Correctness
  • Performance
  • Idioms
  • Output Format
  • Summary
  • Ownership Analysis
  • Error Handling
  • Concurrency
  • Unsafe Audit
  • [U1] file:line
  • Dependencies
  • Recommendation
  • Exit Criteria

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:native-modeling
  • rust-review:idiomatic-elision
  • rust-review:coercion-params
  • rust-review:conversion-traits

10. rust-review:numeric-cast-safety

11. rust-review:mutable-static-audit

12. rust-review:match-wildcard

13. rust-review:transmute-audit

14. rust-review:float-equality

15. rust-review:mem-forget-audit

16. rust-review:repr-packed-audit

17. rust-review:evidence-log

18. rust-review:findings-verified

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
  • See modules/mutable-static-audit.md for static mut globals and

their thread-safe replacements

  • See modules/numeric-cast-safety.md for truncating and

precision-losing as casts

  • See modules/match-wildcard.md for catch-all arms that defeat enum

exhaustiveness

  • See modules/transmute-audit.md for mem::transmute/transmute_copy

calls that reinterpret bytes with no layout check

  • See modules/repr-packed-audit.md for #[repr(packed)] layouts whose

field borrows become unaligned references

Correctness Audit:

  • See modules/float-equality.md for ==/!= against float literals
  • See modules/mem-forget-audit.md for mem::forget leaks and no-op

drop(&x) reference drops

Dependency Review:

  • See modules/cargo-dependencies.md for vulnerability scanning

Idiomatic Patterns:

  • See modules/builtin-preference.md for conversion traits and builtin preference
  • See modules/native-type-modeling.md for enums-over-primitives,

newtype, type-state, and derived ordering

  • See modules/idiomatic-elision.md for lifetime elision,

expression-oriented returns, and explicit -> () unit returns

  • See modules/coercion-params.md for &String/&Vec<T>/&PathBuf

parameters that defeat deref coercion (prefer &str/&[T]/&Path)

  • See modules/conversion-traits.md for impl Into that should be

impl From, and discarded try_into().unwrap() conversion errors

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
  • [ ] No static mut globals; shared state uses OnceLock/LazyLock,

atomics, or a Mutex/RwLock

  • [ ] No mem::transmute/transmute_copy; bytes converted with

from_le_bytes/from_bits/bytemuck or pointers with .cast()

  • [ ] #[repr(packed)] fields copied out before borrowing (no unaligned

references)

  • [ ] No mem::forget leaks (use ManuallyDrop/scope) and no no-op

drop(&x) reference drops

  • [ ] mlock/munlock calls: RLIMIT verified, page-aligned,

ENOMEM handled

Correctness

  • [ ] Error handling complete
  • [ ] Concurrency patterns sound
  • [ ] Lossy as casts (length truncation, as u8/i8, as f32)

replaced with TryFrom/From

  • [ ] Enum matches exhaustive; no _ => unreachable!()/panic!/{}

catch-alls

  • [ ] Floats compared with a tolerance, not exact ==/!= against a

float literal

  • [ ] Tests cover critical paths

Performance

  • [ ] No unnecessary allocations
  • [ ] Borrowing preferred over cloning
  • [ ] Async properly non-blocking

Idioms

  • [ ] Standard traits implemented
  • [ ] Conversion traits preferred over helper functions
  • [ ] Stringly-typed values and boolean flags modeled as enums
  • [ ] Domain invariants encoded with newtypes (private field +

validating constructor) or type-state where warranted

  • [ ] Comparison/ordering traits derived, not hand-written
  • [ ] Lifetimes elided where elision rules apply; '_ in paths
  • [ ] Trailing return dropped in favor of the tail expression
  • [ ] Explicit -> () unit returns dropped (default is elided)
  • [ ] Parameters take &str/&[T]/&Path, not &String/&Vec<T>/

&PathBuf (deref coercion accepts both, so the slice is more general)

  • [ ] Conversions implement From/TryFrom, not Into/TryInto; a

fallible conversion's error is propagated, not unwrap()ped

  • [ ] 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]
- Anchor: `verbatim source text at file:line`
- Risk: [assessment]
- Recommendation: [action]

## Native Type Modeling
[stringly-typed comparisons, boolean blindness, newtype/type-state notes]

## Idiomatic Elision
[needless lifetimes, trailing returns, explicit `-> ()` unit returns]

## Coercion Params
[`&String`/`&Vec<T>`/`&PathBuf` params that should be borrowed slices]

## Conversion Traits
[`impl Into` over `impl From`; discarded `try_into().unwrap()` errors]

## Numeric Cast Safety
[length-truncating, byte-narrowing, and f32 precision-losing `as` casts]

## Mutable Static Audit
[`static mut` globals and their thread-safe replacements]

## Match Wildcard
[catch-all `_ =>` arms that defeat enum exhaustiveness]

## Transmute Audit
[`mem::transmute`/`transmute_copy` calls and their typed replacements]

## Float Equality
[exact `==`/`!=` comparisons against float literals]

## Mem Forget Audit
[`mem::forget` leaks and no-op `drop(&x)` reference drops]

## Repr Packed Audit
[`#[repr(packed)]` layouts whose field borrows become unaligned]

## Dependencies
[cargo audit results]

## Recommendation
Approve / Approve with actions / Block

Verification: Run the command with --help flag to verify availability.

Verify Findings Are Grounded (rust-review:findings-verified)

Every finding must cite a real location and a verbatim anchor. Write

findings to .review/findings.json and confirm each citation resolves:

python plugins/imbue/scripts/citation_verifier.py \
  --findings .review/findings.json --repo-root .

Drop or label UNVERIFIED any finding the verifier fails (exit 1); only

verified findings enter the report. See Skill(imbue:review-core) Step 5

and Skill(imbue:structured-output) for the schema.

Exit Criteria

  • All unsafe blocks audited
  • Concurrency patterns verified
  • Dependencies scanned
  • Evidence logged
  • Action items assigned
  • Every reported finding carries a Location + verbatim Anchor confirmed by citation_verifier.py (exit 0), or unverified findings were dropped or labeled UNVERIFIED

Other skills for the same job

different authors, same section of the catalogue
MCP Builder
by anthropics
vendor ×13

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

30k tokens scripts
Changelog Generator
by frostant
×9

Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.

774 tokens
Finishing A Development Branch
by ZhanlinCui
×7

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup

1k tokens
MCP Builder
by JayZeeDesign
×7

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

37k tokens scripts
Vercel React Native Skills
by vercel-labs
vendor ×6

React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.

39k tokens
Vercel React Best Practices
by ratacat
×5

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

34k tokens
Next Best Practices
by vercel-labs
vendor ×4

Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling

20k tokens
Using Git Worktrees
by ZhanlinCui
×4

Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification

1k tokens

How to use it

Copy the folder

Take athola/rust-review from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.