Dead Code Finder for Openclaw

A powerful static analysis tool for identifying and removing unused exports, files, and dependencies in JavaScript and TypeScript projects.

charlie-morrison
v1.0.1
May 1, 2026
0
847
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install dead-code-finder

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install dead-code-finder using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Dead Code Finder?

Dead Code Finder is a comprehensive static analysis utility designed to streamline modern web development by identifying redundant code. Whether managing a complex monorepo or a standard frontend application, this tool from the Openclaw Skills library parses your codebase to pinpoint functions, types, and entire files that are no longer in use.

By integrating this into your workflow, you can significantly reduce bundle sizes, improve build times, and maintain a cleaner, more navigable repository. It specifically targets the bloat that accumulates over time, such as orphaned components and legacy utility functions that tree-shaking might miss during the build process.

Dead Code Finder Use Cases

  • Identifying unused exports in large TypeScript projects using path aliases.
  • Auditing package.json to remove bloated or unnecessary npm dependencies.
  • Finding orphaned components and legacy files during a major refactor or migration.
  • Reducing production bundle sizes by manually tree-shaking dead code identified by the scanner.
  • Cleaning up barrel files and index re-exports to resolve complex import cycles.

How Dead Code Finder Works

  1. The tool parses the project configuration to identify defined entry points like main.ts or index.js.
  2. It scans all project files while respecting tsconfig path aliases and ignoring specified directories like node_modules or dist.
  3. A comprehensive reference graph is built to track every import and export across the entire codebase.
  4. It cross-references imported symbols against exports and checks every file against the global dependency graph.
  5. A detailed report is generated, highlighting specific lines of code or files that are unreferenced and safe for removal.

Dead Code Finder Setup

To begin optimizing your project with this utility from Openclaw Skills, use the following commands:

# Perform a full scan for unused exports, files, and dependencies
python3 scripts/find_dead_code.py /path/to/project

# Run a targeted scan for unused exports only
python3 scripts/find_dead_code.py /path/to/project --mode exports

# Export the results to JSON for programmatic analysis
python3 scripts/find_dead_code.py /path/to/project --json

Dead Code Finder Data Schema & Taxonomy

The tool organizes findings into three primary categories to help developers prioritize cleanup tasks. The following table describes the data structure of the report:

Data Category Description Examples
Unused Exports Exported symbols never referenced in other files. functions, constants, types, interfaces
Unreferenced Files Files not part of the project's import tree. legacy components, deprecated utils
Unused Dependencies npm packages listed in package.json but never imported. moment, lodash.merge, utility libraries

When using the --json flag, the tool returns a structured object mapping these categories to specific file paths and symbol names.

Dead Code Finder Advanced Features

  • Support for TypeScript path aliases and complex monorepo structures.
  • Deep analysis of barrel files (index.ts) and complex re-export patterns.
  • Customizable entry point detection for frameworks like Next.js (pages/app directories).
  • Intelligent filtering to ignore test files, configuration scripts, and documentation by default.
  • Ability to handle scoped packages and subpath imports in dependency auditing.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*