Help us improve
Share bugs, ideas, or general feedback.
From hone-skills
Finds duplicated code patterns across the codebase including exact copies and structural duplication (same logic with different variable names). Ranks by frequency and suggests extraction candidates. Designed for weekly runs. Do NOT use for method length, naming, or style concerns.
npx claudepluginhub ckorhonen/hone-skillsHow this skill is triggered — by the user, by Claude, or both
Slash command
/hone-skills:duplication-huntThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Scans source code to find duplicated patterns that indicate extraction
Provides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Provides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Share bugs, ideas, or general feedback.
Scans source code to find duplicated patterns that indicate extraction opportunities. Goes beyond simple copy-paste detection to find three types of duplication:
Ranks findings by occurrence count and block size to surface the highest-value extraction candidates first.
hone:method-brevity-audit instead.hone:intent-clarity-audit instead.hone:test-naming-audit instead.Identify scannable files. Walk the repository tree. Exclude vendored
directories (node_modules, vendor, dist, build, .git,
__pycache__), generated files, lock files, and user-specified exclusions.
Include test files in the scan — test duplication is also worth finding.
Normalize source code. For each file, produce a normalized form by:
Detect exact duplicates. Slide a window of minimum_block_size to 50
lines across each normalized file. Hash each window. Group windows by hash.
When the same hash appears in 2+ locations (across files or within the same
file), record an exact duplicate finding. Merge overlapping windows into
the largest contiguous block.
Detect renamed duplicates. For blocks that are not exact matches,
replace all identifiers with a placeholder token and all literals with type
placeholders (<STR>, <NUM>, <BOOL>). Re-hash. Group by this
structural hash. Blocks that share a structural hash but differ in the
original are renamed duplicates.
Detect structural duplicates. Reduce each block to its control flow
skeleton: the sequence of keywords (if, else, for, while, return,
try, catch, switch, case, match, function calls as CALL) and
their nesting structure. Hash the skeleton. Group blocks with matching
skeletons that span at least 6 lines. This catches the "same logic,
different details" pattern.
Score and rank. For each finding, compute a value score:
score = occurrences * block_lines * type_weight
where type_weight is 3.0 for exact, 2.0 for renamed, 1.0 for structural.
Sort by score descending.
Suggest extraction targets. For the top findings, note:
Produce the report per Output Requirements.
Produce a Markdown report:
# Duplication Hunt
**Repo**: <repo name>
**Scanned**: <N> files | **Duplicate groups found**: <count>
## Findings
### 1. <Brief description of the duplicated pattern>
- **Type**: Exact / Renamed / Structural
- **Occurrences**: N locations
- **Block size**: M lines
- **Score**: <value>
**Locations**:
| File | Lines | Preview |
|------|-------|---------|
| src/auth/login.ts | 24-38 | `const token = await fetch(...)` ... |
| src/auth/signup.ts | 31-45 | `const token = await fetch(...)` ... |
**Extraction suggestion**: Extract to a shared `authenticateUser(credentials)`
function in `src/auth/shared.ts`.
---
### 2. ...
## Summary
- **By type**: 5 exact, 3 renamed, 2 structural
- **Total duplicated lines**: ~320 lines across 10 groups
- **Highest-value extractions**: Group 1 (saves ~45 lines), Group 3 (saves ~30 lines)
- **Principle**: "Twice is a smell, three times is a pattern" — groups with 3+ occurrences are strong extraction candidates
Every finding must reference real file paths and line ranges. Previews must be actual code snippets, not fabricated examples.