| name | ds-rust-review |
| description | Review Rust code for safety metrics, error handling, and idiomatic Rust. |
| disable-model-invocation | true |
Applies to: Rust stable, edition 2024. Systems programming, CLI tools, services.
Arguments
Scan the invocation for the --no-tiger, --fix, and --full flags. Treat every other argument as review scope (files or directories); if no scope is given, review the changed files on the current branch.
--no-tiger present → skip the Tiger Style section; run the remaining sections only.
--no-tiger absent → run all sections (default).
--fix → after reporting, apply only the violations whose fix is mechanical and unambiguous (a rename to the idiom, a missing error check the review is certain about). Anything that changes logic or rests on an unverified assumption — especially security and correctness findings — stays report-only. After applying, re-run any build/test/lint check already in the loop and revert any fix that breaks it — or that touched more than the intended mechanical edit. End with a summary of what was applied and what was left.
--full → review the entire codebase instead of just the branch's changes. Explicit positional scope still wins; --full only replaces the no-scope default.
The whole-crate metric commands below are baseline context. Anchor findings to the code in scope — don't report pre-existing unwrap/panic counts outside the change as if the change introduced them.
Automated Checks (run first if tools are available)
cargo geiger 2>/dev/null
cargo geiger --output-format json
cargo clippy -- -D warnings
cargo audit
cargo +nightly udeps --all-targets 2>/dev/null
cargo clean && cargo build 2>&1 | grep -E "^warning"
grep -rn "unsafe " src/
grep -rn "\.unwrap()" src/
grep -rn "\.expect(" src/
grep -rn "panic!(" src/
grep -rn "todo!()" src/
grep -rn "unimplemented!()" src/
Run these commands, report counts, then do manual review below.
Safety Metrics
Report these numbers at the top of the review:
unsafe blocks: <N> (cargo geiger or manual grep)
unwrap() calls: <N>
expect() calls: <N>
panic!() calls: <N>
todo!()/unimpl!(): <N>
clippy warnings: <N>
audit findings: <N>
Each non-zero number introduced or touched by the change requires justification. Pre-existing counts outside the scope are context, not findings.
Review Checklist
Use the checklist as a lens, not a scorecard: reason about the actual change, report real violations anchored to file:line, and flag issues even when they aren't listed. Don't manufacture findings to fill a category.
Tiger Style
Skip this section entirely if --no-tiger was passed. Otherwise it is mandatory.
Unsafe Code
Panic and Unwrap
Error Handling
Ownership and Borrowing
Async (if applicable)
Idiomatic Rust
Performance
Idiom-level checks only — for a ranked, costed optimization plan, use /ds-perf-plan.
Security
Testing
Dependencies (Cargo.toml)
Output Format
Header (always emit):
unsafe: <N> | unwrap: <N> | expect: <N> | panic: <N> | clippy: <N>
Findings:
<file>:<line>: <severity>: <problem>. <fix>.
Severity: critical (soundness/CVE), major (reliability/correctness), minor (idiom/style).
Skip findings with no actionable fix. Do not report clippy items already caught by cargo clippy -- -D warnings.