cyclomatic-complexity-skill README

The project's README from github.com/saurabhkumar8112/cyclomatic-complexity-skill. As one markdown file: README.md.

cyclomatic-complexity

A Claude skill that refactors code to reduce cyclomatic complexity. Built for AI-generated code: it works, but branches like a jungle. This skill makes Claude measure complexity, refactor hotspots, and keep code maintainable for humans and the long-term vision of the codebase.

What it does

Install

Claude Code

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

Claude.ai

Download the .skill file from Releases (or zip the skills/cyclomatic-complexity folder) and upload it under Settings → Capabilities → Skills.

Claude API

Upload via the Skills API.

Usage

Triggers automatically on refactoring, cleanup, and code review requests. Or invoke directly:

"Use the cyclomatic complexity skill to refactor parser.py"

Example output

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

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

License

Apache 2.0

cyclomatic-complexity-skill (saurabhkumar8112/cyclomatic-complexity-skill)

refactoring
Searching Database…

What is this?A Claude Skill that teaches Claude to measure a function's cyclomatic complexity and refactor the worst offenders instead of leaving tangled branch-heavy code behind.
Is this a standalone app, or does it plug into Claude?It is a Claude Skill — a packaged instruction set that Claude loads and follows, not a program you run yourself.
How do I add this skill to Claude?For Claude.ai, download the .skill file from Releases (or zip the skills/cyclomatic-complexity folder) and upload it under Settings -> Capabilities -> Skills; it can also be added to Claude Code or uploaded via the Skills API.
Does it need radon, eslint, or other analyzers installed first?It uses whichever complexity tool fits the codebase - radon, eslint, gocyclo, lizard, or a manual count - and respects your project's own linter thresholds if you have them configured.
Does it just game the complexity score with tricks?No - it explicitly refuses to hide complexity in clever one-liners; complexity is moved into well-named, readable functions instead.
Who is this skill meant for?Developers cleaning up AI-generated code that works but has grown into deeply nested, hard-to-follow branching logic.
When does the skill kick in during a session?It triggers automatically on refactoring, cleanup, and code review requests, or can be invoked directly by asking Claude to use it on a specific file.
What do I get at the end of a refactor?Every refactor ends with a before/after complexity table so you can see exactly how much simpler each function became.
What refactoring techniques does it apply?It targets the worst complexity hotspots first using guard clauses, extract-function, lookup tables, and named predicates.
Which languages can it analyze?It works across languages by picking the right tool for the job - radon for Python, eslint for JavaScript, gocyclo for Go, or lizard as a multi-language fallback.
Size
<0.1 MB
Stars
405
Updated
CommitAug 26
Age
1mo
Commits · 90 Days