complexity-budgets
Skill0 starsChanged 4 days agoMITView on GitHub
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.
In this repository108 other files it gives its agents.
- adaptive-estimationSkill
- adaptive-loop-budgetingSkill
- adopt-and-deleteSkill
- adversarial-reviewSkill
- agent-drives-uiSkill
- agentic-coding-loopSkill
- agent-otel-trajectorySkill
- agents-as-iac-modulesSkill
- ascii-ui-mockupsSkill
- authoring-html-emailSkill
- authoring-skills-vs-mcpSkill
- batched-ssh-enumerationSkill
- c4-architectureSkill
- challenge-the-premiseSkill
- codegraph-bootstrapSkill
- codegraph-worktree-startupSkill
- colocated-pod-tolerationsSkill
- command-creatorSkill
- connector-readinessSkill
- context-anchored-patchingSkill
- continuous-issue-resolutionSkill
- credential-proxySkill
- criticality-tiered-reportingSkill
- data-connector-buildingSkill
- declarative-firstSkill
- disk-pressure-forensicsSkill
- early-return-over-elseSkill
- email-triageSkill
- enums-codify-behaviorSkill
- ephemeral-workspace-lifecycleSkill
- event-sourcingSkill
- evidence-claim-boundariesSkill
- exhaustive-matchSkill
- feature-coverage-not-just-line-coverageSkill
- full-disk-forensicsSkill
- gate-before-pushSkill
- github-pr-shepherdingSkill
- graceful-shutdown-stateful-agentsSkill
- grounded-generationSkill
- iac-incident-responseSkill
- iac-not-ad-hocSkill
- instrumented-service-scaffoldSkill
- interface-over-conditionalsSkill
- knowledge-routingSkill
- lean-on-oss-standardsSkill
- live-money-disciplineSkill
- live-state-verificationSkill
- loop-governance-and-learningSkill
- low-level-executor-task-specSkill
- map-dispatch-over-conditionalsSkill
- merge-conflict-disciplineSkill
- mermaid-diagramsSkill
- oke-arc-runners-opentofuSkill
- orchestrate-agySkill
- orchestrate-claudeSkill
- orchestrate-codexSkill
- orchestrate-geminiSkill
- otel-emit-at-willSkill
- parameter-designSkill
- parse-dont-validateSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this skill when functions are hard to understand because they branch too much, nest too deeply, take too many parameters, or own too …
- Distinctive: line 13
Run the repository's existing formatter and linter first.
- Very specific: line 14
If a repository is indexed by CodeGraph, use codegraph-worktree-startup for navigation and blast radius before selecting files to measure.
- Distinctive: line 17
Run the appropriate language analyzer to find hotspots before choosing a threshold:
- Distinctive: line 38
Add the smallest rule that catches the problem — cyclomatic complexity, cognitive complexity, max nesting depth, max function length, or …
- Distinctive: line 45
Add focused tests around a complex function before reducing its complexity.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Complexity Budgets
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.
Workflow
- Run the repository's existing formatter and linter first.
- If a repository is indexed by CodeGraph, use
codegraph-worktree-startupfor 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 --consoleFor 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.
Tool Bindings
Each tool's cyclomatic-complexity check defaults to a limit near 10 — a sound starting point before ratcheting:
- Python: Ruff with McCabe (
C901) for cyclomatic complexity;complexipyfor cognitive complexity, diff reports, and refactor suggestions. - TypeScript and JavaScript: ESLint
complexityandmax-depth; use typescript-eslint where type information matters. When thecomplexityCLI from@genese/complexityis available, use it for cognitive and cyclomatic reports overts,js,tsx, andjsxcode. - TypeScript hotspot scans:
fta-cliis 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. - Go: golangci-lint with
gocycloorgocognit. - Java: Checkstyle complexity checks plus SpotBugs for bug patterns.
- Kotlin: detekt complexity rules.
- Shell: ShellCheck plus shfmt; extract shell functions once branches grow.
Review Checks
- The rule runs in CI and blocks only changed or newly violating code when the repository has existing debt.
- CI should invoke the same language analyzer used during review. Python CI may
use
complexipyJSON, GitLab, or SARIF output; TypeScript/JavaScript CI may usecomplexity/genese cpxreports or ESLint complexity rules, depending on whether the budget is cognitive, cyclomatic, or both. - Suppressions are rare, local, and include a reason.
- Complexity reduction does not remove behavior coverage.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

