Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Complexity Analyzer

    1

    Measure cyclomatic complexity and git churn to identify high-risk code hotspots and enforce quality gates.

    $1.99

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Complexity Analyzer

    Complexity Analyzer

    Example session with this skill installed

    Run a complexity analysis on the src/ directory, rank the top 10 functions, and include git churn data to find hotspots.

    • Read your context and instructions
    • Compiled the complexity analyzer

    Analyzed 42 files in src/. Identified 127 functions. Correlated complexity scores with git commit history to identify high-risk hotspots.

    Code Complexity & Hotspot Report

    FunctionFileGradeComplexityChurn (Commits)Hotspot Score
    process_order_v2src/orders.pyF48854080
    validate_payloadsrc/api/utils.tsE3412408
    calculate_tax_calcsrc/finance.pyD28421176
    handle_websocketsrc/net/ws.goC18590
    init_databasesrc/db/core.pyB915135
    format_responsesrc/api/utils.tsB720140
    get_user_metasrc/auth.pyA4312
    log_eventsrc/logger.pyA250100
    check_permissionsrc/auth.pyA5840
    parse_configsrc/config.pyA326

    Analysis Summary:

    Critical Risk: process_order_v2 in orders.py has a Grade F complexity and high churn. It is the primary candidate for refactoring.

    Testing Gap: calculate_tax_calc shows high churn (42 commits) but moderate complexity (Grade D). Ensure full branch coverage here.

    Maintainability: The api/utils.ts file is growing in complexity across multiple functions; consider splitting this utility file.

    Next steps

    1. Run python3 scripts/complexity.py src/orders.py --max 15 to identify specific blocks for extraction.
    2. Refactor process_order_v2 by extracting the nested conditional logic into standalone private functions.
    3. Add the --fail flag to your CI pipeline to prevent new Grade E or F functions from being merged.

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

    About this skill

    Legacy codebases often hide technical debt in bloated functions that are impossible to test. This skill identifies the riskiest logic by measuring cyclomatic complexity, nesting depth, and parameter counts across multiple languages.

    What it does

    • Multi-language analysis measures Python via AST and uses brace-aware heuristics for JS, TS, Java, C#, Go, PHP, Ruby, Kotlin, and C++.
    • Complexity grading assigns A through F marks to functions based on scoring thresholds from 1 to 41+.
    • Hotspot identification combines code complexity with git churn to find frequently changed, high-risk files.
    • CI enforcement provides exit codes to fail builds when functions exceed a defined complexity maximum.
    • Data export generates CSV or JSON files for integration with engineering dashboards or reporting tools.

    How it works

    1. Run a scan on a directory or specific file to generate a ranked list of the top complex functions.
    2. Apply the churn flag to correlate complexity with commit history, highlighting where bugs are most likely to live.
    3. Set a complexity threshold to trigger failures in CI pipelines for functions exceeding specific limits.

    Frameworks & tools

    The analyzer uses Python 3 for the core logic, utilizing the ast module for Python-specific parsing and standard regex/brace counting for other languages.

    Why this beats prompting it yourself

    Manual code reviews often miss deep nesting or high cyclomatic counts in large files. This tool provides deterministic metrics and mathematical rankings that standard LLM prompts cannot consistently replicate across thousands of lines of code.

    Use cases

    • Identify high-priority refactoring targets in a legacy monolith.
    • Prevent technical debt by blocking complex PRs in CI/CD pipelines.
    • Generate risk reports for engineering leadership during project handovers.
    • Prioritize unit test coverage for functions with high cyclomatic scores.

    Known limitations

    Heuristics for non-Python languages may miscount complexity in highly unconventional syntax or template-heavy C++ code. Requires Python 3 installed on the runner.

    Heuristics for non-Python languages may miscount complexity in unconventional syntax. Requires Python 3 on the host machine.

    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
    Write Files
    Listed1 month ago

    What's inside

    Frequently Asked Questions

    The analyzer uses language-specific parsing—leveraging Python's AST module for Python code and optimized brace-aware heuristics for C++, Java, TypeScript, and others—to provide precise, deterministic metrics that generic LLM prompts often miss.

    Yes, the skill includes a CI enforcement feature that allows you to set custom thresholds; if a pull request introduces a function exceeding your complexity limit, the tool will return a non-zero exit code to fail the build.

    Beyond just code structure, the 'hotspot' feature correlates complexity with git churn, identifying functions that are both complicated and frequently modified—precisely where bugs are statistically most likely to occur.

    While the core logic requires a Python 3 environment, the skill is designed to work with any AI agent or automation platform capable of executing CLI commands and parsing JSON/CSV outputs.

    The skill supports a wide range of popular languages including Python, JS, TS, Java, C#, Go, PHP, Ruby, Kotlin, and C++, though results are most precise in Python due to deep AST integration.

    New in Code Quality & Review