/dstack-rust:idiomatic-rustfrom DStack Rust
Routes Rust writing, review, and refactoring tasks to handbook chapters on idioms, Clippy lints, errors, testing, generics, and dispatch under edition 2024.
Ships in DStack 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.
Read when SKILL.md points to them.
You give Rust work its idiomatic answer. When code is being written, reviewed, or refactored, or a design choice about borrowing, error handling, dispatch, or testing needs settling, you route to the right handbook chapters, apply their conventions, and prove the result with the toolchain. You write only the Rust source and project files the invoking task already touches (version-control restore is the rollback), and chapter guidance plus verification output goes to chat. The job is done when the code or review follows the conventions below, the routed chapters were actually consulted, and the toolchain verification ran clean or its failure is reported with its cause.
What you need before starting:
Cargo.toml, rust-toolchain.toml, and the edition pin.The grounded pin is Rust 1.99.1 stable (released 2026-10-15) on edition 2024. Rust ships a rolling six-week stable train with no LTS channel, so current stable is the maintained target. When the project pins an older toolchain or edition, work inside that pin and note the delta. Name the effective toolchain and edition. The handbook's per-feature and library claims need their own evidence; the headline pin does not verify them.
Read every chapter the task touches in the same turn:
references/coding-styles-and-idioms.md for borrowing versus cloning, Copy, Option and Result handling, iterators, comments, and when to extract a function.references/clippy-and-linting.md for Clippy configuration, key lints, and workspace lint setup.references/performance.md for profiling, redundant clones, stack versus heap, and zero-cost abstractions.references/errors-and-resilience.md for Result versus panic, thiserror versus anyhow, and error hierarchies.references/testing.md for test naming, one assertion per test, and snapshot testing.references/generics-and-dispatch.md for static versus dynamic dispatch and trait objects.references/type-state-pattern.md for compile-time state safety with the type-state pattern.references/comments-versus-documentation.md for when to comment, doc comments, and rustdoc.references/pointers-and-thread-safety.md for thread safety, Send and Sync, and pointer types.references/retention-contracts.md for admission, ownership, and retained memory bounds for caches and decoded representations.references/json-boundaries.md for JSON representation migration, raw tagged decoding, and lossless value preservation at service boundaries.This step is done when each relevant chapter is loaded.
Apply each convention that fits the task:
&T over .clone() unless ownership must move; take &str over String and &[T] over Vec<T> in parameters; use Cow<'_, T> when ownership is ambiguous.Copy types: passing a small Copy type by value is a heuristic, not a rule. The handbook threshold is about two to three machine words, roughly 24 bytes on a 64-bit target, because the copy avoids a pointer indirection. The real cutoff depends on the target register and calling conventions, so measure when the path is hot. A measurement always beats the heuristic; a heuristic states a default, not a law.Result<T, E> for fallible operations and keep panic! for unrecoverable bugs. Use thiserror for library error types and anyhow for application binaries, and propagate with ?. Keep unwrap() and expect() out of production paths; tests and examples may use them.--release, run cargo clippy -- -D clippy::perf for hints, avoid cloning in loops, and prefer iterators over intermediate .collect() calls.dyn Trait for heterogeneous collections, and box at API boundaries rather than internally.Run cargo fmt --check, cargo clippy --all-targets --all-features --locked -- -D warnings, and cargo test. All three pass, or each failure is reported with its cause. A lint that must be suppressed uses #[expect(clippy::lint)] with a justification comment, never a bare #[allow], because expect warns once the lint stops firing and the suppression cannot go stale. When cargo clippy is missing, install it with rustup component add clippy, since clippy ships as a rustup component in lockstep with rustc rather than as a separately versioned package. When the project pins an older toolchain, work inside that pin and report which conventions need a newer one.
Rust code or review feedback that follows the conventions above, with the toolchain verification results or the blocking failure named.
agents/openai.yaml (opens in a new tab)references/clippy-and-linting.md (opens in a new tab)references/coding-styles-and-idioms.md (opens in a new tab)references/comments-versus-documentation.md (opens in a new tab)references/errors-and-resilience.md (opens in a new tab)references/generics-and-dispatch.md (opens in a new tab)references/json-boundaries.md (opens in a new tab)references/performance.md (opens in a new tab)references/pointers-and-thread-safety.md (opens in a new tab)references/retention-contracts.md (opens in a new tab)references/testing.md (opens in a new tab)references/type-state-pattern.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub gosuda/dstack-skills --plugin dstack-rust10 skills in this plugin
/cargo-workflowsUse when managing Cargo workspaces, feature flags, build scripts, CI caching, dependency auditing, or Cargo.lock with Rust./rust-async-internalsUse when understanding the Rust Future poll model, Pin and Unpin, tokio scheduling, async stack traces, waker leaks, or select!/join! behavior./rust-build-timesUse when profiling slow Rust builds with cargo --timings, configuring sccache, selecting the Cranelift dev backend, splitting a workspace for parallelism, or tuning LTO and the linker.Other plugins' skills for the same job