Knip
$ knip Community Low RiskFast dependency and dead-code analyzer for JavaScript and TypeScript projects with 100+ framework plugins (Next.js, Vite, Vitest, Jest, Playwright). Produces structured --reporter json output and supports --production and --fix cleanup.
npm install -D knip Walks local TypeScript/JS module graphs and package.json manifests offline in seconds.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Supports --reporter json, --include/--exclude category filters, --no-exit-code, and --workspace targeting.
--reporter jsonyields structured dead-code inventories--include/--excludefilter issue types cleanly
Read-only by default; refuses to delete unused files even under --fix unless --allow-remove-files is also passed.
- Requires explicit
--allow-remove-filesopt-in for file deletion
Cross-platform npm package requiring Node.js in the project workspace.
- Runs cleanly via
npx knipacross macOS, Linux, and Windows
Auto-detects 100+ JS/TS tools (Next.js, Vite, Turborepo, Vitest) to dramatically lower dead-code false positives.
- Built-in workspace and framework plugin ecosystem
Actively developed community project (webpro-nl/knip) under ISC license.
- Frequent releases at
webpro-nl/knip
Well-organized CLI reference and plugin docs at knip.dev.
- Official CLI reference at knip.dev/reference/cli
Security, Auth & Guardrails
Offline local module-graph analyzer; no credentials stored or required.
ISC open-source npm package; completely free.
# Knip (knip) Agent Rules - Always run `npx knip --reporter json` read-only and review findings before using `--fix`. - Never pass `--allow-remove-files` without user confirmation, as dynamic imports or framework entrypoints can cause false positives.
Agent-Ready Command Recipes
Safe Read-Only Queries
npx knip --reporter json --no-exit-code
Emits structured JSON detailing unused files, dependencies, devDependencies, and exports without modifying files.
npx knip --production --reporter json
Scopes dead-code analysis strictly to production entry points and dependencies.
Controlled Writes & Previews
npx knip --fix --allow-remove-files
Removes flagged unused exports, package.json entries, and files when explicitly permitted.
Strengths for Agents
- +
--reporter jsonand--include/--excludelet agents inspect unused files, exports, and dependencies precisely. - + File deletion requires explicit
--allow-remove-files, protecting against accidental removals.
Caveats & Pitfalls
- ! Dynamic
require()or unconventional entrypoints can trigger false positives until configured inknip.json. - ! Requires
node_modulesinstalled in the workspace for accurate dependency graph resolution.