Back to Handbook
Operations · Advanced
API & Documentation
Auto-Generated Specs
Your code is useless if no one knows how to use it. How to use AI to generate Swagger/OpenAPI specs and maintain living documentation.
01
The Documentation Gap
In Vibe Coding, code changes fast. Manual docs are always outdated. You must automate documentation generation.
1. Scan
Read Code
AI analyzes your API routes.
2. Spec
OpenAPI
AI generates swagger.json.
3. Host
Redoc
Render beautiful docs automatically.
02
Prompting for Docs
Don't write docs. Prompt them.
Prompt
Task: Generate an OpenAPI 3.0 spec for this file. Requirements: 1. Include all request/response types. 2. Add example values for every field. 3. Document error codes (400, 401, 404). 4. Output as YAML.