npm-deps-cleanup
БесплатноБез исполняемых скриптовНе проверенAudit and reduce JavaScript package dependency footprint across npm, pnpm, Yarn, and Bun projects. Use when asked to remove unused dependencies, deduplicate…
от anthonyshew★ 38 звёзд на GitHubОб этом скилле
npm Dependency Cleanup
Reduce JavaScript dependency footprint. Preserve the existing package manager, lockfile, workspace layout, and dependency range style unless there is a concrete reason to change them.
Workflow
- 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.
Package Manager Detection
Use the repo's existing package manager. Prefer explicit package metadata before lockfiles:
packageManagerin the rootpackage.json.devEngines.packageManager.namein the rootpackage.json.- Lockfile inference.
When devEngines.packageManager is present, use its name for npm, pnpm, Yarn, or Bun detection. Treat its version and onFail fields as policy signals, not as permission to change package managers.
Infer from lockfiles only when package metadata does not identify the package manager:
| Signal | Package manager |
|---|---|
package-lock.json or npm-shrinkwrap.json |
npm |
pnpm-lock.yaml |
pnpm |
yarn.lock |
Yarn |
bun.lock or bun.lockb |
Bun |
Use the matching command family:
| Action | npm | pnpm | Yarn | Bun |
|---|---|---|---|---|
| Install/update lockfile | npm install |
pnpm install |
yarn install |
bun install |
| Remove direct dependency | npm uninstall <pkg> |
pnpm remove <pkg> |
yarn remove <pkg> |
bun remove <pkg> |
| Add/update direct dependency | npm install <pkg>@<version> |
pnpm add <pkg>@<version> |
yarn add <pkg>@<version> |
bun add <pkg>@<version> |
| Explain dependency | npm explain <pkg> |
pnpm why <pkg> |
yarn why <pkg> |
bun pm why <pkg> if available |
| Dedupe lockfile | npm dedupe |
pnpm dedupe |
yarn dedupe if available |
reinstall and inspect |
| One-off tools | npx <tool> |
pnpm dlx <tool> |
yarn dlx <tool> if available |
bunx <tool> |
Safety Rules
- Work in small batches so lockfile diffs remain reviewable.
- Never trust unused-dependency tools blindly; verify imports, config files, scripts, generated code hooks, framework conventions, plugin names, CLIs, and dynamic imports.
- You may write scripting and parsing to verify package.json and lockfile dependency accounts.
- Treat
peerDependencies,optionalDependencies, packagebinusage, test fixtures, and published package manifests as higher risk. - Do not remove or inline dependencies used for security, parsing, crypto, Unicode, URL handling, date/time, i18n, or platform compatibility unless the replacement is proven equivalent.
- Do not change package managers, delete lockfiles, or rewrite workspace structure as part of cleanup.
- Treat package manager dedupe commands as potentially behavior-changing. They can alter selected transitive versions within allowed ranges, so inspect lockfile diffs and run focused verification before keeping the result.
- Measure before and after: direct dependency count, lockfile line count or entry count, package count, and estimated
node_modulessize when available.
Step 1: Baseline
Collect:
- All
package.jsonfiles and workspace boundaries. - Current package manager and lockfile.
- Direct dependency names by manifest section:
dependencies,devDependencies,peerDependencies,optionalDependencies. - Existing verification commands from scripts, CI, or repo docs.
Record baseline metrics before edits:
git status --short
wc -l <lockfile>
If node_modules is installed, also estimate installed footprint with platform-appropriate filesystem tools. Do not make footprint cleanup depend on node_modules being present; lockfile reductions are the primary metric.
Step 2: Remove Unused Direct Dependencies
Use a static analyzer as a starting point, not as proof. Good candidates include knip, depcheck, or repo-native tooling if already configured. Run them through the detected package manager's one-off executor when they are not installed.
For each candidate:
1
Установить npm-deps-cleanup в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл npm-deps-cleanup?
Audit and reduce JavaScript package dependency footprint across npm, pnpm, Yarn, and Bun projects. Use when asked to remove unused dependencies, deduplicate workspace dependency versions, lockfiles or node_modules, analyze direct dependencies' transitive lockfile closure, find low-risk upgrades that reduce dependency trees, inline trivial dependencies, or apply e18e dependency replacement recommendations.
Как установить скилл npm-deps-cleanup?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл npm-deps-cleanup запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic