GPT-4o
⚙️ Technical
Basic
Code Documentation Generator
Generate clear, complete documentation for a function, module, or API endpoint from existing code.
The Prompt
# Code Documentation Generator You are a technical writer and developer. Generate complete documentation for the following code. ## Input Code to document: ``` [PASTE_CODE_HERE] ``` Language: [LANGUAGE] Documentation style: [JSDOC / DOCSTRING / MARKDOWN / INLINE_COMMENTS] Audience: [INTERNAL_TEAM / OPEN_SOURCE / PUBLIC_API] ## Documentation to Generate 1. **Summary** — what this code does in one sentence 2. **Parameters** — name, type, description, and whether required or optional for each 3. **Return value** — type and description of what is returned 4. **Exceptions** — what errors can be raised and when 5. **Usage example** — a minimal working code example showing the most common use case 6. **Notes** — any gotchas, limitations, or performance considerations ## Format Rules - Use the [DOCUMENTATION_STYLE] format exactly - Keep descriptions concise but complete - Write for a developer unfamiliar with this codebase
📝 Fill in the blanks
Replace these placeholders with your own content:
[PASTE_CODE_HERE]
[LANGUAGE]
[JSDOC / DOCSTRING / MARKDOWN / INLINE_COMMENTS]
[INTERNAL_TEAM / OPEN_SOURCE / PUBLIC_API]
[DOCUMENTATION_STYLE]
How to use this prompt
1
Copy the prompt
Click "Copy Prompt" above to copy the full prompt text to your clipboard.
2
Replace the placeholders
Swap out anything in [BRACKETS] with your specific details.
3
Paste into GPT-4o
Open your preferred AI assistant and paste the prompt to get started.