Skip to content
Skills Library
Programming · Review & audit

dead-code-audit

/dead-code-audit

Detect unused code — unreferenced functions, dead imports, orphan files, and unreachable branches. Use when hunting dead code before a cleanup or release, or when the user suspects code is unused.

Licence
MIT
Last repository change
21.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 21.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Detect unused code — unreferenced functions, dead imports, orphan files, and unreachable branches. Use when hunting dead code before a cleanup or release, or when the user suspects code is unused.

Original author description

Detect unused code — unreferenced functions, dead imports, orphan files, and unreachable branches. Use when hunting dead code before a cleanup or release, or when the user suspects code is unused.

How it works

  1. Core Rule
  2. Kit Context
  3. When to Use
  4. Default Behavior
  5. Scope Rules
  6. Context Gathering
  7. Process
  8. Output Format
  9. Report Guidelines
  10. Notes
Original SKILL.md headings · 164 lines, 977 words
SKILL.md preview
---
name: dead-code-audit
description: Detect unused code — unreferenced functions, dead imports, orphan files, and unreachable branches. Use when hunting dead code before a cleanup or release, or when the user suspects code is unused.
user-invocable: true
---

# Dead Code Audit

## Core Rule

Confirm code is unreachable across the full call graph before flagging. Never remove code without explicit user approval, even for obvious dead branches.

## Kit Context

Before starting this skill, ensure you have completed session boot:
1. Read `CODEBASE_MAP.md` for project understanding
2. Read `CLAUDE.project.md` if it exists for project-specific rules
3. Read `tasks/lessons/_index.md` for accumulated corrections (Top Rules + index)

If any of these haven't been read in this session, read them now before proceeding.

## When to Use

Invoke with `/dead-code-audit` when:

- Codebase has grown organically and likely contains unused code
- After a major feature removal or refactoring
- Before a codebase migration to minimize what gets carried over
- During tech debt reduction sprints
- Preparing for a code quality review or due diligence

## Default Behavior

When the user asks to audit, scan, review, or "give me a report" for dead code / unused code, produce the full dead-code-audit report automatically using the Process and Output Format sections below. Do not require the user to specify fields.

Only modify files when the user explicitly requests implement / fix / apply / refactor. By default, this skill is **report-only**.

## Scope Rules

- Analyze ONLY the files and directories relevant to this skill's purpose
- Do not refactor, fix, or modify code — this is a read-only analysis unless explicitly stated otherwise
- Log unrelated issues found during analysis under `tasks/todo.md > ## Not Now`
- State every assumption explicitly before acting on it
- If the user specified a scope (files, directories, modules), respect it strictly

## Context Gathering

Before analysis, map the project:
1. Read project config (`package.json`, `pyproject.toml`, `go.mod`, `Cargo.toml`, etc.)
2. Identify the tech stack, frameworks, and key dependencies
3. Map source directories — skip `node_modules`, `vendor`, `build`, `.next`, `dist`, `__pycache__`
4. Check for existing configurations relevant to this analysis (linters, formatters, CI configs)
5. If the user specified a scope, narrow to those files/directories only

## Process

### Phase 1: Inventory (first-pass leads)

This pass produces **candidates**, not findings. Treat counts as leads for deeper inspection in later phases. Do not report Phase 1 raw output as the final result.

1. Identify the project's source directories (skip node_modules, vendor, build output)
2. Build a list of all exported symbols: functions, classes, types, constants, components
3. Note the project's module system: ES modules, CommonJS, Python imports, Go packages, etc.

### Phase 2: Reference Analysis

For each exported symbol, search for references across the entire project:

**Unreferenced Exports**
- Functions/methods defined but never called
- Classes/types defined but never instantiated or referenced
- Constants defined but never used
- Components defined but never rendered

**Dead Imports**
- Imported symbols that are never used in the importing file
- Entire modules imported but no symbols used
- Type-only imports in runtime code (where applicable)

**Orphan Files**
- Files not imported by any other file
- Test files for code that no longer exists
- Config files for removed features
- Migration files for rolled-back changes

**Unreachable Code**
- Code after unconditional return/throw/break
- Branches that can never be true (constant conditions)
- Feature-flagged code where the flag is permanently off
- Catch blocks for exceptions that are never thrown

