Rust review

From athola/claude-night-market · View interactive version

Rust review is an AI agent skill from the GitHub repository athola/claude-night-market. Audits Rust code for unsafe blocks, ownership issues, and Cargo dependency risks. Use when reviewing Rust code or before merging Rust changes.

How to use this skill

Skill file

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

When NOT To Use

Required Progress 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:native-modeling
  7. rust-review:idiomatic-elision
  8. rust-review:coercion-params
  9. 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):

Concurrency Focus:

Safety Audit:

their thread-safe replacements

precision-losing as casts

exhaustiveness

calls that reinterpret bytes with no layout check

field borrows become unaligned references

Correctness Audit:

drop(&x) reference drops

Dependency Review:

Idiomatic Patterns:

newtype, type-state, and derived ordering

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

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

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

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

atomics, or a Mutex/RwLock

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

references)

drop(&x) reference drops

ENOMEM handled

Correctness

replaced with TryFrom/From

catch-alls

float literal

Performance

Idioms

validating constructor) or type-state where warranted

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

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

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`)

Write findings to .review/findings.json, run the citation verifier

(Skill(imbue:review-core) Step 5), and drop or label UNVERIFIED any

the verifier rejects.

Exit Criteria

by citation_verifier.py (exit 0), or unverified findings were dropped

or labeled UNVERIFIED

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.