agentleFS
vadimvitvickiyvadimvitvickiy/vv-agent-kit/skills/writing-comments/SKILL.md

writing-comments

Skill0 starsChanged 50 days agoMITView on GitHub

Use when writing or reviewing comments and doc comments, or when a diff adds explanatory prose alongside code.

3 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

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

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never overwrite an existing doc comment: Add where missing; reconcile only when the contract changed.

    line 50
  2. Distinctive:

    Every multi-line comment block you just added:

    line 55

“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

Writing comments

The default is no comment. Names and structure carry the meaning; a comment is for what they provably cannot. Where the project has a convention, follow the project.

The one test

  • A comment answers why, and the why is not obvious from the code beside it.
  • Describes what the code does: delete it. Recoverable from the next three lines: delete it.
  • Code that needs a comment to be followed needs a better name or a smaller function instead.

Limits

KindLimit
Line comment1 line
Member doc comment (function, property, case)1 line. A second only for a genuinely subtle exception
Type-level doc comment (class, struct, enum, protocol, module)Several lines, to orient a reader about the whole type

Over the limit means cut, not reflow — the second sentence usually restates the first.

Never

  • Narrate — "loop over the items", "set the title", "returns nil when empty".
  • Restate the signature — a parameter doc repeating the name and type.
  • Decorative dividers. A structured section marker the language supports is fine.
  • Migration history — "moved from X", "new in the refactor". Git knows.
  • Ticket ids. In public API docs they leak an internal tracker.
  • Commentary on the change. Describe the code as it stands, not how it got there.

When a doc comment is warranted

DeclarationDoc comment
Public or exportedYes — it is the contract, and exempt from the member limit where the contract needs the words
Internal helper with a non-obvious exceptionYes — one line naming the exception
Internal helper self-evident from its nameNo
Override or conformance with no added behaviorNo
A constant whose value encodes a decisionYes — why this value

Existing comments

  • Never delete an existing comment or TODO unless asked. These rules govern what you write, not what you remove.
  • Never overwrite an existing doc comment. Add where missing; reconcile only when the contract changed.

Self-check

Every multi-line comment block you just added:

git diff -U0 | awk '/^\+ *(\/\/|#|--)/{n++; if (n>1) print; next} {n=0}'

Empty output, or only type-level overviews, passes. Anything else is over the limit until you can name why that block earns a second line.

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.