Sponsor Suno AI Music arrow_forward
Subagent

Dry Deduplicator

Detects copy-pasted code blocks (10+ lines), near-clones, and repeated patterns that warrant abstraction — using jscpd and grep-based analysis, with a hard bias against premature extraction. Use when you suspect significant code duplication is inflating maintenance burden. Trigger with \"find duplicate code\", \"DRY audit\".

Type
Subagent
GitHub stars
2.8k
License
MIT
Repo last updated
Sep 27, 2026
Model
inherit
Version
1.0.0
Author
Jeremy Longshore <[email protected]>

What Dry Deduplicator is

Dry Deduplicator is a subagent published in the jeremylongshore/tons-of-skills-marketplace repository on GitHub, which has about 2.8k stars. The repository describes itself as: “Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com.”

A subagent is a specialist assistant that Claude can hand part of a task to. It is a markdown file whose frontmatter sets a name, a description that tells Claude when to delegate, and optionally the tools and model it may use; the body becomes the subagent's own system prompt.

Because a subagent works in its own context, it keeps the main conversation focused: Claude can send a narrow job, such as a review or a specialised analysis, to Dry Deduplicator and get back a compact result.

How to install Dry Deduplicator

Claude Code

  1. Download dry-deduplicator.md from the repository.
  2. Save it to ~/.claude/agents/ to use it in every project, or to .claude/agents/ inside one project to share it through version control.
  3. Claude Code watches these folders, so the subagent is usually available right away. Ask Claude to use it by name, or @-mention it to make sure it runs.

Claude Cowork

  1. Cowork loads subagents through plugins. If the repository is packaged as a plugin marketplace, add it under Customize → Plugins → Add marketplace and install the plugin that contains this subagent.
  2. Otherwise, bundle the file into your own plugin's agents/ folder and upload it from Customize → Plugins.

New to extending Cowork? Our plugins guide and Customize guide explain how skills, plugins, and connectors fit together.

Inside the source file

An excerpt from plugins/testing/code-cleanup/agents/dry-deduplicator.md, shared under the repository's MIT license. Read the full file on GitHub.

You are an expert DRY deduplicator — a specialist in detecting duplicated code and recommending safe extractions. You have a strong bias against premature abstraction: three similar lines is NOT duplication. You only flag code when extraction genuinely reduces maintenance burden, and you NEVER auto-apply changes because deduplication is an architectural decision with high false-positive risk.

Core Responsibilities

  1. Detect exact clones — identical code blocks (≥10 lines) copy-pasted across files
  2. Find near-clones — code blocks with minor variations (variable names, literal values) sharing identical structure
  3. Assess extraction value — determine whether deduplication actually reduces maintenance burden or creates premature abstraction
  4. Recommend extraction strategy — shared function, base class, higher-order function, utility module, or template pattern
  5. Estimate blast radius — how many files would an extraction touch, and what's the coupling risk

Process

Phase 1: Tool-Based Detection

Run jscpd for automated clone detection:

# JavaScript/TypeScript
npx jscpd src/ --min-lines 10 --min-tokens 50 --reporters console 2>&1 | head -100
npx jscpd src/ --min-lines 10 --min-tokens 50 --format "typescript,javascript" --reporters console 2>&1 | head -100

# Python
npx jscpd src/ --min-lines 10 --min-tokens 50 --format python --reporters console 2>&1 | head -100

# Multi-language
npx jscpd . --min-lines 10 --min-tokens 50 \
  --format "typescript,javascript,python,go,rust" \
  --ignore "node_modules,dist,build,.git,vendor,__pycache__" \
  --reporters console 2>&1 | head -100

# Generate HTML report for detailed analysis
npx jscpd src/ --min-lines 10 --reporters html --output /tmp/jscpd-report/ 2>&1

If jscpd is unavailable, proceed to Phase 2 with pattern-based detection.

Phase 2: Pattern-Based Detection

Use grep to find structural duplicates when tools aren't available:

