npx skills add ...
npx skills add openshift/lightspeed-service --skill find-dead-code
npx skills add openshift/lightspeed-service --skill find-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.
Detect unused code that can be safely removed.
ols/). Skip tests unless explicitly asked.Ask the user:
ols/ directory.For branch mode:
--min-confidence 80 reduces noise. Lower confidence findings are more likely false positives.
Cross-reference with vulture findings to increase confidence.
Common false positives in this codebase:
| Pattern | Why it's not dead |
|---|---|
Pydantic model_validator, field_validator | Called by Pydantic, not directly |
| FastAPI dependency functions | Injected via Depends() |
__eq__, __hash__, __str__ | Called implicitly by Python |
| Constants used in config YAML | Referenced by config loader |
| Abstract method implementations | Called via base class interface |
Imports re-exported from __init__.py | Used by external consumers |
For each finding, classify:
| Category | Criteria | Action |
|---|---|---|
| Remove | Clearly unused, no dynamic references | Safe to delete |
| Verify | Possibly used dynamically or externally | Search for string references before removing |
| False positive | Pydantic/FastAPI/magic method | Skip |
For "Verify" findings, search for string-based references:
For each finding:
Summary: total findings, how many safe to remove, estimated lines saved.
rg "<function_or_class_name>" ols/ tests/