Agent skill · software engineering · pedronauck

rust-best-practices

Write, review, refactor, or optimize Rust, including ownership, errors, Tokio, traits, tests, benchmarks, Clippy, and documentation. Excludes other languages and architecture unrelated to Rust idioms.

Why this skill is useful

Provides domain-specific guidelines for Rust programming, including async patterns and error handling that the AI wouldn't reliably generate on its own.

What it needs

About 2k tokens when loaded. Last updated 2026-08-01. 564 stars on the source repository.

What this skill does

Rust Best Practices Use the existing crate design, edition, rust-toolchain.toml, and Cargo.toml rust-version (MSRV). Reference examples may use newer features: confirm support before adopting them; do not upgrade the toolchain or add a crate just to follow an example. Read the reference for the Rust concern being changed. A local edit does not require every category, a new test framework, or a workspace-wide audit. Topic Reference Load When ------- ----------- ----------- Coding Style references/coding-style.md Naming, imports, iterators, comments, string handling, macros Error Handling references/error-handling.md Result, Option, ?, thiserror, anyhow, custom errors, async errors Ownership & Pointers references/ownership-and-pointers.md Lifetimes, borrowing, smart pointers, Pin, Cow, interior mutability Traits & Generics references/traits-and-generics.md Trait design, dispatch, GATs, sealed traits, type state pattern Async & Concurrency references/async-and-concurrency.md Tokio, channels, streams, shutdown, runtime config, async traits Sync Concurrency references/concurrency-sync.md Atomics, Mutex, RwLock, lock ordering, Send/Sync, memory ordering Testing references/testing.md Unit/integration/doc tests, snapshot, proptest, mockall, benchmarks, fuzz Performance references/performance.md Profiling, flamegraph, cloning, stack vs heap, iterators, allocation Clippy & Linting references/clippy-and-linting.md Clippy config, key lints, workspace setup, #[expect] vs #[allow] Documentation references/documentation.md Doc comments, rustdoc, doc lints, coverage checklist Engineering floor Borrow or transfer ownership deliberately; clone when independent ownership is needed. Prefer clear ownership over numeric size rules or avoiding every allocation. Handle fallible operations with Result and preserve useful error context. Reserve panic/assertions for violated programmer invariants; validate external input with recoverable errors. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills pedronauck/rust-best-practices

View the source on GitHub

Browse the @skills marketplace