No slash command · from rust-plugin
Detects unused Rust dependencies in Cargo.toml using cargo-machete. Helps optimize build times and clean up dependency bloat in single crates or workspaces.
Ships in rust-plugin. 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.
Detect and remove unused dependencies in Rust projects using cargo-machete.
| Use this skill when... | Use X instead when... |
|---|---|
| Auditing for unused dependencies | Checking for outdated deps -- use cargo outdated |
| Cleaning up Cargo.toml | Auditing security vulnerabilities -- use cargo audit |
| Optimizing build times by removing bloat | Checking license compliance -- use cargo deny |
| Verifying deps in CI | Need nightly-accurate analysis -- use cargo +nightly udeps |
find . -maxdepth 1 -name 'Cargo.toml'find . -maxdepth 1 -name 'Cargo.toml' -exec grep -q '\[workspace\]' {} +cargo machete --versionfind . -maxdepth 1 -name '.cargo-machete.toml'find . -maxdepth 1 -name 'Cargo.toml' -exec grep -A 20 '^\[workspace\]' {} +Execute this unused dependency analysis:
Check if cargo-machete is installed (see Context). If not installed, install it:
cargo install cargo-machete
Run cargo-machete with metadata for detailed output:
# Single crate
cargo machete --with-metadata
# Workspace (if Context shows workspace)
cargo machete --workspace --with-metadata
Review the output and classify each finding:
| Finding | Action |
|---|---|
| Genuinely unused dependency | Remove with --fix or manually |
| Proc-macro dependency (e.g., serde derive) | Add machete:ignore comment |
| Build.rs-only dependency | Move to [build-dependencies] |
| Re-exported dependency | Add machete:ignore comment with explanation |
For confirmed unused dependencies, auto-remove them:
cargo machete --fix
For false positives, add ignore annotations in Cargo.toml:
serde = "1.0" # machete:ignore - used via derive macro
Or create .cargo-machete.toml for project-wide ignores:
[ignore]
dependencies = ["serde", "log"]
After removing dependencies, confirm everything still compiles:
cargo check --all-targets
cargo test --no-run
| Scenario | Solution |
|---|---|
| Proc-macro deps (e.g., serde derive) | machete:ignore comment |
| Build.rs-only deps | Move to [build-dependencies] |
| Re-exported deps | machete:ignore comment with explanation |
| Example/bench-only deps | Verify in [dev-dependencies] |
| Feature | cargo-machete | cargo-udeps |
|---|---|---|
| Accuracy | Good | Excellent |
| Speed | Very fast | Slower |
| Rust version | Stable | Requires nightly |
| False positives | Some | Fewer |
Use cargo-machete for fast CI checks. Use cargo-udeps for thorough audits:
cargo +nightly udeps --workspace --all-features
| Context | Command |
|---|---|
| Quick check | cargo machete |
| Detailed check | cargo machete --with-metadata |
| Workspace check | cargo machete --workspace --with-metadata |
| Auto-fix | cargo machete --fix |
| Verify after fix | cargo check --all-targets |
| Accurate check (nightly) | cargo +nightly udeps --workspace |
| Flag | Description |
|---|---|
--with-metadata | Show detailed output with versions and locations |
--fix | Auto-remove unused dependencies from Cargo.toml |
--workspace | Check all workspace members |
-p <crate> | Check specific workspace member |
--exclude <crate> | Exclude specific workspace member |
| Problem | Solution |
|---|---|
| Proc macro flagged as unused | Add machete:ignore comment in Cargo.toml |
| Build.rs dep flagged | Move to [build-dependencies] |
| Re-exported dep flagged | Add machete:ignore with explanation |
| Need more accuracy | Use cargo +nightly udeps |
For CI integration patterns, configuration file examples, pre-commit setup, and Makefile integration, see REFERENCE.md.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub laurigates/claude-plugins --plugin rust-plugin10 skills in this plugin
/cargo-distcargo-dist (dist) release binaries for a Rust CLI. Use when setting up dist-workspace.toml, pairing dist with release-please, or publishing a Homebrew formula./cargo-generatecargo-generate: scaffold a project from a git template repo. Use when bootstrapping a Rust or Bevy project from a template, or authoring one./cargo-llvm-covcargo-llvm-cov: Rust code coverage with LLVM instrumentation. Use when measuring coverage, enforcing thresholds, generating reports, or integrating codecov/coveralls./cargo-nextestcargo-nextest: fast Rust test runner with parallel execution and advanced filtering. Use when running tests, setting up CI, or diagnosing flaky/slow tests./cargo-worktree-buildsShare one CARGO_TARGET_DIR across parallel git-worktree agents so Rust deps compile once. Use when worktrees run cargo concurrently, rebuild deps N times, or fill disk with N target/ copies./clippy-advancedAdvanced Clippy configuration for Rust — custom rules, pedantic/nursery lints, clippy.toml, IDE and CI integration. Use when configuring or enforcing lint standards.Other plugins' skills for the same job