rust-plugin/skills/cargo-machete/SKILL.md
cargo-machete: detect unused Rust dependencies. Use when auditing Cargo.toml, optimizing build times, or cleaning up dependency bloat.
npx skillsauth add laurigates/claude-plugins cargo-macheteInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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\'grep -q '\[workspace\]' Cargo.tomlcargo machete --versionfind . -maxdepth 1 -name \'.cargo-machete.toml\'grep -A 20 '^\[workspace\]' Cargo.tomlExecute this unused dependency analysis:
Check if cargo-machete is installed (see Context above). 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.
tools
Scaffold a new ComfyUI custom-node repo (pyproject, CI, release-please, vitest+pytest, JS extension skeleton) in the picker/gesture vein. Use when bootstrapping or init-ing a comfyui node pack.
tools
Orchestrate a ComfyUI node pack from idea to registry: scaffold, create + seed the repo, open the gitops adoption PR. Use when releasing or spinning up a new comfyui node pack.
testing
macOS EndpointSecurity/EDR high CPU & battery drain. Use when Kandji ESF / XProtect pegs a core; trace the exec storm via powermetrics + eslogger.
development
odiff pixel-by-pixel image diffing. Use when comparing screenshots, detecting visual regressions, diffing before/after PNGs, asserting golden images.