Imported from datacosmos-br/agents (
skills/tool/dry-refactoring/SKILL.md). Install upstream withnpx skills add datacosmos-br/agents --skill dry-refactoring. Copyright stays with the author.
dry-refactoring
Guided workflow to eliminate copy-paste duplication detected by jscpd.
Detect clones
make duplication
Eight lines is the comparison floor. A project may change flags only through its canonical gate and selected executable. Zero reported clones is mandatory; there is no baseline suppression contract.
Workflow
- Resolve the writable worktree, integration base, and gate owner.
- Parse each clone line into its two locations (file + line range).
- Read both fragments; classify semantic duplication, canonical projection, generated/historical evidence, distinct fixture, or tokenizer false positive. Textual similarity alone authorizes no edit.
- Remediate only confirmed semantic duplication (
references/procedure.md). - Require zero clones, then prove the merged integration commit, command, working directory, exit code, before/after counts, and runtime.
Cross-format clones usually mean a port kept both implementations; consolidate at one owner. Test clones often need a helper; unrelated-module clones often need a shared utility.
Never infer flags from another version: correct and execute the selector-free root Make owner when its contract is under change.