Dead check
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 its SKILL.md
npx -y skills add mikecubed/clean-code-codex --skill dead-checkAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
8.8 KB, as published. Nobody here has run it
Dead Check — Dead Code Elimination
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.
What Counts as Dead Code
| 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!() |
Rules
DEAD-1 — No Commented-Out Code
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):
- Single-line explanatory comments (non-code English prose)
- JSDoc / rustdoc / godoc comment blocks above declarations
//nolint:,# noqa:,#[allow(...)]suppression comments- Example code inside documentation comments (within
///or/** */)
Detection:
- Grep for comment blocks where the content after removing comment markers
(
//,#,/*,*) is valid code syntax:- Contains assignment operators (
=,:=) - Contains function call patterns (
name() - Contains control flow (
if,for,while,return) - Contains closing braces/parens (
},)) at line start
- Contains assignment operators (
- Multi-line comment blocks where ≥ 3 consecutive lines match the above
- Flag each occurrence
agent_action:
- Cite:
DEAD-1 (BLOCK): Commented-out code block at {file}:{start_line}-{end_line}. - Show the commented block
- State: "This code should be deleted. Git history preserves it if needed."
- If
--fix: delete the commented block (no confirmation required — git is the backup) - DO NOT preserve commented-out code when writing or refactoring
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.
DEAD-2 — No Unused Exports
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:
- Run:
python3.12 scripts/lint_dead_code.py --path {scope} - Parse JSON output —
unused_exportsarray - Each entry:
{ "file": "...", "line": N, "symbol": "..." }
agent_action:
- Cite:
DEAD-2 (WARN): Unused export '{symbol}' at {file}:{line}. - Ask: "Is this export part of a public library API intended for external consumers?" If yes → add a suppression waiver. If no → delete.
- If
--fixand confirmed not part of public API: remove the export and its declaration if it has no internal usages either - Do not remove if any external consumer may exist (library context)
DEAD-3 — No Orphaned Files
Severity: 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 files (
*.test.*,test_*.py,*_test.go,#[cfg(test)]modules)
Detection:
- Run:
python3.12 scripts/lint_dead_code.py --path {scope} - Parse JSON output —
orphaned_filesarray - Each entry:
{ "file": "...", "reason": "..." }
agent_action:
- Cite:
DEAD-3 (WARN): Orphaned file '{file}' — not reachable from any entry point. - Show possible reasons: deleted import, renamed module, leftover scaffold
- ⚠️ Requires explicit confirmation before deletion — even in
--fixmode - Present: "Proposed action: delete
{file}. Proceed? (y/n)" - Only delete after explicit
yconfirmation
DEAD-4 — TODOs Must Reference an Issue Tracker
Severity: 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:
- Grep for
TODO:,FIXME:,HACK:,XXX:,BUG:without a(#...)or(GH-...)or(JIRA-...)or([A-Z]+-[0-9]+)pattern immediately after
agent_action:
- Cite:
DEAD-4 (WARN): Unlinked TODO at {file}:{line}: '{comment}'. - Propose conversion:
TODO: {text}→TODO(#{issue_number}): {text} - If no issue exists yet: "Create an issue for '{text}' and add the reference."
- If
--fix: convert format toTODO(#?): {text}with?as placeholder, noting that the issue number must be filled in
DEAD-5 — No Placeholders or Stubs in Production Code
Severity: 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)- An empty body
{}
These are scaffolding artifacts. They imply a contract without delivering it and will cause runtime failures when called.
Exemptions:
- Abstract method declarations in abstract classes (the stub IS the contract)
- Interface method signatures (no body)
- Test doubles / mocks in test files (
*.test.*,test_*.py, etc.)
Detection:
- Grep for
throw new Error('not implemented'),todo!(),unimplemented!(),panic("not implemented")outside test files - Grep for single-statement function bodies containing only
pass(Python), in non-test files
agent_action:
- Cite:
DEAD-5 (BLOCK): Stub/placeholder function '{name}' at {file}:{line}. - Options:
- If this is a planned feature: create an issue, replace with a DEAD-4 compliant TODO comment above the function, and implement a minimal real body (even if it returns a zero value)
- If this is scaffolding that was never implemented: delete the function and all call sites
- DO NOT produce code that calls or wraps a stub function
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.