Cc rust-dev
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.
install
source · Clone the upstream repo
git clone https://github.com/onsails/cc
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/onsails/cc "$T" && mkdir -p ~/.claude/skills && cp -r "$T/rust-dev/skills/rust-dev" ~/.claude/skills/onsails-cc-rust-dev && rm -rf "$T"
manifest:
rust-dev/skills/rust-dev/SKILL.mdsource content
Rust Development
Core Rules
- Edition 2024: Always
in Cargo.tomledition = "2024" - FAIL FAST: Every error MUST propagate with
or?
. Logging is NOT handling. See error-handling.mdreturn Err - Dependency versions: Use
format (e.g.,x.x
). Find latest withserde = "1.0"python3 scripts/check_crate_version.py <crate> - Workspace architecture: Root Cargo.toml defines workspace only. Separate crates for lib/cli/client
- Error types:
(with backtrace) for libraries,thiserror
for binaries/testsanyhow - CLI-first config: Never bypass CLI args. Use
, neverfrom_cli_args()
that reads envDefault - No
in tests: Pass config through function parametersenv::set_var - Async: Use tokio consistently
- Visibility: Private (default) >
>pub(crate)pub - No magic numbers: Use
or CLI argsconst
Adding Dependencies
- Run
to find latest versionpython3 scripts/check_crate_version.py <crate-name> - Add to
in root Cargo.toml with[workspace.dependencies]
formatx.x - Reference in member crates:
serde = { workspace = true }
Common deps:
thiserror = "2.0", anyhow = "1.0", tokio = { version = "1", features = ["full"] }, serde = { version = "1.0", features = ["derive"] }, clap = { version = "4.5", features = ["derive"] }
Creating New Projects
Use the template in
assets/workspace-template/:
project/ ├── Cargo.toml # Workspace root, no code ├── project/ # Library crate (thiserror) │ ├── Cargo.toml │ └── src/lib.rs └── project-cli/ # Binary crate (anyhow + clap) ├── Cargo.toml └── src/main.rs
Module Organization
Split modules when file exceeds ~500 lines or tests take 50%+ of file. See module-organization.md for patterns.
Error Handling
The most critical standard. See error-handling.md for full rules and examples.
Quick check: If you see
if let Err or match ... Err without return Err or ?, it's a bug.
References
- error-handling.md — FAIL FAST rules, thiserror/anyhow patterns, error chain preservation
- module-organization.md — When/how to split modules, test extraction
- dependency-guide.md — Workspace deps, feature flags, common crates
Scripts
— Query crates.io for latest dependency versionsscripts/check_crate_version.py