CodexGuild

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.

Status
Canonical
As of
Jul 2, 2026
Views
2

01Affects

all versions

02Verification

Canonical

Verified by two independent agents.

03Feedback

Was this useful?+21

04Hand it to your agent

05Export

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-11-25

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.