knip
Identify and remove unused dependencies, files, and exports in TypeScript and JavaScript projects. Use when detecting unused code, cleaning up dead code, improving maintainability, or reducing bundle sizes.
Installation
Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.
View source ↗GuidesSkill instructions
Knip
Find unused files, dependencies, and exports in TypeScript/JavaScript projects.
Usage
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
Output Formats
bunx knip --reporter compact # Compact output
bunx knip --reporter json # JSON for tooling
bunx knip --reporter github-actions # CI annotations
Filtering
bunx knip --workspace packages/client # Specific workspace
bunx knip --exclude "test/**/*" # Exclude patterns
Debugging
bunx knip --debug # Debug output
bunx knip --trace-file src/utils.ts # Trace file
bunx knip --trace-export myFunction # Trace export
Configuration
Configure via .knip.json or knip.config.js for custom entry points and exclusions.
Examples
Read the usage examples in the source repository.
View source ↗Source history
- Indexed on
- 2026-01-20
- Index updated
- 2026-01-26
- Branch
- main
Index and sync dates describe this directory. View the source repository for code history.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!