agentleFS
StephanMeijerStephanMeijer/skills/skills/coding-guidelines/SKILL.md

coding-guidelines

Skill0 starsChanged 5 days agoMITView on GitHub

Keep code simple and the architecture sound. Prefer the simplest change that works, remove code that has no effect on functionality or stability, parse input at the boundary, fail loudly with errors as values, prefer no test over a flaky test, and enforce style, formatting, and linting in CI. Use when writing, changing, reviewing, or refactoring code in any language, or when asked about coding guidelines, KISS, simplicity, architecture, input parsing, error handling, flaky tests, or linting.

16 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use grill-me.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • GoogleSkill

    grill-me

    A relentless interview to sharpen a plan or design.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 5 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 8 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Write the simplest code that does the job.

    line 13
  2. Distinctive:

    No speculative code: no abstraction, option, or layer until something needs it.

    line 14
  3. Distinctive:

    Never flatten or bypass the architecture to save lines.

    line 24
  4. Distinctive:

    Use what exists first: the codebase's own helpers, then the standard library, then a dependency already installed.

    line 31
  5. Very specific:

    Never cut validation at trust boundaries, error handling that prevents data loss, or security.

    line 32
  6. Distinctive:

    Test behaviour, not implementation.

    line 47
  7. Very specific:

    Write the guidelines down where every contributor finds them, such as CONTRIBUTING.md.

    line 55

“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Coding Guidelines

Simple is good.

Keep It Simple

  • Write the simplest code that does the job. Not the cleverest, not the most general.
  • No speculative code: no abstraction, option, or layer until something needs it.
  • Boring over clever: plain loops, explicit names, nothing a reader has to stop and decode.
  • Fix the root cause once, in the shared code, not with a workaround at every call site.
  • Comments say why, not what. If a comment explains what the code does, rewrite the code.

Architecture Matters

  • Simple code, not simple architecture. Keep the parts small, and keep the structure sound.
  • Respect the layers, boundaries, and patterns the codebase already has, even where you would have done it differently. Put code where it belongs, not where it is quickest to add. To change a pattern, change it everywhere in a separate change, not one file at a time.
  • Dependencies point one way. A lower layer never reaches into a higher one.
  • Never flatten or bypass the architecture to save lines.
  • Pure functions where possible. Keep logic free of side effects such as I/O, time, and randomness, and push those to the edges.

Remove Rather Than Add

  • Removing code beats adding code. Before adding something, check whether removing something solves it.
  • Code that has no effect on functionality or stability goes: dead code, unused options, needless wrappers, defensive checks for cases that cannot happen.
  • Use what exists first: the codebase's own helpers, then the standard library, then a dependency already installed. Only then write new code. Never add a dependency for a few lines.
  • Never cut validation at trust boundaries, error handling that prevents data loss, or security. For authentication, authorization, tokens, sessions, cookies, or proxy trust, follow the security-invariants skill when it is installed.

Parse, Don't Validate

  • Parse untrusted input into a typed value once, at the boundary: requests, files, environment, external APIs. Code past the boundary trusts the type and does not check again.
  • Parse with the validator the repository already uses. For a small shape with no existing validator, write a small explicit parser; add the ecosystem's schema library (Zod in TypeScript, Pydantic in Python, serde in Rust, Ecto changesets in Elixir) only when nested schemas, unions, or error reporting make hand-written parsing less trustworthy.
  • A failed parse is an error value with the reason, not a half-valid object.

Errors

  • Fail loudly. Never swallow an error or silently fall back to a default.
  • Prefer errors as values over exceptions, in the language's idiom: Result (Ok(value) / Err(error)) in Rust, {:ok, value} / {:error, reason} in Elixir, (value, error) in Go. The signature then shows the caller that the call can fail and must be handled. Where the language has no such idiom, use the codebase's existing pattern rather than inventing one.

Tests

  • Test behaviour, not implementation.
  • No test is better than a flaky test. A flaky test signals too much complexity, in the test or in the code it tests. Simplify that first; do not paper over it with retries, sleeps, or longer timeouts. If it cannot be made reliable, delete it.

Style and Tooling

  • Style, formatting, and linting are checked automatically in CI/CD, not by reviewers.
  • The same formatter and linter run locally and in CI, from one configuration in the repository.
  • Fix the code, not the check. Do not disable a lint rule to get a change through.
  • Write the guidelines down where every contributor finds them, such as CONTRIBUTING.md.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.