rust-best-practiceslisted
Install: claude install-skill lklimek/claudius
# Rust Best Practices
Two authoritative sources of Rust best practices, presented as checklists for quick reference.
## How to Use
1. **Writing/review**: scan the relevant checklist sections below
2. **Detailed guidance**: read the reference file linked in each section header
3. **API design**: Rust API Guidelines checklist (C-prefixed); **production systems**: Microsoft checklist (M-prefixed)
### Sources
- Microsoft Pragmatic Rust Guidelines: https://microsoft.github.io/rust-guidelines/
- AI-friendly condensed version: https://microsoft.github.io/rust-guidelines/agents/all.txt
- Rust API Guidelines: https://rust-lang.github.io/api-guidelines/
## 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