code-complexity

code-complexity is a skill for Claude Code from Vimalk0703/shipworthy. It costs 34 tokens per session (812 once invoked), scanned A, original, MIT.

A set of rules for keeping code small, readable, and easier to maintain. It checks branching, function and file size, nesting, parameter counts, and repeated code.

In plain words
What is it for?
It is for reviewing functions and files for excessive complexity, deep nesting, too many parameters, and duplicated code.
Why use it?
It highlights code that is becoming difficult to understand or change, so developers can split it into focused functions or shared modules before it becomes a maintenance problem.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the shipworthy plugin — 66 skills, 7 commands, 3 hooks shipped together

Good fit It is for reviewing functions and files for excessive complexity, deep nesting, too many parameters, and duplicated code.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/vimalk0703/shipworthy/code-complexity
Install

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.

Any agent
npx skills add Vimalk0703/shipworthy --skill code-complexity
Clone the repo
git clone --depth 1 https://github.com/Vimalk0703/shipworthy

Made for: Claude Code.

Or install shipworthy, the plugin that ships this one along with the rest of its 66 skills, 7 commands, 3 hooks.

Wrote 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.

agentmods badge for code-complexity

README.md
[![agentmods](https://agentmods.dev/badge/skills/vimalk0703/shipworthy/code-complexity/github.svg)](https://agentmods.dev/skills/vimalk0703/shipworthy/code-complexity)
Your own site
<a href="https://agentmods.dev/skills/vimalk0703/shipworthy/code-complexity"><img src="https://agentmods.dev/badge/skills/vimalk0703/shipworthy/code-complexity/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for code-complexity

Your own site · 80×15
<a href="https://agentmods.dev/skills/vimalk0703/shipworthy/code-complexity"><img src="https://agentmods.dev/badge/skills/vimalk0703/shipworthy/code-complexity.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 812 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00034 $0.00812
Opus 5.5 $0.00014 $0.00325
Sonnet 5.5 $0.00007 $0.00162
Haiku 4.5 $0.00003 $0.00081

Measured 1mo ago against content hash 3a0ca3b3ae22, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

code-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 1mo 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.

skills/quality/code-complexity/SKILL.md · 104 lines

How it starts

The opening of the file, as written. The whole thing — 104 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Code Complexity

Limits at a Glance

Metric Limit Action When Exceeded
Cyclomatic complexity < 15 per function Extract helper functions
Function length ~50 lines max Split into focused functions
File length ~300 lines max Extract modules/classes
Nesting depth Max 4 levels Early returns, extract functions
Parameter count Max 4-5 params Use an options/config object
Duplicate blocks > 3 lines repeated 2+ times Extract shared function

Cyclomatic Complexity (< 15 per function)

Each if, else, case, &&, ||, catch, and ternary adds 1. When a function exceeds 15, extract validation, branching logic, or case handling into separate functions.

Function Length (~50 Lines Max)

If you need a comment like // Step 3: ..., that step is its own function.

// BAD -- 120-line function with section comments
function handleRequest(req: Request) { /* validate, fetch, transform, respond */ }

// GOOD -- each concern is a named function
function handleRequest(req: Request) {
  const input = validateInput(req);
  const data = fetchDependencies(input);
  return saveAndRespond(transformData(data));
}

Deep Nesting (Max 4 Levels)

// BAD -- 5 levels deep
function process(items) {
  if (items) {
    for (const item of items) {
      if (item.active) {
        if (item.type === 'premium') {
          if (item.balance > 0) { /* buried logic */ }
        }
      }
    }
  }
}

// GOOD -- flat with early returns and filtering
function process(items) {
  if (!items) return;
  const eligible = items.filter(i => i.active && i.type === 'premium' && i.balance > 0);
  for (const item of eligible) { /* top-level logic */ }
}

Parameter Count (Max 4-5)

// BAD -- 7 positional params
function createUser(name, email, role, team, avatar, locale, timezone) { ... }

// GOOD -- options object
interface CreateUserOptions {
  name: string; email: string; role: Role;
  team?: string; avatar?: string; locale?: string; timezone?: string;
}
function createUser(options: CreateUserOptions) { ... }

Read the full file on GitHub · 104 lines

Changes

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.

  1. 1mo ago First seen · 104 lines · 34 tokens per session scan A 3a0ca3b3ae22

Subscribe to this mod's changes

code-complexity is a skill published in the GitHub repository Vimalk0703/shipworthy (6 stars, last pushed 6mo ago), licensed MIT. It adds 34 tokens to every session and 812 once invoked, about $0.0001 per session on Opus 5.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-09-03.