with one click
deadcode-scan
Detect dead and unused code. Read-only - does not fix or delete.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Detect dead and unused code. Read-only - does not fix or delete.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Read-only quality scan of components. Reports problems without making changes. Uses software-base + domain profile skills.
Refactoring patterns - improving code design without changing behavior
Read-only quality scan of components. Reports problems without making changes. Uses software-base + domain profile skills.
Internal phase: independent Codex review + targeted fixes. Not user-facing.
Find duplicated code and consolidate into shared utilities. Fixes all duplicates.
Reference templates for Codex evaluation. Used by build/improve orchestrators — not executed directly.
| name | deadcode-scan |
| description | Detect dead and unused code. Read-only - does not fix or delete. |
Read-only scan for dead and unused code. Reports findings without making changes.
No arguments? Describe this skill and stop. Do not execute.
Each category has a severity weight. The Dead Code Index is the weighted sum.
| Category | Weight | Why |
|---|---|---|
| Orphaned files | 3 | Entire files of dead weight |
| Unreachable code | 3 | Logic errors, confuses readers |
| Unused exports | 2 | Public API pollution, maintenance drag |
| Dead branches | 2 | Always-true/false conditions hide bugs |
| Unused imports | 1 | Minor noise, easy to fix |
| Unused variables | 1 | Minor noise, compiler catches most |
Index interpretation:
.ts/.js files not imported by any other file in the projectreturn, throw, break, continueif (false) or if (true) equivalent conditionsRun TypeScript compiler with strict unused checks:
npx tsc --noEmit --noUnusedLocals --noUnusedParameters 2>&1 | head -200
Parse TS6133 (declared but never read) and TS6196 (declared but never used) errors. Record each as [file:line].
If tsc is unavailable or the project isn't TypeScript, skip to Step 2.
Build a file-level import graph:
.ts, .tsx, .js, .jsx) excluding node_modules, dist, buildindex.*, main.*, cli.*, app.*, server.*, files in bin/, and test files (*.test.*, *.spec.*)For each source file:
export function, export const, export type, export interface, export class)Read each file and identify:
return/throw/break/continueCollect all findings. Do not fix anything.
## Dead Code Scan: [target]
DEAD_CODE_FOUND:
- [file:line] [category]: [description]
- [file:line] [category]: [description]
SUMMARY:
| Category | Count | Weight | Score |
|----------|-------|--------|-------|
| Orphaned files | N | 3 | N*3 |
| Unreachable code | N | 3 | N*3 |
| Unused exports | N | 2 | N*2 |
| Dead branches | N | 2 | N*2 |
| Unused imports | N | 1 | N*1 |
| Unused variables | N | 1 | N*1 |
TOTAL_FINDINGS: N
DEAD_CODE_INDEX: N (interpretation)
RECOMMENDATION: Remove dead code to reduce maintenance burden
When called from /build or /improve orchestrators, output findings as:
[file:line] [category]: description
End with: DEADCODE_SCAN_DONE
This is a read-only scan. It does not delete, fix, or modify any files.