Make docs agent-ready
More and more readers reach your docs through an AI assistant. docsbot agent-ready has
two parts:
checkscores how well agents can discover, navigate and read the docs.generatewrites the files that help:llms.txt,llms-full.txtand a Markdown copy of every page.
Score agent readiness
docsbot agent-ready check https://docs.example.com # a published site
docsbot agent-ready check . --site https://docs.example.com # a repository and its published site
docsbot agent-ready check . # a repository, through a local preview
The score combines two sets of checks:
- AFDocs, the Agent-Friendly Documentation Spec checks:
llms.txt, Markdown availability, page size, content negotiation and more. docsbot runs them withnpx afdocs, so this part needs Node 22 or later. By default 60% of the score comes from AFDocs (audit.afdocs_weight). - docsbot’s whole-site checks:
llms.txtcoverage, orphan pages, click depth, broken internal links, titles, descriptions, heading structure, page size, code block languages and link text.
Without Node, run with --afdocs off to get docsbot’s checks alone.
Sampling
AFDocs’ page-level checks run on a sample of pages spread across the top-level sections, 50 by default. The same site always gives the same sample, so scores are comparable between runs. A report is labelled audit when every page was checked and indicative when it used a sample. To check every page:
docsbot agent-ready check https://docs.example.com --sample 0
When the score is capped
AFDocs caps its score when a critical check fails, for example when there is no
llms.txt. A capped number means “blocked”, not “how good”, so the report leads with the
blocking issue and gives the score before the cap. Fix that issue first.
Checking a repository without a published site
Without --site (or base_url), docsbot serves the repository on a local port and AFDocs
checks that preview. The preview only serves the llms.txt the repository ships, and
cannot reproduce your host, so checks that depend on it (HTML size, content negotiation,
status codes, caching, rendering, authentication) are left out of the score and listed in
the report.
Generate the files agents use
docsbot agent-ready generate docs --base-url https://docs.example.com
This writes to build/agent-ready (change it with --out; it must be outside the content
root):
| File | What it is |
|---|---|
llms.txt |
an index built from your navigation and page descriptions, split by section when large |
llms-full.txt |
every page in one Markdown file |
<page>.md |
a Markdown copy of each page at its URL with .md added: front matter removed, includes inlined, internal links pointing at the .md copies |
copy-as-markdown.js |
a “Copy page as Markdown” button for your theme |
discovery-snippet.html |
template additions so agents find llms.txt and the copies |
Nothing is published and your docs are not changed. Copy the files into your site build yourself, for example as a step after the site generator runs.
Pages without a description are listed: their llms.txt entries have no summary, so add
one. Shortcodes and JSX are kept as written and listed, because docsbot cannot render them.
Preview first with --dry-run. Set the llms.txt heading and summary with --title and
--summary; by default they come from the home page.
Gate a build on the score
docsbot agent-ready check . --site https://docs.example.com --fail-under 70
In GitHub Actions, set the action’s node input to "true" so AFDocs can run. See
Run docsbot in CI.