code-pattern-extractor
Installation
SKILL.md
Code Pattern Extractor
Every codebase has patterns — some intentional (house idioms), some accidental (copy-paste). Finding them tells you how code gets written here, and which duplication should be consolidated.
Three pattern types
| Type | What it is | What to do with it |
|---|---|---|
| Idiom | The team's standard way of doing X | Document it. New code should follow it. |
| Clone | Copy-pasted code with minor tweaks | Extract to a function. → code-refactoring-assistant |
| Anti-pattern | A recurring mistake | Flag it. → code-smell-detector |
The same structural pattern can be any of the three — it depends on whether the repetition is good, accidental, or bad.
Finding clones — structural similarity
Exact-text clones are easy (rg + sort + uniq -c). Near-clones — same structure, different variable names — need normalization: