agentleFS
SaehwanParkSaehwanPark/agent-skills-archive/skills/code-commenter/SKILL.md

code-commenter

Skill1 starsChanged 5 months agoMITView on GitHub

Use when adding, revising, or reviewing code comments and documentation so maintainers understand non-obvious rationale, domain rules, invariants, constraints, and public contracts without restating code mechanics.

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

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    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:

    Put durable public behavior in the appropriate docstring or API documentation.

    line 23
  2. Distinctive:

    Add the smallest comment that explains the non-obvious fact.

    line 24
  3. Distinctive:

    Remove or revise comments that restate mechanics, preserve dead code, speculate, or no longer match the implementation.

    line 25
  4. Distinctive:

    Read comment patterns and examples when deciding whether a comment is warranted.

    line 29
  5. Distinctive:

    Keep comments adjacent to the smallest stable unit they describe.

    line 37
  6. Distinctive:

    Document inputs, outputs, errors, side effects, ownership, or safety for public or non-obvious interfaces.

    line 41
  7. Very specific:

    Use TODO or FIXME only for concrete, actionable work.

    line 43
  8. Distinctive:

    Delete commented-out code.

    line 45
  9. Distinctive:

    Follow the project's documentation tooling and style.

    line 46
  10. Distinctive:

    Stop and report when:

    line 50
  11. Distinctive:

    No stale, redundant, speculative, or commented-out code remains in the touched scope.

    line 64

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

Code Commenter

Make comments preserve information that clear code cannot express on its own.

Required context

Inspect the relevant implementation, callers, tests, public contracts, repository conventions, and existing comments. Pair this skill with the active implementation or review workflow; do not use comments to compensate for unnecessarily obscure code.

Decision workflow

  1. Simplify confusing code first when that can make the behavior obvious without changing its contract.
  2. Identify knowledge that would otherwise be lost: rationale, domain meaning, invariant, ordering requirement, compatibility constraint, safety condition, or deliberate tradeoff.
  3. Put durable public behavior in the appropriate docstring or API documentation.
  4. Add the smallest comment that explains the non-obvious fact.
  5. Remove or revise comments that restate mechanics, preserve dead code, speculate, or no longer match the implementation.
  6. Validate every changed comment against code and tests.

Read comment patterns and examples when deciding whether a comment is warranted. Read language guidance only for the language being changed.

Commenting rules

  • Explain why a choice exists, what invariant it protects, or which external rule governs it; do not narrate syntax or control flow.
  • Keep comments adjacent to the smallest stable unit they describe.
  • Describe current truth. Put chronology in version control or a design record.
  • Reference an ADR, issue, standard, or specification when it is the durable source of truth.
  • Document inputs, outputs, errors, side effects, ownership, or safety for public or non-obvious interfaces; skip boilerplate for self-evident private helpers.
  • Use TODO or FIXME only for concrete, actionable work. Include an issue identifier when the project uses one.
  • Delete commented-out code; version control already preserves it.
  • Follow the project's documentation tooling and style.

Stop conditions

Stop and report when:

  • The intended behavior is unclear enough that a truthful comment cannot be written.
  • A comment would conceal a correctness issue or substitute for a necessary refactor.
  • The requested wording conflicts with the implementation or public contract.
  • A domain or safety claim lacks a reliable source.

Validation

Before finalizing, verify:

  • Each new comment adds rationale, context, or a contract not obvious from the code.
  • Comments still hold for failure paths and edge cases.
  • Public documentation matches the actual signature and behavior.
  • No stale, redundant, speculative, or commented-out code remains in the touched scope.

Report which comments or docs changed and any uncertainty that prevented a safe update.

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.