Skill
Code Duplication Removal
Detects copy-pasted blocks and merges them into one abstraction only when the copies change together, leaving look-alikes that evolve apart untouched.
1Merge copies that share a reason to change. Leave the rest.
2Steps
31. Detect candidates with a tool if the project has one (`npx jscpd`, `pmd cpd`, or the linter's duplicate rule); otherwise search for repeated distinctive lines with grep. Ignore generated files, tests and migrations unless asked.
42. For each pair or group, read all copies side by side. Write down exactly what differs: constants, types, one branch, a name.
53. Check how they evolved: `git log -L<start>,<end>:<file>` or `git log --oneline -- <file>` for each copy. If a past fix was applied to all copies together, they change together. If they were edited at different times for different reasons, they only look alike.
Claude CodeCodex
Code Duplication Removal
SkillCode quality
Free