refactor-clean

Identify and remove dead code, duplicates, and unused exports with knip, depcheck, and ts-prune.

Updated Feb 10, 2026
One-click install
npx skills add https://github.com/ihj04982/my-cursor-settings --skill refactor-clean-ihj04982
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor-clean
Source: https://github.com/ihj04982/my-cursor-settings/tree/main/skills/refactor-clean
Command: npx skills add https://github.com/ihj04982/my-cursor-settings --skill refactor-clean-ihj04982

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the issue of accumulating dead code, duplicates, and unused exports within a codebase, which can lead to increased complexity, maintenance overhead, and larger bundle sizes.

Core Features & Use Cases

  • Dead Code Identification: Utilizes tools like knip, depcheck, and ts-prune to accurately detect unused code.
  • Safe Deletion Proposals: Only suggests deletions that are categorized as SAFE (utilities), avoiding risky removals from critical areas like entry points.
  • Test Verification: Ensures the integrity of the codebase by running the full test suite before and after each proposed deletion.
  • Use Case: After a large feature refactor, use this command to automatically prune any code that is no longer referenced, ensuring a cleaner and more efficient project.

Quick Start

Run the refactor-clean command to identify and safely remove unused code.

Frequently Asked Questions about refactor-clean

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

FAQPage Schema
How do I safely remove dead code and unused exports from my codebase?

To safely remove dead code, this Skill identifies unused code and proposes deletions categorized as SAFE, specifically avoiding critical areas like entry points. It verifies codebase integrity by running the full test suite before and after each deletion.

What is the best way to find unused code after a large feature refactor?

The best way to find unused code after a refactor is to use analysis tools like knip, depcheck, and ts-prune. This Skill utilizes these dependencies to accurately detect dead code, duplicates, and unused exports for cleanup.

Does dead code removal work with TypeScript projects to prune unused exports?

Yes, dead code removal works with TypeScript projects by utilizing ts-prune to detect unused exports. The Skill integrates this analysis to safely prune unreferenced code, ensuring a cleaner and more efficient project.

How does this approach ensure test verification before deleting dead code?

Test verification ensures codebase integrity by running the full test suite before and after each proposed deletion. This mechanism guarantees that removing identified dead code and duplicates does not break existing software development workflows.

Can I automatically delete unused dependencies and dead code without breaking entry points?

You cannot automatically delete code from critical areas like entry points, as the Skill only suggests deletions categorized as SAFE. It targets utilities and unreferenced code while running test suites to prevent breaking core application functionality.

Why should I remove dead code and duplicates from my software development workflow?

You should remove dead code and duplicates to reduce increased complexity, maintenance overhead, and larger bundle sizes. Cleaning up unused exports ensures a cleaner, more efficient project structure and optimizes overall code hygiene.