code-cleanup

Remove dead code and unused imports from TypeScript and JavaScript codebases.

19|3|Updated Jan 13, 2026
One-click install
npx skills add https://github.com/changoo89/claude-pilot --skill code-cleanup-changoo89
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-cleanup
Source: https://github.com/changoo89/claude-pilot/tree/main/.claude/skills/code-cleanup
Command: npx skills add https://github.com/changoo89/claude-pilot --skill code-cleanup-changoo89

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Dead code clutter and unused imports slow maintenance and cause drift; this skill automatically detects and removes dead code, leaving a leaner, healthier codebase.

Core Features & Use Cases

  • Detects unused imports and dead files using knip (recommended) with safe fallbacks to ESLint/TypeScript tooling.
  • Respects a .cleanup-ignore file to protect critical files and supports risk-based auto-removal with review for high-risk changes.
  • Validates changes through post-cleanup verification steps and provides a rollback path to restore state if needed.

Quick Start

Run the code-cleanup workflow to automatically detect and remove dead code and unused imports, with automated verification.

Frequently Asked Questions about code-cleanup

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

FAQPage Schema
How do I automatically remove dead code and unused imports in a TypeScript codebase?

Automate dead code and unused imports removal by running a workflow that uses knip as the primary detector, applying safe fallbacks to ESLint or TypeScript tooling to identify and eliminate unnecessary files and declarations.

Can I use knip for dead code cleanup without breaking high-risk dependencies?

Yes, the cleanup workflow applies risk-based auto-removal for low and medium risk changes, while requiring explicit user confirmation for high-risk modifications and providing a rollback path to restore the previous state if needed.

What is the best way to protect critical files from automated refactoring and dead code removal?

Protect critical files by creating a .cleanup-ignore file, which the cleanup workflow respects during execution to prevent automatic removal of essential code, declarations, and unused imports across your refactored codebase.

Does dead code cleanup work with ESLint and TypeScript tooling if knip is unavailable?

Yes, if knip is not available, the workflow safely falls back to standard ESLint and TypeScript tooling to detect and remove unused imports and dead files during maintenance, pre-commit runs, or CI pipelines.

How do I verify codebase stability after removing dead files and unused imports?

Verify post-cleanup stability by running the built-in post-cleanup verification steps, which validate the changes and ensure the codebase remains functional after dead code and unused imports are eliminated.

When should I run automated dead code detection during the development lifecycle?

Run automated dead code detection during codebase maintenance, pre-commit runs, or CI pipelines to continuously eliminate drift and clutter caused by unused imports and dead files across your project.