Skip to content
Thally
Log inGet started
Guide

Published · 8 min read

Learn how to create llms.txt for your documentation: what goes in it, how to write or generate one, and how to keep it accurate after each release.

By Published Updated

Your docs site has hundreds of pages. When an AI agent or coding assistant lands on it, how does it know which ten matter? And when it pulls an answer about your API, is it reading the current reference or a stale tutorial from two versions ago? An llms.txt file is one small way to answer the first question. This guide covers how to create llms.txt for a documentation site: what goes in it, how to write one by hand, how to generate it from source, and how to keep it accurate after every release.

What llms.txt is and what it is for

The idea comes from a proposal by Jeremy Howard: "We propose adding a /llms.txt markdown file to websites to provide LLM-friendly content". In practice, it is a curated Markdown overview of your site. It has a title, a short summary, and grouped lists of links to the pages a language model or agent should read first, each with a one-line note.

It is not a sitemap. A sitemap lists everything so crawlers can find it. An llms.txt file is a map with opinions. It tells a client where the quickstart lives, where the API reference lives, and what each page is for.

Adoption has grown quickly. An Originality.ai tracking study of more than 3 million websites, reported by PPC Land, counted 4,088 llms.txt instances in June 2025 and 36,120 in May 2026, an 8.8x increase. Chrome has also started paying attention. Lighthouse's agentic browsing checks now look for "the presence of a machine-readable summary at the domain root". Search Engine Land reports that Google says you don't need llms.txt for Search, and that the audit doesn't produce a traditional 0–100 Lighthouse score. Chrome's audit page puts the reasoning plainly: "Without llms.txt, agents may spend more time crawling the site to understand its high-level structure and primary content".

Keep your expectations honest. Ahrefs analyzed logs from 137,000 domains and found that 97% of llms.txt files got zero requests. AI retrieval bots accounted for just 1.1% of llms.txt requests, while 12% came from tools auditing or scanning the files. A separate dataset found SEO audit tools led with 21.7% of requests. So llms.txt is cheap to publish and increasingly checked, but it is not a traffic lever. Treat it as one part of making docs readable by agents, alongside clean Markdown versions of pages and accurate examples. A discovery file alone cannot repair an outdated example.

Choosing which pages to list

The most common mistake is dumping every URL into the file. If the list is as long as your sitemap, you have thrown away the one thing that makes llms.txt useful: curation.

Start from the questions developers actually ask about your product, then pick the pages that answer them. For most developer-tool companies, that means:

  • A quickstart or "first request" guide
  • Authentication and API keys
  • The API reference, or its top-level index if it is large
  • SDK pages for each supported language
  • Core concepts that explain your data model
  • Error codes, rate limits, and versioning policy
  • Migration guides between major versions
  • Changelog or release notes

Leave out marketing pages, blog posts, and anything that describes behavior you no longer support. If you publish multiple API versions, list the current one prominently and decide deliberately whether older versions belong in the file at all. An agent that follows a link to v1 docs will happily generate v1 code.

Put the file at /llms.txt on your domain root. If your docs live under a path or a separate product area, you can use a scoped location such as /docs/llms.txt when it makes sense. Just remember that the Lighthouse check looks at the domain root.

Illustration of Choosing which pages to list

Writing the file by hand

For a small docs site, writing the file by hand is fine and takes less than an hour. The format is plain Markdown with a predictable structure.

How to create llms.txt step by step

  • Add an H1 with your product or project name. This is the only required element.
  • Add a blockquote with a one- or two-sentence summary of what the product does and who it is for.
  • Optionally, add a short paragraph with context an agent needs before reading anything else, such as the current API version or the base URL.
  • Add H2 sections that group your links, such as Guides, API reference, and SDKs.
  • Under each section, list links in the form [Page title](URL): one-line description.
  • Optionally, add a section titled "Optional" for secondary material a client can skip when context is tight.

A minimal file for a fictional API might read like this, line by line:

# Example API

> Example API lets developers send and track transactional messages over REST.

## Guides

