rust-best-practiceslisted
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