By nikhaldi
Detect and eliminate code duplication across JavaScript, TypeScript, Python, and Java codebases using jscpd, with ranked results and autonomous refactoring into shared utilities.
A Claude Code plugin for detecting and eliminating code duplication using jscpd.
DRY = Don't Repeat Yourself
This was motivated by the observation that coding agents, including Claude Code, have a bias towards producing new code over reusing existing code or extracting common code. The resulting creeping code duplication weighs down AI-native codebases. This is a tool to make ongoing deduplication quick and easy from within Claude Code.
Because DRYwall detects code duplication using a deterministic toolchain (the awesome jscpd), this plugin is significantly more effective and cheaper in tokens than just telling an agent to find and refactor duplication. This blog post provides some background.
Prerequisite: Node.js must be installed on your system (with node and npx binaries available to Claude Code).
Open Claude Code and add the marketplace, then install the plugin:
/plugin marketplace add nikhaldi/drywall
/plugin install drywall@drywall
To start refactoring duplicated code with manual supervision, run the scan skill within Claude Code:
/drywall:scan
If you just want Claude Code to take care of everything, prompt it with something like this after installing the plugin (it will launch a dedicated subagent):
Deduplicate code in this codebase
Create a .drywallrc.json in your project root to set defaults. Values correspond to jscpd CLI options, except for the DRYwall-specific ones listed below:
{
"minTokens": 50,
"minLines": 5,
"ignore": ["**/node_modules/**", "**/dist/**", "**/*.generated.*"],
"respectGitignore": true,
"jscpdVersion": "4.0.9"
}
The configuration options specific to DRYwall are:
respectGitignore — true by default. Passes --gitignore to jscpd so that files excluded by .gitignore are automatically skipped. Set to false to disable.jscpdVersion — Pin the jscpd version used via npx. Defaults to 4.0.9 if not set.maxDuplicates — Maximum number of duplicate pairs to return, ranked by impact. Defaults to 20. (This needs to be restricted to avoid blowing past context limits right away in large codebases.)maxFragmentLength — Maximum character length of each code fragment before truncation. Defaults to 500.If you want to exclude some code from all of DRYwall's refactoring, you can use jscpd:ignore-start and jscpd:ignore-end markers in the code. JavaScript example:
/* jscpd:ignore-start */
import lodash from 'lodash';
import React from 'react';
import {User} from './models';
import {UserService} from './services';
/* jscpd:ignore-end */
/drywall:scanScans the current codebase for duplication and shows a ranked report of suggested deduplication refactorings. This is the simplest way to tackle some refactorings with manual control.
Invoke within a Claude Code session with:
/drywall:scan
/drywall:scan --min-tokens=100 --min-lines=10
Arguments are passed through as is to jscpd. These arguments are additive (or override) defaults configured in .drywallrc.json (see Configuration above).
dedup-refactorAn autonomous agent that detects duplication and refactors it end-to-end — extracting shared utilities, updating call sites, and verifying the changes. Claude delegates to this agent for large deduplication tasks.
detect_code_duplicationAutomatically invoked by Claude Code when your task involves refactoring or deduplication. Runs jscpd under the hood and returns structured results.
Parameters:
path — directory to scan (default: .)options — object of jscpd options passed as CLI flags. Keys are camelCase and converted to --kebab-case flags (e.g., {"minTokens": 30, "minLines": 5, "ignore": ["**/test/**"], "format": ["javascript", "typescript"], "threshold": 10})maxDuplicates — maximum number of duplicate pairs to return, ranked by impact (default: 20)maxFragmentLength — maximum character length of each code fragment before truncation (default: 500)npm install
npm test
npm run build
To test the plugin locally in Claude Code:
claude --plugin-dir /path/to/drywall
This project is licensed under the MIT License.
Admin access level
Server config contains admin-level keywords
Uses power tools
Uses Bash, Write, or Edit tools
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
npx claudepluginhub nikhaldi/drywallUltra-compressed communication mode. Cuts ~75% of tokens while keeping full technical accuracy by speaking like a caveman.
Comprehensive UI/UX design plugin for mobile (iOS, Android, React Native) and web applications with design systems, accessibility, and modern patterns
Memory compression system for Claude Code - persist context across sessions
Standalone image generation plugin using Nano Banana MCP server. Generates and edits images, icons, diagrams, patterns, and visual assets via Gemini image models. No Gemini CLI dependency required.
Multi-model consensus engine integrating OpenAI Codex CLI, Gemini CLI, and Claude CLI for collaborative code review and problem-solving.
Streamline people operations — recruiting, onboarding, performance reviews, compensation analysis, and policy guidance. Maintain compliance and keep your team running smoothly.