agentleFS
milad-ahmdmilad-ahmd/agent-skills/skills/dependency-weigh-in/SKILL.md

dependency-weigh-in

Skill7 starsChanged 5 days agoMITView on GitHub

Weighs installed dependencies on disk (node_modules, venv, Go modules), finds the heaviest packages and what pulls them in, with a meme-worthy card. Use when asked how big node_modules or a venv is, which package eats disk space, or to slim installs.

  • Installs packages

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Ask which items the user wants done.

    line 52
  2. Distinctive:

    Delete node_modules, a venv or the Go module cache, or uninstall, upgrade or move packages without the user asking.

    line 56
  3. Distinctive:

    Treat this as a security or freshness audit.

    line 59

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

Dependency Weigh-in

node_modules jokes land because nobody knows the real number. This skill gets it, makes it shareable, then finds the weight that is actually removable.

1. Weigh

python3 scripts/weigh_in.py                     # project in the current directory
python3 scripts/weigh_in.py path/to/app --top 15
python3 scripts/weigh_in.py --venv .venv        # a venv somewhere other than .venv or venv
python3 scripts/weigh_in.py --svg weigh-in.svg  # also write a 1200x630 card
python3 scripts/weigh_in.py --svg weigh-in.svg --no-credit   # same card without the small "made with agent-skills" line
python3 scripts/weigh_in.py --json              # every number, for follow-up questions

The script only reads. It never installs or deletes anything, and weighs only what is already installed.

For node_modules it sizes every package directory, nested copies and pnpm's node_modules/.pnpm store included. Symlinks are not followed, so pnpm's top-level links and workspace links are not counted twice. Dependencies are resolved the way Node resolves them (nearest node_modules upward), so the "pulled in by" chains and per-dependency totals follow the real install. Dev-only weight comes from dev: true in package-lock.json v2/v3, otherwise from that graph.

A Python venv (.venv, venv or --venv) is sized per distribution from *.dist-info/RECORD, scripts in bin/ included, and "required by" comes from Requires-Dist without extras.

Go modules listed in go.sum (or go.mod) are sized in GOMODCACHE (go env GOMODCACHE). Without Go or a cache, Go is skipped with a note. That cache is shared by every Go project on the machine.

Sizes are apparent sizes (the sum of file sizes) with MB = 1,000,000 bytes; the on-disk figure is block usage. Yarn Plug'n'Play projects keep packages as zips in .yarn/cache and are not weighed.

Exit codes: 0 weighed · 1 the SVG could not be written · 2 nothing installed to weigh. On 2, tell the user to install first (npm ci, pnpm install, pip install -r requirements.txt in a venv, go mod download) and offer to run it only if they want; do not install on your own.

2. Show the weigh-in

Lead with the headline exactly as printed: total, weight class, and the comparison ("about 43 copies of shareware Doom, or 124 floppy disks"). If a card was written, give its path. Then the heaviest five packages, each with its "pulled in by" chain. Keep it short and fun; the numbers are the joke.

3. The slimming plan

Rank by expected savings, using only numbers the script printed. A package's current weight is the ceiling on what removing or replacing it can save.

  1. Duplicates. Copies of the same package at several versions. Try npm dedupe or pnpm dedupe, then re-weigh. Copies left afterwards are usually pinned by incompatible version ranges; npm explain <pkg> or pnpm why <pkg> shows who asks for which.
  2. Dev-only weight in production. If this install feeds a server or container, npm ci --omit=dev or pnpm install --prod leaves out the dev-only total. For a bundled frontend the dev/prod split does not change what users download, so say so.
  3. Dev tools under dependencies (typescript, eslint, jest, @types/*): suggest moving them to devDependencies.
  4. Heavy direct dependencies. For the top ones, check what the project actually uses (grep the imports). A dependency imported in one file for one helper is a candidate to replace with a few lines of code or a smaller package.
  5. Known alternatives the script matched, such as moment, request, aws-sdk v2, node-sass, or CUDA builds of torch on a machine without a GPU. Each is a suggestion; sources are in references/sources.md.
  6. Caches. A node_modules/.vite or .cache folder is build cache, not a dependency. Mention it; do not clear it unasked.

For Go, go mod why -m <module> shows why a module is needed.

4. Change only with a yes, then re-weigh

Ask which items the user wants done. For each one they pick: make the change, reinstall with their package manager, run the tests and build, then run the weigh-in again and report before and after with the real difference.

Do not

  • Delete node_modules, a venv or the Go module cache, or uninstall, upgrade or move packages without the user asking.
  • Recommend an alternative that is unmaintained, archived or deprecated, or one you have not checked does what the project uses the old package for.
  • Promise savings the numbers do not support. Shared dependencies count in every direct dependency that pulls them in, so per-dependency totals overlap and do not add up to the total.
  • Treat this as a security or freshness audit. Vulnerable and outdated packages belong to a dependency audit, not a weigh-in.

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.