code-complexity

Guidance for keeping code understandable as a project grows. It focuses on clear names, small focused functions, contained decisions, and error handling that preserves useful details.

In plain words
What is it for?
Use it when designing modules, reviewing growing code, reducing repeated logic, or deciding where responsibilities and errors should be handled.
Why use it?
It helps prevent changes from becoming difficult or risky because one decision is scattered across many places or requires too much background knowledge.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/anastasiyaw/codex-claude-code-config/code-complexity
Any agent
npx skills add AnastasiyaW/codex-claude-code-config --skill code-complexity
Clone the repo
git clone --depth 1 https://github.com/AnastasiyaW/codex-claude-code-config

Made for: Claude Code, Codex.

Per session 252 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,634 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00252 $0.01634
Opus 5 $0.00126 $0.00817
Sonnet 5 $0.00050 $0.00327
Haiku 4.5 $0.00025 $0.00163

Measured 2d ago against content hash a49b90abea04, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 2d 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/development/code-complexity/SKILL.md · 129 lines

How it starts

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

Code complexity — keeping a unit comprehensible

Complexity is not how clever the code is. It is how much you must hold in your head to change one line safely. It accumulates by increments that each look acceptable, which is why it is never one bad commit's fault and always everyone's problem.

The two symptoms worth memorising

Change amplification — one decision, many edits. If changing a timeout means editing five files, that decision was not encapsulated anywhere.

Cognitive load — how much you must know to be safe. A function that is correct only if you know that the caller already took a lock has exported its complexity to everyone who reads it.

Both are properties of the interface, not the implementation. Which gives the rule:

Deep over shallow

A module's value is functionality it provides ÷ interface you must learn. Deep = small interface, substantial behaviour behind it. Shallow = large interface, little behind it.

  • A pass-through method that only calls one other method with the same arguments is negative value: it adds an interface without adding behaviour.
  • "One class per concept, many tiny classes" is not automatically good. Many shallow classes cost more total interface than a few deep ones.
  • The right question is never "is this class small?" but "how much do I need to know to use it?"

Information hiding — and its inverse

Every design decision that might change should be known to exactly one module. The inverse — information leakage — is when a decision shows up in two places: a file format known to both the reader and the writer, a status string parsed by three modules, a lock the caller has to remember.

Test: if this decision changed, how many files would I edit? More than one is leakage.

Names, functions, errors — the unit level

  • Names: a name that needs a comment to explain it is the wrong name. If you cannot name it, you do not yet know what it does — that is information, not a naming problem.
  • Functions: one job, one level of abstraction, few parameters. Three or more booleans in a signature is a sign that several functions are hiding in one.
  • Comments: comment the why and the constraint, never the what. A comment that restates the code rots the moment the code changes. A comment that records a ceiling or a reason is the most durable thing in the file.
  • Errors: define them out of existence where you can (an operation that cannot fail needs no error path); where you cannot, fail loudly and early. Silently swallowing is the failure that looks like success — the most expensive kind.
  • Tests: one assertion of behaviour per test, named for the behaviour. A test that needs a comment to say what it proves is not proving it clearly.

Read the full file on GitHub · 129 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. 2d ago First seen · 129 lines · 252 tokens per session scan A a49b90abea04

Subscribe to this mod's changes

code-complexity is a skill published in the GitHub repository AnastasiyaW/codex-claude-code-config (147 stars, last pushed 7d ago), licensed MIT. It adds 252 tokens to every session and 1,634 once invoked, about $0.0013 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.