Install
openclaw skills install deadcodeDead code and unused export detector — scans JavaScript/TypeScript, Python, Go, Java, and CSS for dead code, orphan files, unused exports, and code cruft
openclaw skills install deadcodeDeadCode scans source files for dead code, unused exports, orphan files, unreachable code paths, and code cruft across JavaScript/TypeScript, Python, Go, and CSS/SCSS. It uses regex-based pattern matching against 60+ dead code patterns, lefthook for git hook integration, and produces markdown reports with actionable cleanup recommendations.
deadcode scan [file|directory]One-shot dead code scan of files or directories.
How to execute:
bash "<SKILL_DIR>/scripts/deadcode.sh" scan [target]
What it does:
Example usage scenarios:
deadcode scan .deadcode scan src/utils.tsdeadcode scan src/deadcode orphans .deadcode hooks installInstall git pre-commit hooks that scan staged source files before every commit.
How to execute:
bash "<SKILL_DIR>/scripts/deadcode.sh" hooks install
What it does:
deadcode hooks uninstallRemove DeadCode git hooks.
bash "<SKILL_DIR>/scripts/deadcode.sh" hooks uninstall
deadcode report [directory]Generate a markdown dead code report with findings, severity breakdown, and cleanup steps.
bash "<SKILL_DIR>/scripts/deadcode.sh" report [directory]
What it does:
deadcode orphans [directory]Find orphan files that are never imported or referenced by any other file.
bash "<SKILL_DIR>/scripts/deadcode.sh" orphans [directory]
What it does:
deadcode ignore [pattern]Manage ignore rules for dead code detection.
bash "<SKILL_DIR>/scripts/deadcode.sh" ignore [pattern]
What it does:
deadcode sarif [directory]Generate SARIF output for CI/CD integration.
bash "<SKILL_DIR>/scripts/deadcode.sh" sarif [directory]
What it does:
deadcode statusShow license and configuration information.
bash "<SKILL_DIR>/scripts/deadcode.sh" status
DeadCode detects 60+ dead code patterns across 5 language categories:
| Category | Examples | Severity |
|---|---|---|
| JavaScript/TypeScript | Unused exports, console.log left in code, commented-out blocks, unreachable code after return/throw, empty function bodies, unused variables, dead switch cases, deprecated markers, empty catch blocks | Critical/High |
| Python | Functions defined but never called, unused imports, pass-only bodies, commented-out code, dead code after return/raise, all mismatches, empty except blocks | Critical/High |
| Go | Unused imports, unexported dead functions, dead code after return/panic, empty function bodies, commented-out code, empty init() functions | High/Medium |
| CSS/SCSS | Unused CSS classes/IDs, empty rule blocks, duplicate selectors, commented-out styles, !important overuse, unused CSS variables, empty media queries, vendor prefixes | Medium/Low |
| General | Orphan files, large comment blocks, TODO/FIXME density, debug/test code in production, placeholder text, feature flag remnants | High/Medium |
Users can configure DeadCode in ~/.openclaw/openclaw.json:
{
"skills": {
"entries": {
"deadcode": {
"enabled": true,
"apiKey": "YOUR_LICENSE_KEY_HERE",
"config": {
"severityThreshold": "high",
"ignorePatterns": ["**/test/**", "**/fixtures/**", "**/*.spec.*"],
"ignoreChecks": [],
"reportFormat": "markdown"
}
}
}
}
}
hooks install, prompt to install itThe user might say things like: