Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/saurabhkumar8112/cyclomatic-complexity-skill/cyclomatic-complexitynpx skills add saurabhkumar8112/cyclomatic-complexity-skill --skill cyclomatic-complexitygit clone --depth 1 https://github.com/saurabhkumar8112/cyclomatic-complexity-skillWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/saurabhkumar8112/cyclomatic-complexity-skill/cyclomatic-complexity)<a href="https://agentmods.dev/skills/saurabhkumar8112/cyclomatic-complexity-skill/cyclomatic-complexity"><img src="https://agentmods.dev/badge/skills/saurabhkumar8112/cyclomatic-complexity-skill/cyclomatic-complexity.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00103 | $0.00727 |
| Opus 5 | $0.00051 | $0.00364 |
| Sonnet 5 | $0.00021 | $0.00145 |
| Haiku 4.5 | $0.00010 | $0.00073 |
Grade A, and why
cyclomatic-complexity scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 70 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Cyclomatic Complexity
Purpose: AI-written code often works but branches like a jungle. This skill: measure complexity, refactor hotspots, keep code human-maintainable.
Measure first
CC = decision points + 1. Decision points: if, else if, case, loops, catch, ternary, &&, || in conditions.
Project linter config wins. If eslintrc, radon config, sonar config, or similar sets a complexity threshold, use that. No config: use defaults below.
Thresholds:
- 1-5: fine, leave alone
- 6-10: watch, refactor if touching anyway
- 11-15: refactor now
- 15+: must split, no debate
Prefer real tools over eyeballing when environment allows:
- Python:
radon cc -s -a <path> - JS/TS: eslint
complexityrule - Go:
gocyclo - Polyglot:
lizard <path>
No tool available: count manually, per function, show the count.
Refactor tactics, in order of preference
- Guard clauses. Invert conditions, return early, kill nesting.
- Extract function. Each extracted piece gets a name that says what, not how. Names are documentation.
- Lookup table / map instead of if-else or switch chains.
- Named predicates.
if (isEligibleForRefund(order))beats a 4-clause boolean soup. - Polymorphism / strategy for switch-on-type. Only when the switch appears in 2+ places.
- Flatten loops. Extract loop body, use continue instead of nested if.
Hard rules
- Preserve behavior. Run tests before and after. No tests: say so, suggest adding, refactor conservatively.
- Don't game the metric. A dense one-liner hiding 6 branches is worse than the honest if-chain it replaced. Complexity should move into well-named units, not disappear into cleverness.
- Don't break public APIs or exported signatures without asking.
- Small functions with clear names > few functions with comments explaining sections.
- One responsibility per function. If the name needs "and", split.
Workflow
- Measure all touched functions, rank by CC descending.
- Report hotspots with numbers before touching anything.
- Refactor worst first, one function at a time.
- Re-measure. Show before/after table: function, CC before, CC after.
- Verify: tests pass, behavior unchanged, diff reviewable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 5d ago First seen · 70 lines · 103 tokens per session scan A 6e8edae7a225
cyclomatic-complexity is a skill published in the GitHub repository saurabhkumar8112/cyclomatic-complexity-skill (346 stars, last pushed 9d ago), licensed Apache-2.0. It adds 103 tokens to every session and 727 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
software-code-refactoring
Improve production code quality while preserving all existing test behavior. Commonly used for the Refactor phase of TDD red-green-refactor, but applicable to any codebase with tests. Use when production code works but needs cleanup — reducing duplication, improving naming, simplifying complexity, aligning with…
simplify-codebase
Simplification audit or authorized codebase simplification whose stated objective is to remove accidental complexity. Use for evidence-backed deletion or consolidation of dead code, duplicate state, redundant APIs or layers, ownerless abstractions, obsolete compatibility or design records, and over-engineering in any…
refactor
Refactor code to improve structure and maintainability.
absolute-simplify
Use when the user wants to simplify, clean up, refactor, tidy, or refine code — their staged/unstaged git changes or a target file/path. Reduces complexity, flattens nesting, removes redundancy and dead code, scores each change by value (holding low-value churn), then runs tests to prove nothing broke. Invoke on…
techdebt
Find and fix technical debt including duplicated code, dead code, outdated patterns, and code smells. Run at the end of sessions to clean up.
code-quality-review
Run a maintainability and structure review focused on abstraction quality, branching complexity, file growth, canonical ownership, duplication, and refactoring opportunities. Use when the user asks for code quality review, maintainability review, 代码质量审查, 可维护性审查, or comments about whether the change stays easy to…