dead-code
npx machina-cli add skill parcadei/Continuous-Claude-v3/dead-code --openclawDead Code Detection
Find unused functions and dead code using TLDR static analysis.
Quick Start
# Scan entire project
tldr dead .
# Scan specific directory
tldr dead src/
# Specify entry points (functions to exclude from analysis)
tldr dead . --entry main cli test_
# Specify language
tldr dead . --lang python
tldr dead . --lang typescript
Output Format
Dead code analysis:
Total functions: 150
Dead functions: 12
Unused functions:
- old_helper (src/utils.py:42)
- deprecated_func (src/legacy.py:15)
- _unused_method (src/api.py:230)
Cross-Platform
Works on Windows, Mac, and Linux (including WSL).
# Windows (PowerShell)
tldr dead .
# Mac/Linux
tldr dead .
Entry Points
Functions matching entry patterns are excluded from dead code analysis:
main,cli- Application entry pointstest_*,*_test- Test functionssetup,teardown- Fixtures@app.route,@api.endpoint- Framework handlers
# Custom entry points
tldr dead src/ --entry main api_handler background_job
Integration
This skill replaces the session-start-dead-code hook with on-demand analysis.
| Approach | Pros | Cons |
|---|---|---|
| Hook (removed) | Automatic | Slowed startup by 3s |
| Skill (this) | On-demand, fast | Manual invocation |
Related Commands
# Impact analysis (who calls this?)
tldr impact func_name .
# Architecture layers
tldr arch src/
# Full codebase structure
tldr structure . --lang python
Source
git clone https://github.com/parcadei/Continuous-Claude-v3/blob/main/.claude/skills/dead-code/SKILL.mdView on GitHub Overview
Dead Code Detection uses TLDR static analysis to identify unused functions and dead code in the codebase. This helps teams clean up legacy code, reduce maintenance overhead, and improve code readability.
How This Skill Works
Run tldr dead with Bash to analyze the project. You can scan the entire project or a specific directory, and optionally exclude entry points with --entry or target a language with --lang. The tool reports a Dead code analysis section and an Unused functions list with file paths.
When to Use It
- Clean a legacy codebase by removing unreachable functions
- Focus a cleanup pass on a specific directory like src/
- Exclude application entry points to avoid false positives
- Target a particular language (Python or TypeScript) during cleanup
- Assess code health after major refactors or rewrites
Quick Start
- Step 1: Scan the entire project with tldr dead .
- Step 2: Narrow to a directory, e.g., tldr dead src/
- Step 3: Exclude entry points and/or set language, e.g., tldr dead . --entry main cli test_ and tldr dead . --lang python
Best Practices
- Run on small modules first to validate results
- Always exclude known entry points to reduce noise
- Cross-check dead function candidates with unit tests or docs
- Use language filtering (--lang) to improve accuracy
- Regularly re-scan after significant changes
Example Use Cases
- old_helper (src/utils.py:42)
- deprecated_func (src/legacy.py:15)
- _unused_method (src/api.py:230)
- temp_calc (src/analytics/stats.py:120)
- stale_init (lib/core.py:89)