# The cyclomatic-complexity skill ships as a plugin, a .skill file and a zip

> saurabhkumar8112/cyclomatic-complexity-skill is a Claude skill for refactoring code whose branches multiply, with three installation routes and a Claude.ai route that points at a release page the repository does not have.

**saurabhkumar8112/cyclomatic-complexity-skill** — Claude skill: refactor code to reduce cyclomatic complexity

- Repository: https://github.com/saurabhkumar8112/cyclomatic-complexity-skill
- Stars: 405 · Forks: 10
- Language: Unknown
- License: Apache-2.0
- Published: 2026-09-15 · Updated: 2026-09-15 · Language: en
- Canonical page: https://hysenlabs.com/projects/saurabhkumar8112-cyclomatic-complexity-skill

## It is aimed at code that works but branches like a jungle

The premise is narrow and stated in the first line: this is a Claude skill that refactors code to reduce cyclomatic complexity, built for AI-generated code. The description of that code is worth repeating because it sets the tone, it works, but branches like a jungle. That is a specific failure mode rather than a general complaint about generated code. Machine-written code tends to accumulate conditionals instead of structures, so the fix the skill proposes is mechanical rather than inventive: measure complexity, refactor the hotspots, keep the result maintainable for humans and for the long-term vision of the codebase. The repository itself is small, a `.claude-plugin/` directory, a `skills/` directory, a LICENSE, a README and a `.gitignore`, with the default branch on master and no GitHub releases. The primary language of the repository is not recorded.

## Five measurement routes, and deference to your linter settings

The measurement step names its tools rather than shipping one. Complexity can be measured per function with radon, eslint, gocyclo, lizard, or by manual count. That list spans the usual language-specific counters, and the manual option is there for the case where a project has no tool wired up at all. The second behavior matters more than the list: the skill respects your project's own linter thresholds when configured. So the target number it works toward is not a constant baked into the skill, it is whatever threshold your own configuration already states, and if your configuration states nothing then there is no target to hit and the ordering of hotspots becomes the only guide. Either way the unit of measurement is the function, not the file or the module, which is what makes the later per-function table possible.

## Worst hotspots first, through four named moves

Refactoring is ordered rather than scattershot. The skill refactors worst hotspots first, which means the highest complexity functions get attention before the merely untidy ones. The moves it reaches for are named: guard clauses, extract function, lookup tables, named predicates. Guard clauses move an early return to the top of a function and flatten the nesting that follows. Extract function pulls a branch out into something you can name and test. Lookup tables replace chains of conditionals with a data structure. Named predicates give a condition a name instead of leaving it inline in an if. Each of these changes structure without changing what the code computes, and each leaves you with more named things than you started with, which is the opposite of what a metric-driven cleanup usually produces.

## The clause that forbids gaming the number

One line in the behavior list exists to stop the obvious failure mode: the skill refuses to game the metric. The stated rule is that complexity moves into well-named functions, not into clever one-liners. This is the difference between a refactoring tool and a score tool. Lowering a number by collapsing a conditional into a dense expression achieves the same count and a worse file, and the skill names that outcome as the thing to avoid. It also implies a limit on how far extraction goes: if complexity can only leave a function by moving into another well-named function, then a codebase with one enormous dispatcher and forty small functions satisfies the letter of the rule. Nothing here states a cap on function count or a rule against moving work sideways, so the judgment about whether an extraction was honest still sits with whoever reviews the result.

## Every refactor closes with a before and after table

The last behavior in the list is that every refactor ends with a before and after complexity table. The shape of that table is fixed by the example given on the page:

```
## Complexity report
| Function | Before | After |
|----------|--------|-------|
| parseOrder | 14 | 4 |

Extracted: validateHeader, resolveDiscount
Behavior verified: existing test suite passes
```

Three things are worth reading off that example. The numbers are per function, before and after, so `parseOrder` dropping from 14 to 4 is the claim under examination. The `Extracted:` line names what came out, which is how a reader checks the extraction move against the named functions the skill says it prefers. The `Behavior verified:` line is the load-bearing one, and it rests on an existing test suite. If your project has no tests, that line cannot be filled in honestly, which makes the test suite a precondition rather than a nicety.

