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.
Why this prompt works
-
What Is AGENTS.md?
A README for agents: exact commands, enforced conventions, hard boundaries, and how to verify work. Used by 60,000+ projects and 25+ tool...
Read the guide → -
How to Deploy an AI Agent
Every deployment problem follows from one property: you don't know how long a run takes, because you didn't write the path. Why the run m...
Read the guide → -
MCP Authorization and OAuth
Optional until you opt in, then very specific. Why the resource parameter is mandatory even when the server ignores it, why PKCE doesn't ...
Read the guide →