code-comments
Skill9 starsChanged 5 months agoApache-2.0View on GitHub
Adds high-signal code comments and docstrings that explain WHY (intent, invariants, gotchas) rather than restating WHAT, in the language's idiomatic doc format (JSDoc/TSDoc, Google/NumPy Python docstrings, rustdoc, godoc) — without over-commenting.
17 other projects use a version of this.
Adopted by
Most recently taken up by
- ton-anywhere/my-favorite-promptstheir own version, first seen Sep 26, 2026
- cilinmengye/personal-agent-skillstheir own version, first seen Sep 24, 2026
- rokokol/code-comments-skilltheir own version, first seen Sep 23, 2026
- swaroopsm/skillstheir own version, first seen Sep 17, 2026
- overmind-core/overmindtheir own version, first seen Sep 15, 2026
- alumpe/skillstheir own version, first seen Sep 11, 2026
Other versions17 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 17
- overmind-core/overmind★ 376same name
- petekp/claude-code-setup★ 47same name
- keitakn/engineering-skills★ 14same name
- caidanw/skills★ 9same name
- ARTPARK-SAHAI-ORG/calibrate-backend★ 4same name
- karlhorky/agent-skills★ 4same name
- ton-anywhere/my-favorite-prompts★ 4same name
- luabagg/agent-skills★ 3same name
- bmsuisse/skills★ 2same name
- piyushzala158/agent-skills★ 2same name
7 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository147 other files it gives its agents.
- second-brain/AGENTS.mdAGENTS.md
- second-brain/CLAUDE.mdCLAUDE.md
- agent-tool-mcp-builderSkill
- api-design-reviewSkill
- async-concurrency-correctnessSkill
- audit-accessibility-wcagSkill
- audit-license-complianceSkill
- audit-technical-seoSkill
- auth-jwt-sessionSkill
- author-codemodSkill
- brainstorm-designSkill
- build-audit-loggingSkill
- build-cdc-streaming-pipelineSkill
- build-cli-toolSkill
- build-data-tableSkill
- build-etl-pipelineSkill
- build-form-validationSkill
- build-native-mobile-uiSkill
- build-office-docsSkill
- build-offline-first-syncSkill
- build-react-componentSkill
- build-realtime-channelSkill
- build-spreadsheetSkill
- build-vector-searchSkill
- caching-strategySkill
- cicd-pipeline-authorSkill
- cloud-cost-optimizeSkill
- code-reviewSkill
- compose-local-dev-stackSkill
- configure-bundler-buildSkill
- configure-dns-tlsSkill
- configure-reverse-proxy-lbSkill
- configure-security-headers-cspSkill
- contract-testingSkill
- datetime-timezone-correctnessSkill
- db-migration-safetySkill
- debug-ci-pipeline-failureSkill
- debug-flaky-testsSkill
- debug-frontend-browserSkill
- debug-root-causeSkill
- defend-llm-prompt-injectionSkill
- deliver-webhooksSkill
- dependency-upgradeSkill
- deploy-releaseSkill
- design-api-paginationSkill
- design-authorization-modelSkill
- design-backup-dr-recoverySkill
- design-event-sourcing-cqrsSkill
- design-multi-tenancySkill
- design-protobuf-grpc-serviceSkill
- design-relational-schemaSkill
- design-search-index-infraSkill
- design-state-machineSkill
- design-token-systemSkill
- diff-table-paritySkill
- distributed-locks-leasesSkill
- dockerfile-optimizeSkill
- encrypt-sensitive-dataSkill
- error-messageSkill
- estimate-workSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 3 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 15 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
NOT for prose docs (README/guides/API pages) — that's write-docs.
- Distinctive: line 13
NOT a refactor — if logic looks wrong, flag it separately.
- Distinctive: line 17
Read the full unit first: Read the whole function/module before writing a single comment.
- Distinctive: line 21
Write the docstring in the language's idiomatic format: Use the existing convention in the file/repo if one is present (match it).
- Very specific: line 50
Doctests pass: if you added any runnable examples (pytest --doctest-modules, cargo test --doc).
“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.
Files
When to Use
- User says "comment this", "add docstrings", "document this function/module/class", or "explain this tricky block".
- Prepping code for handoff or review where intent isn't obvious.
- Legacy code with zero comments where you must infer and record WHY.
- NOT for prose docs (README/guides/API pages) — that's
write-docs. - NOT a refactor — if logic looks wrong, flag it separately; this skill changes comments only.
Steps
- Read the full unit first. Read the whole function/module before writing a single comment. Trace data flow, error paths, and callers (grep for usages) so you comment real intent, not a guess. If intent is genuinely unrecoverable, write
// FIXME: intent unclear — <specific question>instead of inventing a rationale. - Mark only the non-obvious. Tag lines/blocks where WHY ≠ WHAT: magic numbers, off-by-one guards, ret/ timeout / backoff constants, workarounds for upstream bugs, ordering that looks swappable but isn't, perf hacks, locking/concurrency assumptions, security checks. Skip anything a competent reader infers from the code itself.
- Write the docstring in the language's idiomatic format. Use the existing convention in the file/repo if one is present (match it). Otherwise default to:
- TS/JS → TSDoc/JSDoc: one-line summary, then
@param,@returns,@throws. Omit@paramtypes in TS (the type is in the signature) — describe meaning/constraints/units instead. - Python → match repo (Google or NumPy). Sections: summary,
Args:/Parameters,Returns:,Raises:. AddExamples:(doctest-style) only for non-trivial contracts. - Rust → rustdoc
///: summary,# Arguments(when non-obvious),# Errors,# Panics,# Safetyforunsafe.# Examplesshould be compilable. - Go → godoc: comment starts with the identifier name (
// Foo does ...), full sentences, period-terminated.
- TS/JS → TSDoc/JSDoc: one-line summary, then
- Put the signal in the docstring, not the body. Document: units (ms vs s, bytes vs KB), valid ranges, nullability, ownership/lifetime, side effects, thread-safety, idempotency, and what each error/exception actually means for the caller. These are the things callers can't see from the signature.
- Inline comments only for surprising WHY. One line, above the code (not trailing, unless very short). Good:
// Retry 3x — upstream returns 503 on cold start. Bad:// loop over items. Prefer# TODO(context)/# HACK:/# SAFETY:tags so they're greppable. - Delete redundant and stale comments you encounter. While editing, remove comments that restate code, are commented-out dead code, or contradict current behavior (stale comments are worse than none). Don't expand scope hunting the whole repo — just clean what's in your editing path.
- Keep the diff comment-only. Zero logic, formatting, or whitespace changes beyond the comments themselves. The diff must be reviewable as "comments added/removed" and nothing else.
Common Errors
- Restating WHAT.
i++ // increment i,return user // return the user. If the comment is the code in English, delete it. - Inventing rationale. Writing a confident "why" you didn't verify. If you can't confirm intent from code + callers, say so (
FIXME: intent unclear) — a wrong comment is a future bug. - Over-commenting. Docstring on every trivial getter/setter, comment on every line. Noise drowns the 3 comments that matter. Comment the surprising, skip the obvious.
- Wrong format / mixing conventions. JSDoc in a Python file, NumPy sections in a Google-style repo,
/** */in Go. Match the file's existing style; if none, use the language default above. - Duplicating types in TS JSDoc.
@param {string} namewhen the signature already saysname: string— drift risk when the type changes. Describe meaning, not type. - Touching logic. "Improving" a line while commenting it. Any behavior change voids the comment-only contract — stop and split it out.
- Stale-comment blindness. Adding new docstrings while leaving an old comment that now lies. Reconcile or delete the old one.
- Commenting the wrong layer. Explaining a workaround in the body when the caller needs it — put caller-facing contracts (raises, side effects, units) in the docstring where callers actually read them.
Verify
- Diff is comment-only —
git diffshows only added/removed comment lines and docstrings; no logic, no reordering, no reformatting. If logic changed, revert it. - Still compiles / lints — run the build or doc-comment linter (e.g.
tsc --noEmit,ruff/pydocstyle,cargo doc,go vet). Malformed docstrings (bad@param, broken rustdoc# Examples) must pass. - Doctests pass if you added any runnable examples (
pytest --doctest-modules,cargo test --doc). - WHY-not-WHAT scan — reread each added comment: does it tell the reader something the code doesn't already say? Delete any that fail.
- No invented facts — every "because/to avoid/upstream bug" is traceable to the code or an explicit
FIXME, not a guess.
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
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.

