- Home
- Skills
- Code Quality & Review
- Dead Code and Unused Dependency Finder with Knip
Works with the AI Agents you already use
Dead Code and Unused Dependency Finder with Knip
Finds unused files, exports and dependencies with knip, vulture, deptry, deadcode or cargo machete, checks false positives, plans git removals. Verdict CLEAN / CLUTTERED / RISKY TO PRUNE
$5
Dead Code and Unused Dependency Finder with Knip
Example session with this skill installed
Our Next.js shop-web repo feels bloated. Run knip, tell me which unused files, exports and npm packages are actually safe to delete, and give me a removal plan. Don't delete anything yet.
- Read your context and instructions
- Compiled the dead code
- Generated the UI component
Dead code report: shop-web (2026-10-18)
Verdict: CLUTTERED. 6 items are safe to remove in 3 small commits; 3 need an owner check.
Baseline: tests pass (212), build passes. Tools run: knip (default + --production). Not run: none.
Findings
| # | Item | Kind | Evidence | Class |
|---|---|---|---|---|
| 1 | moment | dependency | 0 imports (git grep -w moment = 0), not in any config | SAFE TO DELETE |
| 2 | lodash | dependency | only lodash.debounce used; lodash itself 0 imports | SAFE TO DELETE |
| 3 | src/utils/formatDate.ts | file | 0 references, last touched 14 months ago | SAFE TO DELETE |
| 4 | src/components/OldBanner.tsx | file | 0 references, no route file | SAFE TO DELETE |
| 5 | slugify in src/lib/text.ts | export | knip --trace: no importers | SAFE TO DELETE |
| 6 | legacyPrice in src/lib/price.ts | export | used only in price.test.ts | SAFE TO DELETE (with test) |
| 7 | app/(marketing)/promo/page.tsx | file | Next.js route convention | KEEP |
| 8 | scripts/seed.ts | file | package.json script db:seed | KEEP |
| 9 | src/flags/checkoutV2.ts | file | string "checkoutV2" in flags.json | VERIFY (flag owner) |
| 10 | pg | dependency | 0 imports, but DATABASE_URL driver loaded by ORM | VERIFY |
| 11 | @acme/ui exports | exports | package is published to npm | VERIFY (downstream users) |
False positives handled
- Items 7 and 8 were not real issues; added config so knip stops flagging them:
{ "entry": ["scripts/*.ts"] }
Removal plan (awaiting your go-ahead)
chore(prune): remove unused deps moment, lodashvianpm uninstall moment lodash, thennpm test && npm run buildchore(prune): remove unused filesviagit rm src/utils/formatDate.ts src/components/OldBanner.tsx, then test + buildchore(prune): drop unused exports slugify, legacyPrice(and the test for it), then test + build
Size before / after
| Metric | Before | After | Note |
|---|---|---|---|
node_modules | 412 MB | to measure | measured before; after is measured once commits land |
.next/static | 1.9 MB | no change expected | estimate: both deps were already tree-shaken |
CI guard
- run: npx knip --reporter github-actions
OldBanner.tsx
TSX · React component
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
About this skill
Every codebase collects files nobody imports, exports nobody calls and packages nobody uses. Tools like knip or vulture list them quickly, but their output mixes real dead code with Next.js routes, Django migrations, pytest fixtures, CLI scripts and public library APIs. Delete the wrong one and production breaks. Asking an AI to "clean up unused code" often ends with confident deletions and no evidence.
This skill gives your coding agent a fixed, cautious procedure and a reference file of checked tool facts. It:
- Detects your ecosystems and runs the right tool: knip for JS/TS, vulture and deptry for Python, staticcheck U1000 and deadcode for Go, cargo machete and cargo udeps for Rust, mvn dependency:analyze for Maven
- Cross-checks every hit with git grep, git log and entry-point config, and walks a false-positive checklist (dynamic imports, reflection, framework conventions, entry points, feature flags, runtime-only drivers, published APIs)
- Classifies each item SAFE TO DELETE, VERIFY or KEEP with one line of evidence, and writes ignore rules for the KEEP items
- Plans removal as small commits (dependencies, then files, then exports) with tests and build after each, using git rm and your package manager so everything can be reverted
- Measures install and bundle size before and after, labelled measured or estimate
- Adds a CI step so new dead code is caught
- Gives a verdict: CLEAN, CLUTTERED or RISKY TO PRUNE
It is for developers and tech leads cleaning up an app, a monorepo or a library before an upgrade or a size push.
Honesty note: it reports first and deletes nothing until you approve the exact list. It never invents tool output, versions or size savings, and it tells you when a tool could not run.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.
Static tools miss some runtime uses such as reflection, string-named plugins and code called from outside the repo, so the skill marks those VERIFY rather than guessing. It needs the language toolchain installed to run the tools, and size savings are only reported as measured once the removals are actually made.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 29 days ago
- Software
GitDead-code tool for your ecosystemknip
Node.js
Pythondeptry
uv (Python tool runner)vulture
knip (JS/TS), vulture and deptry (Python), staticcheck or deadcode (Go), or cargo-machete (Rust).