Skip to content

commandSecurity

Audit Dependencies

Runs your package manager audit, explains which advisories really matter and proposes the smallest safe upgrade for each.

npx workspacetemplates add audit-dependencies --tool claude-code

Writes 1 file to .claude/commands/

.claude/commands/audit-dependencies.md14 lines · 1.2 KBFile
---
description: Runs your package manager audit, explains which advisories really matter and proposes the smallest safe upgrade for each.
argument-hint: "[ecosystem or manifest folder]"
---

Audit the dependencies of this project. Focus: $ARGUMENTS (all manifests if empty).

1. Detect the ecosystem from lockfiles and run the matching audit: `npm audit --json`, `pnpm audit`, `pip-audit`, `cargo audit`, `bundle audit`, `composer audit` or `govulncheck ./...`. If the tool is missing, say so and stop.
2. For every advisory, decide if it is real: is the package a production dependency or dev-only, is the vulnerable function actually called (search the code), and is the vulnerable version the one in the lockfile?
3. For each real one, find the smallest fixed version and classify the jump as patch, minor or major. Read the changelog for breaking changes if it is major.
4. Mention transitive packages with the parent that pulls them in, and whether an override or resolution would help.
5. Do not install, update or edit lockfiles yet.

Report a table: package, current, fixed in, severity, reachable (yes/no/unknown), upgrade size. Then list dismissed advisories with the reason. Ask which upgrades to apply, and run the tests after applying.

What it does

Audit output is long and mostly noise: dev-only packages, unreachable code paths and advisories with no fix. This command runs the audit for your ecosystem, then sorts the real risks from the rest.

For each real finding it names the lowest version that fixes it and flags whether the jump is a patch, minor or major change. Nothing is installed until you agree.

Example

you › /audit-dependencies

agent › 3 real findings of 11 advisories.
high: jsonwebtoken 8.5.1 -> 9.0.2 (major; algorithm confusion; used in src/auth/token.ts)
medium: axios 0.21.1 -> 0.21.4 (patch; SSRF; reachable)
Dismissed: 8 advisories in dev-only packages (eslint, jest).
Apply the two upgrades?

Questions

Will it change my lockfile?
Only after you pick upgrades. The first pass is read-only apart from running the audit command.
Why dismiss some advisories?
Dev-only packages and code paths your app never calls rarely put users at risk; it lists each dismissal so you can disagree.
  • Check Auth

    CommandSecurity

    Free
  • Find Secrets

    CommandSecurity

    Free
  • Harden Input

    CommandSecurity

    Free
  • Review Permissions

    CommandSecurity

    Free