Documentation Generator
Structured doc annotations (@param, @returns, @throws) are parseable by IDE tooling. The 'never seen this code' guideline prevents assumed-knowledge gaps.
Generate documentation for the following {{language}} code.\n\n{{code_to_document}}\n\nDocumentation format: {{doc_format}}\n\nFor each public function/method/class, include:\n- A one-line summary of what it does\n- @param descriptions for all parameters with types and constraints\n- @returns description with type and possible values\n- @throws / @raises for all error conditions\n- @example with a realistic usage example\n- @since version (use {{version}})\n\nFor the module/file level:\n- A brief overview of the module's purpose\n- How it fits into the larger system\n- Any prerequisites or setup required\n\nStyle: Write for a developer who has never seen this code before. Be precise, not verbose.
Variables to customize
Why this prompt works
Structured doc annotations (@param, @returns, @throws) are parseable by IDE tooling. The 'never seen this code' guideline prevents assumed-knowledge gaps.
Save this prompt to your library
Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.
Related prompts
Get thorough code reviews with actionable feedback tailored to your language, framework, and standards.
Context-Aware Code CompletionProviding the surrounding code and project context lets the model match existing patterns exactly. The constraint against modifying existing code prevents unwanted side effects.
Inline Code SuggestionConstraining suggestions to match existing style and scope produces insertions that feel native to the codebase. The 'no explanation' rule mimics real inline completion behavior.
Code ExplanationThe audience level parameter adjusts complexity automatically. Requiring a usage example ensures the explanation is practical, not just theoretical.