Overview
LLMs can generate documentation from source code including README files, API references, inline comments, and usage examples. Provide the code and specify the audience and format.
README Prompt Template
Generate a README.md for this project.
Project structure:
[paste tree output]
Key files:
[paste main entry point and config files]
Include:
1. Project description (2-3 sentences)
2. Prerequisites and installation
3. Usage examples with code blocks
4. Configuration options
5. API reference for exported functions
6. Contributing guidelines
Audience: experienced developers. Tone: technical, concise.Documentation Types
README Generation
Provide project structure and key files. Ask for description, install steps, usage, and API reference.
API Documentation
Provide endpoint handlers. Ask for parameters, return types, errors, and usage examples.
Inline Comments
Provide a module and ask for JSDoc/TSDoc on exported functions. Focus on "why" not "what."