Skip to content
Back to skills

Hr Dependency Audit

ASecurity

Audit an existing codebase's packages and vendored libraries for what can be removed, consolidated or replaced by a platform built-in or a lighter package, without hidden tradeoffs. Use when explicitly asked to slim dependencies, cut install or bundle size, or audit dependency bloat. Report-only; speed claims need hr-benchmarking.

  • 3 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 1, 2026
ai-agentsgoshellsqlapidatabasesecurityperformance

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add bompus/house-rules --skill hr-dependency-audit --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Hr Dependency Audit?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Hr Dependency Audit
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/bompus-hr-dependency-audit/badge)](https://www.skillsdirectory.com/skills/bompus-hr-dependency-audit)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: hr-dependency-audit
description: "Audit an existing codebase's packages and vendored libraries for what can be removed, consolidated or replaced by a platform built-in or a lighter package, without hidden tradeoffs. Use when explicitly asked to slim dependencies, cut install or bundle size, or audit dependency bloat. Report-only; speed claims need hr-benchmarking."
disable-model-invocation: true
---

# Dependency audit

A report on which dependencies a codebase can shed, and which it must keep.
The goal is a lighter, faster project with no tradeoff the reader did not see.
This audit changes no code, manifest or lockfile; it reports findings with
their evidence and a verdict per dependency. To decide whether to add one, use
the dependency gate in the implementation-economy rules; for code structure,
use `hr-maintainability-review`.

## Choose the scope

Use the requested scope: the whole repository, one package of a monorepo, or
one manifest. Record the revision and whether working-tree and untracked files
are included. If the request names no scope, audit the whole repository at its
current checkout. A bundle-size or install-size goal sets the priority: weight
that ships to users outranks weight that only developers install.

## Inventory every dependency surface

List each place a dependency is declared or copied in:

- Manifests: `package.json`, `Cargo.toml`, `composer.json`, `pyproject.toml`
  and `requirements*.txt`, `go.mod`, `Gemfile`, and the equivalents of any other
  ecosystem present. Include workspace and nested manifests.
- Lockfiles beside them; they give the transitive tree.
- Vendored or copied libraries: `vendor/`, `third_party/`, `lib/`, `js/` and
  similar folders, minified files, and scripts loaded from a CDN in templates.

Sort each entry into one group, and report the groups separately:

- **Runtime**: ships to users or runs in production.
- **Build and development**: bundlers, compilers, linters, formatters, type
  packages, test runners. These never count as shipped weight.
- **Excluded**: benchmark and conformance harnesses, which exist to compare
  against other implementations, and code the project does not own: tracked
  forks and subtrees that are developed upstream, and generated code. List each
  exclusion with its reason, and propose changes to none of them. A third-party
  library the project merely copied in and ships (a vendored script, a minified
  file) is not excluded; audit it like any other runtime dependency.

A package declared in the wrong group (a runtime entry that only the build
uses, or the reverse) is not a sixth verdict: note it in the inventory part of
the report, and judge the package on its real group.

## Trace real usage before proposing removal

"No import found" is not evidence of non-use. For each candidate, search all of
these, and name the searches you ran:

- Static imports and requires in every language the project uses.
- Dynamic and string references: `import()`, `require(variable)`, plugin and
  loader names in strings, framework conventions that load a package by name.
- Configuration and build: bundler, PostCSS, Babel, linter, test-runner and
  framework configs; `scripts` entries and binaries they call; CI workflows,
  container files, and templates.
- Peer and reverse requirements: ask the ecosystem which other packages need
  it (`npm ls <pkg>`, `cargo tree --frozen -i <crate>`, `go mod why -m <module>`,
  `composer why <pkg>`, `pipdeptree -r -p <pkg>`, or the lockfile). A package
  another dependency requires stays in the resolved tree when the project's own
  declaration goes, so judge the manifest edge and the resolved package
  separately, using the package manager's effective version and install
  settings (npm's `legacy-peer-deps` makes installs ignore peer edges, and a peer marked
  optional in `peerDependenciesMeta` is not installed by the package that lists
  it, so the project's own declaration may be the only thing that installs the
  host, and the integration it enables is a usage site): dropping a redundant direct declaration is a finding about the
  manifest, and the report says what remains in the lockfile and why. A
  declaration is redundant only if removing it leaves every resolved version
  and enabled feature unchanged: a direct pin or lower bound can be what lifts a
  surviving path above the version its dependent asks for. Compare the
  resolved versions before and after, and confirm that the package manager
  accepts the edited manifest as consistent (Go 1.17 and later records indirect
  requirements that `go mod tidy` restores even when no version changes), in an
  isolated copy with networking denied; mark the effect unchecked when that
  cannot run. In a published library, a declaration can also be part of what
  consumers rely on (an optional Cargo dependency is a public feature, an npm
  peer declaration is a requirement on the host), so it is not redundant while
  consumers can still use it. Run these
  probes read-only: a command that would update a lockfile or fetch from the
  network (a bare `cargo tree` without a committed lockfile, for one) breaks the
  report-only promise, so read the lockfile instead and say so. A lockfile with
  no dependency edges (Go's `go.sum` is a flat list of hashes) cannot answer
  this. For Go, run `go mod graph` and `go mod why -m` only where outbound
  networking is denied (a sandbox or a shell with no network), with
  `GOTOOLCHAIN=local GOPROXY=off GOVCS='*:off'` as well: those variables do not
  stop a lookup for a module matching `GOPRIVATE` or `GONOPROXY`, which can send
  its path to the host before any version-control rule applies. Where network
  cannot be denied, read `go.mod` and the module cache files directly and mark
  each requirement they do not show as unchecked. `go mod why -m` shows package
  usage only; take the module requirements that point at a dependency from
  `go mod graph`. Pass no flag that lets a command write `go.mod` or `go.sum`
  (`-mod=mod`), and never copy a private module pattern from the Go settings
  into the report.
- Types, optional native bindings, and packages used only at install time.

When a search cannot be run (a generated file, a private registry), say what is
unchecked instead of assuming it is unused.

## Classify each candidate

Give every candidate exactly one verdict:

- **Remove**: the trace found no live use, and deleting it changes nothing at
  build or run time.
- **Consolidate**: two or more packages do the same job (two date libraries, two
  HTTP clients, two deep-clone helpers). Name the one that stays and the call
  sites that move, and confirm the copies share a contract: defaults,
  error handling and edge cases drift between look-alikes.
- **Replace with a platform built-in**: the language, standard library, runtime
  or browser already provides what the code uses. Check it exists in every
  version the project supports (`engines`, `browserslist`, the minimum runtime
  in CI), and compare the used behavior, not the library's full API.
- **Replace with a lighter package**: a maintained package covers the used
  surface at a smaller cost. Compare maintenance activity, transitive count and
  measured size, not the package's marketing.
- **Keep (do not roll your own)**: the dependency earns its weight. Say why in
  one line.

### Do not propose rewriting what is hard to get right

For any of these, do not propose a hand-written replacement unless the three
conditions after the list all hold. The verdicts Remove (nothing uses it),
Consolidate, and Replace with a built-in or a vetted, lighter package stay open
when the evidence supports them; swapping a hashing library for the runtime's
own crypto module is not rolling your own.

- Cryptography, authentication, session and token handling.
- HTML, SQL and shell sanitizing or escaping.
- Time zones, calendars, locale and date arithmetic.
- Database drivers and wire protocols.
- Binary, image, audio, video and compression codecs.
- Complex parsers: Markdown, YAML, HTML, URLs, CSV with quoting, semantic
  version ranges, anything with a formal grammar.

A hand-written replacement is acceptable (and counts as Replace with a platform
built-in) only for a tiny usage the code can prove: the call sites use a small
subset, the replacement is a few lines of standard library, and tests cover that
subset's edge cases. Without all three, and with no Remove, Consolidate,
built-in or vetted lighter-package replacement that fits, the verdict is Keep. A dependency kept because it is hard is a decision the report states,
not a gap in it.

## Require evidence for each finding

A finding that proposes a change (any verdict except Keep) needs all of these;
without them it is a guess, so drop it or label it unmeasured. A Keep needs only
its one-line reason and goes in the **Kept** section, not among the findings:

1. **Usage sites**: exact files and lines that use the dependency, or "none" with
   the searches that found none.
2. **Weight**: the exclusive transitive packages, meaning the resolved packages
   that lose their last required path from the roots that remain when this one is
   removed. Shared edges do not count, so a raw closure count overstates it.
   Apply the package manager's peer rules as configured: npm installs required peers
   automatically unless `legacy-peer-deps` is set (an optional peer is never
   installed for you), so a plugin can be the only
   reason a peer and that peer's own dependencies are present, while a peer
   another remaining package needs stays. Compute it
   from the lockfile (`bun.lock`, `package-lock.json`, `Cargo.lock`, `composer.lock`,
   `Gemfile.lock` and so on), not from installed directories, which can lag the manifest. Or,
   for shipped code, the dependency's contribution to the built bundle (from the bundler's
   analysis output or a before and after build). Measure in a scratch copy of
   the repository and leave the working tree unchanged. A scratch build installs
   packages from the network and may run their lifecycle scripts: do it only
   when the user has allowed it, with scripts disabled where the ecosystem
   allows (for example `--ignore-scripts`); otherwise read existing build output
   and the lockfile. Never quote a size from memory or a registry page; say "not
   measured" instead.
3. **Tradeoffs and edge cases**: behavior that differs after the change, the
   supported versions and targets, polyfill or fallback needs, security-update
   cadence of the replacement, and licence changes.
4. **Verification plan**: the existing tests that exercise the call sites and
   what they cover, a bundle or install-size diff, and `hr-benchmarking` for any
   speed claim. Do not run a benchmark inside this audit; label every
   performance claim "unmeasured" until one is.

## Filter and order

Order findings by impact, largest first: shipped weight and transitive packages
removed, then install and build time, then development-only weight. Prefer a few
well-evidenced findings to a long list of guesses. Drop findings with no
nameable gain. If the dependencies are already lean, say so in one sentence
instead of inventing a finding.

## Write each finding

For each finding, give in order:

1. **Dependency**: name, group (runtime or build and development) and manifest.
2. **Verdict**: one of the five.
3. **Evidence**: usage sites and weight, as above.
4. **Tradeoffs**: what changes in behavior, support or risk.
5. **What goes away and how to verify**: the packages, files or lines removed,
   and the verification plan.

## Report

Open with the scope, the revision, the surfaces inventoried, the exclusions, and
what the trace could not check. Then list the findings, then a short **Kept**
section naming each dependency considered and kept, with its reason, so the
reader sees what was weighed. Close with an offer to act on the findings under
the offer rules; changing manifests or code is a separate task the user selects.

## Other assessments

- **Structure:** `hr-maintainability-review` reviews code shape and
  over-engineering.
- **Performance:** `hr-benchmarking` measures a speed or memory claim.
- **Vulnerabilities and licences:** use the ecosystem's audit tools and report
  them separately; this audit does not assess them.

Use these only for the requested dimensions, and report unassessed ones
explicitly.

## Tone

Direct and specific. Name the dependency, the cost and the evidence. Never
soften a finding with evidence behind it, and never present a guess as one.

Files in this skill

  • SKILL.md12.3 KB
  • agents/openai.yaml188 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.