| name | rust-cargo-doc-search |
| description | Search and explore locally-generated cargo doc documentation for Rust projects and their dependencies. Use when: (1) looking up types, traits, functions, or modules in a Rust crate, (2) exploring the API surface of a local workspace crate or dependency, (3) browsing locally-built rustdoc output in target/doc/, (4) searching docs without an internet connection, (5) user mentions cargo doc, rustdoc, rust docs, or asks about Rust API documentation. |
rust-cargo-doc-search
Search and browse Rust crate documentation via the generated rust-docs.ts CLI (wraps rust-docs-mcp).
CLI path: ~/.config/opencode/skills/rust-cargo-doc-search/rust-docs.ts
Invoke with: bun ~/.config/opencode/skills/rust-cargo-doc-search/rust-docs.ts <command> [flags]
Recommended Workflow
- Cache the crate (first time only)
- Explore structure to understand the crate layout
- Search with preview to find item IDs (cheap, token-efficient)
- Fetch details for specific items by ID
Caching a Crate
bun rust-docs.ts cache-crate-from-local --crate-name <name> --path /path/to/crate
bun rust-docs.ts cache-crate-from-local --crate-name <name> --path /path/to/workspace \
--members crates/foo,crates/bar
bun rust-docs.ts cache-crate-from-cratesio --crate-name serde --version 1.0.197
bun rust-docs.ts cache-crate-from-github --crate-name <name> \
--github-url https://github.com/user/repo --branch main
Check what's already cached:
bun rust-docs.ts list-cached-crates
bun rust-docs.ts list-crate-versions --crate-name <name>
Exploring Structure
bun rust-docs.ts structure --crate-name <name> --version <ver>
bun rust-docs.ts structure --crate-name <name> --version <ver> --focus-on my_crate::sync
bun rust-docs.ts structure --crate-name <name> --version <ver> --member crates/foo
Searching Items
Use preview first to get IDs without blowing token budget, then fetch details by ID.
bun rust-docs.ts search-items-preview --crate-name <name> --version <ver> --pattern MyStruct
bun rust-docs.ts search-items-preview --crate-name <name> --version <ver> \
--pattern spawn --kind-filter function
bun rust-docs.ts search-items-fuzzy --crate-name <name> --version <ver> --query AsyncRed
bun rust-docs.ts search-items --crate-name <name> --version <ver> --pattern Error
Fetching Item Details
item_id comes from search results.
bun rust-docs.ts get-item-details --crate-name <name> --version <ver> --item-id <id>
bun rust-docs.ts get-item-docs --crate-name <name> --version <ver> --item-id <id>
bun rust-docs.ts get-item-source --crate-name <name> --version <ver> --item-id <id> \
--context-lines 10
Dependencies
bun rust-docs.ts get-dependencies --crate-name <name> --version <ver>
bun rust-docs.ts get-dependencies --crate-name <name> --version <ver> --include-tree true
Workspace Members
All item commands accept --member <path> for workspace crates (path relative to workspace root, e.g. crates/rmcp).
Auto-Triggering Patterns
Apply this skill when the user:
- Asks "where is X defined?", "what does X do?", "show the API for X" about a Rust item
- Mentions a crate name alongside "docs", "documentation", "API", or "signature"
- Wants to explore a module: "what's in
tokio::sync?"
- References
cargo doc or rustdoc
- Asks about a Rust item likely in the local workspace
For std library or remote docs.rs queries without a local crate, use cache-crate-from-cratesio first, then search as above.