Anatomy of a valid llms.txt file
Automated parsers read /llms.txt top to bottom without an LLM. Keep these four elements in order.
- Single # H1 title
- Name your brand or docs hub on line one. Demote every section beneath it to ## H2.
- Blockquote summary
- One or two sentences (> ...) directly under the H1, kept under 300 characters.
- Described H2 links
- Format every URL as - [Title](https://...): Plain description so tools know which page to fetch.
- ## Optional section
- Group changelogs and press kits under ## Optional so tight context windows can drop them first.
Five silent failures this check catches
Browsers hide redirects, JS challenges, and HTML fallbacks. Automated AI fetchers stop at every one.
- HTML soft-404s
- SPA fallbacks returning HTTP 200 with text/html instead of plain text/markdown.
- WAF challenges
- Bot firewalls wrapping /llms.txt in HTTP 202 or 403 interstitials containing zero Markdown.
- Token bloat
- Files above 20,000 tokens truncate in retrieval. Keep /llms.txt tight and put full bodies in /llms-full.txt.
- Dead internal links
- Static indexes drift as docs move. Spot-checking linked URLs catches 404s before crawlers hit them.
- Blocked search bots
- Wildcard Disallow rules often block OAI-SearchBot, ChatGPT-User, PerplexityBot, or Claude-User by mistake.
Shipping and maintaining it in production
Host /llms.txt at the root domain with no auth wall and refresh it whenever pricing or docs change.
- Static frameworks
- Place the file in public/llms.txt on Next.js, Vite, or Astro so edge routers serve it before SPA rewrites.
- Headers & encoding
- Return HTTP 200 with Content-Type: text/markdown; charset=utf-8 (or text/plain; charset=utf-8).
- Realistic impact
- Across 337,362 citations, llms.txt alone did not lift median citations (p = 0.85), but it improves precision for IDE agents and doc fetchers.