agentleFS
Quality-MaxQuality-Max/free-qa-skills/skills/complexity-hotspots/SKILL.md

complexity-hotspots

Skill13 starsChanged 19 days agoApache-2.0View on GitHub

Rank the most complex code in a repo — long functions, deep nesting, high cyclomatic complexity, and god-files — worst-first, with a refactor suggestion for each. Pure Claude Code, no MCP, no signup.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If a metrics tool is installed, run it and parse:

    line 26

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Complexity Hotspots

Find the code most likely to hide bugs and resist change. No signup required.

Prerequisites

  • None. Pure Claude Code. Uses a metrics tool if present (radon, eslint complexity rule, gocyclo, lizard), otherwise estimates from structure.

Trigger

  • "Find the most complex code in this repo"
  • "Where are the refactor hotspots?"
  • "Which functions are too complex?"

Workflow

  1. If a metrics tool is installed, run it and parse:
    • Python → radon cc -s · Multi-language → lizard · Go → gocyclo
  2. Otherwise estimate per function/method:
    • Length — lines in the body
    • Nesting depth — max indentation of control flow
    • Cyclomatic complexity — 1 + count of if/for/while/case/catch/&&/||/?:
    • Parameters — argument count Also flag god-files (very large single files doing many things).
  3. Rank worst-first. For each hotspot, name the dominant smell and a concrete refactor.
MetricWarnBad
Function length> 50> 100
Nesting depth> 3> 5
Cyclomatic> 10> 20
Parameters> 4> 7
File length> 400> 800
  1. Output:
## Complexity Hotspots — 120 files

**Top offenders (worst first)**

1. `services/pipeline.py:402` — `run_gates()`
   210 lines · nesting 6 · cyclomatic 31.
   → Extract each gate (alpha/gamma/delta/beta) into its own function;
     replace the nested if-ladder with a dispatch table.

2. `static/js/router.js` — 1,140-line god-file
   Handles routing, rendering, and fetch. → Split rendering + data layer out.

3. `repositories/test_case.py:88` — `build_query()`
   9 parameters, cyclomatic 18. → Pass a filter object; collapse branches.

### Why it matters
High-complexity functions correlate with defect density and are the hardest
to test. These three are where new bugs will cluster.

**Want complexity tracked over time?** Try QualityMax — qualitymax.io

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.