docstring-generator

docstring-generator is a skill for Claude Code, Codex from espennilsen/pi. It costs 118 tokens per session (1,514 once invoked), scanned A, original, MIT.

A documentation tool for adding language-appropriate comments to TypeScript and Rust source code. It supports TSDoc or JSDoc for TypeScript and Rustdoc for Rust, including public functions, classes, types, and other exported code.

In plain words
What is it for?
Use it to document exported APIs, classes, methods, interfaces, types, enums, and other public declarations in TypeScript or Rust files.
Why use it?
It makes public code easier to understand and keeps documentation close to the declarations it describes. It can add missing comments or update existing ones according to the selected scope.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to document exported APIs, classes, methods, interfaces, types, enums, and other public declarations in TypeScript or Rust files.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/espennilsen/pi/docstring-generator
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.

Any agent
npx skills add espennilsen/pi --skill docstring-generator
Clone the repo
git clone --depth 1 https://github.com/espennilsen/pi

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for docstring-generator

README.md
[![agentmods](https://agentmods.dev/badge/skills/espennilsen/pi/docstring-generator/github.svg)](https://agentmods.dev/skills/espennilsen/pi/docstring-generator)
Your own site
<a href="https://agentmods.dev/skills/espennilsen/pi/docstring-generator"><img src="https://agentmods.dev/badge/skills/espennilsen/pi/docstring-generator/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for docstring-generator

Your own site · 80×15
<a href="https://agentmods.dev/skills/espennilsen/pi/docstring-generator"><img src="https://agentmods.dev/badge/skills/espennilsen/pi/docstring-generator.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 118 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,514 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00118 $0.01514
Opus 5.5 $0.00047 $0.00606
Sonnet 5.5 $0.00024 $0.00303
Haiku 4.5 $0.00012 $0.00151

Measured 1mo ago against content hash 02427e549140, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

docstring-generator 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 1mo 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.

skills/docstring-generator/SKILL.md · 176 lines

How it starts

The opening of the file, as written. The whole thing — 176 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Docstring Generator

Generates or updates doc comments for TypeScript and Rust source files. The skill analyzes the public API surface (functions, methods, classes/structs, traits/interfaces, enums) and produces language-idiomatic documentation.

Inputs

Input Type Required Description
language string yes "typescript" or "rust"
file_path string yes Path of the file being edited
full_text string yes Entire contents of the file
selection_range object no { start_line, end_line } (1-based, inclusive)
mode string no "update_missing" (default) or "update_all"
public_only boolean no If true (default), only document exported/public items

Workflow

Step 1: Parse declarations

Mentally parse full_text to find all declarations relevant to the language, public_only, and selection_range settings.

TypeScript declarations to document:

  • Exported functions, async functions, and generators
  • Exported classes and their public/protected methods
  • Exported interfaces and type aliases
  • Exported enums
  • Exported const/let/var at module level (when they hold complex types)

Rust declarations to document:

  • pub fn (free functions and methods)
  • pub struct and its pub fields
  • pub enum and its variants
  • pub trait and its method signatures
  • pub type and pub const items
  • pub mod (public modules)

Step 2: Generate doc comments

For each target declaration, follow the language-specific rules below.

Step 3: Merge into file

Insert or update the doc comment immediately before the declaration, preserving all existing formatting, indentation, and code. Return the full updated_text with only doc comment lines changed.

Behavior & Style Rules

General Rules (all languages)

  • Preserve everything: Do not change code semantics, identifiers, formatting, or indentation. Only touch doc comment lines.
  • No speculation: If unsure about behavior, write neutral high-level descriptions instead of guessing.
  • Present tense, concise: Describe what the item does, not what it is. Avoid restating obvious type information unless it aids clarity.
  • Idempotent: Running the skill twice on the same file should produce the same result.
  • Respect developer notes: In update_all mode, preserve explicit warnings, safety notes, panic documentation, and custom annotations.

Read the full file on GitHub · 176 lines

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. 1mo ago First seen · 176 lines · 118 tokens per session scan A 02427e549140

Subscribe to this mod's changes

docstring-generator is a skill published in the GitHub repository espennilsen/pi (122 stars, last pushed 9d ago), licensed MIT. It adds 118 tokens to every session and 1,514 once invoked, about $0.0005 per session on Opus 5.5. 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.

Related

Other skills, from other repositories

ax-rust-signature

Use when writing Rust code with axllm for string signatures, field descriptors, JSON schema output, validation, and typed tool argument shapes.

ax-llm/ax · 36 tokens

dd-code-generation

Use pup CLI for immediate Datadog operations or generate code for integration into applications.

DataDog/pup · 16 tokens

ax-rust-llm

Use when writing Rust code with axllm for using the generated Ax package, factory functions, package docs, examples, and API reference.

ax-llm/ax · 37 tokens

solana-toolkit-guide

Guide to the Solana Wallet Toolkit — vanity address generation with multi-threaded search, official Solana Labs libraries, Rust and TypeScript implementations. Includes wallet generation, custom address prefixes, and OG names on the blockchain.

nirholas/three.ws · 50 tokens

solana

Use when working on Solana software, including one or more of: Solana client code using TypeScript, Rust libraries that use Solana crates, Anchor programs, Quasar programs, LiteSVM tests, including Rust program files, TypeScript tests, and Anchor.toml or Quasar.toml configuration. Designed to create minimal, reusable…

quicknode/solana-finance-claude-plugin · 76 tokens

architecture-audit

Systematic architecture audit and refactoring methodology for Rust + TypeScript codebases. Use when performing refactoring, cleanup, unification, code review, dead code removal, module reorganization, or tech debt elimination. Ensures no naming confusion, semantic overloading, hidden defaults, duplicate logic, or…

org2AI/ORG2 · 70 tokens