knip
/knip
Run Knip to find unused files, dependencies, exports and types in TypeScript and JavaScript projects. TRIGGER WHEN: cleaning up TypeScript/JavaScript dead code, finding unused npm dependencies or exports, or configuring knip.json/knip.ts. DO NOT TRIGGER WHEN: the target is a Python codebase (use python-dead-code).
- Author
- acaprino ↗
- Repository
- alfio-claude-plugins ↗
- Licence
- MIT
- Last repository change
- 27.10.2026
Assessment and security
- Files in this package
- 3
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Run Knip to find unused files, dependencies, exports and types in TypeScript and JavaScript projects. TRIGGER WHEN: cleaning up TypeScript/JavaScript dead code, finding unused npm dependencies or exports, or configuring knip.json/knip.ts. DO NOT TRIGGER WHEN: the target is a Python codebase (use python-dead-code).
Original author description
Run Knip to find unused files, dependencies, exports and types in TypeScript and JavaScript projects. TRIGGER WHEN: cleaning up TypeScript/JavaScript dead code, finding unused npm dependencies or exports, or configuring knip.json/knip.ts. DO NOT TRIGGER WHEN: the target is a Python codebase (use python-dead-code).
How it works
- Reference router
- 1. Installation and CLI Usage
- 2. Configuration
- 3. Interpreting Results and Adoption Order
SKILL.md preview
---
name: knip
description: >
Run Knip to find unused files, dependencies, exports and types in TypeScript and JavaScript projects.
TRIGGER WHEN: cleaning up TypeScript/JavaScript dead code, finding unused npm dependencies or exports, or configuring knip.json/knip.ts.
DO NOT TRIGGER WHEN: the target is a Python codebase (use python-dead-code).
---
# Knip Dead Code Detection
Knip finds unused files, dependencies, exports, types, and enum/class members across JavaScript and TypeScript repositories (including monorepos), backed by 80+ framework and tool plugins.
## Reference router
| Task | Reference |
|---|---|
| Framework/test-runner plugin overrides, monorepo workspace config, JSDoc/`@public` ignores, CI pipelines, or troubleshooting false positives | `references/plugins-ci-and-troubleshooting.md` |
## 1. Installation and CLI Usage
> Examples use `npx`; equivalent commands work with `pnpm dlx`, `bunx`, or `yarn dlx`.
```bash
npm install --save-dev knip
# Scan entire project
npx knip
# Focused scans
npx knip --dependencies
npx knip --exports
npx knip --files
# Production mode (production entry points and dependencies only)
npx knip --production
# Exclude exports used within the same file
npx knip --exclude-exports-used-in-file
# Machine-readable JSON output or config debugging
npx knip --reporter json
npx knip --debug
```
## 2. Configuration
Knip works zero-config on standard projects by reading `package.json` (`main`, `exports`, `bin`, `scripts`) and framework/test configs (`next.config.*`, `vite.config.*`, `vitest.config.*`, `tsconfig.json`).
### `knip.json` or `knip.ts` (Explicit Configuration)
```typescript
// knip.ts
import type { KnipConfig } from 'knip';
const config: KnipConfig = {
entry: ['src/index.ts', 'src/cli.ts', 'scripts/**/*.ts'],
project: ['src/**/*.{ts,tsx}', 'scripts/**/*.ts'],
ignore: [
'**/*.test.ts',
'**/*.spec.ts',
'**/__tests__/**',
'**/__mocks__/**',
'dist/**',
'build/**',
'coverage/**',
'.next/**',
],
ignoreDependencies: [
'@types/*',
'typescript',
'tslib',
],
ignoreBinaries: ['npm-check-updates', 'semantic-release'],
ignoreExportsUsedInFile: true,
};
export default config;
```
## 3. Interpreting Results and Adoption Order
| Issue Type | Meaning | Action |
|---|---|---|
| Unused file | File not reachable from any entry point | Delete file or add to `entry` |
| Unused dependency | Package in `package.json` never imported | Remove from `package.json` |
| Unused export | Exported value never imported externally | Remove `export` keyword or delete |
| Unused type | Exported type/interface never imported | Make internal or delete |
| Unused enum/class member | Member never referenced | Remove member |
| Duplicate export | Same symbol re-exported multiple ways | Consolidate exports |
Recommended adoption sequence on an existing codebase:
1. `npx knip --dependencies --max-issues 0` (highest signal, lowest false-positive rate)
2. `npx knip --exports --exclude-exports-used-in-file`
3. `npx knip --files` and full `npx knip --production`
Files in this package (3)
- SKILL.md 3 KB
- SKILL.toml 1 KB
- references/plugins-ci-and-troubleshooting.md 4 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · acaprino/alfio-claude-plugins | 100 | MIT |
| acaprino/alfio-claude-plugins | 100 | MIT |
| acaprino/alfio-claude-plugins | 100 | MIT |
| acaprino/alfio-claude-plugins | 100 | MIT |
| acaprino/alfio-claude-plugins | 100 | MIT |
| acaprino/alfio-claude-plugins | 100 | MIT |
| TerminalSkills/skills | 100 | Apache-2.0 |
| artivilla/agents-config | 100 | MIT |
Identical content appears in 1 other GitHub folders. We show one copy with the highest score.
Database snapshot: 13.11.2026 · package version 5d2f0e9d46e0 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 1 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100knip-dead-code
Knip dead-code detector for JS/TS: unused files, deps, exports, types. Use when cleaning up codebases, finding dead exports, or enforcing dependency hygiene in CI. - 100knip-deadcode
Knip dead code detection best practices for JavaScript and TypeScript projects. Use when configuring Knip, analyzing unused code, setting up CI integration, or cleaning up codebases. Triggers on knip.json, dead code, unused exports, unused dependencies, bundle optimization. - 90skif
Lint the dependencies of JavaScript and TypeScript monorepos with skif: workspace and manifest rules, version and catalog policies, and unused or unlisted dependencies, files and exports, with format-preserving fixes. Use when a repository has a skif.toml or runs skif in CI or… - 100plan-dead-code
Plan-only dead-code audit: Knip baseline for unused files, exports, and deps, plus duplication, debug residue, suppressions, orphan assets, env drift. Deletes nothing. Use when "find dead code", "is this code used", or "unused exports". - 100fec-refactor-clean
Use when safely removing dead frontend code, unused exports, stale components, obsolete routes, unused dependencies, or cleanup targets found by tools such as knip, depcheck, ts-prune, TypeScript, ESLint, or manual review. Do not use for feature rewrites that change behavior;… - 100dead-code-analyzer
Analyze a codebase for dead code, duplicates, and circular dependencies using knip, jscpd, and madge, then validate findings to filter false positives. Use when user says "quality-dead-code-analyzer", "analyze code", "find dead code", "code cleanup", "find duplicates", "unused…