con un clic
dry-refactoring
// Guided workflow to eliminate copy-paste duplication detected by jscpd. Refactor clones using extract function, module, constant, or base class strategies.
// Guided workflow to eliminate copy-paste duplication detected by jscpd. Refactor clones using extract function, module, constant, or base class strategies.
| name | dry-refactoring |
| description | Guided workflow to eliminate copy-paste duplication detected by jscpd. Refactor clones using extract function, module, constant, or base class strategies. |
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>
See the jscpd skill for full option reference.
--reporters ai on the target pathExtract function — when the duplicate is a block of logic:
// Before: same block in two places
// After: shared function called from both places
Extract module/utility — when the duplicate spans multiple files in different domains:
// Move shared logic to a shared utility file and import it
Extract constant or config — when the duplicate is repeated data or configuration.
Template/base class — when the duplicate is structural (e.g., repeated class shape).
Always ensure:
--min-lines 10 to filter noise and focus on meaningful duplications