/rust-best-practices:rust-best-practicesfrom rust-best-practices
Write and review production Rust using the official API Guidelines, Style Guide, and this engineering standard: allocation contracts, ownership, Result vs panic, debug_assert, Clippy, tests, rustdoc, unsafe, and Cargo CI. Use when writing, reviewing, or refactoring Rust; choosing borrow vs clone; designing crate APIs; handling errors; bounding heap use; configuring clippy or rustfmt; or when the user runs /rust-best-practices. Do not use for other languages. Triggers: rust, rustc, cargo, clippy, rustfmt, ownership, clone, borrow, Result, unwrap, expect, panic, thiserror, anyhow, heapless, no_std, allocation, debug_assert, type-state, Send, Sync, unsafe, FFI, rustdoc, MSRV, rust-best-practices, rust style, rust guidelines
Ships in rust-best-practices. 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.
Apply this standard when writing or reviewing Rust. Engineering guide, not a tutorial.
debug_assert!, heapless cores, determinism, and CI. Load the matching reference; do not invent a rule that lives there.MUST / MUST NOT: required unless an approved architecture decision documents an exception. SHOULD / SHOULD NOT: default; a deviation needs a concrete reason in review. MAY: optional and context-dependent.
Correctness, safety, determinism, and maintainability outrank cleverness. Measure performance. Design allocation and bounds into the API before profiling.
Fetch current official docs for library or toolchain syntax. Do not invent APIs from memory.
/rust-best-practices: apply the standard to the current Rust work./rust-best-practices <path>: review that crate or file. For each finding: quote the line, name the rule (official C-* id or a heading in this skill), give the fix.Load only what the task needs, same turn, in parallel:
| Task | Read |
|---|---|
| Naming, rustdoc sections, official checklist | official.md |
| Memory profile, heapless, output buffers, hidden alloc | allocation.md |
Borrow vs clone, Copy, into_/to_/as_ | ownership.md |
Result, panic, thiserror/anyhow, checked math, debug_assert! | errors.md |
| Functions, iterators, dispatch, type-state, boolean blindness | design.md |
Pointers, Send/Sync, unsafe, FFI | unsafe.md |
| Measure, layout, clones, flamegraph | performance.md |
| rustfmt, Clippy, tests, docs, deps, MSRV, CI | quality.md |
| Review pass, anti-patterns | review.md |
Option, Result, type-state where lifecycle matters.as_ / to_ / into_ conversion naming (C-CONV).u32 for every identifier merely because the representation matches.Cow::into_owned(), format!(), or a spill-capable small-vector as heapless.&T, &str, &[T], &Path unless ownership transfer is required.Copy values by value. Measure ABI and target when size is in question; do not apply a universal byte cutoff.Result<T, E> for recoverable failure. MUST NOT unwrap() / expect() on production paths.debug_assert! as caller validation or as the only unsafe precondition.thiserror in libraries, anyhow only at binary boundaries.#![forbid(unsafe_code)] in crates that do not need unsafe.SAFETY:.Send/Sync impls without a written proof.Arc<Mutex<T>> as an ownership escape hatch.cargo fmt --all -- --check and cargo clippy --workspace --all-targets --all-features --locked -- -D warnings in CI (explicit feature matrix if --all-features is invalid).#[expect(...)] over #[allow(...)], local and justified.// TODO(#123): ....Cite the live page. Do not restate official rules as if they originated here. Minimum set: Style Guide, API Guidelines checklist, debug_assert!, no_std, alloc, Clippy configuration, Cargo profiles. Full list: official.md.
evals/evals.json (opens in a new tab)references/allocation.md (opens in a new tab)references/design.md (opens in a new tab)references/errors.md (opens in a new tab)references/official.md (opens in a new tab)references/ownership.md (opens in a new tab)references/performance.md (opens in a new tab)references/quality.md (opens in a new tab)references/review.md (opens in a new tab)references/unsafe.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub massimodeluisa/rust-best-practices-skill --plugin rust-best-practices