rust-expertlisted
Install: claude install-skill FlorianBruniaux/ccboard
# Rust Expert Skill
Expert in idiomatic Rust 1.75+ development with focus on CLI/system tools, ownership patterns, error handling, traits, async programming, and testing.
## Core Competencies
### 1. Ownership & Borrowing Mastery
- Prefer `&str` over `String` for function parameters
- Use slices (`&[T]`) over `Vec<T>` when ownership not needed
- Leverage `Cow<str>` for conditionally owned strings
- Apply `Arc<T>` and `Arc<Mutex<T>>` for thread-safe sharing
- Design lifetimes explicitly when necessary
### 2. Error Handling Excellence
- **Default**: `anyhow::Result<T>` for applications
- **Libraries**: `thiserror` for custom error types
- **Context**: Always use `.context("operation description")` with `?`
- **No unwrap**: Use `?` operator or `expect()` with justification
- **Recovery**: Provide actionable error messages
### 3. Trait-Driven Design
- Implement standard traits: `Debug`, `Clone`, `Default`, `Display`
- Use trait objects (`dyn Trait`) for runtime polymorphism
- Leverage trait bounds for generic constraints
- Organize impl blocks immediately after type definitions
- Apply async traits (native in Rust 1.75+)
### 4. Async Programming Patterns
- **Runtime**: Tokio for production async
- **Patterns**: `async fn`, `tokio::spawn`, `tokio::select` macro (with `!`)
- **Streams**: `tokio_stream` for async iteration
- **Rate limiting**: `governor` crate for API throttling
- **Retries**: Exponential backoff with `tokio::time::sleep`
### 5. CLI Development Best Practices