Concepts

Documentation as Code

Practice of treating documentation with the same tools and processes as code: versioned in Git, reviewed in PRs, and automatically generated when possible.

seed#documentation#docs-as-code#markdown#automation#dx

What it is

Documentation as Code is the practice of treating documentation like code: it lives in the same repository, is versioned with Git, reviewed in pull requests, and automatically generated/validated in CI.

Principles

PrincipleWhat it meansExample
ColocationDocs near the code they documentREADME per package, JSDoc on functions
VersioningDocumentation evolves with codeDocs in same repo, same PRs
AutomationGenerate docs from code when possibleTypeDoc, Swagger/OpenAPI, Storybook
ValidationVerify links, examples, format in CIMarkdown lint, link checker in CI

Tools

ToolUse
MarkdownUniversal format
MDXMarkdown + React components
DocusaurusDocumentation sites
StorybookComponent documentation
TypeDoc/JSDocDocs generated from code
OpenAPIGenerated API docs

Connection with llms.txt

The llms.txt standard is documentation as code optimized for AI agents — a Markdown file describing the project for LLM consumption.

Why it matters

Documentation that lives separately from code inevitably becomes outdated. Treating it as code — versioned in Git, reviewed in PRs, generated from authoritative sources — is the only way to keep it synchronized with the system's reality.

References

  • Docs as Code — Write the Docs.
  • MkDocs — MkDocs, 2024. Documentation site generator from Markdown.
  • Docusaurus — Meta, 2024. Documentation framework with versioning and i18n.
Concepts