- [Quickstart](https://docs.example.com/v2/quickstart): A first request.

## API reference

- [API reference](https://docs.example.com/v2/api): Parameters and responses.

Write the descriptions for a reader who has never seen your product. "Parameters and responses" is better than "Reference." "How to rotate keys without downtime" is better than "Auth." The note is what lets an agent decide whether to follow the link, so make it specific.

Then make the file discoverable. The v2 changelog notes that the most common request after adoption was discoverability. Version 2 uses standard link relations: rel="alternate" type="text/markdown" points to a page's Markdown version, and rel="describedby" points to the llms.txt file that covers it. You can provide both as HTML elements or as an HTTP Link header. If you already serve Markdown versions of your pages, add both relations to each page's head.

The downside of a hand-written file is obvious. It is a second copy of your navigation that nobody remembers to update.

Generating it from MDX source instead

If your docs are authored in MDX or Markdown, the information an llms.txt file needs already exists. Page titles, descriptions, section groupings, and URLs live in frontmatter and navigation config. Generating the file at build time removes the second copy.

A basic generator does four things:

  • Reads your navigation config to get section order and grouping.
  • Reads each page's frontmatter for title and description.
  • Filters pages using a flag you control, such as llms: true or llms: optional in frontmatter.
  • Writes /llms.txt during the build, alongside the HTML output.

Two habits make generated files good instead of merely complete. First, require a real description in frontmatter and fail the build if it is missing, because an empty note is useless to an agent. Second, keep the inclusion flag explicit. Default to excluded, and opt pages in. That preserves curation even when the file is automated.

While you are in the build pipeline, emit a Markdown version of each page and the rel="alternate" and rel="describedby" links from the same source. Then every format comes from one MDX file, and they cannot disagree with each other.

This is the approach Thally's Content Graph takes: you author in MDX once and publish HTML, Markdown, JSON, and llms.txt from the same source, so the discovery file is a build artifact rather than a document someone maintains.

Illustration of Generating it from MDX source instead

Keeping it current as your product changes

A generated llms.txt file stays structurally current: new pages appear, deleted pages disappear. But it is only as accurate as the pages it points to. If a merged pull request renames a parameter and the reference page still shows the old name, your llms.txt file now sends agents straight to wrong information, faster than before.

That is the real maintenance problem, and it is a docs drift problem, not an llms.txt problem. Docs rarely go out of date because nobody cares. They go out of date because the change happens in one place and the affected pages live somewhere else, including guides, tutorials, and support articles that mention a behavior without being "the docs for" that feature.

A few practices keep both the file and the pages behind it trustworthy:

  • Keep docs in Git next to the code. When docs are MDX or Markdown in a repository, the docs update can ride in the same pull request as the code, or in a linked PR reviewed at the same time, so the reviewer sees the code diff and the docs diff together.
  • Regenerate llms.txt on every docs build, never by hand.
  • Review the descriptions in llms.txt when you review page changes. A changed page purpose means a changed note.
  • Add a check that every URL in llms.txt resolves and that every listed page has a description.
  • Trigger a docs review when your OpenAPI or schema files change on the default branch, and run a periodic sweep to catch what event triggers miss.

The hard part is knowing which pages a given merge affected. Thally Automation handles that step: when a pull request merges, it analyzes the change, drafts the documentation updates it implies, and opens them as a pull request on your docs repo for your review. Nothing publishes without a human approving it, and once the fix merges, your llms.txt points to pages that match the product again.

Start small. Hand-write a file this week if you need one now, then move it into your build so it stops being one more thing to remember.

Sources

  1. The /llms.txt file (official spec, v2)
  2. Changes (llmstxt.org v2 changelog)
  3. Lighthouse agentic browsing scoring (Chrome for Developers)
  4. Google Adds llms.txt Check to Chrome Lighthouse (Search Engine Land)
  5. 97% Of llms.txt Files Got No Requests, Ahrefs Data Shows (Search Engine Journal)
  6. llms.txt adoption rises 8.8x but 97% of files get zero AI requests (PPC Land)
  7. Make Documentation Readable by AI Agents | Thally
  8. Keep Your Docs Site in Sync With Code Changes | Thally
  9. Thally Automation: Ship the Code. Docs Follow. | Thally

Published under the Thally editorial policy. Technical conformance is defined in the agent-readiness methodology.

Build docs that stay close to your product.

Create a managed site, or use the open-source engine to run Thally yourself.