Dead Code Removal with Knip
shift-editor/shift
Finds unused files, exports and class members with Knip, then verifies each candidate through reference tracing before removing anything, never using knip --fix.
Removes copy-paste duplication found by jscpd, starting with exact clones and hotspots, then renamed and near-miss copies, using proven refactoring strategies.
$ npx skills add kucherenko/jscpd --skill dry-refactoring -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install kucherenko/jscpd dry-refactoring --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/kucherenko/jscpd.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/dry-refactoring .claude/skills/dry-refactoring && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "dry-refactoring" agent skill from https://github.com/kucherenko/jscpd/tree/master/skills/dry-refactoring into .claude/skills/dry-refactoring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "dry-refactoring", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/kucherenko/jscpd/tree/master/skills/dry-refactoringType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add kucherenko/jscpd --skill dry-refactoring -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install kucherenko/jscpd dry-refactoring --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/kucherenko/jscpd.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/dry-refactoring .agents/skills/dry-refactoring && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "dry-refactoring" agent skill from https://github.com/kucherenko/jscpd/tree/master/skills/dry-refactoring into .agents/skills/dry-refactoring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "dry-refactoring", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add kucherenko/jscpd --skill dry-refactoring -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install kucherenko/jscpd dry-refactoring --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/kucherenko/jscpd.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/dry-refactoring .cursor/skills/dry-refactoring && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "dry-refactoring" agent skill from https://github.com/kucherenko/jscpd/tree/master/skills/dry-refactoring into .cursor/skills/dry-refactoring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "dry-refactoring", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/kucherenko/jscpd.git --path skills/dry-refactoring--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add kucherenko/jscpd --skill dry-refactoring -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install kucherenko/jscpd dry-refactoring --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/kucherenko/jscpd.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/dry-refactoring .gemini/skills/dry-refactoring && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "dry-refactoring" agent skill from https://github.com/kucherenko/jscpd/tree/master/skills/dry-refactoring into .gemini/skills/dry-refactoring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "dry-refactoring", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install kucherenko/jscpd dry-refactoringInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add kucherenko/jscpd --skill dry-refactoring -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/kucherenko/jscpd.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/dry-refactoring .github/skills/dry-refactoring && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "dry-refactoring" agent skill from https://github.com/kucherenko/jscpd/tree/master/skills/dry-refactoring into .github/skills/dry-refactoring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "dry-refactoring", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add kucherenko/jscpd --skill dry-refactoring -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install kucherenko/jscpd dry-refactoring --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/kucherenko/jscpd.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/dry-refactoring .opencode/skills/dry-refactoring && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "dry-refactoring" agent skill from https://github.com/kucherenko/jscpd/tree/master/skills/dry-refactoring into .opencode/skills/dry-refactoring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "dry-refactoring", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
dry-refactoringRemoves copy-paste duplication found by jscpd, starting with exact clones and hotspots, then renamed and near-miss copies, using proven refactoring strategies.
After running the jscpd copy-paste detector, this skill guides the agent through removing the duplication it found. The detector's AI reporter output is parsed clone by clone, and larger codebases can add a summary that ranks hotspot files and folders by the share of duplicated code.
Exact copies come first, since those are nearly always real copy-paste. Renamed copies and near-miss clones, where a few statements were edited, are noisier and are run only afterward, one family at a time, and treated as leads to read rather than defects. For each clone the agent reads both fragments, lists exactly what differs, and picks a strategy such as extract function, parameterize, move to a module, extract a constant or introduce a base class. A cross-format option catches clones that span languages like JavaScript and TypeScript.
9 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit 14bc176. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
npxFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md. Its commands use npx, which can reach the network depending on how they are called.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
DRY Refactoring With jscpd loads about 2.1k tokens when it runs. Until then it costs about 65 tokens; SKILL.md has 1,020 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from kucherenko/jscpd at commit 14bc176, republished under its MIT licence (© kucherenko). 1,020 words, ~2,112 tokens.
.claude/skills/dry-refactoring/SKILL.md (or your agent's skills folder).Guided workflow to eliminate copy-paste duplication in source code. Use after running jscpd to detect clones.
First, run jscpd to identify duplications:
npx jscpd --reporters ai <path>In codebases that mix related formats (e.g. JavaScript and TypeScript), add --cross-formats so clones spanning both are detected too:
npx jscpd --reporters ai --cross-formats "js-ts" <path>On larger codebases, add --summary to get a refactoring-hotspot overview alongside the clone list — top files and folders with a dup% column showing how much of each file is duplicated:
npx jscpd --reporters ai --summary <path>The default scan reports only exact copies, and those are the ones to refactor first: an exact clone is almost always a real copy-paste. Two more passes find copies that were edited after pasting. They are noisier: they ignore names, values or a few statements on purpose, so they also surface blocks that merely look alike (models and DTOs, config tables, test setup, generated code, shared idioms). Run them only after the exact clones are dealt with, one family at a time, with tight settings, and treat what they report as leads to read rather than defects to fix:
# Type-2: renamed copies (other variable names, other constants), reported as "(renamed)".
# Raise --min-tokens: with identifiers ignored, a short block is mostly placeholders.
npx jscpd --reporters ai --ignore-identifiers --min-tokens 70 <path>
# Type-3: near-miss copies (one or two edited lines, or JS/TS/Python functions with the same structure),
# reported as "[~0.91 gap]" and "[~0.85 ast]". Widen only if the tight run finds nothing.
npx jscpd --reporters ai --max-gap-lines 1 --similarity <path>See the jscpd skill for full option reference, including cross-format group syntax, the clone-kind suffixes and how to read the summary.
--reporters ai on the target path (add --summary on larger codebases to pick a starting point: files with high dup% and high token counts pay off most)(renamed) differs only in names or values, [~N gap] has a few edited lines in the middle, [~N ast] is a function pair with the same structureswitch over different enums, two reducers with unrelated semantics); the sameness is intentional boilerplate (models, DTOs, config, route tables, test fixtures); the code is generated; a shared abstraction would need a vague name like processData; or the pair is under about 10 lines. Only a pair that would let you delete code and give the extraction a precise name goes on to the next stepdup% of the touched files went down; a clone that was (renamed) will not show in a default run, so check with --ignore-identifiers againExtract function — when the duplicate is a block of logic:
// Before: same block in two places
// After: shared function called from both placesExtract module/utility — when the duplicate spans multiple files in different domains:
// Move shared logic to a shared utility file and import itExtract constant or config — when the duplicate is repeated data or configuration.
Template/base class — when the duplicate is structural (e.g., repeated class shape).
Parameterize — for (renamed) clones. The two sides are the same algorithm over different names or values, so the things that differ become parameters:
// Before: computeCartTotal(items) and computeBasketTotal(entries), same body, other names;
// limits-dev.js and limits-prod.js, same shape, other numbers
// After: one function whose parameters are the identifiers that differed,
// or one function reading the values that differed from a config objectA renamed clone whose only difference is a literal is a missing constant or config entry, not a missing function.
Unify near-miss copies — for [~N gap] clones. Read the unmatched lines: the gap is the one place the copies diverged, typically a guard, a log call or an extra field. Extract the common body and pass the divergence in:
// Before: saveUser and saveAccount, identical except one inserted validation line
// After: one saveRecord(record, { validate }) with the inserted line behind the option,
// or the inserted line moved to the caller before the shared callIf the gap changes the meaning rather than adding a step, keep two functions but extract the shared halves.
Merge similar functions — for [~N ast] clones. The structure matches but names, literals and some statements do not. Diff the two functions first; the ast score tells how much is shared (0.9 is a copy with one edit, 0.75 a copy with a couple of added statements plus renames). Extract the shared skeleton and inject what differs, as arguments, a strategy object, or a callback:
// Before: buildInvoice(order, customer, taxRate) and buildCreditNote(refund, account, vatRate):
// same loop, same rounding, one extra guard and one extra log call in the second
// After: buildDocument(source, party, rate, { filter, onBuilt }) used by bothBelow about 0.8 the pair usually shares an idiom, not an implementation; leave those alone unless the summary shows the file is a hotspot anyway.
Always ensure:
dup% column to order the work: a large file with a high share of duplicated lines pays back first.js and a .ts file, found with --cross-formats) often means code was ported without deleting the original — consolidate into one implementation (usually the TypeScript one) and update imports, rather than extracting a third shared copy(renamed) clones in one file usually mean one abstraction is missing, not many: look for the shared shape before extracting pair by pair. Many (renamed) clones across test files usually mean nothing: test cases are supposed to look alike--threshold, --fail-on-new-clones) on the Type-2/Type-3 passes until the team has reviewed what they report on this codebase; gate on the exact run--similarity covers JavaScript, TypeScript, Python, Java, Kotlin, Scala, C#, Go, Rust, C, C++, PHP, Ruby, Swift and Clojure, also inside Markdown code blocks and Vue, Svelte and Astro scripts; for other languages rely on the exact and --max-gap-lines passes--min-lines 10 to filter noise and focus on meaningful duplications--baseline per set of detection flags when gating CI: renamed and similar runs fingerprint clones differently from exact runs© kucherenko, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in skills/dry-refactoring of kucherenko/jscpd.
Open the folder on GitHubat commit 14bc176
DRY Refactoring With jscpd next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| DRY Refactoring With jscpd this skillkucherenko/jscpd | 6.4k | — | ~2.1k | Automated safety check: Pass | MIT | |
| Dead Code Removal with Knipshift-editor/shift | 348 | — | ~1.8k | Automated safety check: Pass | Apache-2.0 | |
| Code RefinerMathews-Tom/armory | 328 | — | ~3.1k | Automated safety check: Pass | MIT | |
| Typescript Best Practicesjwynia/agent-skills | 169 | — | ~2.5k | Automated safety check: Pass | MIT | |
| Code ReviewerLeoYeAI/openclaw-master-skills | 2.2k | 1 repos | ~1.2k | Automated safety check: Pass | MIT | |
| Typescript Writeaiskillstore/marketplace | 430 | 2 repos | ~1.7k | Automated safety check: Pass | None |
shift-editor/shift
Finds unused files, exports and class members with Knip, then verifies each candidate through reference tracing before removing anything, never using knip --fix.
Mathews-Tom/armory
Deep code simplification and refactoring preserving behavior across Python, Go, TypeScript, Rust.
jwynia/agent-skills
Guide AI agents through TypeScript coding best practices including type safety, error handling, code organization, and architecture patterns.
LeoYeAI/openclaw-master-skills
Code review automation for TypeScript, JavaScript, Python, Go, Swift, Kotlin.
aiskillstore/marketplace
Write TypeScript and JavaScript code following Metabase coding standards and best practices.
borghei/Claude-Skills
Code review automation for TypeScript, JavaScript, Python, Go, Swift, and Kotlin.
kucherenko/jscpd
Measures a code port between languages or frameworks with jscpd's function-level comparison, porting tests before code and tracking what is left unmatched.
kucherenko/jscpd
Compares two folders function by function with jscpd --compare, across languages if needed, and explains which functions match and which have no counterpart.
kucherenko/jscpd
A three-part cleanup guided by jscpd: measure health, then fix duplicated code, remove dead code and simplify the most complex files, finishing by re-measuring the score.
kucherenko/jscpd
Finds duplicated code in 220+ languages with jscpd, reports exact, renamed and near-miss clones in a compact agent-friendly format and measures duplication.
Works with
Categories
Removes copy-paste duplication found by jscpd, starting with exact clones and hotspots, then renamed and near-miss copies, using proven refactoring strategies. After running the jscpd copy-paste detector, this skill guides the agent through removing the duplication it found. The detector's AI reporter output is parsed clone by clone, and larger codebases can add a summary that ranks hotspot files and folders by the share of duplicated code.
DRY Refactoring With jscpd fits situations like: cleaning up duplicated code that jscpd reported; choosing where to start from a duplication hotspot summary; merging near-identical functions that differ only in names or values; extracting repeated blocks into shared functions or modules.
Run `npx skills add kucherenko/jscpd --skill dry-refactoring -a claude-code`. Or copy the skill folder (skills/dry-refactoring in kucherenko/jscpd) into .claude/skills/dry-refactoring in your project. Claude Code loads it when a task matches its description.
Run `npx skills add kucherenko/jscpd --skill dry-refactoring -a codex`. Or copy the skill folder (skills/dry-refactoring in kucherenko/jscpd) into .agents/skills/dry-refactoring in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add kucherenko/jscpd --skill dry-refactoring -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/dry-refactoring, .gemini/skills/dry-refactoring, .github/skills/dry-refactoring and .opencode/skills/dry-refactoring in your project.
Going by SKILL.md and its folder, DRY Refactoring With jscpd needs the command-line tools its instructions call (npx). Our summary lists: Node.js, to run jscpd through npx.
SKILL.md contains no URLs. Its commands use npx, which can reach the network depending on how they are called. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
DRY Refactoring With jscpd is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.1k tokens (SKILL.md is roughly 8.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with DRY Refactoring With jscpd: Dead Code Removal with Knip (shift-editor/shift, 348 stars), Code Refiner (Mathews-Tom/armory, 328 stars), Typescript Best Practices (jwynia/agent-skills, 169 stars) and Code Reviewer (LeoYeAI/openclaw-master-skills, 2.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
kucherenko (a GitHub user) maintains it in kucherenko/jscpd, which has 6,361 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on October 9, 2026.
Source: kucherenko/jscpd on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.