cleanup-dedupe

Installation
SKILL.md

Find duplicated code and consolidate where it reduces complexity. Auto-extract only token-identical, sizeable blocks. Smaller or divergent duplicates often shouldn't be DRY'd — premature abstraction is worse than 3 similar lines.

Preflight

  1. Language detect — jscpd handles 150+ languages, so we run it on whatever is present.
  2. Git state: refuse auto-apply on dirty tree.
  3. Report dir: ensure .claude/cleanup-reports/ exists.
  4. Read existing util conventions: where does the project keep shared utilities? Look for lib/, utils/, shared/, common/, package directories. Extracted code goes there.

Detect

# jscpd - the standard for cross-language clone detection
bunx jscpd --min-tokens 70 --min-lines 30 --threshold 0 --reporters json --output /tmp/jscpd-out . 2>/dev/null \
  || npx jscpd --min-tokens 70 --min-lines 30 --reporters json --output /tmp/jscpd-out .

Parse /tmp/jscpd-out/jscpd-report.json. Each duplication entry has firstFile, secondFile, lines, tokens, and the actual fragment.

Installs
2
GitHub Stars
78
First Seen
2 days ago
cleanup-dedupe — raintree-technology/claude-starter