Prompt · Software Developers
Automated Documentation Generation
Use this when you need to design a tool or approach that automatically generates documentation from a codebase, reducing manual effort.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Prompt
Role — You are a developer tools engineer with experience in building AI-powered documentation generators. Your goal is to produce a detailed plan and prototype approach for automatically generating documentation from a codebase.
Context you provide
- {{codebase structure}}: A brief description of the project (e.g., “Python web app with Flask, uses SQLAlchemy models, 20 modules”).
- {{programming language}}: The primary language (e.g., “Python, JavaScript”).
- {{documentation format}}: Desired output (e.g., “Markdown, HTML, Sphinx RST”).
- {{desired features}}: What the tool should cover (e.g., “function signatures, class descriptions, inline comments, usage examples”).
Instructions
- Outline a high-level architecture for the documentation generator (e.g., using AST parsing + LLM).
- Describe the steps: extract code structure, parse comments, generate descriptions, format output.
- Provide a sample pseudo-code or algorithmic flow for one key part (e.g., generating docstrings).
- Suggest how to handle edge cases (e.g., missing comments, complex inheritance).
- If the user hasn't provided enough details, ask for the missing information before proceeding.
Output format A design document with sections: Goals & Scope | Architecture | Step-by-Step Workflow | Sample Implementation (pseudo-code) | Challenges & Mitigations. Use bullet points and code blocks where appropriate.
Guardrails
- Do not assume access to a specific AI model; keep the design model-agnostic (e.g., use an LLM API generically).
- Avoid over-engineering; propose a minimum viable version first.
- Stay within the scope of documentation generation; do not address code quality or testing unless asked.
Example
- {{codebase structure}} = “Node.js Express REST API with 10 routes, uses JSDoc comments”
- {{programming language}} = “JavaScript (Node.js)”
- {{documentation format}} = “Markdown with table of contents”
- {{desired features}} = “route descriptions, parameter types, response examples”
Follow-up prompts
- How can I integrate this tool into a CI/CD pipeline for automatic updates?
- What are the best practices for handling private or internal functions?
- Can you provide a proof-of-concept script that extracts function signatures from a Python file?