← ClaudeAtlas

rust-best-practiceslisted

This skill should be used when implementing, fixing, writing, reviewing, or discussing Rust code quality, API design, safety, or idioms. It applies the Microsoft Pragmatic Rust Guidelines and Rust API Guidelines checklists.
lklimek/claudius · ★ 1 · Code & Development · score 74
Install: claude install-skill lklimek/claudius
# Rust Best Practices Checklists from the [Microsoft Pragmatic Rust Guidelines](https://microsoft.github.io/rust-guidelines/) (M-prefixed, production systems; [AI-condensed](https://microsoft.github.io/rust-guidelines/agents/all.txt)) and the [Rust API Guidelines](https://rust-lang.github.io/api-guidelines/) (C-prefixed, API design). Scan the relevant sections while writing or reviewing; item details are in the linked `references/` files. ## Technical Standards & Patterns - **Rust Edition**: latest stable (2021 or newer) - **Code Style**: rustfmt defaults; **Linting**: clippy with `deny(warnings)` in CI - **Documentation**: one-line `///` comment for every public item; expand only when non-obvious - **Error Handling**: `thiserror` typed error enums (see below) - **Dependencies**: minimal, prefer std - **Async**: tokio; **Serialization**: serde derive; **CLI**: clap; **Logging**: `tracing` crate (see coding-best-practices § Logging Levels) - **Testing**: cargo test with doc tests; proptest for property-based testing - **Benchmarking**: criterion ## Error Handling **Preferred crate: `thiserror`** with typed error enums. Always define explicit error enums — never erase error types into opaque wrappers. ### Design Principles - **`Display` = user-friendly, `Debug` = technical**: `Display` (auto-generated by `#[error(...)]`) is the message shown to users or logged at info level; `Debug` preserves the full error chain for diagnostics. - **Granular variants over generic string