### Phase 3: False Positive Filtering

Before reporting, verify each finding is truly dead:

- **Entry points**: main files, CLI handlers, server routes, event handlers — these won't be imported
- **Dynamic references**: string-based imports, reflection, registry patterns, dependency injection
- **Framework conventions**: lifecycle hooks, decorators, magic methods that are called by the framework
- **Re-exports**: barrel files (index.ts/js, `__init__.py`) that re-export for public API
- **Config-wired**: symbols registered in config files, plugin systems, or service containers
- **Test utilities**: helpers only used in test files (search test directories too)
- **Type-only usage**: types/interfaces used only in type annotations

### Phase 4: Impact Assessment

For confirmed dead code, assess:

- Lines of dead code (absolute and percentage of codebase)
- Maintenance burden (dead code with dependencies that block upgrades)
- Confusion risk (dead code that looks similar to active code)

## Output Format

```markdown
# Dead Code Audit Report

## Summary
- Total dead code: ~N lines across M files
- Orphan files: N
- Unused exports: N
- Dead imports: N

## Orphan Files (no importers)
| File | Lines | Last Modified | Confidence |
|------|-------|---------------|------------|
| path/to/file.ts | 150 | 2024-01-15 | High |

## Unused Exports
| Symbol | Defined In | Type | Confidence |
|--------|-----------|------|------------|
| processOrder | services/order.ts:45 | function | High |

## Dead Imports
| File | Unused Import | Line |
|------|--------------|------|
| handlers/user.ts | formatDate | 3 |

## Unreachable Code
| File | Lines | Reason |
|------|-------|--------|
| utils/parser.ts | 120-135 | After unconditional return on line 119 |

## Safe to Remove (High Confidence)
[List of items safe to remove immediately]

## Needs Verification (Medium Confidence)
[List of items that might have dynamic references]

## Removal Impact
- Estimated lines removable: N
- Files deletable: N
- Dependencies unlockable: [packages only used by dead code]
```

## Report Guidelines

- Use tables for structured findings — they're scannable and diffable
- Include file paths with line numbers (`file.ts:42`) for every finding
- Separate findings by severity: Critical > Major > Minor
- End with actionable recommendations, not just observations
- If no issues found in a category, state it explicitly — don't omit the section

## Notes

- Confidence levels: **High** = no references found anywhere; **Medium** = might have dynamic/config references
- For removal, use the `dead-code-remover` agent which handles safe deletion with verification
- This audit is read-only — it identifies dead code but does not remove it
- "Exported != Used" — a symbol exported from a file is only alive if something imports and uses it

Versions

RepositoryScoreLicence
This page · tansuasici/claude-code-kit100MIT
anortham/julie100MIT

Database snapshot: 13.11.2026 · package version c26d4789441c (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100find-dead-code
    Find unused functions, classes, imports, and unreachable code paths. Use when the user asks to find dead code, unused code, cleanup candidates, or wants to reduce codebase size.
  • 100code-dead-code
    Detect dead code, unused exports, unreachable branches, and orphaned files. Use when reducing maintenance burden, cleaning up after refactors, or auditing codebase health.
  • 84analyze-dead-code
    Find and remove dead code — unused exports, unreachable modules, and stale files. Always use this skill whenever the user says "find dead code", "remove unused code", "clean up unused exports", "what code can we delete", "detect unreachable code", "what files are no longer…
  • 90finding-dead-code
    Use when reviewing code changes, auditing new features, or cleaning up. Triggers: 'find dead code', 'find unused code', 'check for unnecessary additions', 'what can I remove', 'is this used anywhere', 'can I delete this', 'orphaned code', 'unused imports'.
  • 100fai-dead-code-removal
    Identify and remove dead code in Python/TypeScript — unused exports, unreachable branches, and orphaned files, verified by tooling. Use this skill when cleaning up a codebase, reducing bundle size, or before a refactor — even if the user only says "remove unused code".
  • 90removing-dead-code
    Use when asked to find, audit or remove dead, unused or unreachable code in a Swift package or Xcode app, repository-wide or in one module ("dead code cleanup", "удалить неиспользуемый код", unused declarations, imports, target dependencies, resources, assets or files), or when…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.