tsr

Detect and remove unused exports and files in TypeScript/React projects.

6|1|Updated Dec 8, 2009
One-click install
npx skills add https://github.com/jey3dayo/dotfiles --skill tsr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tsr
Source: https://github.com/jey3dayo/dotfiles/tree/main/agents/skills-internal/tsr
Command: npx skills add https://github.com/jey3dayo/dotfiles --skill tsr

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Detects and safely removes unused exports and dead code in TypeScript/React projects using a cascading configuration system (project -> home -> default) to minimize manual cleanup and reduce risk of deleting live code.

Core Features & Use Cases

  • Cascading configuration (project/home/default) to tailor cleanup across environments.
  • Framework-aware detection for Next.js, React, and Node.js generation of ignore patterns to avoid false positives.
  • Auto-generated .tsrignore guidance and verification steps after deletion to ensure code health.
  • Use cases include weekly maintenance, refactor cleanup, and CI integrations to validate deletion.

Quick Start

Create a project .tsr-config.json at the root, run TSR check to discover dead code, and then run TSR fix to remove it safely.

Frequently Asked Questions about tsr

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

FAQPage Schema
How do I find and remove unused exports in a TypeScript React project?

To remove unused exports in a TypeScript React project, you can use a cascading configuration system that identifies dead code across project-root, user home, and default settings. It safely detects and deletes unused files and exports while generating ignore patterns to prevent false positives.

What is the best way to automate dead-code cleanup for Next.js and Node.js?

Automating dead-code cleanup for Next.js and Node.js involves framework-aware detection that generates specific ignore patterns. By applying a cascading configuration approach, you can minimize manual cleanup and reduce the risk of accidentally deleting live code during refactor sessions.

Does dead-code detection work with custom TypeScript stacks?

Yes, dead-code detection works with custom TypeScript stacks through a cascading configuration system. You can tailor the cleanup process by creating a project-level configuration file to handle specific requirements beyond default Next.js, React, and Node.js environments.

How do I verify code health after removing dead code?

To verify code health after removing dead code, run type-checks, linting, and tests as post-deletion verification steps. This ensures the removal of unused exports and files does not break existing functionality and maintains overall project stability.

Can I integrate unused file removal into my CI pipeline?

Yes, you can integrate unused file removal into CI pipelines to validate deletions automatically. The process generates a configurable report path and uses verification steps to ensure that removing dead code maintains code health across different environments.

Why does TypeScript dead-code detection produce false positives?

TypeScript dead-code detection produces false positives when framework-specific usage patterns are not recognized. To minimize this, framework-aware detection generates ignore patterns and auto-generated guidance files to exclude necessary files from being flagged as unused.