agentleFS
shinzoxDshinzoxD/knackbox/skills/coding/code-comments/SKILL.md

code-comments

Skill0 starsChanged 5 months agoApache-2.0View on GitHub

Write and improve code comments and docstrings that explain why,

17 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

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

  • 0

    Common

    Most of the 15 edited versions we read keep these.

  • 5

    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:

    Leave stale comments that contradict code

    line 30
  2. Distinctive:

    Update comments in the same change as behavior.

    line 35
  3. Distinctive:

    Prefer short, precise language.

    line 36
  4. Distinctive:

    Do not invent library behavior in comments.

    line 39
  5. Distinctive:

    Deleted code: delete comments with code.

    line 51

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

Comments capture intent, invariants, and non-obvious trade-offs. If the code can be clearer, prefer rename/refactor over a comment that restates the line.

When to comment

  • Why a non-obvious approach was chosen
  • Invariants and concurrency assumptions
  • Workarounds for bugs in dependencies (link issue)
  • Public API docstrings: params, returns, errors, examples
  • Security-sensitive constraints

When not to

  • Restate i += 1 as "increment i"
  • Leave stale comments that contradict code
  • Joke or dead commented-out code blocks without reason

Rules

  1. Update comments in the same change as behavior.
  2. Prefer short, precise language; link specs when long.
  3. Public APIs get complete docstrings; internals only where needed.
  4. Mark TODOs with ticket refs if required by team norms — avoid empty TODOs.
  5. Do not invent library behavior in comments.
  6. For generated code, say so and point to source of generation.

Output format

Provide the commented code or a diff-style patch, plus a one-line rationale for non-obvious comments.

Edge cases

  • Regulated code: traceability comments may be mandatory.
  • Algorithms: complexity and references (paper/RFC).
  • Deleted code: delete comments with code; use VCS history.

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.