DevTools Logo

AI Documentation Generator

AI Documentation Generator

JSDoc/TSDoc from code — on-device WebLLM

Source

Examples

Typed function

Input
export function parseDuration(input: string): number

A fully typed signature — the model documents the params and the return value.

Options object

Input
interface FetchOptions { retries?: number; timeoutMs?: number; signal?: AbortSignal }

Optional members become @property lines; verify any defaults it claims.

Class method

Input
class Cache { get(key: string): string | undefined { /* … */ } }

Method docs including the undefined-on-miss case.

About this tool

JSDoc/TSDoc blocks from source code — on-device WebLLM.

How to use

  1. Paste typed source

    A function signature with parameter and return types gives the best docs.

  2. Pick a model

    Quality (1.5B) keeps @param names aligned with the signature.

  3. Generate

    Get a JSDoc/TSDoc block you can paste above the declaration.

  4. Edit descriptions

    Adjust wording and add @defaultValue or @throws only where you verified them.

Use cases

Backfilling docs

Generate first-pass JSDoc for legacy helpers that never got documented.

Consistent style

Uniform @param/@returns blocks across a team's codebase.

Public API docs

TSDoc comments for library entry points, drafted in seconds.

Common mistakes

Mistake:Documenting untyped code and expecting precise types.

Fix:Add TypeScript types (or JSDoc types) to the input first — the model mirrors what it sees.

Mistake:Accepting hallucinated defaults and throws.

Fix:Check every @defaultValue and @throws against the implementation.

Mistake:Docs that restate the implementation.

Fix:Edit toward the contract — what it does and when to call it, not a line-by-line narration.

Frequently asked questions

References & standards