lean-code

A guide for keeping code as small as possible while still meeting the requirement. It favors existing tools, standard library features, and simple solutions before adding abstractions or dependencies.

In plain words
What is it for?
Use it when the user asks for a minimal or simplest solution, objects to bloat, or is about to write a substantial amount of code.
Why use it?
It helps avoid unnecessary code, boilerplate, dependencies, and design complexity.

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/lean-code
Any agent
npx skills add AnastasiyaW/codex-claude-code-config --skill lean-code
Clone the repo
git clone --depth 1 https://github.com/AnastasiyaW/codex-claude-code-config

Made for: Claude Code, Codex.

Per session 134 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 848 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.00134 $0.00848
Opus 5 $0.00067 $0.00424
Sonnet 5 $0.00027 $0.00170
Haiku 4.5 $0.00013 $0.00085

Measured 2d ago against content hash a520a4ce3d4c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

lean-code 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/lean-code/SKILL.md · 36 lines

How it starts

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

Lean Code

Aggressive YAGNI mode, on demand. The always-on baseline is rules/quality-code.md; this skill is the intensifier you invoke when minimalism matters most. The win is measured ("smallest solution that FULLY satisfies the task"), not a slogan.

The ladder — stop at the first rung that holds

  1. Does this need to exist at all? Speculative need → skip it, say so in one line. (YAGNI)
  2. Stdlib does it? Use it.
  3. Native platform feature covers it? (<input type="date"> over a picker lib, CSS over JS, a DB constraint over app code.)
  4. An already-installed dependency solves it? Use it. Never add a new dependency for what a few lines do.
  5. Can it be one line? Make it one line.
  6. Only then — the minimum code that works.

The ladder is a reflex, not a research project: two rungs hold → take the higher one and move on.

Intensity

  • lite — build what's asked, but name the leaner alternative in one line; user picks.
  • full — the ladder enforced; stdlib/native first; shortest working diff. (Default.)
  • ultra — YAGNI extremist: ship the one-liner and challenge the rest of the requirement in the same breath.

When NOT to be lean (load-bearing — never simplify these away)

Input validation at trust boundaries · error handling that prevents data loss · security · accessibility · the calibration real hardware needs · anything the user explicitly asked to keep. Lean ≠ incomplete: non-trivial logic leaves ONE runnable check behind (assert-demo or one small test). User insists on the full version → build it, no re-arguing.

Hard boundary — lean targets OVER-building, never completeness

This is orthogonal to thoroughness. "Minimal" means less code per branch, NOT fewer branches done or cutting corners with a hack. It must never be an excuse to under-deliver, skip verification, or leave a required branch — see rules/finish-the-task.md (its completeness + quality pillars win) and rules/quality-code.md (the no-monkey-patch pole). Mark a deliberate shortcut with a simplification: comment naming the ceiling + upgrade path.

Read the full file on GitHub · 36 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 · 36 lines · 0 tokens per session scan A a520a4ce3d4c

Subscribe to this mod's changes

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