Agent skill
clean-code-dead-code-identification-and-removal
Sub-skill of clean-code: Dead Code Identification and Removal.
Install this agent skill to your Project
npx add-skill https://github.com/vamseeachanta/workspace-hub/tree/main/.claude/skills/_archive/workspace-hub/clean-code/dead-code-identification-and-removal
SKILL.md
Dead Code Identification and Removal
Dead Code Identification and Removal
Dead code is any code that is never called, imported, or referenced.
# Find files that nothing imports (potential dead modules)
# Run from repo root:
python3 -c "
import ast, os, sys
from pathlib import Path
src = Path('src')
all_files = list(src.rglob('*.py'))
imported = set()
for f in all_files:
try:
tree = ast.parse(f.read_text())
for node in ast.walk(tree):
if isinstance(node, (ast.Import, ast.ImportFrom)):
if hasattr(node, 'module') and node.module:
imported.add(node.module.split('.')[-1])
except:
pass
for f in all_files:
stem = f.stem
if stem not in imported and stem != '__init__':
print(f)
"
Common dead code patterns to delete:
*_unused.py— explicitly named dead code*_old.py,*_bak.py,*.py.bak— backup files (use git, not backup files)- Files with only
passin every function - Commented-out code blocks >5 lines (use git history instead)
__all__ = []with no exports (likely orphaned)
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
gsd-complete-milestone
Archive completed milestone and prepare for next version
gsd-reapply-patches
Reapply local modifications after a GSD update
gsd-verify-work
Validate built features through conversational UAT
gsd-thread
Manage persistent context threads for cross-session work
clinical-trial-protocol
Generate clinical trial protocols for medical devices or drugs through a modular, waypoint-based architecture with research-only and full protocol modes.
single-cell-rna-qc
Performs quality control on single-cell RNA-seq data (.h5ad or .h5 files) using scverse best practices with MAD-based filtering and comprehensive visualizations.
Didn't find tool you were looking for?