Audit Duplication
Measure duplicated code and redundant copy-paste clone classes (DRY) across a change, path, or tree with instance spans, excluding repo-sanctioned…
от melodic-software★ 34 звезды на GitHub
Установить Audit Duplication в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Audit duplication
Pre-computed context
Current branch: !git branch --show-current 2>/dev/null || echo "unknown"
Purpose
Duplication is the measure most likely to report noise, because some replication is deliberate: a repository that vendors one helper into seventeen plugins on purpose has seventeen copies and zero debt. This skill reports the clone groups a detector found, then subtracts the groups the target repository has already declared about itself, and stops there: no pass or fail, no severity, no finding. What to do about a surviving clone is the reader's call.
Collectors, tried in ladder order per language:
| Collector | Languages | Values per clone group | When |
|---|---|---|---|
jscpd |
every language | lines, tokens |
jscpd resolves on PATH or in ./node_modules/.bin |
dupl |
Go only | lines, tokens null |
jscpd did not resolve and dupl did |
cpd (PMD) |
TypeScript/JavaScript, Python, Go, C# | lines, tokens |
jscpd did not resolve and pmd did (never for Bash: CPD has no shell language) |
No collector resolves means the language's row says so with the tool's install hint and the run
continues. This plugin never installs, downloads, or npx-fetches a detector.
Run it
"${CLAUDE_SKILL_DIR}/scripts/audit-duplication.sh" # the change: diff from the merge-base plus uncommitted files
"${CLAUDE_SKILL_DIR}/scripts/audit-duplication.sh" src/ lib/ # explicit paths (a missing one is a usage error)
"${CLAUDE_SKILL_DIR}/scripts/audit-duplication.sh" --all # every tracked or untracked-but-not-ignored file
"${CLAUDE_SKILL_DIR}/scripts/audit-duplication.sh" --registry scripts/cross-plugin-source-registry.txt --all
"${CLAUDE_SKILL_DIR}/scripts/audit-duplication.sh" --json --all src/ # the code-metrics/v3 document instead of markdown
"${CLAUDE_SKILL_DIR}/scripts/audit-duplication.sh" --json --keep --all # the document, also kept as the next run's trend baseline
Append --user-file '${user_config.config_file}' to every script call, exactly as written:
it names the file holding your userConfig layer, and an empty or unsubstituted value means none
(${CLAUDE_PLUGIN_ROOT}/reference/config.md).
A target form (--repo <repo> and the others) runs the script once per repository, as
${CLAUDE_PLUGIN_ROOT}/reference/several-repositories.md says, and never passes the form to the
script. Each run finds clones within its own repository and keeps its own trend baseline, and
each registry path, named or configured, resolves against that repository's root. A file copied between repositories is not this script's to find: /coupling:reduce (if enabled)
measures it.
Present the markdown report as printed. It opens with the scope and a "Coverage of this run"
table (language, collector, status, reason), then one row per clone group, largest first, listing
every instance as file:start-end, then a rollup per language and per directory, then the summary
lines: files with clones, the duplicated-line total, how many groups a registry excluded, and
which languages were partial. Files with clones leaves out any file holding nothing but excluded
groups; the scope's count keeps it. When an earlier report of this project with the same scope
mode was kept, the last line is the clone trend: this run's class count, the previous run's, and
the signed delta, then how many classes are new since that run and how many gained copies
(trend in the JSON); the first run in a project prints none. When the report opens with No clone detector ran in any language, offer the user the install command that headline carries (npm install -g jscpd, or a
devDependency) and run it only when they confirm; never install silently and never npx-fetch it.
Keep the --json document when the numbers feed a comparison:
/verification:measure metrics (if enabled) consumes it (treat a
report whose status is empty on either side as INCONCLUSIVE); otherwise keep the JSON beside
your notes and compare by hand.
Reading the numbers
- A clone group is reported beside no reference. There is no configured bar for duplication in
this plugin and no standard sets one, so nothing is ever counted as
over_reference. - A group is a clone class, not a detector pair.
jscpdand PMD CPD report clones as pairs, so seventeen identical copies arrive as sixteen two-instance rows; this skill merges rows that share an instance with an identical file and line range into one row per class before it counts anything. Copies that share only part of a fragment are named with different ranges and stay separate groups: the merge joins on identity, never on overlap, so a class is never wider than what the detector called identical. summary.duplicated_linescounts each class once, using the length of the class, not the sum over its instances: three copies of a 4
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
- 01
Bash(${CLAUDE_SKILL_DIR}/scripts/audit-duplication.sh:*) - 02
Bash(git branch --show-current:*)
Вложенные файлы
- evals/evals.json
- scripts/audit-duplication.sh
- scripts/audit-duplication.test.sh
- scripts/cluster-clones.py
- scripts/registry-filter.py
- scripts/test_cluster_clones.py
- scripts/test_registry_filter.py
FAQ
Что делает скилл Audit Duplication?
Measure duplicated code and redundant copy-paste clone classes (DRY) across a change, path, or tree with instance spans, excluding repo-sanctioned replication. Reports, never gates. Use when 'find copy-paste code', 'clone detection', 'duplication report'. Not for file length: /code-metrics:audit size.
Как установить скилл Audit Duplication?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Audit Duplication запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
docx
AnthropicUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
xlsx
AnthropicUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
pptx
AnthropicUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…