detect-code-duplication

Detect duplicate code in TypeScript and JavaScript projects and generate a prioritized refactor plan.

64|2|Updated Feb 8, 2018
One-click install
npx skills add https://github.com/yuki-yano/dotfiles --skill detect-code-duplication
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: detect-code-duplication
Source: https://github.com/yuki-yano/dotfiles/tree/main/.agents/skills/detect-code-duplication
Command: npx skills add https://github.com/yuki-yano/dotfiles --skill detect-code-duplication

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires similarity-ts, and includes scripts (resource) and references (resource) components.

What problem does it solve?

Detect and map duplicated code across TypeScript and JavaScript projects, then generate a prioritized refactor plan to reduce duplication and improve maintainability.

Core Features & Use Cases

  • Code similarity detection across TS/JS files to surface duplicated patterns and hotspots.
  • Prioritized plan generation with actionable steps, owners, and phased execution guidance.
  • Logs and traceability by storing raw run data under docs/tmp/duplication/runs and producing a final plan under docs/plans/active.

Quick Start

Provide a target path to scan and I will generate a prioritized refactor plan.

Frequently Asked Questions about detect-code-duplication

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

FAQPage Schema
How do I detect duplicate code in a TypeScript or JavaScript monorepo?▼

To detect duplicate code in a TypeScript or JavaScript monorepo, provide a target path for scanning. The tool uses similarity-ts to locate similar code blocks and outputs a similarity report along with a prioritized refactor plan in markdown.

What is the best way to generate a refactor plan for duplicated JavaScript code?▼

Generating a refactor plan for duplicated JavaScript code is done by scanning files with configurable thresholds for similarity and minimum lines. The tool produces a markdown plan under docs/plans/active containing actionable remediation steps for consolidation.

Can I configure the minimum lines and file extensions for code duplication detection?▼

Yes, you can configure the minimum lines and file extensions for code duplication detection. The tool accepts configurable threshold, min-lines, and file-extensions parameters to customize the static analysis scope for your TS/JS files.

Does similarity-ts work for finding similar code blocks across a single repository?▼

Yes, similarity-ts works for finding similar code blocks across a single repository. The detection tool relies on it to perform static analysis on TS/JS files, outputting raw run data and scan metadata to the docs/tmp/duplication/runs directory.

Where does the code duplication scan metadata and similarity report get saved?▼

The code duplication scan metadata and similarity report get saved to the docs/tmp/duplication/runs/<run-id>/ directory. A final prioritized refactor plan is also generated at docs/plans/active/refactor-duplications-<run-id>.md.