dead-code-finder

Find and remove dead code in JavaScript/TypeScript projects. Detects unused exports, unreferenced files, orphaned components, unused dependencies, and dead functions/variables. Supports monorepos, path aliases, barrel exports, and dynamic imports. Use when asked to find dead code, detect unused exports, clean up unused files, find orphaned modules, audit code for unused functions, remove dead code, identify unused dependencies, or reduce bundle size by removing unused code. Triggers on "dead code", "unused exports", "unused files", "orphan", "tree shake", "unused imports", "unused dependencies", "code cleanup", "reduce bundle".

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "dead-code-finder" with this command: npx skills add dead-code-finder

Dead Code Finder

Detect and report dead code in JavaScript/TypeScript projects.

Quick Start

# Full scan — unused exports, files, and dependencies
python3 scripts/find_dead_code.py /path/to/project

# Exports only
python3 scripts/find_dead_code.py /path/to/project --mode exports

# Unused files only
python3 scripts/find_dead_code.py /path/to/project --mode files

# Unused dependencies only
python3 scripts/find_dead_code.py /path/to/project --mode deps

# JSON output for programmatic use
python3 scripts/find_dead_code.py /path/to/project --json

What It Detects

1. Unused Exports

Exported functions, classes, constants, types, and interfaces never imported anywhere.

  • Named exports (export function foo, export const bar)
  • Re-exports (export { x } from './y')
  • Type exports (export type, export interface)
  • Barrel file analysis (index.ts re-exports)

2. Unreferenced Files

Files never imported by any other file in the project.

  • Skips entry points (configurable)
  • Skips test files, config files, and scripts by default
  • Handles path aliases (tsconfig paths)

3. Unused Dependencies

npm packages in package.json never imported in code.

  • Checks dependencies and devDependencies
  • Recognizes CLI tools as potentially used
  • Handles scoped packages and subpath imports

Configuration

Default entry points: src/index.{ts,tsx,js,jsx}, src/main.*, src/app.*, pages/**/*, app/**/*.

Default ignores: node_modules, dist, build, .next, coverage, __tests__, *.test.*, *.spec.*, *.config.*, *.d.ts.

Override via flags:

--entry "src/main.ts,src/worker.ts"
--ignore "generated,vendor"

Interpreting Results

=== Dead Code Report ===

UNUSED EXPORTS (12 found):
  src/utils/helpers.ts: formatDate, parseQuery, slugify
  src/components/Button.tsx: ButtonProps (type)
  src/api/client.ts: createClient

UNREFERENCED FILES (3 found):
  src/legacy/oldAuth.ts
  src/utils/deprecated.ts
  src/components/unused/Card.tsx

UNUSED DEPENDENCIES (2 found):
  moment
  lodash.merge

Workflow

  1. Run scan on the project
  2. Review report — some findings may be false positives (dynamic imports, reflection)
  3. Verify each finding before removing
  4. Remove confirmed dead code
  5. Run tests to confirm nothing broke

Limitations

  • Dynamic imports with variable paths may cause false positives
  • Code consumed by external packages (libraries) shows as unused
  • CSS/SCSS imports not tracked
  • export * partially supported

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

Claude Chrome

Use Claude Code with Chrome browser extension for web browsing and automation tasks. Alternative to OpenClaw's built-in browser tools.

Registry SourceRecently Updated
Coding

App Builder

Build, edit, and deploy Instant-backed apps using npx instant-cli, create-instant-app (Next.js + Codex), GitHub (gh), and Vercel (vercel). Use when asked to create a new app, modify an existing app, fix bugs, add features, or deploy/update an app. Projects live under ~/apps; always work inside the relevant app folder.

Registry SourceRecently Updated
Coding

Opengraph Io

Extract web data, capture screenshots, scrape content, and generate AI images via OpenGraph.io. Use when working with URLs (unfurling, previews, metadata), capturing webpage screenshots, scraping HTML content, asking questions about webpages, or generating images (diagrams, icons, social cards, QR codes). Triggers: 'get the OG tags', 'screenshot this page', 'scrape this URL', 'generate a diagram', 'create a social card', 'what does this page say about'.

Registry SourceRecently Updated
Coding

Xlsx Pro

Compétence pour manipuler les fichiers Excel (.xlsx, .xlsm, .csv, .tsv). Utiliser quand l'utilisateur veut : ouvrir, lire, éditer ou créer un fichier tableur ; ajouter des colonnes, calculer des formules, formater, créer des graphiques, nettoyer des données ; convertir entre formats tabulaires. Le livrable doit être un fichier tableur. NE PAS utiliser si le livrable est un document Word, HTML, script Python standalone, ou intégration Google Sheets.

Registry SourceRecently Updated