annotate

A workflow for adding inline explanations to code, including JSDoc, docstrings, and comments. It covers public functions, complex logic, parameters, return values, and errors.

In plain words
What is it for?
Use it to document JavaScript, TypeScript, Python, Go, or Rust files, then check that the added documentation does not break the project.
Why use it?
It makes under-documented code easier to understand and maintain without changing what the code does.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/rohitg00/awesome-claude-code-toolkit/annotate
Clone the repo
git clone --depth 1 https://github.com/rohitg00/awesome-claude-code-toolkit
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 392 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00392
Opus 5 $0.00000 $0.00196
Sonnet 5 $0.00000 $0.00078
Haiku 4.5 $0.00000 $0.00039

Measured 2d ago against content hash 7e74e318ef7e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

annotate scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/code-explainer/commands/annotate.md · 47 lines

What it actually says

Add inline documentation (JSDoc, docstrings, comments) to under-documented code.

Steps

  1. Read the target file and assess current documentation level.
  2. Identify what needs documentation:
    • Public functions and methods lacking doc comments.
    • Complex logic blocks without explanatory comments.
    • Non-obvious parameter types or return values.
    • Module-level overview missing.
  3. Generate documentation in the appropriate format:
    • TypeScript/JavaScript: JSDoc with @param, @returns, @throws, @example.
    • Python: Google-style or NumPy-style docstrings.
    • Go: Godoc comments above exported functions.
    • Rust: /// doc comments with examples.
  4. For each function, document:
    • What it does (one-sentence summary).
    • Parameters with types and descriptions.
    • Return value description.
    • Thrown exceptions or error conditions.
    • Usage example for complex functions.
  5. Add a module-level doc comment explaining the file's purpose.
  6. Verify the documentation does not break the build or linter.

Format

/**
 * Creates a new user account with the given credentials.
 *
 * @param email - The user's email address (must be unique)
 * @param password - Plain text password (will be hashed)
 * @returns The created user object with generated ID
 * @throws {ConflictError} If a user with this email already exists
 * @example
 * const user = await createUser("[email protected]", "securePass123");
 */

Rules

  • Document intent and contracts, not implementation details.
  • Every public function must have at minimum a summary and parameter descriptions.
  • Do not add comments that merely restate the code.
  • Use the project's existing documentation style if one is established.
  • Include @example for functions with non-obvious usage patterns.
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 47 lines · 0 tokens per session scan A 7e74e318ef7e

Subscribe to this mod's changes

annotate is a command published in the GitHub repository rohitg00/awesome-claude-code-toolkit (2,578 stars, last pushed 3mo ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 392 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.