knip

Detect and remove unused files, dependencies, and exports in JavaScript and TypeScript repositories.

Updated Apr 10, 2026
One-click install
npx skills add https://github.com/erichugy/agentic.skills --skill knip-erichugy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: knip
Source: https://github.com/erichugy/agentic.skills/tree/main/knip
Command: npx skills add https://github.com/erichugy/agentic.skills --skill knip-erichugy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Knip identifies and helps remove dead code by locating unused files, dependencies, devDependencies, exports, and types in a codebase to reduce bloat and maintenance surface area.

Core Features & Use Cases

  • Detection: Run knip to produce a categorized report of unused files, dependencies, devDependencies, exports, and types.
  • Automated Fixes: Use knip's --fix and --allow-remove-files options to automatically remove high-confidence issues.
  • Safety Workflow: Classify items into auto-delete versus needs-clarification, ask about uncertain items in a single batch, and re-run to verify cleanup.
  • Use Cases: Useful for single-package repos and monorepos preparing for refactors, releases, or dependency audits.

Quick Start

Run npx knip to generate a report, classify uncertain items for confirmation, and apply safe fixes with npx knip --fix --allow-remove-files while respecting existing knip config and workspace flags.

Frequently Asked Questions about knip

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

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

You can detect unused exports and dead code by running an analysis tool that scans your repository for unreferenced files, exported symbols, and types. It produces a categorized report highlighting unused exports and dependencies for cleanup.

Can I automatically remove unused files and dependencies from my codebase?

Yes, you can automatically remove unused files and dependencies by running the tool with --fix and --allow-remove-files options. This applies automated fixes for high-confidence issues while respecting your configuration and workspace flags.

Does unused code detection work for monorepos and single-package repositories?

Yes, unused code detection works for both single-package repositories and monorepos. The tool respects workspace flags and configuration to accurately locate unused files, dependencies, and exports across multiple packages in your codebase.

What is the safest workflow for cleaning up dead code before a release?

The safest workflow for cleaning up dead code involves running a scan, classifying items into auto-delete versus needs-clarification batches, asking about uncertain items once, and then re-running the scan to verify that the cleanup is complete and safe.

How do I integrate dead code detection into my CI workflows?

You can integrate dead code detection into CI workflows by running the tool to generate parseable reports during your pipeline. It respects existing configuration and workspace flags, allowing automated checks for unused dependencies and exports before merging.