agentleFS
saizulsaizul/rust-dev-skills/skills/rust-dependency-audit/SKILL.md

rust-dependency-audit

Skill0 starsChanged 3 days agoMITView on GitHub

Audit a Rust project's dependencies - Cargo.toml requirements and Cargo.lock offline (wildcard versions, unpinned git dependencies, path dependencies that block publishing, test crates in normal dependencies, tokio full in libraries, deprecated or unmaintained crates such as failure, atty, dotenv, structopt, serde_yaml with their replacements, crates compiled in several versions, git and private-registry sources), then cargo audit and cargo deny for RustSec advisories, licenses and bans, and cargo machete, cargo udeps and cargo outdated for unused and old dependencies. Includes a ready deny.toml. Use when the user asks to audit or clean up Cargo dependencies, reduce build times or binary size from duplicate crates, check licenses, respond to a RustSec advisory, or set up cargo-deny in CI.

  • Installs packages

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Start from assets/deny.toml.

    line 48

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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

Rust dependency audit

Goal: every dependency is wanted, maintained, free of known vulnerabilities, licensed compatibly and resolved to as few versions as practical.

Paths below are relative to this skill's folder (in Claude Code: ${CLAUDE_SKILL_DIR}).

When to use

  • "Audit my dependencies", "are any of these crates unmaintained?", "check licenses"
  • A RustSec advisory or Dependabot alert for a crate in Cargo.lock
  • Slow builds or big binaries caused by duplicate crate versions
  • Setting up cargo deny in CI

When not to use

  • Arranging dependencies across workspace members: rust-workspace-setup
  • Publishing metadata and pre-publish checks: rust-crates-publish
  • Reviewing unsafe code inside a dependency: rust-unsafe-review

Workflow

  1. Offline pre-check (read-only, no network):
    python3 scripts/deps_check.py .
    python3 scripts/deps_check.py . --json --fail-on high
    The list of unmaintained crates is a curated snapshot; treat it as a hint and confirm with step 2.
  2. Advisory and policy scan (these tools download the RustSec advisory database; ask before installing tools):
    cargo install --locked cargo-audit cargo-deny
    cargo audit                         # vulnerabilities, yanked and unmaintained crates
    cargo deny init                     # or copy assets/deny.toml and edit it
    cargo deny check                    # advisories, licenses, bans (duplicates), sources
    Start from assets/deny.toml; adjust the license allow-list with the user, never silently add licenses.
  3. Unused and outdated:
    cargo install --locked cargo-machete && cargo machete      # fast, heuristic
    cargo +nightly udeps --all-targets                         # precise, needs nightly
    cargo install --locked cargo-outdated && cargo outdated -R # root deps only
    cargo tree -d                                              # duplicates and who pulls them
    cargo tree -i <crate> -e features                          # why a crate / feature is enabled
  4. Decide per finding with references/remediation.md: upgrade (semver-compatible first: cargo update -p <crate>), replace (table of alternatives), remove, or accept with a dated reason in deny.toml ignore.
  5. Apply changes one crate at a time, cargo check --all-targets and cargo test after each; show the user the Cargo.toml diff and the Cargo.lock summary (git diff --stat Cargo.lock).
  6. Keep it green in CI: cargo deny check job (or EmbarkStudios/cargo-deny-action) plus Dependabot or Renovate for Cargo; see references/remediation.md.

Decision points

  • Vulnerability with a fix: upgrade now; if it is a transitive dependency, cargo update -p or upgrade the parent. No fix: check whether the vulnerable code path is used, document the decision, and add an ignore with the advisory id and a review date.
  • Unmaintained but no vulnerability: plan a replacement; it is not an emergency.
  • Duplicate versions (syn 1 and 2, windows-sys x3): usually harmless at runtime but cost build time; fix only when the duplicated crate is large or you control the parent.
  • Default features: default-features = false plus the features you use, especially for libraries (every user inherits your features).

Output

deps_check: 13 findings (1 high, 5 medium); cargo audit: 1 vulnerability (RUSTSEC-YYYY-NNNN in <crate>)
Fixed: regex "*" -> "1.11"; failure -> thiserror; atty -> std::io::IsTerminal; criterion -> dev-deps
Accepted: syn 1.x via an old proc-macro dependency (upgrade pending upstream)
CI: added cargo deny check job with deny.toml

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.