What it does
Code Documentor reads your source files and generates documentation that matches both the language idioms and your project's existing documentation style. For TypeScript and JavaScript it produces JSDoc block comments with @param, @returns, @throws, and @example tags. For Python it writes Google-style or NumPy-style docstrings. For any language it can produce a standalone Markdown API reference page. The skill reads surrounding code to understand what a function actually does — not just what its parameter names suggest — producing descriptions that would satisfy a thorough code reviewer.
Type inference is a key differentiator: even in JavaScript without type annotations, the skill examines how values are used, what methods are called on them, and what shapes are passed in from call sites to produce accurate @param {string} or @param {Object} options annotations. For Python it generates type hints compatible with mypy in addition to the docstring text.
How to install
npx skills add user/code-documentor
How to use
Target a single function, a file, or an entire module:
# Document a specific function Document the validatePayload function in src/api/validate.ts # Document all exported functions in a file Add JSDoc to all exports in src/utils/format.js # Generate a Markdown API reference Generate a Markdown API reference for the src/sdk/ directory
Example output for a TypeScript function:
/** * Validates and normalises an incoming webhook payload. * * Checks the HMAC signature against the secret stored in * `process.env.WEBHOOK_SECRET`, then coerces the `timestamp` * field to a JavaScript Date object. * * @param {Object} raw - The raw request body as parsed JSON. * @param {string} signature - The X-Hub-Signature-256 header value. * @returns {{ valid: boolean; payload: WebhookPayload | null }} * @throws {SignatureError} If the HMAC does not match. * @example * const { valid, payload } = validatePayload(req.body, req.headers['x-hub-signature-256']); */ function validatePayload(raw, signature) { ...
Configuration
Control output style with inline options:
# Force a specific docstring style Document src/models.py using NumPy-style docstrings # Include usage examples Document src/auth.ts, include @example for every function # Skip private members Document src/api.ts, public exports only
Tip: Run Code Documentor on newly merged PRs as a post-merge step. Pair it with a linter rule that enforces JSDoc presence (such as eslint-plugin-jsdoc) to keep documentation coverage from drifting below 100%.
Related skills
Use PR Review Assistant to catch undocumented functions during code review before they reach main. Pair with API Designer when starting a new module — design the interface first, then use Code Documentor to document the implementation once it is written.