check-similarity-py

Identify duplicate Python functions and classes using AST-based similarity analysis.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Detects Python code duplication and similarity to streamline refactoring and improve maintainability.

Core Features & Use Cases

  • AST-based similarity analysis to identify identical or near-duplicate functions and classes
  • Guidance for refactoring opportunities across modules and packages
  • Works with Python projects of varying sizes

Quick Start

Run similarity-py on your Python project to detect duplicate functions and classes.

Frequently Asked Questions about check-similarity-py

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

FAQPage Schema
How do I detect Python code duplication in my project?

Detect Python code duplication by applying AST-based similarity analysis across your project to surface identical or near-duplicate functions and classes for refactoring. The tool scans codebases of any size and outputs actionable results suitable for code review.

How does AST analysis find similar Python functions and classes?

AST analysis finds similar Python functions and classes by parsing code into abstract syntax trees and comparing structural patterns to identify near-duplicate code blocks. This approach surfaces refactoring opportunities across modules and packages within the project.

Can I adjust the sensitivity threshold for Python code similarity detection?

Yes, you can adjust the sensitivity threshold for Python code similarity detection using the --threshold option. This controls how aggressively the AST analysis matches duplicate functions and classes, allowing you to tune results for your specific refactoring needs.

What is the best way to find duplicate functions for Python code review?

The best way to find duplicate functions for Python code review is using AST-based static analysis to compare code structures across modules. This identifies refactoring opportunities and outputs actionable results that can guide maintainability improvements.

Does AST-based similarity analysis work on large Python codebases?

Yes, AST-based similarity analysis works on large Python codebases of varying sizes. The tool applies static analysis across the entire project to identify duplicate functions and classes, making it suitable for extensive refactoring guidance.

How do I print duplicate code results from a Python static analysis scan?

Print duplicate code results from a Python static analysis scan by using the --print option. This outputs the identified similar functions and classes directly, providing actionable data to guide your refactoring efforts during code review.