/selamy-skills:complexity-budgetsfrom selamy-skills
Use when code review or implementation needs enforceable limits on branching, nesting, cognitive complexity, function size, or parameter count. Compose language-specific complexity analyzers with repo-native lint gates.
Ships in selamy-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use this skill when functions are hard to understand because they branch too much, nest too deeply, take too many parameters, or own too many responsibilities.
Run the repository's existing formatter and linter first.
If a repository is indexed by CodeGraph, use codegraph-worktree-startup
for navigation and blast radius before selecting files to measure. CodeGraph
finds the code; complexity analyzers score it.
Run the appropriate language analyzer to find hotspots before choosing a threshold:
# Python
complexipy . --top 20 --sort desc
complexipy . --max-complexity-allowed 10 --failed --suggest-refactors
# TypeScript / JavaScript, when @genese/complexity is installed
complexity src
genese cpx src --language ts --console
For changed-code checks, prefer the repository's base reference or staged diff when the tool supports it:
complexipy . --diff main
complexipy . --staged=true
Add the smallest rule that catches the problem — cyclomatic complexity, cognitive complexity, max nesting depth, max function length, or max parameter count — not all of them.
Set the first threshold to the current worst offender, so it stops new outliers without forcing a cleanup PR. For cyclomatic complexity, a starting threshold of 10 is the conventional default across the linters below; raise it to fit existing debt, then ratchet down.
Add focused tests around a complex function before reducing its complexity.
Lower a threshold only after the code is already below the new value.
Each tool's cyclomatic-complexity check defaults to a limit near 10 — a sound starting point before ratcheting:
C901) for cyclomatic complexity; complexipy for
cognitive complexity, diff reports, and refactor suggestions.complexity and max-depth; use
typescript-eslint where type information matters. When the complexity CLI
from @genese/complexity is available, use it for cognitive and cyclomatic
reports over ts, js, tsx, and jsx code.fta-cli is a good fast file-level triage tool
when the repository already uses it, but do not substitute a file-level score
for function-level thresholds when a function budget is needed.gocyclo or gocognit.complexipy JSON, GitLab, or SARIF output; TypeScript/JavaScript CI may
use complexity/genese cpx reports or ESLint complexity rules, depending
on whether the budget is cognitive, cyclomatic, or both.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub selamy-labs/agent-skills --plugin selamy-skills111 skills in this plugin
/adaptive-estimationUse when tracking a slowly-varying latent quantity from noisy measurements with quantifiable uncertainty — a drifting metric, capacity, latency trend, or confidence. Prefer a Kalman-style adaptive estimator over fixed moving averages or static thresholds./adaptive-loop-budgetingUse when an autonomous loop needs explicit limits on attempts, time, cost, tool calls, verification depth, or risk, and a clear stop, continue, yield, or escalate decision./adopt-and-deleteUse when adopting a shared module, library, chart, or service, or doing any consolidation, migration, or refactor that supersedes existing code. The change that adds the replacement must REMOVE what it replaced, in the same atomic change.Other plugins' skills for the same job