Complexity#
Analyze code complexity and rank refactor targets using objective metrics.
Description#
The complexity skill runs language-appropriate complexity tools, ranks
functions by cyclomatic complexity (and maintainability index for Python),
and writes a report under resources/agent-docs/reviews/complexity/.
Supported tools:
Python:
radon(radon cc,radon mi)Go:
gocyclo(default threshold: over 10)
Missing tools are reported with install commands. The skill does not auto-install packages.
Triggers#
complexityanalyze complexityfind complex coderefactor targetscyclomatic complexitycode metrics
Invocation examples:
/wf:complexity
/wf:complexity src/
$complexity
/complexity path/to/pkg
Workflow#
Resolve scope — user path, else recent
.py/.gochanges, else ask or use the repo root.Detect languages — Python and/or Go under the target.
Check tools — require
radonand/orgocyclo; never silent install.Run metrics — capture tool output.
Rank targets — CC > 10 should refactor; > 20 must; > 30 critical.
Recommend fixes — open high-CC functions and give specific extract / simplify advice.
Write report —
resources/agent-docs/reviews/complexity/YYYY-MM-DD-<target>.md.Summarise — overall stats, top 3 targets, report path.
Output#
Session summary (counts, top targets)
Markdown report under
resources/agent-docs/reviews/complexity/
Prerequisites#
Language |
Tool |
Install (user-approved) |
|---|---|---|
Python |
|
|
Go |
|
|
Relationship to Other Skills#
thermo-nuclear — qualitative maintainability / code-judo review
review-tests — test quality only; complexity is primarily production metrics
Attribution#
Vendored and adapted from LobeHub skill boshu2-agentops-complexity
(associated with boshu2/agentops,
Apache-2.0).