/rust-skills:rust-documentationfrom rust-skills
Designs, writes, builds, tests, and publishes Rust documentation using rustdoc, cargo doc, doctests, intra-doc links, mdBook, and docs.rs. Applies Rust API Guidelines documentation rules (C-DOC, C-LINK, C-META, C-EXAMPLE).
Ships in rust-skills. 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.
Treat documentation as an executable interface. Keep API reference close to code, conceptual and operational guides in an appropriate book or repository document, and examples compiled against the supported API.
Use this skill for rustdoc comments, crate and module documentation, doctests, intra-doc links, README generation, mdBook, docs.rs configuration, link checking, spelling, and documentation release gates.
Route general test architecture to rust-testing, public API compatibility to rust-code-review, Cargo metadata and publishing to rust-cargo-build, API shape and trait design decisions to rust-api-design, and non-Rust office document formats to their dedicated document skills. This skill documents what already exists; rust-api-design decides what the API should be.
Inventory public crates, binaries, features, targets, examples, READMEs, books, generated references, and hosted output. Define the audience and owner for each surface:
| Surface | Primary purpose |
|---|---|
| Crate and module docs | Entry path, architecture, feature and platform overview |
| Item docs | Contract, errors, panics, safety, examples, complexity |
| Doctests and examples | Executable usage and compatibility proof |
| README | Discovery, installation, minimal quick start, support policy |
| mdBook | Tutorials, concepts, operations, migration, long-form guides |
| docs.rs | Versioned public API publication |
Avoid duplicating the same prose across surfaces without a declared source of truth.
For each public API, document only applicable sections:
# Examples with assertions and realistic imports;# Errors for each meaningful failure category;# Panics for reachable panic conditions;# Safety for caller obligations on unsafe APIs;Prefer intra-doc links such as [`Client::send`] over brittle hand-written URLs. Enable broken-link checking at the crate boundary:
#![deny(rustdoc::broken_intra_doc_links)]
Adopt missing_docs deliberately; do not enable it globally before deciding which public compatibility surface requires documentation.
The Rust API Guidelines define five documentation rules (C-DOC, C-DOC-COMMENT, C-META, C-EXAMPLE, C-LINK) that high-quality crates are expected to satisfy. Treat them as the acceptance bar for documentation of any public crate. Full rationale, anti-patterns, and worked examples live in API Guidelines — Documentation; this section is the routing summary.
Every public item (function, struct, enum, trait, module, etc.) carries a doc comment. Enforce mechanically with the missing_docs lint:
// src/lib.rs
#![deny(missing_docs)]
Decide the scope deliberately. #![deny(missing_docs)] at the crate root is the strongest policy; if some surfaces (sealed modules, generated code, deliberately unstable APIs) need exemptions, scope the lint with #[allow(missing_docs)] on the smallest possible item and record why.
/// versus //!/// documents the next item (function, struct, field, module declared by name below it).//! documents the current module or crate (placed at the top of a file, or inside a module body).[Foo].Use //! at the top of src/lib.rs and any module root that needs an overview; use /// for every documented item.
src/lib.rs must open with //! documentation covering:
MIT OR Apache-2.0.Run cargo doc --no-deps -p <crate> and check that the crate landing page reads as a self-contained overview, not just a module list.
# ExamplesEvery public item should have a # Examples section. Examples should compile and run as doctests. Pick fence attributes precisely:
```no_run — compile but skip execution (network, files, hardware);```ignore — skip entirely, with a documented reason;```compile_fail — only in proc-macro crates to demonstrate rejected input.Avoid no_run as a disguise for broken examples; if a workflow needs files or credentials, move it into examples/ and test it as a real target.
Use [ItemType] and [ItemType::method] syntax so rustdoc resolves targets and tracks renames. Never hand-write paths to types in the same crate. Enable broken-link enforcement at the crate boundary:
#![deny(rustdoc::broken_intra_doc_links)]
For full examples, anti-patterns, the lint matrix, and the verification commands per rule, read API Guidelines — Documentation.
Use doctests for small public API contracts and examples/ crates for complete workflows. Mark fences precisely:
no_run compiles code that requires unavailable external effects;compile_fail proves rejected usage without locking full diagnostics;ignore is a last resort with a documented reason.Run:
cargo test --workspace --doc --all-features
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --all-features --no-deps
Read rustdoc and Doctests when authoring API documentation.
Use mdBook for tutorials, architecture, operations, and migration material that would overload API docs. Keep SUMMARY.md as the explicit navigation contract. Test Rust code samples with mdbook test, build in CI, and check internal plus external links. Read mdBook and Project Guides.
Inspect package metadata, docs.rs target and feature configuration, README links, repository URLs, licenses, examples, and hidden/private APIs. Verify docs using the locked dependency graph and supported MSRV/current stable rather than only the author's machine.
Do not publish, change hosted documentation, or enable external analytics without authorization. Read Documentation Release Quality.
cargo fmt --all --check
cargo test --workspace --doc --all-features
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --all-features --no-deps
mdbook test path/to/book
mdbook build path/to/book
lychee README.md docs book/src
typos README.md docs book/src src
Run only tools present in the project or approved for installation. Pin non-Rust documentation tools in CI and do not silently rewrite prose during a check-only job.
examples/golden-docs/: a compilable crate with enforced intra-doc links and doctests.This skill does not collect, store, or transmit user data. Review examples, generated source links, build logs, and hosted analytics for secrets or proprietary paths before publication.
agents/openai.yaml (opens in a new tab)examples/examples.md (opens in a new tab)examples/golden-docs/Cargo.lock (opens in a new tab)examples/golden-docs/Cargo.toml (opens in a new tab)examples/golden-docs/src/lib.rs (opens in a new tab)references/api-guidelines-documentation.md (opens in a new tab)references/documentation-release-quality.md (opens in a new tab)references/mdbook-and-guides.md (opens in a new tab)references/rustdoc-and-doctests.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Generated from the plugin's indexed repository (full-stack-skills/rust-skills) — no native marketplace selected
npx claudepluginhub p/full-stack-skills-rust-skills29 skills in this plugin
/rust-api-designDesign Rust library APIs that follow the Rust API Guidelines — naming (C-CASE, C-CONV, C-GETTER), interop traits (C-COMMON-TRAITS, C-CONVERT, C-ITER, C-SERDE), predictability (C-INTUITIVE, C-CONST), flexibility (C-GENERIC, C-NEWTYPE, C-EXT), type safety (C-BOOL, C-NONZERO, C-WRAPPER, C-STR), dependability (C-PANIC, C-UNWRAP), debuggability (C-DEBUG), and future-proofing (C-SEALED, C-STRUCT-FIELD, C-NON-EXHAUSTIVE). Use when users design a public crate API, choose between generics/concrete/newtype, decide trait bounds, hide implementation, avoid breakage, or ask "what is idiomatic Rust API design"; hand semver and publish workflow to rust-semver, lint config to rust-style-clippy, and in-crate layout to rust-module-layout./rust-by-exampleShow Rust patterns through short compilable examples — type conversions (From/Into/TryFrom/as/Deref), flow control (if let/while let/match/loop), functions and closures (Fn/FnMut/FnOnce, captures), modules (mod/use/pub/super/self), generics and traits (bounds/associated types/trait objects), error handling (?/Result/thiserror/anyhow), attributes (derive/cfg/inline/allow), unsafe (raw pointers/unions/ABI), procedural macros (derive/attribute/function-like), and inline asm. Use when users ask "how do I write X in Rust", need a concrete pattern with copy-pasteable code, or are migrating from Java/Python/Go/C++ and want the Rust equivalent; hand architecture decisions to rust-api-design/rust-workspace, std API selection to rust-stdlib, and async runtime to rust-concurrency./rust-cargo-buildConfigure, operate, diagnose, and automate Cargo for Rust packages and workspaces. Cover manifests and targets, commands, dependency resolution and features, profiles, build scripts, configuration and environment variables, caches and build diagnostics, cross-compilation, registries, packaging, publishing, metadata, CI reproducibility, and stable-versus-nightly feature gates. Use for Cargo.toml, Cargo.lock, .cargo/config.toml, cargo build/check/run/tree/metadata/package/publish, resolver or feature problems, build output and performance, private registries, and beginner Cargo workflows. Route crate selection and supply-chain audits to rust-dependencies, workspace topology to rust-workspace, test design to rust-testing, documentation design to rust-documentation, lint policy to rust-style-clippy, and API compatibility decisions to rust-semver./rust-cliDesign, implement, test, and release production Rust command-line applications, including command contracts, subcommands, configuration precedence, stdin/stdout/stderr, exit codes, file safety, daemon IPC, terminal handling, packaging, and process-level tests. Use when users ask for a Rust CLI, command parser, clap integration, Unix-style pipelines, daemon clients, PTY/TUI behavior, shell completion, or CLI release engineering./rust-code-reviewReview Rust changes for correctness, memory and thread safety, error semantics, unnecessary allocation or cloning, lock scope, API compatibility, test gaps, documentation, and dependency risk, applying the Rust API Guidelines checklist (C-PANIC, C-UNWRAP, C-TRANSMUTE, C-BOOL, C-NEWTYPE, C-COMMON-TRAITS, C-CONVERT, C-SEALED, C-NON-EXHAUSTIVE). Use when reviewing Rust diffs, pull requests, libraries, unsafe boundaries, or production incidents; report actionable findings by severity before summaries, route automated formatting or lint policy to rust-style-clippy, and route API shape decisions (trait sealing, error taxonomy, newtype design, builder patterns) to rust-api-design./rust-concurrencyDesign, implement, diagnose, and test Rust concurrency and parallelism with threads, Send and Sync, locks, atomics, channels, Tokio, Rayon, Crossbeam, bounded backpressure, actor ownership, task supervision, graceful shutdown, runtime diagnostics, and Loom model tests. Use when users ask about shared state, deadlocks, async tasks, CPU parallelism, high concurrency, daemon resource budgets, slow consumers, worker pools, lock-free structures, or concurrent correctness.Other plugins' skills for the same job