b2b-backend-refactor-clean

Identify unused TypeScript backend code with knip, depcheck, and ts-prune.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/herren-official/product-agents --skill b2b-backend-refactor-clean
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: b2b-backend-refactor-clean
Source: https://github.com/herren-official/product-agents/tree/main/skills/b2b-backend/hyeoni/refactor-clean
Command: npx skills add https://github.com/herren-official/product-agents --skill b2b-backend-refactor-clean

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Identifies and safely removes unused code in a TypeScript backend repository using automated analysis tools, reducing code bloat while protecting functionality.

Core Features & Use Cases

  • Analyze dead exports with knip to surface unused code
  • Detect unused dependencies with depcheck
  • Find unused TypeScript exports with ts-prune
  • Use case: refactor a multi-module b2b backend without breaking runtime behavior

Quick Start

Run the refactor-clean command to identify candidate removals and verify them with the full test suite.

Frequently Asked Questions about b2b-backend-refactor-clean

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

FAQPage Schema
How do I safely remove unused code in a TypeScript monorepo without breaking runtime behavior?▼

To safely remove unused code in a TypeScript monorepo, use automated analysis tools like knip, depcheck, and ts-prune to detect dead exports and dependencies, then enforce a full test suite run before any deletion to preserve behavior.

What is the best way to find unused dependencies and dead exports in a backend project?▼

Finding unused dependencies and dead exports in a backend project is best done by running knip, depcheck, and ts-prune to surface unused modules and verify candidate removals against the full test suite.

Can I use knip and ts-prune together to refactor a multi-module backend?▼

Yes, you can use knip and ts-prune together to refactor a multi-module backend by cross-referencing their results to accurately identify and prune unused TypeScript exports and dependencies.

Do I need to run the full test suite before deleting dead code?▼

Yes, you need to run the full test suite before deleting dead code because the refactor-clean process enforces it to verify that removing identified unused dependencies and exports does not break existing runtime behavior.

Why does pruning unused TypeScript code require multiple analysis tools?▼

Pruning unused TypeScript code requires multiple analysis tools because knip, depcheck, and ts-prune each detect different types of dead code and unused dependencies across various modules, ensuring comprehensive and safe removal.

What are the limitations of using depcheck for dead code removal?▼

Depcheck focuses on detecting unused dependencies but does not identify unused TypeScript exports, so you must combine it with ts-prune and knip and run the full test suite to safely prune code without breaking behavior.