Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Duplicate Code Detector

    1

    Detect exact and near-duplicate code clones across any codebase with normalization and CI gate support.

    $2.99

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Duplicate Code Detector

    Duplicate Code Detector

    Example session with this skill installed

    Scan the src/ directory for any code clones longer than 8 lines, including cases where variables were renamed. Report the duplication percentage.

    • Read your context and instructions
    • Compiled the duplicate code detector
    • Generated the document

    I have completed a deep scan of the src/ directory. By normalizing identifiers and ignoring whitespace, I identified 4 distinct clone groups. The overall duplication rate for this directory is 8.4%.

    Duplicate Code Analysis Report

    Clone GroupOccurrencesAvg. LinesSimilarity TypeLocations
    GROUP_001312Type-2 (Renamed)src/auth/service.py:45, src/users/service.py:112
    GROUP_002210Type-1 (Exact)src/ui/buttons.tsx:12, src/ui/inputs.tsx:84
    GROUP_00329Type-2 (Renamed)src/api/v1/handlers.go:204, src/api/v2/handlers.go:198
    GROUP_00448Type-1 (Exact)src/db/migrations/001_init.sql, src/db/migrations/002_add_logs.sql

    Refactoring Recommendations

    Group 001: The logic for validate_session_token is repeated with different variable names in Auth and User services. Recommend extracting to src/common/security.py.

    • Group 002: Exact CSS-in-JS object detected in two UI components. Move to a shared theme.ts constant.

    Group 003: API response wrapping logic is duplicated across versions. Wrap in a middleware or a shared response utility.

    Next steps

    1. Extract the validate_session_token logic to a shared service.
    2. Run the scanner with --fail --max-percent 5 in your CI config to prevent future regressions.
    3. Consolidate the UI styling constants into the design system.

    buttons.tsx

    PDF · document

    Generated

    Example file from a real run - the skill writes it into your workspace.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Duplicate code blocks often bypass standard linters and static analysis, leading to high maintenance debt and hidden bugs. This skill scans your codebase to identify identical (Type-1) and renamed (Type-2) clones that simple grep commands miss.

    What it does

    • Normalization scanning ignores whitespace, comments, and literals to find logical duplicates.
    • Identifier abstraction detects code blocks where variables or functions were renamed.
    • Clone grouping merges overlapping matches into logical groups for refactoring.
    • Duplication metrics calculates percentage of duplicate lines per file and across the project.
    • CI enforcement provides exit codes to fail builds if duplication exceeds a set threshold.

    How it works

    1. Run the detector on a target directory or file glob.
    2. Specify the minimum line count to filter out trivial repetitions.
    3. Toggle identifier ignoring to catch near-duplicate logic.
    4. Review the report of clone groups and their specific locations.

    Frameworks & tools

    This tool uses a Python-based implementation compatible with any language. It supports standard CLI integration for use in local environments or CI/CD pipelines.

    Why this beats prompting it yourself

    Manual prompting often fails to track rolling hashes or maintain state across large file trees. This skill handles the heavy lifting of normalization and percentage calculation that LLMs struggle to do accurately at scale.

    Use cases

    • Identify refactoring opportunities for shared utility modules.
    • Audit a legacy codebase to quantify technical debt.
    • Prevent copy-paste growth during large-scale migrations.
    • Set a hard quality gate in CI pipelines for team projects.

    Known limitations

    Requires Python 3 environment. Large codebases may require specific file exclusions to maintain performance.

    Requires Python 3. Performance varies with codebase size; use --exclude for generated files or tests. Output is focused on detection, not automated code rewriting.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 1 month ago

    Permissions

    Terminal / Shell
    Read Files
    Listed1 month ago

    What's inside

    Frequently Asked Questions

    Unlike standard linters, this skill uses identifier abstraction and normalization to find 'near-duplicates' where variables were renamed or comments were changed, which simple text searches typically miss.

    The skill is language-agnostic; because it focuses on logical patterns and structural normalization, it can detect duplicates across Python, JavaScript, C++, and many other common programming languages.

    Yes, it provides specific exit codes and configurable thresholds, allowing you to automatically fail builds or pull requests if the percentage of duplicate code exceeds your team's limits.

    You will receive the complete detection engine, documentation for CLI integration, and example configuration files to help you set up duplication thresholds and file exclusions immediately.

    While it can handle large projects, we recommend using the file globbing feature to exclude third-party libraries or build artifacts to ensure the fastest possible scanning performance.

    New in Code Quality & Review