duplicate-code-detector

Detect exact, parameterized, near-miss, and semantic code clones across codebases.

3|2|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/robotijn/ctoc --skill duplicate-code-detector-robotijn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: duplicate-code-detector
Source: https://github.com/robotijn/ctoc/tree/main/skills/quality/duplicate-code-detector
Command: npx skills add https://github.com/robotijn/ctoc --skill duplicate-code-detector-robotijn

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the risk of unmaintainable codebases caused by copy-pasted code, which forces developers to fix the same bug multiple times and creates inconsistent behavior across duplicate code segments.

Core Features & Use Cases

  • Clone Type Classification: Categorizes duplicates into exact (T1), parameterized (T2), near-miss (T3), and semantic (T4) types to apply the correct remediation strategy.
  • Intentional Duplication Suppression: Automatically skips flagging allowed duplicates like generated code, test fixtures, idiomatic boilerplate, and mid-refactor transient code to reduce noise.
  • Language-Specific Refactoring Guidance: Provides concrete before/after extraction examples for C#, Java, Python, C, C++, JavaScript/TypeScript, and SQL to guide clean, maintainable fixes.
  • Use Case: For example, if the same validation logic is duplicated across 3 different service classes, this skill will flag it as a high-severity Type 2 clone and suggest a generic validator extraction to reduce code size and maintenance burden.

Quick Start

Ask the AI to scan your codebase for duplicate code to receive a prioritized report of clone groups with suggested extractions and severity ratings.

Frequently Asked Questions about duplicate-code-detector

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

FAQPage Schema
How do I detect duplicate code across my codebase?

To detect duplicate code, the system scans your codebase to find copy-pasted and semantically equivalent segments, classifying them by clone type and providing severity ratings to prioritize refactoring.

What is the rule of three for DRY extraction?

The rule of three for DRY extraction dictates that code should be refactored when duplicated three or more times. The skill enforces this rule to reduce maintenance overhead and prevent inconsistent bug fixes across clones.

Does the duplicate code detector work with Python and JavaScript?

Yes, the duplicate code detector works with Python and JavaScript, along with C#, Java, C, C++, and SQL. It provides language-specific refactoring guidance with before and after extraction examples for these major programming languages.

How do you identify semantic code clones versus exact matches?

Semantic code clones are identified by detecting functional equivalence rather than exact text matching. The skill categorizes duplicates into exact, parameterized, near-miss, and semantic clone types to apply the correct remediation strategy.

Can I suppress intentional duplicate code in test fixtures?

Yes, you can suppress intentional duplicate code. The skill automatically skips flagging allowed duplicates like generated code, test fixtures, idiomatic boilerplate, and mid-refactor transient code to reduce noise in analysis reports.

What is the best way to run static analysis for code clones in CI/CD pipelines?

The best way to run static analysis for code clones in CI/CD pipelines is to scan production code and configuration files automatically. This skill applies maintainability checks across your pipeline to flag high-severity duplicate segments and suggest extractions.