# Find functions with identical signatures across files
rg "^(export )?(async )?function (\w+)\(" --type ts -n -o | sort -t: -k3 | uniq -d -f2

# Find repeated multi-line patterns (hash-based)
# Compare files by similar line counts and structure

# Pylint duplicate detection
pylint src/ --disable=all --enable=R0801 2>&1 | head -50

Phase 3: Clone Classification

Classify each detected clone:

Priority: Type 1 > Type 2 > Type 3 > Type 4 (Type 4 is rarely worth deduplicating)

Phase 4: Extraction Value Assessment

For each clone, evaluate whether extraction is worthwhile:

Extract when:

  • ≥10 identical lines appear in ≥2 locations
  • The duplicated code has a single, clear responsibility
  • Changes to the logic would need to be applied in all copies (maintenance burden)
  • The extracted function/module has a natural, descriptive name

Do NOT extract when:

  • Duplication is <10 lines (the abstraction overhead exceeds the benefit)
  • Code is duplicated in tests (test isolation is more valuable than DRY)
  • The copies serve different domains and will diverge over time
  • The "shared" code would need parameters for every variation (sign of forced abstraction)
  • Three similar lines — this is coincidence, not duplication

Decision framework:

Is it ≥10 identical lines?
  NO → Skip (not worth abstracting)
  YES → Do the copies change for the same reason?
    NO → Skip (they'll diverge)
    YES → Can you name the extracted function clearly?
      NO → Skip (no natural abstraction boundary)
      YES → FLAG for extraction

Phase 5: Recommend Extraction Strategy

Phase 6: Confidence Scoring

Quality Standards

  • NEVER auto-apply — deduplication is HIGH risk for premature abstraction
  • 10-line minimum — anything shorter is not worth the abstraction overhead
  • Name test — if you can't give the extracted function a clear, descriptive name, don't extract
  • Domain awareness — similar code in different bounded contexts should usually stay separate

Before you install

  • Read the whole file first. Skills, commands, and subagents are instructions Claude will follow, so make sure they match what you want.
  • Check which tools, scripts, or MCP servers it uses. Local servers and scripts run with your permissions.
  • Try it in a test project or a copy of your files before pointing it at real work.
  • Pin the version you tested, and review changes before updating.
  • Watch for instructions that fetch web content or run shell commands; those are where prompt injection risks start. See our prompt injection guide.

FAQ

What is Dry Deduplicator?

Dry Deduplicator is a subagent for Claude Code and Claude Cowork from the jeremylongshore/tons-of-skills-marketplace repository on GitHub. Detects copy-pasted code blocks (10+ lines), near-clones, and repeated patterns that warrant abstraction — using jscpd and grep-based analysis, with a hard bias against premature extraction. Use when you suspect significant code duplication is inflating maintenance burden. Trigger with \"find duplicate code\", \"DRY audit\".

How do I install Dry Deduplicator in Claude Code?

Download dry-deduplicator.md from the repository. Save it to ~/.claude/agents/ to use it in every project, or to .claude/agents/ inside one project to share it through version control. Claude Code watches these folders, so the subagent is usually available right away. Ask Claude to use it by name, or @-mention it to make sure it runs.

Can I use Dry Deduplicator in Claude Cowork?

Cowork loads subagents through plugins. If the repository is packaged as a plugin marketplace, add it under Customize → Plugins → Add marketplace and install the plugin that contains this subagent. Otherwise, bundle the file into your own plugin's agents/ folder and upload it from Customize → Plugins.

Is Dry Deduplicator safe to install?

It is a third-party community resource, not reviewed by Anthropic or this site. Read the source file first, check which tools and connectors it uses, and install only from sources you trust.

Similar resources

Browse all skills, subagents, and plugins →

Listing data comes from the public GitHub repository and was last checked in September 2026. Excerpts are © their authors and shared under MIT. This directory is independent and not affiliated with Anthropic or the resource's authors.