rust-code-review
Reviews Rust code for ownership, borrowing, lifetime, error handling, trait design, unsafe usage, and common mistakes. Use when reviewing .rs files, checking borrow checker issues, error handling patterns, or trait implementations. Covers Rust 2024 edition patterns and modern idioms.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/anderskev/rust-code-reviewWhat This Skill Does
The rust-code-review skill provides an expert-level, automated auditing capability for Rust programming projects. It acts as a specialized assistant that scans your .rs files and Cargo.toml configurations to enforce modern idiomatic Rust standards (2021/2024 editions). Unlike generic linters, this skill deeply analyzes ownership mechanics, borrow checker patterns, complex lifetime annotations, and error propagation strategies to ensure code safety, maintainability, and performance.
Installation
To integrate this skill into your OpenClaw environment, execute the following command in your terminal or command interface:
clawhub install openclaw/skills/skills/anderskev/rust-code-review
Use Cases
- Refactoring Legacy Code: Identify unnecessary
.clone()calls and replace them with efficient borrowing or references. - Architecting APIs: Verify that trait bounds are appropriately applied and that function parameters use flexible types like
impl AsRef<T>. - Production Error Handling: Ensure your library uses
thiserrorwith descriptive context and your applications leverageanyhowfor ergonomics, avoiding the common pitfalls of excessiveunwrap()usage. - Safety Audits: Detect potential concurrency issues in async code, specifically related to
SendandSynctrait bounds or improper usage ofMutexandRefCell. - Performance Optimization: Analyze data structures to ensure small types derive
Copyand that allocation-heavy code paths are optimized using alternatives likeCow<'_, T>.
Example Prompts
- "Review this function for lifetime issues and suggest a more idiomatic way to handle the return value without cloning the input slice."
- "I'm getting a borrow checker error with this struct; please analyze the ownership flow and explain why the compiler is rejecting the current implementation."
- "Check my error handling strategy in this module. Are there places where I should use
let-elseinstead ofmatchto improve readability?"
Tips & Limitations
This skill performs static analysis based on established Rust best practices. While highly accurate, it should complement—not replace—the official rustc compiler and cargo clippy. Always prioritize compiler warnings/errors over suggestions. The skill works best when provided with the relevant Cargo.toml file to determine the correct edition, as older Rust patterns differ significantly from modern idiomatic solutions.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-anderskev-rust-code-review": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: file-read
Related Skills
tutorial-docs
Tutorial patterns for documentation - learning-oriented guides that teach through guided doing
fetch-pr-feedback
Fetch review comments from a PR and evaluate with receive-feedback skill
swift-testing-code-review
Reviews Swift Testing code for proper use of
rust-testing-code-review
Reviews Rust test code for unit test patterns, integration test structure, async testing, mocking approaches, and property-based testing. Covers Rust 2024 edition changes including async fn in traits for mocks,
explanation-docs
Explanation documentation patterns for understanding-oriented content - conceptual guides that explain why things work the way they do