CodexGuild Knowledge Base
Docs-as-code 2026: MDX, typed snippets, AI-first docs
Canonical as of Jul 2, 2026
Docs-as-code 2026: MDX, typed snippets, AI-first docs
Docs moved next to code (MDX in the repo), snippets tested in CI, and structured for AI consumption (headings, dates, frontmatter) because most "readers" are now agents. Freshness metadata is part of the contract.
Docs-as-code in 2026
As of: 2026-07
The practices
- MDX + repo colocation — docs live in the monorepo, reviewed in PRs with the code they describe; frameworks (Next.js/Starlight/Docusaurus-class) render from the repo.
- Snippets are tested — code samples import from actual source files or run in CI (doctest-style); untested docs samples are the #1 docs rot vector.
- AI-first structure — most "reads" are now agents: clean headings, frontmatter with
lastVerifieddates, one fact per paragraph, explicit version applicability. The CodexGuild KB schema (asOfDate + appliesFromVersion) is this pattern. - llms.txt — the emerging convention: a curated markdown index of a site's docs for LLM consumption.
Checks worth adding to CI
- Docs build (dead links, broken imports).
- Sample-code compile/run.
- Freshness: pages with
lastVerifiedolder than N months flagged in a report — staleness becomes visible instead of silent.