knip

Identify and remove unused files, dependencies, and exports in JavaScript/TypeScript projects.

2|Updated Jan 21, 2026
One-click install
npx skills add https://github.com/roderik/mpe --skill knip
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: knip
Source: https://github.com/roderik/mpe/tree/main/.agents/skills/knip
Command: npx skills add https://github.com/roderik/mpe --skill knip

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill automates the identification and removal of unused files, dependencies, and exports in a codebase, reducing maintenance burden and improving build performance.

Core Features & Use Cases

  • Automated cleanup: Detects dead code, unused dependencies, and orphaned exports to shrink bundles and simplify maintenance.
  • Monorepo support: Handles multi-package repositories, coordinating cleanup across packages.
  • Safety-first cleanup: Applies changes only when safe, with options to preview before deleting.

Quick Start

  1. Install locally if needed: npm install -D knip
  2. Run initial analysis: npx knip
  3. Apply safe fixes: npx knip --fix --allow-remove-files

Frequently Asked Questions about knip

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find and remove unused dependencies in a JavaScript project?

To find and remove unused dependencies in a JavaScript project, you can run `npx knip` to analyze imports and exports, producing safe cleanup recommendations for unused files and dependencies.

What is dead code analysis and how does it help with code cleanup?

Dead code analysis identifies unused files, dependencies, and orphaned exports in a codebase. This code cleanup reduces maintenance burden, simplifies the project, and improves build performance by shrinking bundles.

Can I detect unused exports and dead code in a monorepo?

Yes, you can detect unused exports and dead code in a monorepo. The analysis handles multi-package repositories, coordinating cleanup safely across packages to remove orphaned files and dependencies.

Is there a safe way to preview dead code removal before deleting files?

Yes, you can safely preview dead code removal before deleting files. You run an initial analysis to view recommendations, then apply safe fixes using the `--fix --allow-remove-files` command to execute the cleanup safely.

Do I need to install a static analysis tool globally to clean up unused dependencies?

No, you do not need to install a static analysis tool globally to clean up unused dependencies. You can run it directly via `npx knip` or install it locally as a development dependency using `npm install -D knip`.