/rust:rust-qualityfrom rust
Use for any Rust work: writing, planning, reviewing, or editing `.rs` files, Cargo.toml, or clippy fixes. Self-correct against LLM-specific failure modes the model tends to repeat: clone escapes to satisfy the borrow checker, speculative fallbacks for failure modes that don't exist, god modules, verbose match chains, and weak error modeling. Provides concrete reference patterns (transpose, Arc::clone, newtypes, parse-don't-validate, sealed traits) and routes type modeling to rust-design. For formal reviews, use rust-review; it applies these rules as a gate checklist.
Ships in rust. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Reference patterns by name; do not re-explain them. For reviews, use rust-review; it loads these rules and applies the review gate checklist.
transpose() for Option<Result<T,E>> → Result<Option<T>,E>Arc::clone(&var) over var.clone() on ref-counted typesif let over single-arm match (clippy::single_match).to_owned() over .to_string() on &str (clippy::str_to_string).map_err(Variant) over .map_err(|e| Variant(e)) when #[from] exists_ => (clippy::wildcard_enum_match_arm)#[allow(clippy::type_complexity)]thiserror for libraries, anyhow for applications (dtolnay split)Sprawl: adding a helper, trait, module, or abstraction for a single use site. Three similar lines beats a premature abstraction.
God modules: if a module exceeds ~500 lines, it's doing too many things. Split by domain concept, not by "utils."
Speculative fallbacks: don't write a fallback code path for a failure mode that hasn't manifested. Log warn, test first, add the fallback when a real model/runtime actually fails.
Clone to satisfy the borrow checker: restructure ownership instead. Move the clone into a let binding, use Arc, or redesign the data flow. clone() as a borrow checker escape hatch is the #1 LLM code smell.
Verbose match chains: if you're matching on the same value 3+ times in sequence, the data model is wrong. Refactor the enum or use combinators.
Redundant closures: .map_err(|e| Error::Variant(e)) when Error::Variant is a function pointer via #[from]. The closure is noise.
Transitive dependency assumptions: if you use a crate, it must be in [dependencies]. Compiling via a transitive dep is fragile.
Guards and temps before iterator chains: don't add a guard conditional or assign a temp variable just to start an iterator chain. Chain directly on the expression.
Hand-written derivable impls: don't hand-write a trait impl that a standard derive already covers (Default, Clone, PartialEq). #[derive] it.
Comments earn their place by explaining "why" when it is not apparent at face value; very light "what" is tolerable at struct or function level. Never "how" — the code is the single source of truth for what and how.
Load rust-design for type modeling — newtypes and constrained
constructors, illegal-states-unrepresentable enums, railway-oriented
error composition, and types-before-logic. The rules live there; do not
model a new type surface from this skill alone.
Run cargo build --workspace immediately. Fix ALL non-exhaustive match errors before any other change. Don't fix them one at a time across build cycles.
Start with [workspace.lints.clippy] enabling category groups at warn. See kristof-mattei/rust-seed for the most complete public config (127 restriction lints). Adopt progressively — don't dump all 127 at once.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub shearerbeard/agent-skills --plugin rust6 skills in this plugin
/rust-asyncUse when writing, reviewing, or designing async and explicitly
multithreaded Rust code — "async function", "tokio", "spawn a
task", "Send+Sync", "Send + Sync", "multithreaded", "blocking
the executor", "tokio::spawn", "spawn_blocking", "async/await",
"async Rust". Contains cooperative scheduling rules, Send +
'static bounds, spawn_blocking vs rayon vs dedicated threads,
std::sync::Mutex vs tokio::sync::Mutex, async Drop patterns,
and channel/stream guidance. Pair with rust-design for type
modeling and rust-quality for anti-pattern prevention.
/rust-designUse when writing, designing, or reviewing Rust types and domain
models — "design a Rust type", "model this in Rust", "Rust ADT",
"state machine", "make illegal states unrepresentable",
"constrained type", "typestate", "newtype design", "sketch type
signatures", "write a Rust struct", "review these Rust types".
Also use when authoring `.rs` files that introduce a new struct
or enum, or when deciding a public API shape.
Contains ADT-first workflow, constrained type patterns, railway-
oriented programming, match semantics, 6-step clone avoidance,
and ownership restructuring. Pair with rust-quality for anti-pattern
prevention and rust-review for gate-level review.
/rust-modulesUse for any Rust module work: planning, creating, splitting, moving, discussing,
or reviewing modules and files: mod declarations, pub use facades, crate
structure, mod.rs cleanup, type co-location, and naming. Pair with rust-quality
for code patterns inside modules.