knip_skill
- Shell
145
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill brianlovin/claude-config --skill knip- SKILL.md2.7 KB
Overview
This skill runs knip to detect and remove unused files, dependencies, exports, and types in a JavaScript/TypeScript codebase. It helps automate dead-code cleanup, reduce bundle size, and keep package.json accurate. Use it to iterate safely: detect, confirm uncertain items, and apply fixes with verification.
How this skill works
The skill executes knip to produce a categorized report: unused files, unused dependencies, unused devDependencies, unused exports, and unused types. It classifies issues into high-confidence items that can be removed automatically and lower-confidence items that require human confirmation (entry points, public API exports, dynamic imports). After changes, it re-runs knip to verify the cleanup.
When to use it
- Before a release to trim unused dependencies and shrink package size
- During refactoring to remove orphaned files and exports
- When package.json grows stale and contains unused packages
- As part of a cleanup sprint for legacy or monorepo codebases
- After dependency upgrades to catch leftover, unused packages
Best practices
- Run npx knip first and capture full output before making changes
- Create a minimal knip.json if many false positives appear for your framework
- Auto-delete only clearly internal items; ask about anything that looks public or dynamic
- Use --fix and --allow-remove-files for high-confidence removals, but re-run knip to confirm
- Respect existing knip ignore patterns and monorepo workspace flags when relevant
Example use cases
- Remove orphaned utility files and unused components discovered by knip
- Clean package.json by removing dependencies reported as unused
- Prune exported functions and types that are no longer consumed
- Run automated fixes for internal unused exports and types with --fix
- Batch-confirm ambiguous items (entry points, public exports) before deletion
FAQ
Start with npx knip to get a report; use npx knip --reporter json for machine parsing and npx knip --production to ignore tests.
When is it safe to auto-delete?
Auto-delete items that are clearly internal: unused type exports, internal unused exports, unused dependencies listed in package.json and unused orphan files that are not entry points.