Llms.txt 讓您的文件具備 AI 可發現性

Hacker News·

本文提供了一份實用指南,教導如何架構文件(llms.txt)並提供 Markdown 版本,以確保 AI 代理能夠有效發現和理解文件內容,並強調了 AI 可讀性對於開發者工具日益增長的重要性。

How to Make Your Documentation AI Readable (A Practical Guide)

Your docs will be read by AI agents more than humans. Here's how to structure llms.txt, serve markdown versions, and actually get found by AI tools.

TL;DR

Here's something that's easy to miss: your documentation is increasingly being read by AI, not humans. When developers ask Claude about your API, when Cursor tries to understand your SDK, when Perplexity answers questions about your product, they're pulling from your docs. If your docs aren't AI readable, you're invisible to a growing chunk of your audience.

This isn't theoretical. We've been talking to teams revamping their documentation, and the question keeps coming up: "How do we make our docs LLM friendly?"

This post is the answer. We'll cover:

Let's get into it.

Why This Matters Now

The shift happened faster than most teams realized. A year ago, developers read documentation directly. Now they ask AI first.

When someone types "how do I authenticate with [your product]" into Claude or ChatGPT, the AI needs to find and understand your docs. If it can't:

AI readability isn't a nice to have anymore. It's table stakes for developer tools.

The Three Layers of AI Readable Docs

There are three things you can do, in order of impact:

Let's break each one down.

Layer 1: Markdown Versions of Every Page

This is the foundation. AI tools struggle with HTML. They struggle more with JavaScript rendered content. They do great with plain markdown.

The pattern: For every documentation page, serve a markdown version at the same URL with .md appended.

For URLs without file extensions, append index.html.md:

Why This Works

When AI agents browse documentation, many request markdown by default via the Accept header. If you serve markdown, they get clean content. If you don't, they get a mess of HTML, navigation, cookie banners, and ads.

One team I talked to took a different approach: they check the user agent and redirect AI crawlers to the markdown version automatically. Same result, cleaner URLs.

Implementation

If you're using a docs platform like Mintlify, Gitbook, or Fumadocs (I mean I shouldn't mention docsalot but it should be obvious), this is often handled automatically. Check your platform's settings.

If you're building with a static site generator, add a build step that outputs markdown versions alongside your HTML. Here's the rough logic:

Layer 2: The llms.txt File

The llms.txt proposal is simple: put a markdown file at /llms.txt that summarizes your site for AI.

Think of it as a table of contents written for machines. It tells AI:

The Format

Here's the structure:

The "Optional" section has special meaning. Content listed there can be skipped if the AI has limited context window space.

A Real Example

Here's what a well structured llms.txt looks like:

What Makes This Good

Notice a few things:

Layer 3: llms-full.txt

Some sites also provide llms-full.txt, which contains the complete documentation content in a single file.

When to use this:

When to skip this:

If you do create one, it's typically generated by expanding your llms.txt, following each link and concatenating the content.

The Structure That Actually Works

After looking at a bunch of implementations and talking to folks who've done this, here's what separates good from mediocre:

1. Be Explicit About Everything

This came up multiple times in conversations: don't trust that AI will understand implicit information.

Bad:

Good:

The second version tells AI exactly what it'll find. No guessing.

2. Use Synonyms

If people might search for the same thing with different terms, include both.

This seems unnecessary. SEO folks will tell you it's not needed in 2026. Based on testing, it still helps with AI retrieval.

3. Add Section Descriptions

Don't just list links. Add a sentence explaining what the section covers:

4. Include What Your Product Integrates With

Integrations are high value content. Be explicit:

5. Front Load the Important Stuff

The blockquote and opening paragraphs are what AI reads first. Put your most important information there.

What belongs in the opening:

Beyond llms.txt: Other AI Readability Wins

The file is just part of the story. Here's what else helps:

Serve Markdown on Request

Check if the request accepts text/markdown and serve markdown content:

Add "Open in LLM" Links

Some docs sites include links that open a page directly in an AI chat context. The URL pattern:

When clicked, it opens the page content in an AI assistant. This is more of a UX feature than a technical requirement, but it signals that you're thinking about AI consumption.

Keep Content Focused

AI has context limits. Pages that try to cover everything are harder to use than focused pages that cover one thing well.

If a page is over 3000 words, consider splitting it.

Use Clear Headings

AI uses headings for navigation. Vague headings hurt:

Bad: "Overview", "Details", "More Information"

Good: "How Authentication Works", "API Rate Limits", "Handling Webhook Failures"

How to Evaluate Your Docs (The DocsAgent Score)

We've been thinking about how to measure AI readability. Here's our framework. We're calling it the DocsAgent Score because these are the things that matter when an AI agent tries to use your docs. (We're building a free tool to check your score automatically—more on that soon.)

Availability (0-25 points)

Structure (0-25 points)

Content Quality (0-25 points)

Accessibility (0-25 points)

Score Interpretation:

The Bottom Line

Your docs are being read by AI. That's not a prediction. It's happening now.

The good news: making docs AI readable isn't hard. It's the same stuff that makes docs good for humans (clear structure, explicit explanations, focused content) plus a few specific files (llms.txt, markdown versions).

The teams that do this well will show up when developers ask AI for help. The teams that don't will wonder why their docs feel invisible.

Don't be invisible.

If you've implemented llms.txt or AI readable docs and have lessons to share, drop us a note. We're collecting examples for a future post on what's working in the wild.

More Articles to Read

Image

install.md reinvents Gherkin, poorly

A new 'standard' for AI-powered installation has emerged. But is it solving a real problem, or is it a solution that wouldn't exist if building things wasn't so cheap now?

Image

Your Documentation Is Already Lying to You

I spent three years watching documentation rot. Here's why it happens, what's actually changing, and the uncomfortable truth about keeping docs alive.

Image

I Let AI Write My Docs for Six Months. Here's What It Can't Do.

After six months of using AI to generate documentation, I have strong opinions about where it's magic and where it's garbage. This is that list.

Company

Resources

Compare

X vs Y

© 2026 DocsAlot. All rights reserved.

Hacker News

相關文章

  1. 我爬取了 1,500 個網站:30% 封鎖 AI 機器人,僅 0.2% 使用 llms.txt

    3 個月前

  2. 為 AI 代理人優化內容

    大約 1 個月前

  3. AI能讀懂你的SaaS嗎?為何llms.txt優於MCP,造福開發者

    4 個月前

  4. 是時候將你的文件移入程式碼倉庫了

    大約 1 個月前

  5. 給因AI而解僱技術寫作人員者的公開信

    3 個月前