agentleFS
thepictishbeastthepictishbeast/claude-tools/skills/audit-unused-dep/SKILL.md

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).

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
  1. Very specific:

    Verify against cargo tree -i <name> (sometimes a transitive pulls the same crate.

    line 29
  2. Very specific:

    Check Cargo.toml [features] — features may reference deps without use in source

    line 31
  3. Very specific:

    Remove the line from Cargo.toml, run cargo build, run any relevant tests.

    line 33
  4. Distinctive:

    Use both for cross-check.

    line 51

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/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

  1. 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:

    • name
    • confidence: high (0 matches anywhere) or medium (0 in code, N in comments — verify before removing)
    • rationale
  2. 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 without use in source
    • Remove the line from Cargo.toml, run cargo build, run any relevant tests. If clean, commit.
  3. 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).

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.