Home/
Part VI — Practical Vibe Coding Workflows (The Stuff You'll Actually Use Daily)/20. Vibe Coding for Documentation (That Doesn't Lie)/20.2 "Docs as a build artifact" workflow
20.2 "Docs as a build artifact" workflow
Overview and links for this section of the guide.
On this page
Goal: keep docs updated automatically
Docs drift because updating docs is optional work. The “docs as a build artifact” workflow makes docs updates part of the normal build pipeline.
The goal is:
- docs are generated/validated in CI,
- docs changes show up as diffs,
- docs stay close to the code’s real behavior.
Docs as a build artifact (what it means)
It means you treat documentation outputs like build outputs:
- generated docs are produced deterministically from sources,
- changes are reviewed in PRs,
- the build fails if docs are inconsistent (optional but powerful).
Examples of “sources”:
- API schemas (OpenAPI, JSON schema)
- typed interfaces and docstrings
- CLI help output
- tests and examples
Source-of-truth strategy
Pick a clear source of truth:
- APIs: request/response schemas and tests
- CLI: help output + README examples + tests
- AI behavior: prompt + schema versions
The goal is “docs reflect contracts,” not “docs reflect intentions.”
A practical workflow (local + CI)
- Write docs sources: schemas, docstrings, examples.
- Generate docs locally: produce markdown/HTML outputs.
- Commit generated docs (optional): or publish them in CI.
- CI gate: verify docs generation is up to date.
Even if you don’t fully automate generation, you can automate verification (“docs must be regenerated”).
Docs gates (prevent drift)
Examples of lightweight gates:
- CI checks that generated docs match committed docs
- CI runs a script that validates schemas and example payloads
- CI verifies README quickstart commands (smoke test)
These gates keep docs from becoming stale silently.
Where AI fits (and where it shouldn’t)
AI is great for:
- drafting explanatory text from a file map and contracts
- generating example payloads from schemas (then you validate)
- rewriting docs for clarity without changing meaning
- drafting changelogs and release notes (then you review)
AI is bad for:
- inventing undocumented behavior
- guessing API contracts without evidence
- describing “best practices” instead of your system’s real behavior
Never accept docs without verification
Docs are a user-facing contract. Verify examples and commands. Make “unknown” explicit.