Skip to content
Development
Skill

/code-standards

Use when writing, modifying, reviewing, or refactoring code — any language or stack, application, infrastructure, or configuration. Also when asked to apply, audit, or clean up the code standards of a file or module.

From plugin
metraton-gaia
339 skills9 agents11 hooks
Install
$ npx -y skills add metraton/gaia --skill code-standards --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/code-standards

Context preview

The summary Claude sees to decide when to auto-load this skill.

Use when writing, modifying, reviewing, or refactoring code — any language or stack, application, infrastructure, or configuration. Also when asked to apply, audit, or clean up the code standards of a file or module.

SKILL.md

code-standards.SKILL.md
name: code-standards
description: Use when writing, modifying, reviewing, or refactoring code — any language or stack, application, infrastructure, or configuration. Also when asked to apply, audit, or clean up the code standards of a file or module.

Code Standards

Code Standards governs how code is expressed — clarity, simplicity, safety, and maintainability — not which architectural pattern should exist. Use the applicable domain or pattern guidance to determine the design; use these standards to implement that design clearly and safely.

Load and apply this discipline before generating a change, then check the result against it as well as the behavioral checks before calling the change done. Ordinary coding includes coherent local improvement and verification, not an automatic multi-reviewer audit. For an explicitly requested review, use `code-review` to organize the examination; this skill remains the owner of the quality criteria.

Iron Law

Write code so that its behavior, responsibility, and intent can be understood from the implementation itself. Prefer code that explains itself over explanations surrounding unclear code.

Mental Model

A good implementation lets another engineer — or another agent — determine what assumptions it relies on and where to look when behavior must change. Clarity reduces the amount of inference required to safely modify the system.

Rules

1. Make responsibility visible

Before adding code, identify the responsibility being implemented and the existing pattern it belongs to; names, boundaries, and structure should reveal that responsibility. Follow the local pattern when one exists — it settles the form of what you write, never whether it was warranted, and matching what surrounds you is no evidence that what surrounds you earned its place. A new abstraction or pattern should exist because the problem requires it, not because the current implementation can be made more elaborate.

2. Prefer the simplest complete implementation

Implement the behavior required by the current problem. Additional abstractions, configuration, indirection, branches, or extensibility added for hypothetical future cases increase the number of assumptions a reader must understand and the number of places a future change can fail. Safety comes from making current assumptions and boundaries explicit, not from anticipating every possible implementation.

3. Make behavior explicit

Important behavior should be visible in code rather than hidden behind unexpected side effects, implicit state, or unrelated abstractions. Inputs, transformations, state changes, and failure paths should be traceable from the implementation.

4. Keep changes local

A change should touch the smallest coherent surface that correctly implements the behavior; a small blast radius makes it easier to reason about, verify, and revert. Include coupled declarations, callers, schemas, and tests when they must change together to preserve an invariant; the smallest diff is not necessarily coherent. Identify those dependencies before editing and verify the relationship afterwards.

A normal modification is not permission to restructure its neighbors. Reassess the touched file without treating existing debt as approved; fix within the agreed coherent surface and report unrelated debt separately. If correctness requires a wider scope, explain the dependency and obtain agreement before expanding. An explicit review examines its declared scope without editing; a transformation or refactor beyond the modification requires a separate assignment.

5. Protect boundaries

Treat external input, configuration, network responses, persisted data, and other trust boundaries explicitly. Validate where data enters a trusted part of the system rather than spreading defensive assumptions throughout the implementation. Sensitive values should not become source code, logs, error messages, or other persistent output.

6. A comment is the exception, not the default

Default to no comment. Each one is optional and justified on its own: it earns its line only by carrying a fact the code cannot state — why a non-obvious decision exists, an invariant that must hold, an external constraint, a compatibility requirement, a surprising consequence of changing the code. A comment that narrates the implementation carries no such fact and leaves a second description to drift from the first. One comment is not optional: the contract the caller reads, description or docstring, one sentence saying what the unit promises.

Size a comment to its facts, never to the size of what it heads: one fact rarely needs more than about two lines, and four chained facts are four entries in a dry list of about a line each. Neither figure is a count to satisfy — padding one fact to two lines and truncating a real chain to look short fail the same way.

When a file changes or is explicitly reviewed, reassess every comment in that file: each one must earn its line again, warrant correction, or warrant removal. Apply corrections only within the authorized modification; a read-only review reports them, and unrelated cleanup remains declared debt rather than a silent scope increase. Existing volume is not precedent — every comment already in the file faces the same justification as one written today. A pass that leaves a commented file carrying as much comment as it found owes an account of why each line survived, whatever route it took to get there.

No comment-density ratio proves quality. Zero is valid where code carries the facts; necessary knowledge must survive where it does not. A 5–10% band is only a proposal for experimentation, not a quota, cap, gate, or chosen threshold. Keep interface contracts, licenses, and tool directives distinct from explanatory comments; do not delete their obligations to improve a count.

7. Comments are context, not evidence

When reading existing code, use comments as navigation and his

Read more
Ships withmetraton-gaia

Generative AI Architecture

Get the whole plugin

Other skills on metraton-gaia.