clean-code-dead-code-identification-and-removal

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

5 stars

Best use case

clean-code-dead-code-identification-and-removal is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

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

Teams using clean-code-dead-code-identification-and-removal should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/dead-code-identification-and-removal/SKILL.md --create-dirs "https://raw.githubusercontent.com/vamseeachanta/workspace-hub/main/.agents/skills/_archive/workspace-hub/clean-code/dead-code-identification-and-removal/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/dead-code-identification-and-removal/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How clean-code-dead-code-identification-and-removal Compares

Feature / Agentclean-code-dead-code-identification-and-removalStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

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

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 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)

---

Related Skills

mnt-analysis-cleanup

5
from vamseeachanta/workspace-hub

Survey, classify, and clean up `/mnt/local-analysis/` (or any sibling-to-workspace-hub directory holding orphan worktrees, codex-burn artifacts, agent log accumulations, and outer-clone duplicates) without losing useful code/work. Surfaces a tiered approval menu rather than baking decisions; defers all destructive ops until user confirms.

pre-completion-cleanup-audit

5
from vamseeachanta/workspace-hub

Audit and dispose of session residue (orphan files, scratch dirs, sibling-repo state, locks, trash-stages) BEFORE claiming a task complete. Required gate before any agent says "all done", "task complete", or hands work back to user/orchestrator.

git-worktree-cleanup-at-scale

5
from vamseeachanta/workspace-hub

Identify and remove stale git worktrees blocking branch deletion in multi-repo environments

git-worktree-cleanup-and-branch-reconciliation

5
from vamseeachanta/workspace-hub

Systematic process for cleaning up stale git worktrees, resolving merge conflicts in diverged branches, and reconciling branch state across multiple repositories.

git-worktree-cleanup-and-branch-hygiene

5
from vamseeachanta/workspace-hub

Systematic approach to cleaning up stale git worktrees, orphan branches, and branch hygiene at scale across multiple repos

git-blob-size-filter-cleanup

5
from vamseeachanta/workspace-hub

Strip oversized blobs from unpushed commits using git filter-branch when GitHub's 100 MB limit blocks push

clean-worktree-integration-from-dirty-main

5
from vamseeachanta/workspace-hub

Land validated issue work from isolated worktrees when the main checkout is dirty by creating a fresh integration worktree, cherry-picking only implementation commits, re-running combined validation, and preparing push/closeout artifacts.

clean-code

5
from vamseeachanta/workspace-hub

Clean code enforcement for workspace-hub Python repos: file/function size limits, God Object detection, naming rules, dead code removal, and refactor decision guidance. Consult before writing new modules or accepting large files.

live-writer-branch-cleanup-guard

5
from vamseeachanta/workspace-hub

Guardrails for multi-repo sync and branch cleanup when workspace-hub or another shared repo has active writer sessions, worktree-backed branches, or unrelated-history branches.

full-branch-cleanup-and-worktree-hygiene

5
from vamseeachanta/workspace-hub

Track all dirty/untracked workspace-hub changes, merge stale branches into main, clean remote/local branches, and remove stale worktrees while preserving tracked nested gitlinks.

blocked-branch-preserve-tag-cleanup

5
from vamseeachanta/workspace-hub

Safely clean stale local branches that cannot be merged by preserving them with local tags before deletion

gmail-extract-and-clean

5
from vamseeachanta/workspace-hub

DEPRECATED — superseded by gmail-extract-and-act. Extract emails from Gmail to /mnt/ace/<repo>/, archive to repos, commit, then delete. Uses archive-everything model.