This skill should be used when working with Rust code, reviewing Rust code, managing Rust dependencies, creating Rust projects, or fixing Rust compilation errors. It provides strict coding standards (especially FAIL FAST error handling), workspace architecture guidance, dependency management automation, and common Rust patterns.
View on GitHubSelect agents to install to:
npx add-skill https://github.com/onsails/cc/blob/main/rust-dev/skills/rust-dev/SKILL.md -a claude-code --skill rust-devInstallation paths:
.claude/skills/rust-dev/# Rust Development
## Overview
This skill enables writing correct, idiomatic Rust code following strict standards and best practices. It enforces FAIL FAST error handling, manages dependencies properly, provides workspace templates, and offers solutions to common Rust patterns and pitfalls.
## When to Use This Skill
Activate this skill for:
- Adding or updating Rust dependencies
- Creating new Rust projects or workspaces
- Writing or modifying Rust code
- Fixing compilation errors, borrow checker issues, or lifetime problems
- Implementing error handling
- Setting up async/await patterns
- Configuring CLI applications
- Organizing tests and configuration
- Splitting large modules or reorganizing file structure
## Core Standards
**Critical principles to follow in ALL Rust code:**
1. **Edition 2024**: Always use `edition = "2024"` in Cargo.toml
2. **FAIL FAST Error Handling**: NEVER swallow errors - always propagate with `?` or explicit return
3. **Dependency Versioning**: Use `x.x` format (e.g., `serde = "1.0"`)
4. **Workspace Architecture**: Use workspace with single-responsibility crates
5. **Error Types**: thiserror (with backtrace) for libraries, anyhow for binaries/tests
6. **CLI-First Configuration**: Never bypass CLI argument parsing
7. **No env::set_var in Tests**: Pass config through function parameters
8. **Async Runtime**: Use tokio consistently
See `references/standards.md` for complete details on all standards.
## Dependency Management
### Adding Dependencies
When adding a dependency:
1. **Find the latest version** using the bundled script:
```bash
python3 scripts/check_crate_version.py <crate-name>
```
2. **Use the x.x version format** from the script output:
```toml
serde = "1.0"
```
3. **For workspace projects**, add to `[workspace.dependencies]` in root Cargo.toml:
```toml
[workspace.dependencies]
serde = { version = "1.0", features = ["derive"] }
```
4. **In member crates**, reference workspace dependenc