What problem does it solve?
This Skill helps developers quickly identify and remove unused files, dependencies, and exports in JavaScript and TypeScript projects, reducing bundle size and technical debt.
Core Features & Use Cases
- Code cleanup: Detect dead or unreferenced files and prune them from the repository.
- Dependency hygiene: Find unused dependencies and prune package.json entries.
- Export hygiene: Surface and remove unreferenced exports across modules in a codebase.
- Use Case: In a large monorepo, scan all packages to reveal dead code and stale dependencies, then run automated fixes to clean up the project.
Quick Start
Use bunx knip to analyze a project.
bunx knip # Analyze project
bunx knip --production # Production only (no tests, devDeps)
bunx knip --strict # Direct dependencies only
bunx knip --fix # Auto-remove unused (use cautiously)
bunx knip --include files # Only unused files
bunx knip --include exports # Only unused exports
bunx knip --include dependencies # Only unused deps