utils-precedentlisted
Install: claude install-skill soumit-kaz/lazysitter
# Hook and util precedent
Components get the attention; **the duplication that rots a frontend codebase lives below them**. The fourth `getInitials`, the third `useDebounce`, two date formatters that disagree about timezones. None of these is findable by name.
## Structural clone detection
```bash
lazysitter fe-index dup --kind util
lazysitter fe-index dup --kind hook
```
The index alpha-normalizes each function before comparing: every identifier collapses to a placeholder, while keywords, operators and literal *kinds* are preserved. The resulting 5-gram shingle sets are compared by Jaccard similarity. **Two functions that differ only in variable and parameter naming produce identical shingles.**
That is why `formatMoney(cents, currency)` and `toCurrency(amount, code)` land in the same cluster despite sharing no identifier. No grep, and no fuzzy name match, connects them.
**A shingle match is a strong signal, not proof of identical semantics.** Open both and confirm — the edge cases are where they diverge, and the divergence is usually the reason someone wrote the second one. Report the delta; "near-duplicate" with no delta is not actionable.
## Search by shape, not only by name
```bash
lazysitter fe-index precedent "currency formatting" --kind util
lazysitter fe-index query --kind hook --like "debounce"
lazysitter fe-index query --has-hook useEffect --kind hook # hooks with effects
lazysitter fe-index who useDebounce # real adoption
```
##