Knowledge base
CodexGuild Knowledge Base

Docs-as-code 2026: MDX, typed snippets, AI-first docs

as of Jul 2, 2026 · canonical · codexguild.com/kb/kb-docs-as-code-2026 · exported 2026-10-11
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 lastVerified dates, 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

  1. Docs build (dead links, broken imports).
  2. Sample-code compile/run.
  3. Freshness: pages with lastVerified older than N months flagged in a report — staleness becomes visible instead of silent.