Back to guide/Developer Tools

Documentation Generator

Structured doc annotations (@param, @returns, @throws) are parseable by IDE tooling. The 'never seen this code' guideline prevents assumed-knowledge gaps.

ai-coding-assistant-promptslanguagecode_to_documentdoc_format
Edit View
Prompt
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

{{language}}{{code_to_document}}{{doc_format}}{{version}}

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.