Generate Documentation and Docstrings From Code

Produce clear docstrings or reference docs for a function, class, or module — accurate to the code, without inventing behavior.

0 likes 0 dislikes
Sign in to rate this prompt

Prompt

    Write documentation for the code below.

Code:
{{code}}

Doc style (optional — e.g. Python docstrings/Google style, JSDoc, YARD, or prose reference): {{style}}

Produce:
1. A one-line summary of what it does.
2. For each public function, method, or class: its purpose, parameters (name, type, meaning), return value, side effects, and any errors it can raise.
3. A short usage example if it would help a reader.

Rules:
- Document only what the code actually does — do not invent behavior, parameters, or return values that aren't in the code.
- If the code's intent is unclear in a spot, say so rather than guessing.
- Match the requested style; keep descriptions tight and concrete.

Like this prompt?

Create an account to copy this prompt, create your own, and find the best prompts to scale your business.