unused-package-deps

Check whether dependencies declared in package.json are actually used in this Citado monorepo. Use whenever the task is to audit unused dependencies, clean up package manifests, decide whether a package belongs in dependencies or devDependencies, confirm Knip results, or explain why a dependency should stay, move, or be removed. Also use for prompts like “检查未使用依赖”, “哪些依赖可以删”, “package.json 里有没有没用到的包”, or “为什么 Knip 报这个依赖没用”.

Nameunused-package-deps
Pathunused-package-deps
Version1.0.0
Originlocal
SourceSkillHub
Authorseekthought
Projectcitado
Tagsdependencies knip monorepo cleanup package-json
LicenseMIT

Install

skillctl install -r skillhub unused-package-deps

Purpose

Audit package.json dependencies with evidence. Do not blindly delete packages based on a single tool report.

In this repo, dependency-cruiser is already used for module-boundary and import-graph checks, but it is not the primary tool for detecting unused package.json dependencies. For manifest-level auditing, prefer Knip and then verify each candidate with source/config searches.

Primary references

What counts as “used”?

A dependency is used if any of these are true:

Important repo-specific rules

Standard workflow

1. Read the target package manifest

At minimum, check whether the package has:

2. Run Knip for declared dependency usage

Use package-scoped analysis first.

pnpm dlx knip --dependencies --workspace packages/fe

If runtime-vs-build classification matters, also run:

pnpm dlx knip --production --strict --dependencies --workspace packages/fe

Interpretation:

3. Verify each hit with search

For every flagged package, search the workspace for actual usage.

Preferred checks:

Typical commands:

rg "@tailwindcss/vite|vite-plugin-raw|wrangler" packages/fe
rg "@trpc/client|superjson" packages/fe
rg "shadcn|husky|lint-staged" packages/fe

4. Classify findings before editing

Each candidate should end in exactly one bucket:

5. Edit only after classification is clear

When the user asks to clean the manifest:

6. Re-run checks after changes

High-value heuristics

Runtime/build split

Common false positives

Be careful with these:

Citado-specific examples

Example: config-only dependency is still used

If @tailwindcss/vite appears in vite.config.ts, it is used. It belongs in devDependencies, not removal.

Example: CSS import counts as runtime usage

If src/App.css contains @import 'tw-animate-css';, then tw-animate-css is a used dependency and should not be removed.

Example: root declaration does not excuse a missing package-local declaration

If packages/fe/src/shared/api/client/trpc-client.ts imports @trpc/client and superjson, but packages/fe/package.json does not declare them, classify them as add missing direct dependency for packages/fe.

Example: lint plugin should have an import site

If eslint-plugin-react is declared but eslint.config.* does not import or reference it, it is a strong removal candidate.

Fallback when Knip cannot run cleanly

If pnpm dlx knip is blocked by network, auth, or registry issues:

  1. Inspect package scripts and config files manually.
  2. Search imports with rg.
  3. Use pnpm why <pkg> for install-path context.
  4. Report that the audit is manual and lower confidence than a Knip-backed result.

Output expectations

When reporting findings, use this order:

  1. High-confidence removable dependencies.
  2. Dependencies that should stay.
  3. Dependencies that are declared in the wrong section.
  4. Missing direct dependencies that should be added.
  5. False positives or confidence caveats.
  6. Commands run and whether package checks passed.

Success criteria

The task is not complete until you have done both:

Back to all skills