[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75FMWF0J3W1YT2GJ59VH5R7":3,"skill-same:01M75FMWF0J3W1YT2GJ59VH5R7":52},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M75FMWF0J3W1YT2GJ59VH5R7","audit-and-reduce-dependencies",null,"Reduces JavaScript dependency footprint with pnpm while preserving lockfile, workspace layout, and dependency range style. Runs \u002Fcheck-npm first, then removes unused deps, dedupes versions, ranks transitive closure, and reports Keep\u002FReplace\u002FRemove 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.","stanfish06\u002Fskillquarium","stanfish06","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F93099613?v=4","01M75F1CK4ZW109ZK3T26VN52F","Zhiyuan","01M75F1CM53VH6F79DZ8GXKKES",12,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Faudit-and-reduce-dependencies\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: audit-and-reduce-dependencies\nlicense: Apache-2.0\ndescription: >-\n  Reduces JavaScript dependency footprint with pnpm while preserving lockfile,\n  workspace layout, and dependency range style. Runs \u002Fcheck-npm first, then\n  removes unused deps, dedupes versions, ranks transitive closure, and reports\n  Keep\u002FReplace\u002FRemove triage. Use when cleaning up pnpm dependencies, reducing\n  lockfile size, or shrinking node_modules in Grafana plugins; not for Go\n  modules or full GitHub Actions workflow audits.\n---\n\n# Audit and reduce dependencies\n\nReduce JavaScript dependency footprint. Use **pnpm only**. Preserve the lockfile, workspace layout, and dependency range style unless there is a concrete reason to change them.\n\nFor 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**).\n\n## Workflow\n\n0. Hardening gate: run `\u002Fcheck-npm` (read-only). See [check-npm](..\u002Fcheck-npm\u002FSKILL.md).\n1. Establish the baseline.\n2. Remove unused direct dependencies.\n3. Deduplicate direct dependency versions in monorepos.\n4. Rank direct dependencies by transitive lockfile closure.\n5. Use closure data to find low-risk minor\u002Fpatch upgrades.\n6. Use closure data to find trivial dependencies worth inlining.\n7. Check e18e recommendations for replacements\u002Fremovals.\n8. Reinstall, verify, and report measured impact.\n\n## Step 0: Hardening gate (`\u002Fcheck-npm`)\n\nRun **`\u002Fcheck-npm`** before mutating manifests or lockfiles.\n\n- If any check **FAIL**s: report the table and fix snippets; **do not weaken** `pnpm-workspace.yaml`, `.npmrc`, CI install flags, or Renovate age gates during cleanup.\n- Do not paste full hardening config into this workflow — `\u002Fcheck-npm` owns version thresholds, script policy, git-dep protocols, and min release age.\n- If the user only asked for hardening (not reduction), stop after `\u002Fcheck-npm` unless they also want cleanup.\n\n**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.\n\n## Dependency triage\n\nFor each non-trivial direct dependency (especially after Steps 4–7), assign one label:\n\n| Label | Meaning |\n|-------|---------|\n| **Keep** | Required; worthwhile transitive cost; well maintained. |\n| **Replace-with-Better** | Required; better-maintained or safer alternative exists. |\n| **Replace-with-Internal** | Required; external risk warrants internal implementation. |\n| **Remove** | Can drop or inline (Step 6). |\n| **Needs-user-review** | Ambiguous usage, policy tradeoff, or change needing human verification. |\n\n**Replacements and new direct deps**\n\n- **No new direct dependencies** (including swaps) without explicit user approval.\n- Prefer **Remove** (inline\u002Fnative APIs) over **Replace-with-Better** when equivalent.\n- For **Replace-with-Better**: state why (maintenance, security, smaller tree); prefer actively maintained, widely adopted packages from trusted maintainers.\n- Respect repo `minimumReleaseAge` \u002F Renovate gates; command-level 72h freshness is a floor, not permission to bypass stricter config.\n\n## pnpm & supply-chain\n\nConfirm the repo uses pnpm: `pnpm-lock.yaml`, `pnpm-workspace.yaml`, and\u002For `packageManager` \u002F `devEngines.packageManager.name` set to `pnpm` in root `package.json`. If not on pnpm, stop — do not migrate package managers as part of cleanup.\n\nRespect repo install policy when present (e.g. `pnpm install --frozen-lockfile --ignore-scripts`).\n\n| Action | Command |\n|--------|---------|\n| Install\u002Fupdate lockfile | `pnpm install --ignore-scripts` (+ repo flags, e.g. `--frozen-lockfile`) |\n| Remove direct dependency | `pnpm remove \u003Cpkg> --ignore-scripts` |\n| Add\u002Fupdate direct dependency | `pnpm add \u003Cpkg>@\u003Cversion> --ignore-scripts` |\n| Explain dependency | `pnpm why \u003Cpkg>` |\n| Dedupe lockfile | `pnpm dedupe` (then `pnpm install --ignore-scripts` if lockfile changed) |\n| Outdated \u002F version info | `pnpm outdated \u003Cpkg>` |\n| One-off tools | `pnpm --config.ignore-scripts=true dlx \u003Cpkg>@\u003Cversion> \u003Cargs...>` (pin version; prefer `pnpm exec` when in lockfile) |\n\n**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 \u003Cpkg>`).\n\n**Freshness check (≥ 72 hours)** — required before any command that adds or upgrades a **named package version** (`pnpm add`, `pnpm dlx` with new\u002Fupgraded direct version). **Not required** for plain `pnpm install` \u002F `pnpm remove` with no new package argument.\n\nFor each directly named package:\n\n1. `curl -s https:\u002F\u002Fregistry.npmjs.org\u002F\u003Cpackage-name>`\n2. Resolve version: pinned `pkg@1.2.3` → that version; range\u002F`latest`\u002Funspecified → `dist-tags.latest`\n3. Read `time[\"\u003Cversion>\"]`\n4. If published **less than 72 hours ago** → **stop**. Tell the user package, version, and exact age. Suggest an older known-good pin unless they write **override freshness check**.\n5. **`@grafana\u002F*`** scoped packages are **exempt** from the freshness check; `--ignore-scripts` still applies.\n\nAfter a failed freshness check, do not substitute a different version without user approval.\n\n## Safety rules\n\n- Work in small batches so lockfile diffs remain reviewable.\n- Never trust unused-dependency tools blindly; verify imports, config files, scripts, generated code hooks, framework conventions, plugin names, CLIs, and dynamic imports.\n- You may write scripting and parsing to verify `package.json` and lockfile dependency accounts.\n- Treat `peerDependencies`, `optionalDependencies`, package bin usage, test fixtures, and published package manifests as higher risk.\n- Do not remove or inline dependencies used for security, parsing, crypto, Unicode, URL handling, date\u002Ftime, i18n, or platform compatibility unless the replacement is proven equivalent.\n- Do not switch package managers, delete `pnpm-lock.yaml`, or rewrite workspace structure as part of cleanup.\n- Treat `pnpm dedupe` as potentially behavior-changing; inspect lockfile diffs and run focused verification before keeping the result.\n- Measure before and after: direct dependency count, lockfile line count or entry count, package count, and estimated `node_modules` size when available.\n\n## Step 1: Baseline\n\nCollect:\n\n- All `package.json` files and workspace boundaries (`pnpm-workspace.yaml`).\n- `pnpm-lock.yaml`, `pnpm-workspace.yaml` security settings (`minimumReleaseAge`, `strictDepBuilds`, `blockExoticSubdeps`, `allowBuilds`), and install policy in `.npmrc` \u002F CI flags (e.g. `--frozen-lockfile`, `--ignore-scripts`).\n- Direct dependency names by manifest section: `dependencies`, `devDependencies`, `peerDependencies`, `optionalDependencies`.\n- Existing verification commands from scripts, CI, or repo docs.\n- **CI spot-check** (`.github\u002Fworkflows` or equivalent): installs should use `pnpm install --frozen-lockfile` and script blocking consistent with workspace config. Flag workflows that regenerate lockfiles on every run.\n- **Renovate \u002F Dependabot** (if present): note `minimumReleaseAge` for npm packages; do not reduce it during cleanup.\n\nRecord baseline metrics: `git status --short`, `wc -l pnpm-lock.yaml`. If `node_modules` is installed, estimate footprint with platform-appropriate tools. Lockfile reductions are the primary metric — do not depend on `node_modules` being present.\n\n## Step 2: Remove unused direct dependencies\n\n**Unsafe direct dependency protocols** — scan all workspace `package.json` dependency sections. Flag values that are not: semver range, `workspace:`, `patch:`, or `npm:` alias to semver. Flag `git:` \u002F `github:` \u002F tarball URLs \u002F `user\u002Frepo` shorthand \u002F `file:` \u002F `link:` \u002F `exec:` \u002F etc. (same allow-list as `\u002Fcheck-npm`). Do not remove flagged entries silently; report for a separate hardening PR unless the user asked to fix them.\n\nUse a static analyzer as a starting point, not as proof (knip, depcheck, or repo-native tooling). Run with pinned `pnpm --config.ignore-scripts=true dlx \u003Ctool>@\u003Cversion> \u003Cargs...>` when not installed (freshness-check the pin first).\n\nFor each candidate:\n\n- Search code, configs, package scripts, build tooling, tests, and docs for the package name and known import paths.\n- Check whether required by a published package manifest, peer contract, plugin loader, CLI command, or dynamic `require`\u002F`import`.\n- Remove only when no real usage remains.\n- Run `pnpm install --ignore-scripts` (+ repo flags) and focused verification.\n\nIf usage is only in a script or config, consider moving between `dependencies` and `devDependencies` instead of removing.\n\n## Step 3: Deduplicate monorepo direct versions\n\nLook for the same direct dependency declared with multiple versions\u002Franges across package manifests. Use existing policy first: exact pins, caret ranges, catalog\u002Fprotocol usage, workspace protocol, or central constraints.\n\n- Use `syncpack list-mismatches` or equivalent for discovery.\n- Standardize direct ranges when packages can share the same compatible version.\n- Prefer manifest-level consistency before adding `pnpm.overrides`.\n- Use `pnpm.overrides` only for transitive convergence or security fixes, and document why.\n\nAfter deduping, run `pnpm install --ignore-scripts` (+ repo flags) and inspect manifest and lockfile diffs. Then consider `pnpm dedupe` — apply carefully; may change transitive resolution.\n\n## Step 4: Rank transitive lockfile closure\n\nFor each important direct dependency, estimate closure: transitive lockfile entries reachable from that dependency.\n\nReport both:\n\n- **Total closure**: all packages reachable from the dependency.\n- **Exclusive closure**: packages that disappear if this dependency is removed and are not retained by other direct dependencies.\n\nPrefer deterministic measurement:\n\n1. Save baseline lockfile metrics.\n2. Temporarily remove one direct dependency from the owning manifest.\n3. Run `pnpm install --ignore-scripts` (+ repo flags).\n4. Measure lockfile line\u002Fentry reduction and package count reduction.\n5. Revert the manifest *and* `pnpm-lock.yaml` (e.g., `git checkout -- \u003Cmanifest> pnpm-lock.yaml`) before measuring the next dependency.\n\nUse `pnpm why \u003Cpkg>` for large transitive packages. Rank by impact and risk, not just raw size.\n\n## Step 5: Find low-risk high-impact upgrades\n\nUse closure rankings to target direct dependencies whose newer minor\u002Fpatch versions reduce transitive dependencies.\n\nFor each candidate:\n\n- Check available non-major versions with `pnpm outdated`.\n- Review changelog\u002Frelease notes for dependency tree changes.\n- Freshness-check the target version, then upgrade one dependency or tight cluster at a time (`pnpm add \u003Cpkg>@\u003Cversion> --ignore-scripts`).\n- Run `pnpm install --ignore-scripts` (+ repo flags) and compare closure metrics.\n- Run focused tests and relevant build\u002Ftypecheck commands.\n\nAvoid major upgrades unless the user explicitly accepts the migration risk.\n\n## Step 6: Inline trivial usage\n\nUse closure rankings to find direct dependencies with small, obvious usage but large transitive cost.\n\nInline only when all are true:\n\n- Usage is tiny and easy to fully characterize.\n- Equivalent code is shorter or clearer than retaining the dependency.\n- Behavior is covered by tests or can be covered with small characterization tests.\n- The dependency is not solving cross-platform, security, parsing, Unicode, locale, or spec-compliance edge cases.\n\nPrefer native APIs over new replacement dependencies when the required behavior is simple.\n\n## Step 7: Apply e18e guidance\n\n```bash\n# Pin @e18e\u002Fcli@\u003Cversion> after freshness check; disable scripts on the dlx install\npnpm --config.ignore-scripts=true dlx @e18e\u002Fcli@\u003Cversion> analyze\npnpm --config.ignore-scripts=true dlx @e18e\u002Fcli@\u003Cversion> migrate --dry-run\n```\n\nAlso check https:\u002F\u002Fe18e.dev\u002Fdocs\u002Freplacements\u002F. Treat recommendations as candidates, not mandates; verify bundle\u002Fruntime behavior and run tests. Map e18e swaps to **Replace-with-Better** only after user approval.\n\n## Reporting\n\nSummarize outcomes with measured impact:\n\n- `\u002Fcheck-npm` result (PASS\u002FFAIL summary; link fixes if FAIL).\n- Direct dependencies removed or moved.\n- Direct versions deduplicated.\n- Lockfile line\u002Fentry reduction.\n- Estimated package or `node_modules` reduction when available.\n- High-impact candidates deferred and why (including replacements awaiting approval).\n- Unsafe protocol \u002F CI \u002F Renovate findings from baseline (if any).\n- Verification commands run and results.\n- Supply-chain: versions freshness-checked (or exempted), `--ignore-scripts` on all installs\u002Fadds, `--config.ignore-scripts=true` on `pnpm dlx`.\n\nCall out risk explicitly when a removal depends on static analysis rather than runtime coverage.\n\n### Reporting format\n\nUse for **dependency cleanup findings only** — not GitHub Actions workflow triage.\n\nFor each finding:\n\n- **Evidence**: package name and version\u002Frange; manifest path and section; supporting signal (import site, `pnpm why`, knip\u002Fdepcheck hit, closure measurement, `\u002Fcheck-npm` row, or workflow file + step only for **pnpm install policy**).\n- **Decision**: one of **Dependency triage** labels.\n- **Proposed change**: exact manifest\u002Flockfile command or edit. If not applied yet, state that explicitly.\n- **Rationale**: footprint (exclusive\u002Ftotal closure), supply-chain, maintenance, or verification risk.\n- **User review required**: tests\u002Fbuild\u002Ftypecheck to run; peer\u002Fplugin\u002FCLI consumers; published-package or dynamic-import risk; approval before **Replace-with-Better** or any new direct dependency.\n\nUse one block per package (or per protocol\u002FCI finding), not a single-line summary, when the finding is non-trivial.\n","# Audit and reduce dependencies\n\nReduce JavaScript dependency footprint. Use **pnpm only**. Preserve the lockfile, workspace layout, and dependency range style unless there is a concrete reason to change them.\n\nFor 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**).\n\n## Workflow\n\n0. Hardening gate: run `\u002Fcheck-npm` (read-only). See [check-npm](..\u002Fcheck-npm\u002FSKILL.md).\n1. Establish the baseline.\n2. Remove unused direct dependencies.\n3. Deduplicate direct dependency versions in monorepos.\n4. Rank direct dependencies by transitive lockfile closure.\n5. Use closure data to find low-risk minor\u002Fpatch upgrades.\n6. Use closure data to find trivial dependencies worth inlining.\n7. Check e18e recommendations for replacements\u002Fremovals.\n8. Reinstall, verify, and report measured impact.\n\n## Step 0: Hardening gate (`\u002Fcheck-npm`)\n\nRun **`\u002Fcheck-npm`** before mutating manifests or lockfiles.\n\n- If any check **FAIL**s: report the table and fix snippets; **do not weaken** `pnpm-workspace.yaml`, `.npmrc`, CI install flags, or Renovate age gates during cleanup.\n- Do not paste full hardening config into this workflow — `\u002Fcheck-npm` owns version thresholds, script policy, git-dep protocols, and min release age.\n- If the user only asked for hardening (not reduction), stop after `\u002Fcheck-npm` unless they also want cleanup.\n\n**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.\n\n## Dependency triage\n\nFor each non-trivial direct dependency (especially after Steps 4–7), assign one label:\n\n| Label | Meaning |\n|-------|---------|\n| **Keep** | Required; worthwhile transitive cost; well maintained. |\n| **Replace-with-Better** | Required; better-maintained or safer alternative exists. |\n| **Replace-with-Internal** | Required; external risk warrants internal implementation. |\n| **Remove** | Can drop or inline (Step 6). |\n| **Needs-user-review** | Ambiguous usage, policy tradeoff, or change needing human verification. |\n\n**Replacements and new direct deps**\n\n- **No new direct dependencies** (including swaps) without explicit user approval.\n- Prefer **Remove** (inline\u002Fnative APIs) over **Replace-with-Better** when equivalent.\n- For **Replace-with-Better**: state why (maintenance, security, smaller tree); prefer actively maintained, widely adopted packages from trusted maintainers.\n- Respect repo `minimumReleaseAge` \u002F Renovate gates; command-level 72h freshness is a floor, not permission to bypass stricter config.\n\n## pnpm & supply-chain\n\nConfirm the repo uses pnpm: `pnpm-lock.yaml`, `pnpm-workspace.yaml`, and\u002For `packageManager` \u002F `devEngines.packageManager.name` set to `pnpm` in root `package.json`. If not on pnpm, stop — do not migrate package managers as part of cleanup.\n\nRespect repo install policy when present (e.g. `pnpm install --frozen-lockfile --ignore-scripts`).\n\n| Action | Command |\n|--------|---------|\n| Install\u002Fupdate lockfile | `pnpm install --ignore-scripts` (+ repo flags, e.g. `--frozen-lockfile`) |\n| Remove direct dependency | `pnpm remove \u003Cpkg> --ignore-scripts` |\n| Add\u002Fupdate direct dependency | `pnpm add \u003Cpkg>@\u003Cversion> --ignore-scripts` |\n| Explain dependency | `pnpm why \u003Cpkg>` |\n| Dedupe lockfile | `pnpm dedupe` (then `pnpm install --ignore-scripts` if lockfile changed) |\n| Outdated \u002F version info | `pnpm outdated \u003Cpkg>` |\n| One-off tools | `pnpm --config.ignore-scripts=true dlx \u003Cpkg>@\u003Cversion> \u003Cargs...>` (pin version; prefer `pnpm exec` when in lockfile) |\n\n**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 \u003Cpkg>`).\n\n**Freshness check (≥ 72 hours)** — required before any command that adds or upgrades a **named package version** (`pnpm add`, `pnpm dlx` with new\u002Fupgraded direct version). **Not required** for plain `pnpm install` \u002F `pnpm remove` with no new package argument.\n\nFor each directly named package:\n\n1. `curl -s https:\u002F\u002Fregistry.npmjs.org\u002F\u003Cpackage-name>`\n2. Resolve version: pinned `pkg@1.2.3` → that version; range\u002F`latest`\u002Funspecified → `dist-tags.latest`\n3. Read `time[\"\u003Cversion>\"]`\n4. If published **less than 72 hours ago** → **stop**. Tell the user package, version, and exact age. Suggest an older known-good pin unless they write **override freshness check**.\n5. **`@grafana\u002F*`** scoped packages are **exempt** from the freshness check; `--ignore-scripts` still applies.\n\nAfter a failed freshness check, do not substitute a different version without user approval.\n\n## Safety rules\n\n- Work in small batches so lockfile diffs remain reviewable.\n- Never trust unused-dependency tools blindly; verify imports, config files, scripts, generated code hooks, framework conventions, plugin names, CLIs, and dynamic imports.\n- You may write scripting and parsing to verify `package.json` and lockfile dependency accounts.\n- Treat `peerDependencies`, `optionalDependencies`, package bin usage, test fixtures, and published package manifests as higher risk.\n- Do not remove or inline dependencies used for security, parsing, crypto, Unicode, URL handling, date\u002Ftime, i18n, or platform compatibility unless the replacement is proven equivalent.\n- Do not switch package managers, delete `pnpm-lock.yaml`, or rewrite workspace structure as part of cleanup.\n- Treat `pnpm dedupe` as potentially behavior-changing; inspect lockfile diffs and run focused verification before keeping the result.\n- Measure before and after: direct dependency count, lockfile line count or entry count, package count, and estimated `node_modules` size when available.\n\n## Step 1: Baseline\n\nCollect:\n\n- All `package.json` files and workspace boundaries (`pnpm-workspace.yaml`).\n- `pnpm-lock.yaml`, `pnpm-workspace.yaml` security settings (`minimumReleaseAge`, `strictDepBuilds`, `blockExoticSubdeps`, `allowBuilds`), and install policy in `.npmrc` \u002F CI flags (e.g. `--frozen-lockfile`, `--ignore-scripts`).\n- Direct dependency names by manifest section: `dependencies`, `devDependencies`, `peerDependencies`, `optionalDependencies`.\n- Existing verification commands from scripts, CI, or repo docs.\n- **CI spot-check** (`.github\u002Fworkflows` or equivalent): installs should use `pnpm install --frozen-lockfile` and script blocking consistent with workspace config. Flag workflows that regenerate lockfiles on every run.\n- **Renovate \u002F Dependabot** (if present): note `minimumReleaseAge` for npm packages; do not reduce it during cleanup.\n\nRecord baseline metrics: `git status --short`, `wc -l pnpm-lock.yaml`. If `node_modules` is installed, estimate footprint with platform-appropriate tools. Lockfile reductions are the primary metric — do not depend on `node_modules` being present.\n\n## Step 2: Remove unused direct dependencies\n\n**Unsafe direct dependency protocols** — scan all workspace `package.json` dependency sections. Flag values that are not: semver range, `workspace:`, `patch:`, or `npm:` alias to semver. Flag `git:` \u002F `github:` \u002F tarball URLs \u002F `user\u002Frepo` shorthand \u002F `file:` \u002F `link:` \u002F `exec:` \u002F etc. (same allow-list as `\u002Fcheck-npm`). Do not remove flagged entries silently; report for a separate hardening PR unless the user asked to fix them.\n\nUse a static analyzer as a starting point, not as proof (knip, depcheck, or repo-native tooling). Run with pinned `pnpm --config.ignore-scripts=true dlx \u003Ctool>@\u003Cversion> \u003Cargs...>` when not installed (freshness-check the pin first).\n\nFor each candidate:\n\n- Search code, configs, package scripts, build tooling, tests, and docs for the package name and known import paths.\n- Check whether required by a published package manifest, peer contract, plugin loader, CLI command, or dynamic `require`\u002F`import`.\n- Remove only when no real usage remains.\n- Run `pnpm install --ignore-scripts` (+ repo flags) and focused verification.\n\nIf usage is only in a script or config, consider moving between `dependencies` and `devDependencies` instead of removing.\n\n## Step 3: Deduplicate monorepo direct versions\n\nLook for the same direct dependency declared with multiple versions\u002Franges across package manifests. Use existing policy first: exact pins, caret ranges, catalog\u002Fprotocol usage, workspace protocol, or central constraints.\n\n- Use `syncpack list-mismatches` or equivalent for discovery.\n- Standardize direct ranges when packages can share the same compatible version.\n- Prefer manifest-level consistency before adding `pnpm.overrides`.\n- Use `pnpm.overrides` only for transitive convergence or security fixes, and document why.\n\nAfter deduping, run `pnpm install --ignore-scripts` (+ repo flags) and inspect manifest and lockfile diffs. Then consider `pnpm dedupe` — apply carefully; may change transitive resolution.\n\n## Step 4: Rank transitive lockfile closure\n\nFor each important direct dependency, estimate closure: transitive lockfile entries reachable from that dependency.\n\nReport both:\n\n- **Total closure**: all packages reachable from the dependency.\n- **Exclusive closure**: packages that disappear if this dependency is removed and are not retained by other direct dependencies.\n\nPrefer deterministic measurement:\n\n1. Save baseline lockfile metrics.\n2. Temporarily remove one direct dependency from the owning manifest.\n3. Run `pnpm install --ignore-scripts` (+ repo flags).\n4. Measure lockfile line\u002Fentry reduction and package count reduction.\n5. Revert the manifest *and* `pnpm-lock.yaml` (e.g., `git checkout -- \u003Cmanifest> pnpm-lock.yaml`) before measuring the next dependency.\n\nUse `pnpm why \u003Cpkg>` for large transitive packages. Rank by impact and risk, not just raw size.\n\n## Step 5: Find low-risk high-impact upgrades\n\nUse closure rankings to target direct dependencies whose newer minor\u002Fpatch versions reduce transitive dependencies.\n\nFor each candidate:\n\n- Check available non-major versions with `pnpm outdated`.\n- Review changelog\u002Frelease notes for dependency tree changes.\n- Freshness-check the target version, then upgrade one dependency or tight cluster at a time (`pnpm add \u003Cpkg>@\u003Cversion> --ignore-scripts`).\n- Run `pnpm install --ignore-scripts` (+ repo flags) and compare closure metrics.\n- Run focused tests and relevant build\u002Ftypecheck commands.\n\nAvoid major upgrades unless the user explicitly accepts the migration risk.\n\n## Step 6: Inline trivial usage\n\nUse closure rankings to find direct dependencies with small, obvious usage but large transitive cost.\n\nInline only when all are true:\n\n- Usage is tiny and easy to fully characterize.\n- Equivalent code is shorter or clearer than retaining the dependency.\n- Behavior is covered by tests or can be covered with small characterization tests.\n- The dependency is not solving cross-platform, security, parsing, Unicode, locale, or spec-compliance edge cases.\n\nPrefer native APIs over new replacement dependencies when the required behavior is simple.\n\n## Step 7: Apply e18e guidance\n\n```bash\n# Pin @e18e\u002Fcli@\u003Cversion> after freshness check; disable scripts on the dlx install\npnpm --config.ignore-scripts=true dlx @e18e\u002Fcli@\u003Cversion> analyze\npnpm --config.ignore-scripts=true dlx @e18e\u002Fcli@\u003Cversion> migrate --dry-run\n```\n\nAlso check https:\u002F\u002Fe18e.dev\u002Fdocs\u002Freplacements\u002F. Treat recommendations as candidates, not mandates; verify bundle\u002Fruntime behavior and run tests. Map e18e swaps to **Replace-with-Better** only after user approval.\n\n## Reporting\n\nSummarize outcomes with measured impact:\n\n- `\u002Fcheck-npm` result (PASS\u002FFAIL summary; link fixes if FAIL).\n- Direct dependencies removed or moved.\n- Direct versions deduplicated.\n- Lockfile line\u002Fentry reduction.\n- Estimated package or `node_modules` reduction when available.\n- High-impact candidates deferred and why (including replacements awaiting approval).\n- Unsafe protocol \u002F CI \u002F Renovate findings from baseline (if any).\n- Verification commands run and results.\n- Supply-chain: versions freshness-checked (or exempted), `--ignore-scripts` on all installs\u002Fadds, `--config.ignore-scripts=true` on `pnpm dlx`.\n\nCall out risk explicitly when a removal depends on static analysis rather than runtime coverage.\n\n### Reporting format\n\nUse for **dependency cleanup findings only** — not GitHub Actions workflow triage.\n\nFor each finding:\n\n- **Evidence**: package name and version\u002Frange; manifest path and section; supporting signal (import site, `pnpm why`, knip\u002Fdepcheck hit, closure measurement, `\u002Fcheck-npm` row, or workflow file + step only for **pnpm install policy**).\n- **Decision**: one of **Dependency triage** labels.\n- **Proposed change**: exact manifest\u002Flockfile command or edit. If not applied yet, state that explicitly.\n- **Rationale**: footprint (exclusive\u002Ftotal closure), supply-chain, maintenance, or verification risk.\n- **User review required**: tests\u002Fbuild\u002Ftypecheck to run; peer\u002Fplugin\u002FCLI consumers; published-package or dynamic-import risk; approval before **Replace-with-Better** or any new direct dependency.\n\nUse one block per package (or per protocol\u002FCI finding), not a single-line summary, when the finding is non-trivial.\n",{"name":5,"license":15,"description":7},"master","49e49abf2f670d429e0b7e2c0349739c3fdd5cbe","skills\u002Faudit-and-reduce-dependencies",5,"https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium","https:\u002F\u002Fgithub.com\u002Fstanfish06","https:\u002F\u002Fwww.stanfish.dev\u002F","2026-11-14 21:31:37",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add stanfish06\u002Fskillquarium --skill audit-and-reduce-dependencies",{"tool":38,"command":39},"bunx","bunx skills add stanfish06\u002Fskillquarium --skill audit-and-reduce-dependencies",{"tool":41,"command":42},"pnpm","pnpm dlx skills add stanfish06\u002Fskillquarium --skill audit-and-reduce-dependencies","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Faudit-and-reduce-dependencies\u002FSKILL.md",true,[46],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"agents\u002Fopenai.yaml","REFERENCE","参考文档",194,"https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Faudit-and-reduce-dependencies\u002Fagents\u002Fopenai.yaml",[53,61,69,76,83,90],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":57,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M76ZJTRVA456GD7K8Y3EP82H","zarr-python","Stores and queries chunked N-D scientific arrays with Zarr-Python 3, including codecs, sharding, S3\u002FGCS storage, and NumPy\u002FDask\u002FXarray integration. Use for array layout, bounded I\u002FO, format migration, or scientific metadata preservation.","MIT","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fzarr-python\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":65,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M76ZJQZ15Q1HKC5V85NHE325","yeet","Publish local changes to GitHub by confirming scope, committing intentionally, pushing the branch, and opening a draft PR through the GitHub app from this plugin, with `gh` used only as a fallback where connector coverage is insufficient.","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fyeet\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fyeet\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M76ZJ8ASZ4QYQ70Y6SBA4Z4S","xarray","N-dimensional labeled arrays and datasets in Python. Built on top of NumPy and Dask. It introduces labels in the form of dimensions, coordinates, and attributes on top of raw NumPy-like arrays, making data analysis in physical sciences more intuitive and less error-prone. Use for working with multi-dimensional scientific data, NetCDF\u002FGRIB\u002FZarr files, climate\u002Fweather\u002Foceanographic datasets, remote sensing, geospatial imaging, large out-of-memory datasets with Dask, and labeled array operations.","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fxarray\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":57,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M76ZHFBXD6VXPQ02VCEG202B","writing-mstest-tests","Use when asked to fix, rewrite, update, improve, modernize, show corrected code for, or explain existing MSTest tests or MSTest-specific configuration. Use for \"review\" when corrected code or edits are wanted, even for one pasted assertion or passing tests with bad failure output. Covers expected\u002Factual labels; generic Boolean, collection, string, numeric, null, identity, exception, hard-cast, and object[] checks; TestContext\u002Flifecycle; timeout\u002Fcancellation; OS\u002FCI conditions, retry, cleanup, parallelization, MSTest.Sdk project setup, and MSTESTxxxx. Honor the installed MSTest version. DO NOT USE to design new test cases (code-testing), perform report-only audits, create project files rather than explain MSTest setup, run tests, migrate frameworks, or handle non-MSTest\u002Fnon-.NET code.","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fwriting-mstest-tests\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":57,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M76ZDFDF4N88RH6HSYGS7GP2","wgs-prs","End-to-end WGS to polygenic risk score pipeline. Takes paired-end FASTQ files (or a pre-existing VCF) through nf-core\u002Fsarek for variant calling, applies VCF QC (normalisation, hard filtering, Ti\u002FTv and Het\u002FHom checks), then computes polygenic risk scores via the PGS Catalog. Fills the FASTQ to VCF gap upstream of the gwas-prs skill.","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fwgs-prs\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":94,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":19},"01M76ZCC1SC68J42QK4MDC8RCG","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fwebapp-testing\u002FSKILL.md",[],[]]