rust-developmentlisted
Install: claude install-skill aiskillstore/marketplace
# Rust Development Skill for Guts
You are developing a Rust project using commonware primitives for decentralized infrastructure.
## Code Style Guidelines
### General Principles
1. **Idiomatic Rust**: Follow Rust idioms and conventions
2. **Memory Safety**: Leverage the borrow checker, avoid unsafe unless absolutely necessary
3. **Error Handling**: Use `thiserror` for library errors, `anyhow` for applications
4. **Documentation**: Every public item needs docs with examples
### Formatting & Linting
```bash
# Always run before committing
cargo fmt --all
cargo clippy --all-targets --all-features -- -D warnings
```
### Error Handling Pattern
```rust
use thiserror::Error;
#[derive(Debug, Error)]
pub enum RepositoryError {
#[error("repository not found: {0}")]
NotFound(String),
#[error("permission denied for repository: {0}")]
PermissionDenied(String),
#[error("storage error: {0}")]
Storage(#[from] StorageError),
}
pub type Result<T> = std::result::Result<T, RepositoryError>;
```
### Async Patterns
Use Tokio for async runtime with structured concurrency:
```rust
use tokio::sync::{mpsc, oneshot};
// Prefer channels over shared state
pub struct Service {
tx: mpsc::Sender<Command>,
}
impl Service {
pub async fn query(&self, request: Request) -> Result<Response> {
let (tx, rx) = oneshot::channel();
self.tx.send(Command::Query { request, reply: tx }).await?;
rx.await?
}
}
```
### Module Structure
```rust
// l