
Rust Skills
Install when your agent writes or reviews Rust so ownership, errors, async, and API design follow 179 prioritized rules instead of generic LLM habits.
Install
npx skills add https://github.com/leonardomso/rust-skills --skill rust-skillsWhat is this skill?
- 179 prioritized rules across 14 categories with own-, err-, mem-, api-, and async- prefixes
- Critical coverage for ownership and borrowing, error handling, and memory optimization
- High-priority async/await, API design, and compiler optimization guidance
- Sourced from Rust API Guidelines, Performance Book, and patterns from ripgrep, tokio, serde, polars
- Invoke with /rust-skills when implementing, refactoring, or reviewing Rust modules and hot paths
Adoption & trust: 1.3k installs on skills.sh; 241 GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
Recommended Skills
Journey fit
Rust application and library code is authored in Build; this skill is the canonical shelf for backend/systems Rust work. Backend is where ownership, async services, and public crate APIs live—the rule categories map directly to systems and service crates.
Common Questions / FAQ
Is Rust Skills safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Rust Skills
# Rust Best Practices Comprehensive guide for writing high-quality, idiomatic, and highly optimized Rust code. Contains 179 rules across 14 categories, prioritized by impact to guide LLMs in code generation and refactoring. ## When to Apply Reference these guidelines when: - Writing new Rust functions, structs, or modules - Implementing error handling or async code - Designing public APIs for libraries - Reviewing code for ownership/borrowing issues - Optimizing memory usage or reducing allocations - Tuning performance for hot paths - Refactoring existing Rust code ## Rule Categories by Priority | Priority | Category | Impact | Prefix | Rules | |----------|----------|--------|--------|-------| | 1 | Ownership & Borrowing | CRITICAL | `own-` | 12 | | 2 | Error Handling | CRITICAL | `err-` | 12 | | 3 | Memory Optimization | CRITICAL | `mem-` | 15 | | 4 | API Design | HIGH | `api-` | 15 | | 5 | Async/Await | HIGH | `async-` | 15 | | 6 | Compiler Optimization | HIGH | `opt-` | 12 | | 7 | Naming Conventions | MEDIUM | `name-` | 16 | | 8 | Type Safety | MEDIUM | `type-` | 10 | | 9 | Testing | MEDIUM | `test-` | 13 | | 10 | Documentation | MEDIUM | `doc-` | 11 | | 11 | Performance Patterns | MEDIUM | `perf-` | 11 | | 12 | Project Structure | LOW | `proj-` | 11 | | 13 | Clippy & Linting | LOW | `lint-` | 11 | | 14 | Anti-patterns | REFERENCE | `anti-` | 15 | --- ## Quick Reference ### 1. Ownership & Borrowing (CRITICAL) - [`own-borrow-over-clone`](rules/own-borrow-over-clone.md) - Prefer `&T` borrowing over `.clone()` - [`own-slice-over-vec`](rules/own-slice-over-vec.md) - Accept `&[T]` not `&Vec<T>`, `&str` not `&String` - [`own-cow-conditional`](rules/own-cow-conditional.md) - Use `Cow<'a, T>` for conditional ownership - [`own-arc-shared`](rules/own-arc-shared.md) - Use `Arc<T>` for thread-safe shared ownership - [`own-rc-single-thread`](rules/own-rc-single-thread.md) - Use `Rc<T>` for single-threaded sharing - [`own-refcell-interior`](rules/own-refcell-interior.md) - Use `RefCell<T>` for interior mutability (single-thread) - [`own-mutex-interior`](rules/own-mutex-interior.md) - Use `Mutex<T>` for interior mutability (multi-thread) - [`own-rwlock-readers`](rules/own-rwlock-readers.md) - Use `RwLock<T>` when reads dominate writes - [`own-copy-small`](rules/own-copy-small.md) - Derive `Copy` for small, trivial types - [`own-clone-explicit`](rules/own-clone-explicit.md) - Make `Clone` explicit, avoid implicit copies - [`own-move-large`](rules/own-move-large.md) - Move large data instead of cloning - [`own-lifetime-elision`](rules/own-lifetime-elision.md) - Rely on lifetime elision when possible ### 2. Error Handling (CRITICAL) - [`err-thiserror-lib`](rules/err-thiserror-lib.md) - Use `thiserror` for library error types - [`err-anyhow-app`](rules/err-anyhow-app.md) - Use `anyhow` for application error handling - [`err-result-over-panic`](rules/err-result-over-panic.md) - Return `Result`, don't panic on expected errors - [`err-context-chain`](rules/err-context-chain.md) - Add context with `.context()` or `.with_context()` - [`err-no-unwrap-prod`](rules/err-no-unwrap-prod.md) - Never use `.unwrap()` in production code - [`err-expect-bugs-only`](rules/err-expect-bugs-only.md) - Use `.expect()` only for programming errors - [`err-question-mark`](rules/err-question-mark.md) - Use `?` operator for clean propagation - [`err-from-impl`](rules/err-from-impl.md) - Use `#[from]` for automatic error conversion - [`err-source-chain`](rul