audit-unused-dep
Skill1 starsChanged 6 months agoMITView on GitHub
Scan a Cargo.toml + src/ tree for zero-call-site direct dependencies. Reports candidates with confidence levels; doesn't modify Cargo.toml. Faster + more inspectable than cargo-machete for the common case; complements machete (not a replacement).
In this repository16 other files it gives its agents.
- checkpointSkill
- double-checkSkill
- file-adrSkill
- fleetSkill
- fmt-sweepSkill
- forge-mirror-scaffoldSkill
- forgeSkill
- gemini-pullSkill
- loop-from-taskSkill
- loop-healthSkill
- loop-onSkill
- loopSkill
- loopsSkill
- regression-guardSkill
- restoreSkill
- workspace-testsSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 29
Verify against cargo tree -i <name> (sometimes a transitive pulls the same crate.
- Very specific: line 31
Check Cargo.toml [features] — features may reference deps without use in source
- Very specific: line 33
Remove the line from Cargo.toml, run cargo build, run any relevant tests.
- Distinctive: line 51
Use both for cross-check.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
/audit-unused-dep — list direct deps with no code references
Thin wrapper around the audit-unused-dep binary (installed at
~/.local/bin/audit-unused-dep; built by install.sh). Binary
owns: Cargo.toml parse, recursive .rs scan, comment-stripping, +/-
grep, confidence classification.
Steps
Invoke the binary (defaults to current dir's Cargo.toml + src/):
audit-unused-dep [--manifest Cargo.toml] [--src src] [--extra-dir bin] [--human]Stdout is JSON (default) or a human-readable table (
--human). Each candidate carries:nameconfidence:high(0 matches anywhere) ormedium(0 in code, N in comments — verify before removing)rationale
- Triage each
high-confidence candidate:- Verify against
cargo tree -i <name>(sometimes a transitive pulls the same crate; removing the direct dep doesn't help) - Check Cargo.toml
[features]— features may reference deps withoutusein source - Remove the line from
Cargo.toml, runcargo build, run any relevant tests. If clean, commit.
- Verify against
- Triage
medium-confidence candidates more carefully — the comment matches mean the crate name appears in a doc-string or string literal. Could be:- Documentation reference (keep dep)
- Static-analysis rule that names the crate (keep dep)
- Stale comment from a removed call site (safe to remove)
Net visible tool calls per audit
1–2 total: Bash (audit-unused-dep) + optional Bash
(cargo tree -i for verification).
Compared with cargo-machete: this tool is more inspectable (rationale per candidate) but slightly noisier (medium-confidence candidates are FPs for machete-style "strict no-comments" rules). Use both for cross-check.
When to NOT remove
- Feature-flag-only deps (only
used under#[cfg(feature = "X")]that's off by default) — false-positive for both tools. - Build-time-only deps that show up as
[build-dependencies](this tool already ignores them). - proc-macro deps without an explicit
use(rare but possible — e.g. some derives bring their crate into scope implicitly).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

