Generate Code Documentation
Automatically create high-quality documentation for your codebase.
Prompt template
Create complete documentation for the following [PROGRAMMING LANGUAGE] code: **Documentation Requirements:** - Format: [JSDoc/Docstring/XML-Doc/Markdown] - Target audience: [Team developers/external API users/open-source community] - Style: [DOCUMENTATION STYLE] **For each function/class/module, create:** 1. **Description:** What does the unit do and why does it exist? 2. **Parameters:** Types, descriptions, default values, constraints 3. **Return Values:** Type, description, possible values 4. **Exceptions:** What errors can occur and when? 5. **Examples:** At least one usage example with input and output 6. **Notes:** Performance implications, thread safety, deprecation **Additional Documentation:** - Module overview with dependency diagram - Getting started guide for new developers - Architecture Decision Records (ADRs) - FAQ for common questions Code: ```[PROGRAMMING LANGUAGE] [INSERT CODE HERE] ```
Replace placeholders in [square brackets]: [PROGRAMMING LANGUAGE][JSDoc/Docstring/XML-Doc/Markdown][Team developers/external API users/open-source community][DOCUMENTATION STYLE][INSERT CODE HERE]
How to use this template
Copy the prompt, replace the placeholders in square brackets with your details and paste it into the AI assistant of your choice. The more precise your details, the better the result.
Tips for better results
- Specify the target audience of the documentation
- Mention the desired documentation format
- Ask for an Architecture Decision Record (ADR)
- Request diagrams in Mermaid syntax
Suitable open models
The selection names current open models as a starting point for your own tests. It is not a measurement for this template.
Keywords: #documentation #jsdoc #comments #knowledge-sharing