Works with the AI tools you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+22 more

    Duplicate Code Detector

    1

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

    $9.99

    Secure checkout via Stripe

    30-day refund 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.

    How to use

    Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean today

    • Passed all security checks, Safe to install

    Listedtoday

    What's inside

    Frequently Asked Questions