agentleFS
DobroslavRadosavljevicDobroslavRadosavljevic/cabrakan/.agents/skills/jsdoc/SKILL.md

jsdoc

Skill1 starsChanged 3 months agoMITView on GitHub

Enforces purposeful JSDoc on complex or non-obvious TypeScript code—algorithms, invariants, side effects, edge cases, and public contracts—without restating types or narrating simple code. Use when writing or reviewing TypeScript, adding documentation comments, cleaning noisy JSDoc, documenting public APIs, or when the user says jsdoc, JSDoc, document this, or add docs comments.

6 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use humanizer.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Microsoft AzureSkill

    humanizer

    Tone enforcement patterns for external-facing community responses

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

12 rules. 0 are common, 9 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 9

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Add JSDoc only where a careful reader cannot infer intent, constraints, or failure modes from names and types alone.

    line 8
  2. Distinctive:

    Document a symbol when any of these are true:

    line 12
  3. Distinctive:

    Default: no comment. Silence is better than noise.

    line 32
  4. Very specific:

    Types carry the shape: Do not duplicate types in JSDoc (@param {string} id) when the signature already has id: string.

    line 36
  5. Distinctive:

    JSDoc carries meaning: Use prose + selective tags for behavior types cannot express.

    line 37
  6. Very specific:

    Prefer @param name / @returns descriptions without type braces when documenting TS.

    line 38
  7. Distinctive:

    Keep the first sentence a summary of behavior or purpose, not a restatement of the symbol name.

    line 39
  8. Very specific:

    Document non-obvious generics with a short note on what T represents and any constraints beyond the type bound.

    line 40
  9. Distinctive:

    Every JSDoc block you add must include:

    line 46
  10. Distinctive:

    Add tags only when they earn their keep:

    line 51
  11. Distinctive:

    Do not invent tags the project never uses.

    line 63
  12. Distinctive:

    When asked to document a scope, report briefly:

    line 94

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

JSDoc

Add JSDoc only where a careful reader cannot infer intent, constraints, or failure modes from names and types alone. Prefer TypeScript types for shape; use JSDoc for why, when, and what breaks.

When to Document

Document a symbol when any of these are true:

  • Control flow, algorithm, or state machine is non-obvious on first look.
  • Behavior depends on invariants, ordering, timing, idempotency, or concurrency.
  • Side effects matter (I/O, mutation, cache, network, timers, global state).
  • Failure modes, throws, empty results, or partial success are part of the contract.
  • Units, ranges, formats, or domain meanings are not clear from the type.
  • Public / exported API that callers will use without reading the implementation.
  • Deprecation, migration, security, or compatibility constraints apply.

When Not to Document

Skip JSDoc when:

  • The name + TypeScript types already explain the symbol.
  • The body is a trivial getter, setter, passthrough, or one-liner map/filter.
  • The comment would only restate the parameter or return type.
  • The comment narrates what the next line does (// increment i).
  • Generated code, tests that are self-describing fixtures, or vendored files (unless documenting a public test helper).

Default: no comment. Silence is better than noise.

TypeScript Rules

  1. Types carry the shape. Do not duplicate types in JSDoc (@param {string} id) when the signature already has id: string.
  2. JSDoc carries meaning. Use prose + selective tags for behavior types cannot express.
  3. Prefer @param name / @returns descriptions without type braces when documenting TS.
  4. Keep the first sentence a summary of behavior or purpose, not a restatement of the symbol name.
  5. Document non-obvious generics with a short note on what T represents and any constraints beyond the type bound.
  6. For overloads, document each distinct call pattern; put shared caveats on the implementation or the primary export.
  7. Match existing project JSDoc style (tag set, punctuation, @returns vs @return) when one is already dominant.

Required Content for Documented Symbols

Every JSDoc block you add must include:

  1. Summary — one sentence: what it does or why it exists (not “This function…” fluff).
  2. Non-obvious details — only what a reader would miss: invariants, ordering, side effects, edge cases, units, security.

Add tags only when they earn their keep:

TagUse when
@paramParam semantics, units, valid ranges, or “must be…” constraints beyond the type
@returnsMeaning of the value, empty/sentinel cases, or “never returns” style contracts
@throwsDocumented error conditions callers should handle
@exampleNon-trivial usage that types alone do not teach (keep short; one example usually enough)
@seeRelated symbol, RFC, ticket, or algorithm source
@deprecatedReplacement path and removal intent
@templateOnly in JS files or when documenting a generic’s role; prefer TS type params in .ts

Do not invent tags the project never uses. Prefer standard JSDoc/TS-supported tags.

Workflow

  1. Scope — files, symbols, or “public API only” as the user named. If unclear, prefer exported / complex symbols over private helpers.
  2. Scan — find candidates using the “When to Document” list. Skip obvious code.
  3. Audit existing JSDoc — remove or rewrite comments that restate types, lie about behavior, or narrate the obvious.
  4. Write — add concise blocks; prefer editing the symbol in place over separate doc files.
  5. Verify — re-read: would a new teammate understand the hard parts without opening every callee? Types still match the prose?

Quality Bar

Good JSDoc:

  • Explains a constraint or failure mode you cannot see from the signature.
  • Stays accurate if implementation details change under the same contract.
  • Is shorter than the code it documents whenever possible.

Bad JSDoc:

  • @param id - The id
  • @returns {Promise<User>} when the signature already says that
  • Essays that duplicate the function body
  • Outdated comments that contradict the code (delete or fix; never leave lying docs)

Examples

Concrete good/bad patterns: examples.md.

Completion

When asked to document a scope, report briefly:

  • What was documented and why it qualified.
  • What was left undocumented (and that it was intentional).
  • Any JSDoc removed as noise or corrected as wrong.

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.