Enforces dead code elimination rules (DEAD-1 through DEAD-5). Loaded by the conductor for review, refactor, and cleanup operations. Detects commented-out code, unused exports, orphaned files, unlinked TODOs, and stub/placeholder functions. References scripts/lint_dead_code.py for export and orphan detection.
From clean-code-codexnpx claudepluginhub mikecubed/agent-orchestration --plugin clean-code-codexThis skill uses the workspace's default tool permissions.
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Details PluginEval's skill quality evaluation: 3 layers (static, LLM judge), 10 dimensions, rubrics, formulas, anti-patterns, badges. Use to interpret scores, improve triggering, calibrate thresholds.
Hook coverage check (run first): Before running DEAD-1 detection, check whether the hook already flagged commented-out code blocks in this session for the file(s) in scope:
cat "$COVERAGE_FILE" 2>/dev/null # COVERAGE_FILE = /tmp/codex-hook-coverage-<PROJECT_HASH>.jsonl
For each JSON line where "rule" is "DEAD-1", extract file, line, and
end_line. When scanning, skip any file+line range that matches an existing
coverage record.
Log: "Skipping DEAD-1 at {file}:{line}-{end_line} — already reported by hook this session."
If no coverage file exists, proceed with the full DEAD-1 analysis.
For unused export and orphan detection: invoke
scripts/lint_dead_code.py --path {scope} and parse its JSON output.
Requires Python 3.12+ (python3.12 scripts/lint_dead_code.py --path {scope}).
Precedence in the overall system: SEC → TDD → ARCH/TYPE → NAME/SIZE/DEAD → quality BLOCK.
| Category | Description |
|---|---|
| Commented-out code | Any block of syntactically valid code inside a // or /* */ comment |
| Unused export | An exported symbol with zero import references in the codebase |
| Orphaned file | A source file unreachable from any entry point via imports |
| Unlinked TODO | TODO: / FIXME: / HACK: without an issue tracker reference |
| Stub / placeholder | Function body that is only pass, throw new Error('not implemented'), todo!(), unimplemented!() |
Severity: BLOCK | Languages: * | Source: CCC
What it prohibits: Blocks of code that have been commented out rather than deleted. This includes single-line and multi-line commented code, regardless of how recently it was added.
Exemptions (not flagged):
//nolint:, # noqa:, #[allow(...)] suppression comments/// or /** */)Detection:
//, #, /*, *) is valid code syntax:
=, :=)name()if , for , while , return )}, )) at line startagent_action:
DEAD-1 (BLOCK): Commented-out code block at {file}:{start_line}-{end_line}.--fix: delete the commented block (no confirmation required — git is
the backup)Bypass prohibition: "I might need it later", "it's a reference", "it documents what was tried" → Refuse. Cite DEAD-1. Write a commit message. Delete the code.
Severity: WARN | Languages: typescript, javascript, python, rust | Source: CCC
What it prohibits: Exported/public symbols (functions, classes, constants, types) that are not imported or referenced anywhere in the codebase. These inflate public API surface area and imply tests must be written for them.
Go note: Go's compiler enforces unused imports natively. Unexported symbols in Go are not flagged by this rule — only exported (PascalCase) symbols.
Detection:
python3.12 scripts/lint_dead_code.py --path {scope}unused_exports array{ "file": "...", "line": N, "symbol": "..." }agent_action:
DEAD-2 (WARN): Unused export '{symbol}' at {file}:{line}.--fix and confirmed not part of public API: remove the export and its
declaration if it has no internal usages eitherSeverity: WARN | Languages: * | Source: CCC
What it prohibits: Source files that are not reachable from any entry point via the import graph. Orphaned files are often the remains of deleted features or refactored modules that were never cleaned up.
Entry points (heuristic — adapt to project):
index.ts / main.ts / app.ts / server.tsmain.py / __main__.pymain.gomain.rs*.test.*, test_*.py, *_test.go, #[cfg(test)] modules)Detection:
python3.12 scripts/lint_dead_code.py --path {scope}orphaned_files array{ "file": "...", "reason": "..." }agent_action:
DEAD-3 (WARN): Orphaned file '{file}' — not reachable from any entry point.--fix mode{file}. Proceed? (y/n)"y confirmationSeverity: WARN | Languages: * | Source: CCC
What it prohibits: TODO:, FIXME:, HACK:, XXX:, BUG: comments that
do not reference an issue tracker ticket. Unlinked TODOs become permanent
fixtures. Every deferred item must have an owner and a tracking number.
Compliant formats:
// TODO(#123): Implement retry logic after rate limiting
// TODO(GH-456): Remove after migration to v2 API
# FIXME(JIRA-789): Handle None case for legacy records
// HACK(#234): Temporary workaround for upstream bug — remove after v3.1
Non-compliant formats:
// TODO: fix this later
// FIXME: handle error
// HACK: temporary workaround
Detection:
TODO:, FIXME:, HACK:, XXX:, BUG: without a (#...) or
(GH-...) or (JIRA-...) or ([A-Z]+-[0-9]+) pattern immediately afteragent_action:
DEAD-4 (WARN): Unlinked TODO at {file}:{line}: '{comment}'.TODO: {text} → TODO(#{issue_number}): {text}--fix: convert format to TODO(#?): {text} with ? as placeholder,
noting that the issue number must be filled inSeverity: BLOCK | Languages: * | Source: CCC
What it prohibits: Functions in non-test code whose body consists only of:
pass (Python)throw new Error('not implemented') / throw new Error('TODO') (TypeScript/JavaScript)todo!() / unimplemented!() (Rust)panic("not implemented") (Go){}These are scaffolding artifacts. They imply a contract without delivering it and will cause runtime failures when called.
Exemptions:
*.test.*, test_*.py, etc.)Detection:
throw new Error('not implemented'), todo!(), unimplemented!(),
panic("not implemented") outside test filespass (Python),
in non-test filesagent_action:
DEAD-5 (BLOCK): Stub/placeholder function '{name}' at {file}:{line}.Bypass prohibition: "I'll implement it later" → Refuse. Cite DEAD-5. Either implement the minimum viable version or delete it and track via issue.
Report schema: see skills/conductor/shared-contracts.md.