Guide · Docs

How should developer docs be written so AI can understand and cite them?

Updated 2026-11-06 · kagentx

Short answer

One question per page: the title is the question, the first paragraph is the answer, the applicable version and update date are stated, code examples are copyable text, and the content is written in the HTML. llms.txt is worth doing: on 2026-11-06 we sampled /llms.txt on 11 well-known docs sites; 8 have one (for example Stripe, Cloudflare, Vercel, Next.js, React) and 3 do not (MDN, the OpenAI platform, Python docs). No official source says who reads these files, so we could not verify it, and so far there is no evidence it helps AI search recommend you.

Do well-known developer docs sites have an llms.txt?

Not all, but most. On 2026-11-06 we opened /llms.txt at the root of 11 well-known docs sites with curl: 8 returned 200 and 3 returned 404. This is one sample, not all docs sites, and it does not show what the sites with an llms.txt got out of it.

Docs site/llms.txt (2026-11-06)What we saw
docs.stripe.comYes (200)About 97 KB; it opens with instructions for AI coding tools rather than an ordinary summary; every page also has a .md version (/payments.md returns text/markdown); no llms-full.txt (404)
developers.cloudflare.comYes (200)About 17 KB, grouped by product, each product linking to its own llms.txt; an llms-full.txt exists, about 70 MB
docs.anthropic.comYes (redirects to platform.claude.com)About 98 KB
vercel.com/docsYes (308 redirect to vercel.com/llms.txt)About 5 KB; vercel.com/docs/llms-full.txt exists, about 12 MB
supabase.comYes (200)About 3 KB
nextjs.orgYes (200)About 15 KB; has a “when to use nextjs.org” section saying which questions the docs are the source of truth for
react.devYes (200)About 15 KB; the links at the start point to .md versions of pages
docs.github.comYes (200)About 29 KB; has a “how to use” section pointing to interfaces for full text and search
developer.mozilla.orgNo (404)—
platform.openai.comNo (404)—
docs.python.orgNo (404)—

The files show three approaches: a short index (Supabase, React); several files split by product, tied together by one top-level index (Cloudflare); and an index plus a Markdown version of each page (Stripe, React). The two llms-full.txt files are tens of MB and about 12 MB, too large to read in one go; that is our inference, not a reason they gave.

We found no official statement on who reads these files or how much. Whether they help AI search recommend you, see What is llms.txt, and does it work?: there is no evidence so far.

How are docs different from a marketing page for AI?

Readers of docs mostly ask “how do I do X” or “what does this error mean”, not “which product is best”. So a docs page has to work as an answer on its own, without another page to fill in the context.

ApproachWhy
One question per page, and the title is the questionThe title matches the question, so AI and search can match them easily
Give the answer in the first paragraph, then expandLifting the first paragraph gives a complete answer
State the applicable version and last updated date on every pageOld-version instructions are the most likely to be taken as current; see the freshness guide
Code examples can be copied as-is, with language, prerequisites and expected outputNo screenshots, and do not mix commands and output
Put the exact error message on the page, with the cause and fix beside itUsers search and ask with the exact error text
Link pages with ordinary links whose text says what the target isNot just “click here” or “see below”
Body text is written directly in the HTMLDo not rely on browser-side script rendering; see the JavaScript guide

For how to write the text see How to write content AI will quote: before and after; for page updates and dates see Does showing an updated date on a page help AI citations?; for whether crawlers run scripts see Do AI crawlers render JavaScript?.

What can one docs page look like?

Here is a skeleton (the product and API are made up): the title is the question, the first paragraph is the answer, it states the applicable version and date, code is split by language, and errors are in a table.

# How do I verify a webhook signature?

Verify the X-Example-Signature header with your endpoint secret before
you read the body. Use the official library; do not compare strings yourself.

Applies to: API version 2026-10-01 and later. Last updated: 2026-11-06.

## Node.js

    const event = example.webhooks.verify(rawBody, signature, secret);

## Python

    event = example.webhooks.verify(raw_body, signature, secret)

## If verification fails

| Error | Cause | Fix |
|---|---|---|
| invalid_signature | Body was parsed before verifying | Pass the raw body |
| timestamp_too_old | Server clock is off by more than 5 minutes | Sync the clock |

Related: [Webhook events](/docs/webhooks/events/), [Retries](/docs/webhooks/retries/)

Should I make llms.txt and llms-full.txt?

For developer docs you can, it is cheap, but do not expect recommendations from it. llms.txt is an index and llms-full.txt joins the docs into one big file; for the spec and the current state see What is llms.txt, and does it work?. In the sample above some sites that publish one also offer a .md version of each page so tools can fetch clean text. For a first draft use llms.txt generator and then edit by hand.

If the docs are large, do not make only one llms-full.txt: split by product or section and add a sentence for each in the index. Cloudflare does this in our sample; smaller files, we infer, are easier to read in full.

How do I fix it, step by step?

  1. 1. First make sure crawlers can get into the docs site

    Docs often live on a subdomain, so check its robots.txt and firewall separately. For the rules see How do you write robots.txt for AI crawlers?.

  2. 2. Pick the 20 most-asked pages and change those first

    Choose from your search logs, support questions and GitHub issues; do not change everything at once.

  3. 3. Turn each into “title is the question, first paragraph is the answer”

    Add the applicable version and last updated date.

  4. 4. Replace code examples with copyable text

    State the language, prerequisites and expected output; put exact error messages in a table.

  5. 5. Add structured data that matches the content

    Docs pages can use TechArticle or Article; the title and date must match what is visible on the page. See Does structured data help AI search?.

  6. 6. Publish llms.txt, and add .md versions and llms-full.txt if needed

    Publish the index first with a one-sentence note on each link; if the docs are large, split by product.

  7. 7. Update the date with each release and watch the server logs

    Search the logs for requests to /llms.txt and .md files and see which User-Agents they come from; invest more only if there are records.

FAQ

Do developer docs need an llms.txt?

You can; it is cheap. But there is no evidence it makes AI search recommend you more. On 2026-11-06 we sampled 11 well-known docs sites: 8 have one and 3 do not (MDN, the OpenAI platform, Python docs).

Should I make an llms-full.txt?

Not required. In the sample Cloudflare (about 70 MB) and Vercel (about 12 MB) have one and Stripe does not (404). For large docs, splitting by product is the more practical approach.

Should every docs page have a Markdown version?

Stripe and React do (add .md to the URL; both returned 200 on 2026-11-06). Whether it is worth it depends on whether your readers use AI coding tools; we have no data on its effect on search citations.

Should docs be on a subdomain or a subdirectory?

We found no official statement on which is better, so it is unverified. Both appear in the sample (docs.stripe.com is a subdomain, vercel.com/docs is a subdirectory). Either way, check robots.txt and the firewall separately.

Should code examples be screenshots?

No. Text inside screenshots cannot be read or copied; use text code blocks and state the language and prerequisites.

Sources

kagentx

Can crawlers read your pages?
Let the evaluation tell you

The evaluation checks whether crawlers can get in and whether the text is served directly, then asks ChatGPT, Perplexity and Claude (with web search on) your buyers' questions and sees whether you are mentioned. The Basic plan is $1, and results usually take 2–3 minutes.