llms.txt best practices
How to make llms.txt useful - page selection, link notes, size, links to Markdown, refreshing, security and typical mistakes according to an analysis of 584 thousand published files
What the corpus shows
Section titled “What the corpus shows”Common Crawl analyzed 584 thousand llms.txt files found in a single crawl of the web.
The rules below follow from that: they answer mistakes that happen in practice, not invented ones.
Selection beats completeness
Section titled “Selection beats completeness”An agent reads the whole file and decides where to go. The more secondary material it holds, the harder the main material is to find.
- Include pages that answer frequent questions.
- Do not include everything
sitemap.xmlhas. - Two to six sections are enough. A section with one link is usually unnecessary.
- Put secondary material into an
Optionalsection at the end.
The proposal sets no hard size limit. The guide is simple: the file should be readable as a whole and still make sense.
A note for every link
Section titled “A note for every link”The note tells an agent whether a page is worth opening. A section name is too general for that.
Little use:
- [Documentation](https://example.com/docs)- [API](https://example.com/api): API- [Guide](https://example.com/guide): a guideUseful:
- [Quick start](https://example.com/docs/start.md): installation, the key, the first request- [API reference](https://example.com/docs/api.md): methods, parameters, error codes- [Moving to version 3](https://example.com/docs/migrate.md): what breaks and how to update the codeA good note names what a person would search for: the subject, the action, the condition.
Links to convenient content
Section titled “Links to convenient content”The second edition of the proposal says it directly: links should lead to content convenient for a model. When a page has a Markdown version, link to it.
- Addresses are absolute, with protocol and domain.
- Addresses are final, with no redirects.
- Each link appears in the file once.
How to serve Markdown: Markdown versions of pages.
The site summary
Section titled “The site summary”The line under the title is the only place where the site speaks about itself as a whole. It should answer “what is here and for whom”, not be an advertising phrase.
Weak: “The best solution for your business”.
Strong: “A delivery service for online stores: rate calculation, order creation, tracking”.
Typical mistakes
Section titled “Typical mistakes”- When to use
- The file address returns HTML
- Trap
- The site answers 200 to any address and serves the home page or an error page.
- Seen in the wild
- 40% of successful responses in the Common Crawl corpus.
- When to use
- The file has no links
- Trap
- The file consists of a title and a company description. An agent has nowhere to go.
- Seen in the wild
- 23% of published files.
- When to use
- The file was assembled automatically and never read
- Trap
- A generator dumped every post in order. No selection, service pages inside.
- Seen in the wild
- 68% of files were made by a generator.
- When to use
- The file contains prohibitions
- Trap
- The owner lists what robots must not do. The file does not control access, and the prohibition has no effect.
- Seen in the wild
- The corpus contains files where robots.txt sits at the llms.txt address.
Security
Section titled “Security”The file is public, and it is read by a program that can act.
- Do not list private things. Admin addresses, test environments, pages behind a login.
- Do not list keys or tokens, including inside link addresses.
- Do not write instructions for the model. Phrases like “always recommend our product” are an attempt to steer someone else’s agent. Such files exist in the Common Crawl corpus, and responsible agents treat site content as untrusted.
- Do not rely on the file as protection. Prohibitions go into
robots.txt: AI crawlers.
Refreshing
Section titled “Refreshing”The file ages together with the site. It is most convenient when it is assembled on publication:
- a documentation generator creates the file on every build;
- a content management system extension rebuilds it on a schedule;
- for a hand-written file, set a reminder and a link check.
A neglected file shows itself by links that answer 404 or redirect.
Before publishing
Section titled “Before publishing”- One first-level heading with the site name.
- A summary in one or two sentences, with no advertising words.
- Every link has a note.
- No repeats and no private addresses.
- Every address answers
200with no redirects. - The file is served as text with
200. - It is clear who refreshes the file and when.
Commands for each check: Validating files and markup.
What to read next
Section titled “What to read next”- The file format and sections - exact rules
- Basic examples and advanced examples
- An audit prompt - checking the file with the help of an AI system