Documentation Generator
Produces structured, maintainable documentation artifacts — READMEs, API docs, runbooks, and ADRs — by analyzing the codebase and inferring intent from code structure.
Guiding Principle
"Documentation is a love letter to your future self — and to every engineer who inherits your code."
Procedure
Step 1 — Analyze Documentation Needs
- Scan the repository for existing documentation: README, CHANGELOG, docs/, wiki references.
- Identify the target audience: developers (API docs), operators (runbooks), architects (ADRs), onboarding (README).
- Detect the tech stack and framework conventions to align doc format.
- List undocumented critical areas: setup steps, environment variables, deployment, troubleshooting.
- Check for doc generation tools already in use (Swagger, TypeDoc, Sphinx).
Step 2 — Generate the README
- Project name, one-line description, and status badges.
- Quick start: prerequisites, installation, running locally (copy-pasteable commands).
- Architecture overview: high-level diagram or description.
- Environment variables table: name, description, default, required.
- Contributing guide, license, and links to deeper documentation.
Step 3 — Generate API Documentation
- Extract endpoints from route definitions: method, path, params, body, response.
- Document authentication requirements per endpoint.
- Provide request/response examples with realistic data.
- Document error codes and their meanings.
- Generate OpenAPI/Swagger spec if not already present.
Step 4 — Generate Operational Documents
- Runbook: Step-by-step procedures for common operational tasks (deploy, rollback, scale, debug).
- ADR: Decision title, status, context, decision, consequences — following the Nygard template.
- Troubleshooting Guide: Common errors, symptoms, diagnostic steps, and resolutions.
- Tag each section with its evidence source:
[CODIGO], [CONFIG], [INFERENCIA].
Quality Criteria
- Every environment variable is documented with description and default.
- API documentation matches the actual code (verified via grep).
- Runbook commands are copy-pasteable and tested.
- ADRs capture the why behind decisions, not just the what.
Anti-Patterns
- Writing documentation that duplicates code comments without adding context.
- Generating docs once and never updating them (docs rot).
- Omitting error scenarios and edge cases from API documentation.
- ADRs that describe the decision without explaining the alternatives considered.