Document a Function or Module

Complete JSDoc or docstrings with precise types, throws, constraints, and a usage example.

Beginner1 min read

Customize

Fill these in and the prompt below updates as you type. Anything you leave blank stays as a placeholder.

Your prompt

1 placeholder left
Write JSDoc / docstring documentation for the following code.

Include:
- A one-sentence summary of what it does
- @param tags with types and descriptions for every parameter
- @returns with type and description
- @throws for any errors it can raise
- A usage example in @example

Be precise about types. If a parameter has constraints (e.g. must be positive, must be ISO 8601), document that.

Code:
{{code}}

Similar prompts

Add Types Incrementally

Type one file with runtime behavior frozen, and make the type-checker output the proof.

Document What You Built

Update docs strictly from the diff, with no invented features.

Function From Requirements

A typed, documented function built to spec — with three unit tests covering the edge and error cases.

Pull Request Description

Turn a diff into a scannable PR write-up with risks, rollback, and a reviewer checklist.