agentleFS
dublyodublyo/saas-skills/lean-code/SKILL.md

lean-code

Skill14 starsChanged 5 months agoMITView on GitHub

Write the shortest correct code that does exactly what was asked - nothing more. Solve the direct target, reach for stdlib and native features before custom code, one line before fifty, and never cut validation, error handling, security, or accessibility. Use whenever the user wants minimal, direct, no- fluff code, or complains about bloat, boilerplate, over-engineering, or unnecessary dependencies.

9 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 6 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 6

    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:

    Write code like a senior dev who is paid to solve the problem, not to show off.

    line 15
  2. Distinctive:

    Standard library does it?: Use it.

    line 29
  3. Very specific:

    Native platform feature covers it?: Use it (<input type="date"> over a picker lib, CSS over JS, a DB constraint over app code).

    line 30
  4. Distinctive:

    An installed dependency solves it?: Use it. Don't add a new dependency for what a few lines do.

    line 32
  5. Distinctive:

    Only then: write the minimum code that works.

    line 35
  6. Distinctive:

    No abstraction with one caller.

    line 42
  7. Distinctive:

    If the explanation is longer than the code, delete the explanation.

    line 64

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

Lean Code

Write code like a senior dev who is paid to solve the problem, not to show off. The best code is the code you did not have to write. Hit the exact target the user asked for, in the fewest correct lines, and stop.

The target rule

Solve only what was asked. Restate the goal in one sentence, then write the smallest thing that fully meets it. No extra features, options, config, or "while we're here" additions. If you think they need more, ship the direct answer first and ask in one line.

The ladder (stop at the first rung that holds)

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

Two rungs work -> take the higher one and move on. The first solution that works is the right one.

Rules

  • No abstraction with one caller. No interface with one implementation. No config for a value that never changes.
  • Deletion over addition. Boring over clever - clever is what someone debugs at 3am.
  • Fewest files, shortest diff that does the job.
  • Match the surrounding code's style, names, and patterns.
  • Two same-size options -> pick the one that is correct on edge cases. Lazy means less code, not a flimsier algorithm.
  • Mark a deliberate shortcut with a lean: comment naming its ceiling and the upgrade path, e.g. // lean: in-memory only, swap for Redis if multi-process.

Never cut (lazy is not careless)

Input validation at trust boundaries, error handling that prevents data loss, security, accessibility, and anything the user explicitly asked to keep. Code without its check is unfinished: non-trivial logic leaves ONE runnable check behind (a small test or an assert-based self-check). Trivial one-liners need none.

Output

Code first. Then at most three short lines: what you skipped and when to add it. If the explanation is longer than the code, delete the explanation. Give full explanation only when the user explicitly asked for one.

Pattern: [code] -> skipped: [X], add when [Y].

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.