Skip to content
Back to skills

Knip

ASecurity

Find dead code, unused files, unused exports, and unused dependencies in a JavaScript/TypeScript project using knip. Use before a refactor, before a PR, or when the user asks to clean up bloat, remove unused deps, or shrink the codebase.

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 4, 2026
ai-agentsjavascripttypescriptgojavabashapi

Works with

  • cli
  • api

Security analysis

A100/100

Scanned September 4, 2026

npx -y skills add LFTPadilla/agent-dev-kit --skill knip --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Knip?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Knip
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/lftpadilla-knip/badge)](https://www.skillsdirectory.com/skills/lftpadilla-knip)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: knip
description: Find dead code, unused files, unused exports, and unused dependencies in a JavaScript/TypeScript project using knip. Use before a refactor, before a PR, or when the user asks to clean up bloat, remove unused deps, or shrink the codebase.
---

# knip — dead code & unused dependency finder

Knip traces the whole project (not one file at a time) to find what nothing
references: unused files, exports, types, and dependencies. This is the
mechanical version of "delete code you don't need."

## Run

```bash
npx knip                  # report unused files, exports, deps, types
npx knip --production     # only production code paths (ignore tests/dev)
npx knip --dependencies   # just unused/unlisted dependencies
npx knip --fix            # auto-remove unused exports/files (review the diff!)
```

Zero-config for most setups — knip reads `package.json` + `tsconfig.json` and
has built-in plugins for Vite, Vitest, Next, ESLint, etc. Add a `knip.json`
only if entry points are non-standard.

## How to use the output

1. Run `npx knip`. Group findings: unused files / exports / deps / types.
2. **Verify before deleting** — knip can flag things reached only by dynamic
   import, config strings, or framework conventions. Confirm each is truly dead.
3. Remove in small commits (files, then exports, then deps). Re-run knip after.
4. `--fix` is safe for clearly-unused exports/files, but read the diff — never
   blind-apply on auth, migration, or public-API code.

## Gotchas

- Monorepo: run per-workspace or configure `workspaces` in `knip.json`.
- Entry points it can't infer (CLI bins, serverless handlers) → list them in
  `knip.json` so it doesn't report them as unused.
- Pairs well as a pre-commit gate (warn, don't block) and before any refactor.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…