duplicate-code-detector

Detect and rank duplicated code across multi-file projects.

23|7|Updated Sep 8, 2025
One-click install
npx skills add https://github.com/pvillega/claude-templates --skill duplicate-code-detector-pvillega
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: duplicate-code-detector
Source: https://github.com/pvillega/claude-templates/tree/main/plugins/ct/skills/duplicate-code-detector
Command: npx skills add https://github.com/pvillega/claude-templates --skill duplicate-code-detector-pvillega

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Duplicated code across projects leads to maintenance burden, inconsistencies, and wasted effort. This skill identifies and classifies duplicates across files and generates a prioritized refactoring plan.

Core Features & Use Cases

  • Detects exact, near, and structural duplicates using jscpd and outputs a prioritized list of refactoring targets.
  • Ranks groups by impact (lines x instances) and proposes a TDD refactoring plan for each group.
  • Produces an actionable handoff to the incremental-refactoring workflow.

Quick Start

Run this skill against your codebase to detect duplicates and generate a prioritized refactoring plan.

Frequently Asked Questions about duplicate-code-detector

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find duplicate code across multiple files in my project?

To find duplicate code across multiple files, this skill analyzes your codebase to identify exact, near, and structural duplicates. It ranks duplicate groups by impact and generates a TDD refactoring plan for each group.

What is the best way to plan refactoring for code smells like duplication?

Planning refactoring for code smells like duplication requires ranking instances by impact and creating an actionable plan. This skill generates a structured TDD plan for each duplicate group to guide incremental refactoring.

Does this duplicate code detection work with any programming language?

Yes, duplicate code detection works with multi-file projects in any programming language. The skill evaluates exact, near, and structural duplicates across the codebase while respecting available project configuration.

How does jscpd help detect near and structural code duplicates?

Jscpd helps detect near and structural code duplicates by scanning the codebase to identify matching patterns. The skill uses this mechanism to classify duplicates and compute an impact score for prioritized refactoring.

Can I generate a TDD plan for refactoring duplicated code blocks?

Yes, you can generate a TDD plan for refactoring duplicated code blocks. After identifying and ranking duplicates by impact, the skill produces actionable refactoring guidance and a structured plan for each group.