check-similarity-ts

Detect duplicate code blocks in TypeScript/JavaScript projects using AST-based similarity.

821|20|Updated Jun 16, 2025
One-click install
npx skills add https://github.com/mizchi/similarity --skill check-similarity-ts
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: check-similarity-ts
Source: https://github.com/mizchi/similarity/tree/main/.claude/skills/check-similarity-ts
Command: npx skills add https://github.com/mizchi/similarity --skill check-similarity-ts

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Detects duplicate and similar code blocks in TypeScript/JavaScript projects using AST-based similarity, helping teams locate refactoring opportunities and reduce code drift.

Core Features & Use Cases

  • Detect duplicate functions and types across TS/JS codebases.
  • Analyze results and guide refactoring, including consolidating shared logic and parameterizing differences.
  • Supports threshold controls and experimental type-detection for deeper similarity checks.

Quick Start

Run similarity-ts on your project to detect duplicate code and propose a refactor plan.

Frequently Asked Questions about check-similarity-ts

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

FAQPage Schema
How do I detect duplicate code blocks in a TypeScript project?

Detect duplicate code in a TypeScript project using AST-based similarity detection to locate repeated functions, types, and patterns. This structural analysis identifies refactoring opportunities to consolidate shared logic and reduce code drift.

What is AST-based code similarity analysis?

AST-based code similarity analysis parses TypeScript and JavaScript syntax trees to locate duplicated functions and types. It identifies structural overlaps rather than matching raw text, providing deeper insight into repeated patterns for refactoring.

Can I analyze TSX and JSX files for code duplication?

Yes, you can analyze TSX and JSX files for code duplication. The tool supports codebases written in TS, TSX, JS, and JSX, allowing you to locate repeated functions and types across your entire frontend and backend JavaScript stack.

How do I configure the duplication threshold for code analysis?

Configure the duplication threshold using command-line arguments to control sensitivity. Adjusting this threshold filters similarity results, allowing you to focus on high-impact refactoring targets or surface subtle repeated patterns in your codebase.

Does AST code duplication detection support type-aware similarity checks?

Yes, experimental type-detection features support deeper type-aware similarity checks. This allows the analysis to match duplicated logic based on TypeScript type signatures, identifying structural duplicates that standard AST parsing might miss.

What is the best way to refactor duplicate JavaScript functions?

The best way to refactor duplicate JavaScript functions is to detect them via AST analysis and consolidate shared logic. The tool guides refactoring by locating repeated patterns and parameterizing differences to reduce code drift.