audit-and-reduce-dependencies
БесплатноБез исполняемых скриптовНе проверенReduces JavaScript dependency footprint with pnpm while preserving lockfile, workspace layout, and dependency range style. Runs /check-npm first, then removes…
от grafana★ 328 звёзд на GitHubОб этом скилле
Audit and reduce dependencies
Reduce JavaScript dependency footprint. Use pnpm only. Preserve the lockfile, workspace layout, and dependency range style unless there is a concrete reason to change them.
For GitHub Actions workflow triage (action choice, permissions, pinning), use a dedicated workflow audit — not the reporting format below (workflow file + step only when the finding is pnpm install policy).
Workflow
- Hardening gate: run
/check-npm(read-only). See check-npm. - Establish the baseline.
- Remove unused direct dependencies.
- Deduplicate direct dependency versions in monorepos.
- Rank direct dependencies by transitive lockfile closure.
- Use closure data to find low-risk minor/patch upgrades.
- Use closure data to find trivial dependencies worth inlining.
- Check e18e recommendations for replacements/removals.
- Reinstall, verify, and report measured impact.
Step 0: Hardening gate (/check-npm)
Run /check-npm before mutating manifests or lockfiles.
- If any check FAILs: report the table and fix snippets; do not weaken
pnpm-workspace.yaml,.npmrc, CI install flags, or Renovate age gates during cleanup. - Do not paste full hardening config into this workflow —
/check-npmowns version thresholds, script policy, git-dep protocols, and min release age. - If the user only asked for hardening (not reduction), stop after
/check-npmunless they also want cleanup.
pnpm 11+: script and release-age policy live in pnpm-workspace.yaml, not .npmrc or package.json#pnpm (pnpm 11 no longer reads the package.json#pnpm field). Verify each key against the installed pnpm major before suggesting config. Never add unsupported keys. Do not lower an existing minimumReleaseAge (or org equivalent) during cleanup.
Dependency triage
For each non-trivial direct dependency (especially after Steps 4–7), assign one label:
| Label | Meaning |
|---|---|
| Keep | Required; worthwhile transitive cost; well maintained. |
| Replace-with-Better | Required; better-maintained or safer alternative exists. |
| Replace-with-Internal | Required; external risk warrants internal implementation. |
| Remove | Can drop or inline (Step 6). |
| Needs-user-review | Ambiguous usage, policy tradeoff, or change needing human verification. |
Replacements and new direct deps
- No new direct dependencies (including swaps) without explicit user approval.
- Prefer Remove (inline/native APIs) over Replace-with-Better when equivalent.
- For Replace-with-Better: state why (maintenance, security, smaller tree); prefer actively maintained, widely adopted packages from trusted maintainers.
- Respect repo
minimumReleaseAge/ Renovate gates; command-level 72h freshness is a floor, not permission to bypass stricter config.
pnpm & supply-chain
Confirm the repo uses pnpm: pnpm-lock.yaml, pnpm-workspace.yaml, and/or packageManager / devEngines.packageManager.name set to pnpm in root package.json. If not on pnpm, stop — do not migrate package managers as part of cleanup.
Respect repo install policy when present (e.g. pnpm install --frozen-lockfile --ignore-scripts).
| Action | Command |
|---|---|
| Install/update lockfile | pnpm install --ignore-scripts (+ repo flags, e.g. --frozen-lockfile) |
| Remove direct dependency | pnpm remove <pkg> --ignore-scripts |
| Add/update direct dependency | pnpm add <pkg>@<version> --ignore-scripts |
| Explain dependency | pnpm why <pkg> |
| Dedupe lockfile | pnpm dedupe (then pnpm install --ignore-scripts if lockfile changed) |
| Outdated / version info | pnpm outdated <pkg> |
| One-off tools | pnpm --config.ignore-scripts=true dlx <pkg>@<version> <args...> (pin version; prefer pnpm exec when in lockfile) |
Lifecycle scripts: Always --ignore-scripts on pnpm install, pnpm add, and pnpm remove unless the user explicitly writes allow scripts in the same message (state which scripts would run and the risk). For pnpm dlx, dlx does not accept --ignore-scripts directly — use pnpm --config.ignore-scripts=true dlx (flags after dlx are forwarded to the executed binary). If a dependency legitimately needs a build script (native modules, etc.), finish without scripts, then ask whether to run a specific manual rebuild (e.g. pnpm rebuild <pkg>).
Freshness check (≥ 72 hours) — required before any command that adds or upgrades a named package version (pnpm add, pnpm dlx with new/upgraded direct version). Not required for plain pnpm install / pnpm remove with no new package argument.
For each directly named package:
curl -s https://registry.npmjs.org/<package-name>- Resolve version: pinned
[email protected]→ that version; range/latest/unspecified →dist-tags.latest - Read
time["<version>"] - If published less than 72 hours ago → stop. Tell the user package, version, and exa
Установить audit-and-reduce-dependencies в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл audit-and-reduce-dependencies?
Reduces JavaScript dependency footprint with pnpm while preserving lockfile, workspace layout, and dependency range style. Runs /check-npm first, then removes unused deps, dedupes versions, ranks transitive closure, and reports Keep/Replace/Remove triage. Use when cleaning up pnpm dependencies, reducing lockfile size, or shrinking node_modules in Grafana plugins; not for Go modules or full GitHub Actions workflow audits.
Как установить скилл audit-and-reduce-dependencies?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл audit-and-reduce-dependencies запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic