agentleFS
duvi-aiduvi-ai/skills/skills/disciplines/self-explaining-code/SKILL.md

self-explaining-code

Skill2 starsChanged 58 days agoMITView on GitHub

Write code without comments, so names and structure carry the meaning. Use whenever writing or editing source, config, Dockerfiles, CI files, CSS or env examples, and when tempted to add a comment, a JSDoc block or a section banner.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    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:

    No comments in code or config.

    line 8
  2. Distinctive:

    No comments of any kind: No inline comments, no JSDoc or TSDoc, no section banners, no CSS notes, no commented-out code, in any file type.

    line 12
  3. Very specific:

    Tool directives are not comments: Keep eslint-disable, @ts-expect-error, # syntax=docker/dockerfile:1.7, license headers and generated-file …

    line 15
  4. Distinctive:

    In a file that already has comments,: follow the project's lead.

    line 16

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “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

Self-explaining code

No comments in code or config. If something needs explaining, the name, the file placement or the structure should explain it. The reasoning behind a decision goes in the docs or the commit message.

The rules

  • No comments of any kind. No inline comments, no JSDoc or TSDoc, no section banners, no CSS notes, no commented-out code, in any file type.
  • When a comment feels necessary, rename or split instead. That urge is a signal the name is wrong or the function does two things.
  • Rationale goes elsewhere. Explain non-obvious decisions in the commit body, the project's architecture doc, or your reply to the user.
  • Tool directives are not comments. Keep eslint-disable, @ts-expect-error, # syntax=docker/dockerfile:1.7, license headers and generated-file markers. They are instructions to tools, not prose. Ask before removing any that look load-bearing.
  • In a file that already has comments, follow the project's lead. If the project's rule is no comments, strip them from the code you touch.

Why

Comments restate what the code says, and they drift out of sync with it because nothing checks them. A comment that was true when written and false six months later is worse than none. Code read without comments is code whose names had to be good.

Example

A comment explaining a condition:

// owners and admins can see billing
if (user.role === 'owner' || user.role === 'admin') {

The same thing, explained by a name:

const canViewBilling = (user) => user.capabilities.includes('billing:read');

if (canViewBilling(user)) {

The second version needs no comment, and it also stopped checking role names directly.

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.