codebase-hygiene
Installation
SKILL.md
Codebase Hygiene (Duplicate Detection + Module Deepening)
Advisory and read-heavy. Diagnoses and proposes; does not refactor. Any actual change goes through BUILD with full gates.
Mode: DUPLICATE DETECTION
Semantic duplicates: functions serving the same purpose but implemented independently under different names. Copy-paste detectors catch syntactic duplicates; this finds "same intent, different implementation."
Method
- Scope before you scan — take the user's named target; else
git log --onelinefor hot spots and weight recently-changed code — deepening pays off in proportion to future change. - Extract catalog — Grep/Glob for exported functions. Record
name | file:line | signature. - Categorize by domain (cheap tier) — validation, formatting, path manipulation, HTTP shaping, date handling. Mechanical bucketing to shrink comparison space.
- Drop categories with <3 functions — can't hide a meaningful duplication pattern.
- Detect duplicates per category (capable tier) — read implementations, decide which share intent. Never use cheap tier for detection — it anchors on names and rubber-stamps "these look different."
- Emit findings — group by confidence, highest first. Each finding: what is duplicated, why it matters, the fix,
file:lineevidence. Route through code-reviewer finding contract.