agentleFS
robo311robo311/devflow/skills/code-rules/SKILL.md

code-rules

Skill1 starsChanged 24 days agoMITView on GitHub

General rules for writing production code in any project: conventions, reuse, structure, comments, scope, errors, tests. Use when implementing or changing code, and when judging whether written code follows them.

4 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions4 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 4

    1. claude-office-skills/claude-office-plugin★ 9same name
    2. zedarvates/frugal-skills★ 1same name
    3. FrankieeW/agent-skills★ 0same name
    4. LNSD/lorecraft★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository8 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

11 rules. 0 are common, 10 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 10

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When sources disagree, the higher one wins:

    line 10
  2. Distinctive:

    When you see a better way than the project's, build it the project's way and put the alternative in your report as a suggestion, with what …

    line 25
  3. Distinctive:

    Write new code the way the surrounding code is written: naming, file layout, syntax, error handling, test style.

    line 30
  4. Distinctive:

    Use the project's formatter and linter settings.

    line 32
  5. Distinctive:

    Search before writing: an existing helper, component, service, query or type that does the job is used or extended, not duplicated.

    line 36
  6. Distinctive:

    When you extend something shared, check its other callers still work.

    line 37
  7. Distinctive:

    Write the simplest code that meets the acceptance criteria: clear names, early returns, no flags or options nobody asked for.

    line 47
  8. Very specific:

    Leave no dead code, commented-out code or debug output (console.log, dd(), var_dump, print).

    line 48
  9. Distinctive:

    Add a dependency only when the plan includes it.

    line 49
  10. Distinctive:

    Leave version control to the developer: no commits, branches, stashes or pushes.

    line 61
  11. Distinctive:

    Test behaviour through the public interface, derived from the acceptance criteria.

    line 70

“Common” is measured: kept by at least 6 in 10 of the 3 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

Code rules

Priority

When sources disagree, the higher one wins:

  1. What the developer said for this task, and the approved plan.
  2. The project's written rules: CLAUDE.md, AGENTS.md, docs/, ADRs, REVIEW.md.
  3. The project's existing code: its architecture, conventions and syntax.
  4. These rules and the fe-rules / be-rules that add to them.
  5. The best practices of the language and framework in use.

Applying the rules

Apply a rule where its subject exists in the task; the rest do not apply.

Architecture

  • Build inside the project's architecture: its layers, module boundaries, patterns and data flow. A new feature looks like the features already there.
  • When you see a better way than the project's, build it the project's way and put the alternative in your report as a suggestion, with what it would buy.
  • In a new project, the architecture comes from the approved plan.

Conventions

  • Write new code the way the surrounding code is written: naming, file layout, syntax, error handling, test style. Before writing a new kind of file, read two or three existing files that do the same job and match them.
  • Where the project is silent, follow the idioms and best practices of the language and framework (their standard library, error handling and type conventions).
  • Use the project's formatter and linter settings; leave formatting of lines you did not change as it is.

Reuse

  • Search before writing: an existing helper, component, service, query or type that does the job is used or extended, not duplicated.
  • When you extend something shared, check its other callers still work.

Structure

  • Split by responsibility, not by length: one unit does one job. Split a unit when it does two jobs; keep it whole when it does one, even if it is long.
  • A reader understands a unit without jumping through more than a couple of files. Thin wrappers and one-line indirections that add a file without adding meaning are folded back in.
  • An abstraction earns its place with a second real use or a clearly separate responsibility, never "for later".

Simplicity

  • Write the simplest code that meets the acceptance criteria: clear names, early returns, no flags or options nobody asked for.
  • Leave no dead code, commented-out code or debug output (console.log, dd(), var_dump, print).
  • Add a dependency only when the plan includes it.

Comments

  • Comment the why that the code cannot say: a constraint, a workaround and its reason, an invariant, a non-obvious consequence. One or two lines.
  • Let names and structure say what the code does; a comment that narrates the code is deleted.
  • Changes and their history belong to version control, not to comments.

Scope

  • Change what the plan or the task asks for, and what that change requires (a caller that must follow a new signature, a spec that must match a new response).
  • Anything outside that scope you think should change (a bug you noticed, a cleanup, a better structure) goes to your report as a suggestion with its reason. It is never changed without the developer's approval.
  • Leave version control to the developer: no commits, branches, stashes or pushes.

Errors

  • Validate and handle errors at system boundaries: user input, requests, files, network, external services. Trust internal code and framework guarantees.
  • Fail loudly with context; an error is never swallowed or turned into a silent default.

Tests

  • Test behaviour through the public interface, derived from the acceptance criteria. Follow the project's test conventions and location.
  • A new test fails before the change and passes after it; run it red first when the change makes that feasible.
  • Mock only at boundaries the project already mocks (network, time, external services), never the unit under test.

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.