jscpd
Skill58 starsChanged 2 months agoMITView on GitHub
Copy-paste detector for the hr-skills TypeScript packages (packages/hr-skills-build, packages/hr-skills-ref). Run jscpd to detect duplicated code and measure duplication percentages before refactoring.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- kucherenko/jscpdtheir own version, first seen Sep 2, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- kucherenko/jscpd★ 6.6ksame name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository19 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- biomeSkill
- bunSkill
- changesetSkill
- clackSkill
- dry-refactoringSkill
- github-awesome-copilot-git-commitSkill
- hr-root-router-maintainingSkill
- hr-skills-maintainingSkill
- humanizerSkill
- markdownSkill
- pdfSkill
- skill-vetterSkill
- turboSkill
- typescriptSkill
- valibotSkill
- hr-skillsSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 64
Before opening a PR that adds or edits code under packages/hr-skills-build/src/client/, packages/hr-skills-build/src/server/, …
- Distinctive: line 69
After a large refactor, to confirm clones were actually eliminated (re-run, don't assume)
- Very specific: line 74
Run jscpd against packages/, never against the full repo root — skills/hr-*/SKILL.md files are prompt content, not code, and will produce …
- Very specific: line 75
Test files (packages/*/test/) legitimately duplicate describe/it/expect scaffolding — don't chase 100% duplication-free tests.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
jscpd
Copy-paste detector for source code. Use this skill to run jscpd against packages/* in this repo and understand its output before handing clones to dry-refactoring.
Not to be confused with
packages/hr-skills-build/src/server/validation/detect-duplicates.ts, which detects duplicated HR skill content (skills/hr-*/SKILL.md) at publish time.jscpdhere targets TypeScript source code inpackages/*only — keep the two concerns separate and never merge their logic.
Quick start
This repo uses Bun, so prefer bunx over npx:
# Scope to the TypeScript packages only — skip skills/ (markdown) and generated output
bunx jscpd@5 packages \
--format typescript \
--mode strict \
--min-lines 3 \
--min-tokens 20 \
--reporters console,json,markdown \
--output duplicate-report \
--ignore "**/node_modules/**,**/dist/**,**/*.md"
# Compact output optimized for agents
bunx jscpd@5 packages --reporters ai --format typescriptduplicate-report/ is a generated artifact — do not commit it; add it to .gitignore if it isn't already covered.
AI reporter output format
The ai reporter produces compact, token-efficient output:
Clones:
packages/hr-skills-build/src/server/validation/validate.ts:53-59 ~
security.ts:89-94
---
N clones · X% duplication- Same directory: shared path prefix factored out
- Different paths: full path shown for both sides
Options used in this repo
| Option | Value here | Why |
--format typescript | scoped to .ts | skills/**/*.md content duplication is handled by detect-duplicates.ts, not jscpd |
--mode strict | exact-match clones | avoids false positives from formatting-only similarity (Biome already normalizes formatting) |
--min-lines 3 / --min-tokens 20 | low thresholds | this is a small, young codebase; catch clones early before they compound |
--ignore | node_modules, dist, *.md | matches .gitignore / build output conventions |
Full option reference: bunx jscpd@5 --help, or the upstream configuration docs.
When to run
- Before opening a PR that adds or edits code under
packages/hr-skills-build/src/client/**,packages/hr-skills-build/src/server/**,packages/hr-skills-ref/src/client/**, orpackages/hr-skills-ref/src/server/** - After a large refactor, to confirm clones were actually eliminated (re-run, don't assume)
- Optionally wired into
lefthook.ymlas a pre-push (not pre-commit — it's slower thanbiome) step; see CI and hooks for the pattern this repo'slefthook.ymlfollows for other tools
Tips
- Run jscpd against
packages/, never against the full repo root —skills/hr-*/SKILL.mdfiles are prompt content, not code, and will produce noisy, irrelevant clones. - Test files (
packages/*/test/**) legitimately duplicatedescribe/it/expectscaffolding — don't chase 100% duplication-free tests. Prioritizesrc/**clones. - Hand the clone list to
dry-refactoringrather than refactoring ad hoc; it enforces "extract, don't just rename."
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

