check-similarity

Detect duplicate code across languages using AST-based similarity tools.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Cross-language codebases often contain duplicate logic dispersed across languages, making maintenance costly and error-prone. This Skill detects and highlights semantic duplicates using AST-based analysis and automatically selects the right tool based on file types in the project.

Core Features & Use Cases

  • Automatic language detection and tool selection based on file extensions.
  • AST-based similarity analysis across languages to identify exact and near-duplicates.
  • Consolidated reporting with prioritized refactoring recommendations to reduce duplication.

Quick Start

Provide a project path to scan and I will detect languages and run the appropriate similarity tools.

Frequently Asked Questions about check-similarity

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

FAQPage Schema
How do I detect duplicate code across different programming languages in a single project?

To detect cross-language duplicate code, this Skill automatically identifies languages by file extension and runs AST-based similarity analysis tools like similarity-ts and similarity-py to surface exact and near-duplicate logic for consolidation.

What is AST-based similarity analysis and how does it help with code refactoring?

AST-based similarity analysis parses code into abstract syntax trees to identify structural duplicates rather than just matching text. This approach finds semantic duplicates across languages, providing prioritized remediation guidance to reduce maintenance costs during refactoring.

Can I use this tool to find duplicate logic in a polyglot codebase with TypeScript, Python, and Rust?

Yes, you can use this tool in a polyglot codebase. It detects languages present in the target project and automatically selects the appropriate similarity tool, such as similarity-ts for TypeScript, similarity-py for Python, and similarity-rs for Rust.

What's the best way to start scanning a project for cross-language code duplicates?

The best way to start scanning is to provide a project path. The Skill will automatically detect the languages present based on file extensions, execute the appropriate similarity tools for each detected language, and aggregate the results into a structured report.

Does this duplicate code detection tool work by comparing source text or syntax trees?

This duplicate code detection works by comparing syntax trees. It uses AST-based analysis to identify semantic duplicates and near-duplicates across different languages, ensuring that structurally equivalent code blocks are surfaced even if the text differs.

What limitations should I expect when detecting near-duplicate code blocks across different languages?

A key limitation is that detection relies on language-specific tools like similarity-py and similarity-ts, so it is constrained by the supported languages in your project. It aggregates results for exact and near-duplicate blocks, but complex semantic logic translations may not always match perfectly.