Knip
Finds unused files, exports, types, and dependencies in JavaScript and TypeScript projects. Knip analyzes your entire project's import/export graph to identify what isn't used anywhere — dead code files, exported functions nobody imports, npm dependencies listed in package.json but never required, and unlisted dependencies that are used but not declared. Particularly valuable for large codebases that have accumulated technical debt from deleted features or refactored code.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Local analysis tool — no network access. Reduces security surface by identifying unused dependencies. ISC licensed.
⚡ Reliability
Best When
You have a mature TypeScript/JavaScript codebase with accumulated dead code and want a systematic way to identify and safely remove it.
Avoid When
Your project uses heavy dynamic code patterns (dynamic require, eval, plugins) that Knip can't statically analyze.
Use Cases
- • Remove dead code from large TypeScript projects by identifying unused exports, files, and class members that can be safely deleted
- • Audit npm dependencies to find packages listed in package.json but never actually imported — reducing security surface and install times
- • Identify unlisted dependencies that are used but not in package.json — 'phantom dependencies' that work by accident via transitive dependencies
- • Clean up TypeScript monorepos by finding workspace packages that export types or functions nobody consumes across all packages
- • Run in CI to prevent dead code accumulation by failing builds when new unused exports or dependencies are introduced
Not For
- • Runtime dead code detection — Knip analyzes static imports only; dynamic requires or runtime-evaluated imports may appear as unused
- • Non-JavaScript/TypeScript projects — Knip is JS/TS ecosystem only
- • Projects using non-standard module resolution — Knip relies on TypeScript module resolution; unusual bundler configurations may produce false positives
Interface
Authentication
Local CLI tool — no authentication.
Pricing
Knip is ISC open source. Free for personal and commercial use.
Agent Metadata
Known Gotchas
- ⚠ Knip produces false positives for exports used via dynamic patterns — exported functions used in test setup files, plugin systems, or dynamic requires appear as unused; configure ignore patterns in knip.json
- ⚠ Entry point configuration is critical — Knip needs to know the project entry points to trace the import graph correctly; missing entry points cause legitimate exports to appear unused
- ⚠ Knip may report exports from libraries published as npm packages — if your repo IS the library, mark all public API exports as 'entry' exports or configure them as public
- ⚠ TypeScript path aliases (tsconfig paths like '@/components') require knip.json configuration with matching TypeScript config to resolve correctly
- ⚠ Knip analysis of large monorepos can take several minutes — first run on a big codebase may seem hung; add --reporter=progress to see progress
- ⚠ Configuration changes (adding plugins for specific tools like Astro, Remix) dramatically reduce false positives — use the correct plugin for your framework
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for Knip.
Scores are editorial opinions as of 2026-03-06.