## Two slash commands install it into Claude Code

The Claude Code route is two slash commands:

```
/plugin marketplace add saurabhkumar8112/cyclomatic-complexity-skill
/plugin install cyclomatic-complexity@cyclomatic-complexity-skill
```

The first registers this repository as a marketplace under its full owner and name, and the second installs a plugin called `cyclomatic-complexity` from that marketplace. The `.claude-plugin/` directory at the repository root is what makes the first command work, and the skill itself lives under `skills/`, which is also the folder you zip for the other two routes. The license is Apache 2.0, stated in both the LICENSE file and the README. The default branch is master. Nothing in the repository records a version number for the skill, and there are no GitHub releases to pin, so a marketplace install tracks whatever the branch currently holds.

## The Claude.ai route points at releases that do not exist

For Claude.ai the instruction is to download the `.skill` file from Releases, or zip the `skills/cyclomatic-complexity` folder yourself, and upload it under Settings, then Capabilities, then Skills. The repository has no GitHub releases, so the first half of that instruction has nothing to point at and the zip route is the one that works. That fallback is not a small detail: it means the artifact you install is whatever the master branch holds at the moment you zip it, and there is no version marker in the file itself that the page mentions. The third route is programmatic rather than manual. For the Claude API you upload through the Skills API, documented at https://docs.claude.com/en/api/skills-guide, which is the same artifact uploaded through a different door. Three routes, one artifact, and no published version to compare against.

## Triggers on refactoring, cleanup and code review

Usage is described in one sentence plus an example. The skill triggers automatically on refactoring, cleanup, and code review requests, so a request to tidy a file can pull it in without being named. Or you invoke it directly with a sentence like "Use the cyclomatic complexity skill to refactor parser.py", which names the target file and leaves the skill to measure it. There is no configuration file, no threshold setting and no language list anywhere in the repository to review, because the five measurement tools and the four refactor moves are all the behavior described. The homepage field is empty, so the README is the entire documentation, and it points nowhere else. What you get is a narrow, opinionated prompt packaged for three different Claude surfaces.

## Conclusion

This skill fits a team whose AI-generated code passes its tests and still reads badly, since the work it does is measuring, extracting and re-measuring rather than rewriting behavior. It does not fit a codebase with no test suite, because the closing step claims behavior is verified by existing tests, and it does not fit a team that wants a fixed threshold, because the skill defers to whatever linter settings already exist. Before adopting it, check whether your repository has releases, since the Claude.ai instructions assume one.

## FAQ

### What tools does the cyclomatic-complexity skill use to measure complexity?

It measures cyclomatic complexity per function with radon, eslint, gocyclo, lizard, or by manual count, and it respects your project's own linter thresholds when they are configured.

### How do I install the cyclomatic-complexity skill in Claude Code?

Run `/plugin marketplace add saurabhkumar8112/cyclomatic-complexity-skill`, then `/plugin install cyclomatic-complexity@cyclomatic-complexity-skill`. The `.claude-plugin/` directory in the repository is what the first command registers.

### Where do I get the .skill file for Claude.ai?

The instructions point at the Releases page, but the repository has no GitHub releases. The working alternative given is to zip the `skills/cyclomatic-complexity` folder and upload it under Settings, then Capabilities, then Skills.

### What refactoring moves does the cyclomatic-complexity skill make?

It refactors the worst hotspots first using guard clauses, extract function, lookup tables and named predicates, and it refuses to game the metric: complexity moves into well-named functions, not clever one-liners.

## Sources

- [Issues](https://github.com/saurabhkumar8112/cyclomatic-complexity-skill/issues)
- [License: Apache-2.0](https://github.com/saurabhkumar8112/cyclomatic-complexity-skill/blob/master/LICENSE)
- [README](https://github.com/saurabhkumar8112/cyclomatic-complexity-skill/blob/master/README.md)
- [saurabhkumar8112/cyclomatic-complexity-skill on GitHub](https://github.com/saurabhkumar8112/cyclomatic-complexity-skill)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/saurabhkumar8112-cyclomatic-complexity-skill
