Knip finds unused files, npm dependencies, and TypeScript exports in JavaScript and TypeScript codebases. It uses entry-point analysis tuned to your frameworks and monorepo layout.
Overview
Knip is a project linter focused on dead code and dependency clutter in JavaScript and TypeScript repositories. It traces usage from fine-grained entry points through the tools you actually run, aiming for actionable reports rather than noisy guesses.
It ships with a large set of plugins for Astro, Cypress, ESLint, Jest, GitHub Actions, Next.js, Nx, Remix, Storybook, Svelte, Vite, Vitest, Webpack, and many others. Results can guide manual cleanup or CI enforcement to keep packages and exports lean over time.
Distribution includes the main knip CLI package, a create-config helper, a language server, and an MCP server so coding agents can generate configuration. A VS Code extension is available on both marketplace registries, and the site offers a playground to try analysis online.
Typical workflow is install via npm, run knip against the project, refine config as needed, and optionally wire the MCP server so agents automate setup. The tool name refers to cutting unused pieces before release.
Key features
- Unused file detection
- Unused npm dependency reports
- Unused TypeScript export analysis
- Framework-aware entry point graph
- Hundreds of tool plugins
- Language server package
- MCP server for agent setup
- VS Code extension support
Use cases
- Pruning dead code before releases
- CI gates on unused dependencies
- Monorepo maintenance automation
- Agent-driven Knip configuration
- Reducing bundle and install weight