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
- Repository
- jeremylongshore/tons-of-skills-marketplace
- 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
- 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.
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.
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
- Detect exact clones — identical code blocks (≥10 lines) copy-pasted across files
- Find near-clones — code blocks with minor variations (variable names, literal values) sharing identical structure
- Assess extraction value — determine whether deduplication actually reduces maintenance burden or creates premature abstraction
- Recommend extraction strategy — shared function, base class, higher-order function, utility module, or template pattern
- 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>&1If 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 -50Phase 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 extractionPhase 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
- Agency Os Run your work like an AI agency, from a single Notion board. Agents discuss, plan, and execute tasks in parallel with dependency ordering and model routing. Plugin · jeremylongshore/tons-of-skills-marketplace
- Advisor Use this agent when the User asks for health, fitness, nutrition, or longevity guidance tailored to adults 50+, or when they describe physical symptoms, fatigue, lab results, metabolic markers, joint pain, or sleep issues — even without explicitly asking for health advice. Subagent · jeremylongshore/tons-of-skills-marketplace
- Adobe Pack Operate Adobe Firefly, Photoshop v2, PDF Services, I/O Events, App Builder, and enterprise access through 30 evidence-backed skills with safe auth, data, spend, deployment, and recovery boundaries. Plugin · jeremylongshore/tons-of-skills-marketplace
- Agent Context Manager Automatically detects and loads AGENTS.md files to provide agent-specific instructions alongside CLAUDE.md. Enables specialized agent behaviors without manual intervention. Plugin · jeremylongshore/tons-of-skills-marketplace
- Echo Synthesizes user research into actionable product signal — interviews, JTBD analysis, persona development, and feedback clustering. Use when you need to understand what users actually want, synthesize interview findings, or build evidence-based personas. Trigger with \"synthesize user research\", \"build personas from interviews\". Subagent · jeremylongshore/tons-of-skills-marketplace
- Drift Detects and diagnoses ML model decay in production — data drift, concept drift, and silent degradation. Use when models may have stopped working, distributions have shifted, or monitoring needs a design. Trigger with \"audit my ML monitoring\", \"detect model drift\". Subagent · jeremylongshore/tons-of-skills-marketplace
- Edge Designs CDN configurations, cache strategies, and edge function deployments to minimize latency globally. Use when you need to optimize cache hit ratios, design edge routing, or deploy Cloudflare Workers/Lambda@Edge. Trigger with \"design CDN config\", \"optimize cache strategy\". Subagent · jeremylongshore/tons-of-skills-marketplace
- Draft Owns the structural UX layer — user flows, information architecture, wireframes, and interaction patterns. Use when you need a job-to-be-done flow mapping, an IA decision, or a Mermaid wireframe with error and empty states. Trigger with \"map the user flow\", \"design the information architecture\". Subagent · jeremylongshore/tons-of-skills-marketplace