complexity

Identify high-cyclomatic-complexity functions in Python and Go projects.

418|40|Updated Nov 5, 2025
One-click install
npx skills add https://github.com/boshu2/agentops --skill complexity-boshu2
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: complexity
Source: https://github.com/boshu2/agentops/tree/main/skills/complexity
Command: npx skills add https://github.com/boshu2/agentops --skill complexity-boshu2

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams locate high-complexity code regions and prioritize refactoring efforts to improve maintainability and reduce risk.

Core Features & Use Cases

  • Detect high-CC regions: surface functions or methods with elevated cyclomatic complexity for targeted refactoring.
  • Language support: analyzes Python and Go projects by scanning source trees to surface hotspots.
  • Use Case: Imagine a codebase with nested conditionals; this Skill highlights hotspots and suggests concrete refactoring targets.

Quick Start

Run the complexity analysis on your repository to produce a report under .agents/complexity, such as .agents/complexity/2026-02-08-target.md.

Frequently Asked Questions about complexity

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

FAQPage Schema
How do I identify high-complexity code regions for refactoring in Python and Go projects?

Identify high-complexity code regions by scanning source trees to calculate cyclomatic complexity metrics for functions and methods, surfacing hotspots. This analysis targets Python and Go projects to prioritize maintainability improvements and reduce risk.

What is cyclomatic complexity and when do I need to analyze it?

Cyclomatic complexity measures the number of linearly independent paths through a program's source code. Analyze it when nested conditionals create maintenance risks, using the generated report to highlight specific functions requiring refactoring.

Do I need external tools to run cyclomatic complexity analysis on my repository?

Yes, cyclomatic complexity analysis requires installing external tools radon for Python projects or gocyclo for Go projects. These dependencies scan your source tree and calculate metrics to identify functions with elevated complexity scores.

How do I generate a complexity report for my codebase?

Generate a complexity report by running the analysis on your repository, which scans functions and methods then writes the results to a markdown file at .agents/complexity/YYYY-MM-DD-<target>.md. This report surfaces specific refactoring targets based on complexity metrics.

What's the best way to prioritize refactoring efforts across a large codebase?

Prioritize refactoring by using cyclomatic complexity metrics to locate high-CC regions and nested conditionals. The resulting report highlights specific functions and methods as concrete refactoring targets, guiding teams toward the highest-risk areas.

Can I analyze code complexity for languages other than Python and Go?

No, cyclomatic complexity analysis currently supports Python and Go projects only. The Skill relies on radon for Python and gocyclo for Go to scan source trees and calculate the complexity metrics needed for refactoring decisions.