Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

Knip

$ knip Community Low Risk
webpro · Code & DevOps · ISC · macos / linux / windows

Fast 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.

FCRS-1.0 Score
90 /100
Excellent
Medium Confidence
Zero-Friction Install
npm install -D knip
CLI vs MCP Decision CLI Only

Walks local TypeScript/JS module graphs and package.json manifests offline in seconds.

Agent-Readiness Checklist

✓ JSON Output
✓ Field Filtering
✓ Non-Interactive
— Dry-Run
✓ Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 23 / 25

Supports --reporter json, --include/--exclude category filters, --no-exit-code, and --workspace targeting.

  • --reporter json yields structured dead-code inventories
  • --include / --exclude filter issue types cleanly
Trust & Safety 24 / 25

Read-only by default; refuses to delete unused files even under --fix unless --allow-remove-files is also passed.

  • Requires explicit --allow-remove-files opt-in for file deletion
Setup & Portability 13 / 15

Cross-platform npm package requiring Node.js in the project workspace.

  • Runs cleanly via npx knip across macOS, Linux, and Windows
Utility & Efficiency 14 / 15

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
Maintenance & Lineage 8 / 10

Actively developed community project (webpro-nl/knip) under ISC license.

  • Frequent releases at webpro-nl/knip
Docs & Verifiability 8 / 10

Well-organized CLI reference and plugin docs at knip.dev.

  • Official CLI reference at knip.dev/reference/cli

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

Offline local module-graph analyzer; no credentials stored or required.

Side Effects
Read-Only Local Write
Cost & Quotas

ISC open-source npm package; completely free.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# 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

Audit unused files, deps, and exports as JSON
npx knip --reporter json --no-exit-code

Emits structured JSON detailing unused files, dependencies, devDependencies, and exports without modifying files.

Check production entrypoints only
npx knip --production --reporter json

Scopes dead-code analysis strictly to production entry points and dependencies.

Controlled Writes & Previews

Auto-remove unused exports and dependencies
npx knip --fix --allow-remove-files

Removes flagged unused exports, package.json entries, and files when explicitly permitted.

Strengths for Agents

  • + --reporter json and --include/--exclude let 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 in knip.json.
  • ! Requires node_modules installed in the workspace for accurate dependency graph resolution.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI