Skip to content
Back to skills

Dead Code Identification And Removal

ASecurity

Sub-skill of clean-code: Dead Code Identification and Removal.

  • 17 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 9, 2026
developmentpythongobashnodegit

Security analysis

A100/100

Scanned September 9, 2026

npx -y skills add vamseeachanta/workspace-hub --skill dead-code-identification-and-removal --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Dead Code Identification And Removal?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Dead Code Identification And Removal
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vamseeachanta-dead-code-identification-and-removal/badge)](https://www.skillsdirectory.com/skills/vamseeachanta-dead-code-identification-and-removal)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: clean-code-dead-code-identification-and-removal
description: 'Sub-skill of clean-code: Dead Code Identification and Removal.'
version: 2.1.0
category: workspace
type: reference
scripts_exempt: true
---

# Dead Code Identification and Removal

## Dead Code Identification and Removal


Dead code is any code that is never called, imported, or referenced.

```bash
# 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 `pass` in every function
- Commented-out code blocks >5 lines (use git history instead)
- `__all__ = []` with no exports (likely orphaned)

---

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.