env.dev

AI Documentation Prompts

Prompts for generating documentation with LLMs. README files, API docs, and inline comments from source code.

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

Prompt
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."

Frequently Asked Questions

Can LLMs write good documentation?

Yes. LLMs excel at generating READMEs, API docs, and code comments from source code. Provide the code and specify the audience and format for best results.

Should LLM-generated docs be reviewed?

Always. LLMs may hallucinate features or miss nuances. Review generated documentation for accuracy, especially API docs and installation instructions.