Code Standards

A practical guide to software code-quality rules and common size limits. It explains principles such as keeping code simple, avoiding unnecessary duplication, and separating responsibilities.

In plain words
What is it for?
Use it when reviewing or refactoring code, or when deciding whether files, functions, or responsibilities should be split.
Why use it?
It gives developers concrete checks for deciding when code is too complex, repetitive, or large. This makes code-quality reviews more consistent.

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/hculap/better-code/code-standards
Any agent
npx skills add hculap/better-code --skill code-standards
Clone the repo
git clone --depth 1 https://github.com/hculap/better-code

Made for: Claude Code, Codex.

Per session 83 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,353 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.00083 $0.01353
Opus 5 $0.00042 $0.00677
Sonnet 5 $0.00017 $0.00271
Haiku 4.5 $0.00008 $0.00135

Measured yesterday against content hash 4239e5d0867c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

Code Standards 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 yesterday.

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.

plugins/code-standards/skills/code-standards/SKILL.md · 182 lines

How it starts

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

Code Standards

Practical code quality standards with concrete "rules of thumb" - actionable thresholds rather than philosophy.

Core Principles

KISS (Keep It Simple, Stupid)

Prefer the simplest solution that works. Avoid "clever" code, magic, and over-engineering.

DRY (Don't Repeat Yourself)

Remove duplication when it's real duplication. Avoid premature abstraction.

YAGNI (You Aren't Gonna Need It)

Build features/abstractions only for real, current needs - not hypothetical future ones.

SRP (Single Responsibility Principle)

One module/class/function should have one reason to change.

Separation of Concerns

Keep UI, domain logic, persistence, integration, and config separated.

Principle of Least Surprise

Code should behave as a reader expects.

Fail Fast, Loudly

Validate inputs early; crash with clear errors rather than silently continuing.

Size Limits

File Size (Lines of Code)

Level LOC Action
Target 100-300 Ideal
Soft limit 400 Consider splitting (warning)
Hard limit 800 Must refactor (critical)

When a file grows too large, ask what responsibilities got mixed (SRP), then split by domain or feature.

Function/Method Size

Level LOC Action
Target 10-30 Ideal
Soft limit 50 Review (warning)
Hard limit 80 Must refactor (critical)

If a function cannot be named clearly, it's doing too much.

Cyclomatic Complexity

Score Action
>10 Review required
>15 Refactor strongly
>20 Almost always too complex

Language-Specific Thresholds

Different languages have different conventions. See references/language-thresholds.md for complete per-language limits.

Naming & Readability

  • Prefer clear names over comments
  • Use consistent vocabulary (e.g., "user" everywhere, not sometimes "customer")
  • Avoid abbreviations unless universally known
  • Boolean names: isEnabled, hasAccess, shouldRetry

Read the full file on GitHub · 182 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. yesterday First seen · 182 lines · 83 tokens per session scan A 4239e5d0867c

Subscribe to this mod's changes

Code Standards is a skill published in the GitHub repository hculap/better-code (2 stars, last pushed 7mo ago), licensed MIT. It adds 83 tokens to every session and 1,353 once invoked, about $0.0004 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-31.