Knip
Knip finds and fixes unused dependencies, exports, and files in JavaScript and TypeScript projects.
At a Glance
About Knip
Knip is an open-source static analysis tool that declutters JavaScript and TypeScript projects by finding unused dependencies, unused exports, and unused files. Less code and fewer dependencies lead to improved performance, less maintenance, and easier refactorings.
Knip works by building a dependency graph of your codebase starting from fine-grained entry points based on the actual frameworks and tooling in use. This results in accurate, actionable findings rather than the false positives common in older dead-code tools.
What it detects
- Unused files
- Unused dependencies and devDependencies in
package.json - Unlisted dependencies (used but not declared)
- Unused exports and exported types
- Unused enum members and class members
- Duplicate exports
- Configuration hints to tighten your setup
Plugins for the ecosystem
Knip ships with around 150 plugins covering tools and frameworks like Astro, Cypress, ESLint, Jest, GitHub Actions, Next.js, Nx, Remix, Storybook, Svelte, Vite, Vitest, Webpack, and many more. Plugins teach Knip about each tool's entry points and config files so detection stays accurate in real-world projects, including monorepos.
Editor and agent support
Knip publishes a VS Code extension (also on Open VSX) and an MCP server (@knip/mcp) so coding agents can run Knip, retrieve documentation, and generate a knip.json configuration through guided workflows. A language server package (@knip/language-server) is also available.
Installation
Knip v6 requires Node.js v20.19.0 or newer (or Bun). The recommended install uses the create-config script:
npm init @knip/config
Then run:
npm run knip
It can also be run without installation via npx knip, pnpm dlx knip, or bunx knip.
Pricing
Knip is free and open-source under the ISC License. The project is funded through GitHub Sponsors and Open Collective.
Why teams use it
Knip is used by teams at Vercel, Shopify, TanStack, Backstage, Sentry, and thousands of other projects. It's commonly run locally and in CI to keep codebases clean as they evolve.
Community Discussions
Be the first to start a conversation about Knip
Share your experience with Knip, ask questions, or help others learn from your insights.
Pricing
Open Source
Capabilities
Key Features
- Finds unused files in JavaScript and TypeScript projects
- Detects unused dependencies and devDependencies in package.json
- Flags unlisted dependencies that are imported but not declared
- Identifies unused exports, exported types, enum members, and class members
- Around 150 plugins for frameworks and tools (Next.js, Vite, Jest, ESLint, Astro, Storybook, and more)
- Native monorepo and workspace support
- Production mode for stricter checks against shipped code
- Auto-fix to remove unused exports and dependencies
- Configurable rules and filters per issue type
- Multiple reporters (default, JSON, Markdown, JUnit, custom)
- Compiler support for non-standard files (Astro, MDX, Svelte, Vue)
- VS Code extension and Open VSX extension
- MCP server (@knip/mcp) for AI coding agents
- Language server (@knip/language-server) for editor integrations
- CI-friendly exit codes for blocking on unused code
- Browser-based playground to try without install
Integrations
Demo Video

