find-duplicates

Detect and remediate Type-1 through Type-4 code clones using JSCPD and AI.

4|1|Updated Dec 30, 2025
One-click install
npx skills add https://github.com/lushly-dev/afd --skill find-duplicates-lushly-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: find-duplicates
Source: https://github.com/lushly-dev/afd/tree/main/.claude/skills/find-duplicates
Command: npx skills add https://github.com/lushly-dev/afd --skill find-duplicates-lushly-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the issue of redundant code (copy-pasting) within a codebase, which leads to bloat, inconsistency, and maintenance challenges.

Core Features & Use Cases

  • Hybrid Detection: Combines algorithmic (JSCPD) and AI-based analysis to find various types of code clones (Type-1 to Type-4).
  • Prevention: Encourages searching for existing utilities before writing new code.
  • Safe Refactoring: Guides users through a Red-Green-Refactor process to consolidate duplicates with test coverage.
  • Use Case: Identify and consolidate repetitive utility functions across your project to improve code quality and reduce maintenance overhead.

Quick Start

Run the find-duplicates skill to discover code duplication in the current directory.

Frequently Asked Questions about find-duplicates

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

FAQPage Schema
How do I detect code duplication and consolidate repetitive utility functions?

To detect code duplication, this Skill uses a hybrid approach combining JSCPD for syntactic clones and AI for semantic clones, identifying Type-1 through Type-4 clones. It prioritizes findings by occurrence count and block size to guide safe refactoring and DRY compliance.

What is the best way to find semantic code clones that JSCPD might miss?

Finding semantic code clones is handled by AI-based analysis, which complements JSCPD's syntactic detection. This hybrid approach detects Type-1 through Type-4 clones, ensuring deeper DRY compliance by identifying functionally similar code even when syntax differs.

How do I safely refactor code duplication without breaking existing functionality?

To safely refactor code duplication, this Skill guides you through a Red-Green-Refactor process to consolidate duplicates with test coverage. It prioritizes findings based on occurrence count and block size for efficient code consolidation.

Can I use AI analysis to find all types of code clones in my project?

Yes, AI analysis is used to find semantic code clones, while JSCPD handles syntactic clones. This hybrid detection supports Type-1 through Type-4 clone identification, prioritizing results by occurrence count and block size for efficient code consolidation.

How do I prevent code duplication when writing new code?

To prevent code duplication, this Skill encourages searching for existing utilities before writing new code. This strategy, combined with safe refactoring workflows, ensures DRY compliance and reduces future maintenance overhead in your project.

Does JSCPD find Type-4 code clones where syntax and variables are completely different?

JSCPD primarily detects syntactic code clones, while AI analysis handles semantic clones like Type-4. The hybrid approach supports Type-1 through Type-4 clone detection, prioritizing findings based on occurrence count and block size for efficient code consolidation.