Published · 8 min read
How to create an llms.txt file for your docs
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.
Published · 7 min read
Give Cursor a current, structured source for your docs, keep it in step with merged code, and check its answers against evidence. A step-by-step guide.

When a developer asks Cursor how your API handles pagination, where does the answer come from? Is it last quarter's docs export, a training snapshot from before your v2 release, or the code you merged this morning? If you're wondering how to make Cursor understand your docs, the answer is not a better prompt. You need to give it a current, structured source, keep that source in step with your code, and check its answers against evidence. This guide walks through each step.
Cursor is only as accurate as the context it gets. When it has no direct source for your product, it falls back on what the underlying model learned in training. Research on code generation describes the problem directly: a model's knowledge is largely determined by the code available during training, and outdated recommendations require extra developer verification and migration effort.
The numbers are not small. A 2026 arXiv paper on evolving APIs notes that prior work observed a 25% to 38% rate of deprecated API usage across eight Python libraries. In the same paper's failure analysis, Old API Usage and Mixed API Usage accounted for 16.4% and 12.3% of failures, respectively. Mixed usage is the subtle one: the model writes code that combines your current API with one it remembers.
Developers notice. In the Stack Overflow 2025 Developer Survey, "46% of developers said they don't trust the accuracy of the output from AI tools". Usage is still climbing, though. 84% of respondents said they use or plan to use AI tools in their development process, up from 76% in 2024. Teams aren't going to stop using Cursor. They need it to be right about their own product.
Even when you do give Cursor documentation, stale docs cause a second failure. If your docs say one thing and your code does another, Cursor will confidently repeat the docs. The tool isn't broken. It's faithfully reading a source that drifted.
The common first move is to paste a docs export into the project, or to drop a folder of Markdown files into the repo and hope Cursor picks it up. That works for about a week. Then someone ships a change, the export doesn't, and you have built a stale-answer machine.
A better pattern is to point Cursor at a source that is maintained as part of your normal workflow.
Cursor's own documentation says project rules live in .cursor/rules as .mdc files and are version-controlled. Cursor recommends using them to encode domain-specific knowledge about your codebase. That makes rules a good home for durable conventions: which SDK version to target, which endpoints are deprecated, where the canonical API reference lives.
Two practical notes from the Cursor docs:
.md file dropped into .cursor/rules is ignored by the rules system, because it lacks the frontmatter that specifies description, globs, and alwaysApply. Use .mdc with proper frontmatter.AGENTS.md. Put product knowledge in version-controlled project rules or AGENTS.md so it changes alongside the code it describes.Keep rules short and pointed. A rule that says "Our public API reference is at /docs/api; prefer it over memory for endpoint names and parameters" does more than one that tries to restate the whole reference. The reference itself should live somewhere it gets updated.
If your docs live in a separate editor with its own workflow, keeping them current depends on someone remembering to go there. When docs are MDX or Markdown in a repository, the documentation update can ride in the same pull request as the code, or in a linked PR that is reviewed at the same time. The reviewer sees the code diff and the docs diff together.
This matters for Cursor because the docs in Git are what Cursor can read, and Git history tells you exactly how current they are.

Human-readable HTML is not the best format for an AI tool. Navigation chrome, cookie banners, and client-side rendering all get in the way. Publish your docs in formats an agent can consume directly.
The llms.txt proposal describes it simply: "We propose adding a /llms.txt markdown file to websites to provide LLM-friendly content". It's a Markdown index that lists your key pages with a one-line description of each. You can put it at /llms.txt, or at a scoped location like /docs/llms.txt when that fits your site. A minimal section looks like this:
Be realistic about what this does. It helps clients that choose to read it understand your documentation. It is not a guarantee that every AI product will use it, and some analysts point out that major LLM providers don't currently support it as a standard. The dependable use is direct: give Cursor the URL of your llms.txt, or reference it in a project rule, so the agent has a clean map of your current docs.
For reference material like endpoints, parameters, error codes, and config options, structured JSON beats prose. An agent can look up a parameter's exact type and default without parsing paragraphs. If you generate references from an OpenAPI spec or schema files, publish that output alongside your pages.
Anthropic introduced the Model Context Protocol as "an open standard that enables developers to build secure, two-way connections between their data sources and AI-powered tools". Developers can expose data through MCP servers, and AI applications connect to those servers as clients. Cursor can act as an MCP client, so an MCP server for your docs lets the agent search and fetch current pages on demand instead of relying on whatever was in its context window.
You can build these outputs yourself. Thally's Content Graph takes another route: you author once in MDX, and it publishes the same source as a site, Markdown, JSON, llms.txt, and MCP tools. Either way, the principle is the same. Every format should come from one source, so they can't disagree with each other.
Here's the uncomfortable part. Everything above makes Cursor better at reading your docs. None of it makes your docs correct. If the source drifts, every format you publish drifts with it, and Cursor gets a cleaner path to the wrong answer.
The arXiv research on evolving APIs found that "providing external documentation significantly improves API adoption". It also found that models still struggle to override stale knowledge they learned in training. Current docs help, but only if they're actually current.
Docs rarely go stale because nobody cares. They go stale because a change touches pages nobody thinks of as "the docs for" that feature: guides, tutorials, support articles, and marketing pages that mention a behavior in passing. A renamed flag might appear in the reference, a quickstart, three help articles, and a pricing page.
To keep the source current:
Automating that impact step is the job of Thally Automation. When a pull request merges, it analyzes the change, drafts the documentation updates the change implies, and opens them as a pull request on your docs repo for your review. It uses a read-only GitHub App, and you choose what triggers a draft, such as release tags, changes to openapi.yaml or schema files, or a weekly sweep. Nothing publishes until a person approves it.

Even with current docs and good formats, test what Cursor actually says. The llms.txt proposal suggests a useful check: ask an agent questions about your content, giving it only your llms.txt as a starting point. If it can't find the answer, the problem is your index or your pages, not the model.
Build a small evaluation set from questions your users and engineers really ask:
Run the same questions after each release. When an answer is wrong, trace it to the page or index entry behind it, fix that source, and ask again.
Published under the Thally editorial policy. Technical conformance is defined in the agent-readiness methodology.
Create a managed site, or use the open-source engine to run Thally yourself.