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 · 8 min read
Find which API doc pages a merged pull request made wrong, draft evidence-backed updates, and publish only what a person approves.
Which pages went wrong when your last pull request merged? Could you list them without opening the ticket, reading the diff, and searching the docs repo by hand? If not, you have the same problem as most API teams. Working out how to keep API docs up to date is less about writing faster and more about knowing, at merge time, what just became untrue. This guide walks through one workflow: trace the change, draft the update, check the evidence, and publish only what a person approved.
Drift rarely happens because nobody cares. It happens because the change and the page live in different places, are owned by different people, and get reviewed at different times.
The scale of the problem is well documented. In Postman's 2025 State of the API Report, 55% of respondents reported struggling with inconsistent documentation. An older data point, from a secondary review of SmartBear's 2020 State of API report, found that 47% say their docs are out of sync with the API implementation, and 64% of participants named limited time as the biggest obstacle to keeping them current. That data is from a few years back, but the complaint will sound familiar.
It matters because docs are where developers go first. In the Stack Overflow 2025 Developer Survey, technical documentation was the top learning resource, with nearly 68% of respondents using it in the past year.
If your reference is generated from an OpenAPI file at build time, the endpoint tables can't fall behind the spec they ship with. That closes one gap and leaves several others open. After a merge that renames a field or changes a default, check for drift in these places:
A single renamed field can leave the old name in the API reference, a quickstart, a troubleshooting article, and a blog post at the same time. Pages that mention a behavior without being the docs for that feature are the ones that get missed.
Start from the merged pull request, not from the docs. The diff tells you what changed, so the job is to turn it into a list of affected pages.
Work through it in this order:
customer_ref renamed to customer_id; old name accepted until the next major version" is a claim you can check pages against.Done by hand, this takes time, and limited time is the obstacle teams cite most. This is the step to automate first. Thally's Automation runs on every merge: it analyzes the change, drafts the documentation updates it implies, and opens them as a pull request on your docs repo for review. Whether a tool or a person does the tracing, the output should be the same: a list of pages, each tied to a specific line in a specific pull request.

Once you know which pages are wrong, don't fix them in a live editor. Put the fix in a pull request.
The docs-as-code approach from Write the Docs describes it plainly: "Write and publish your docs with the same tools as your code: issue trackers, version control, plain text files, code review and automated tests." When docs live in a separate editor with its own workflow, keeping them current depends on someone remembering to go there. A docs pull request doesn't depend on memory. It sits in a queue with a diff, an author, and a reviewer.
A few rules keep drafts reviewable:
Who writes the first draft is flexible. Write the Docs notes that developers will often write it, and in Postman's 2025 survey 41% of respondents said they rely on AI to generate API documentation. Either is fine, as long as the draft is a proposal that someone reviews before it goes anywhere.
Decide what triggers a draft, too. Not every commit deserves a documentation review. Reasonable triggers are a merge that touches the public surface, a release tag, a change to openapi.yaml or schema files on the default branch, and a scheduled weekly sweep to catch drift the event triggers missed.
A docs draft is a set of claims about your product. Before approving it, the reviewer should be able to confirm each claim from the code without trusting whoever wrote the draft.
For every changed line, ask:
This step is why the trace is worth doing carefully. A reviewer can approve a twelve-file docs change in a few minutes when each edit points at its source. Without that evidence, the reviewer has to redo the trace or approve without checking.

The last step is a gate: nothing reaches the public reference without a named person approving it.
On GitHub, you can enforce this with code owners and branch protection. Assign owners to your reference and guide directories, then edit the branch protection rule and enable "Require review from Code Owners". Two details trip teams up. The GitHub docs state that "For code owners to receive review requests, the CODEOWNERS file must be on the base branch of the pull request." Code owners are also not automatically requested to review draft pull requests, so an automated draft has to be marked ready for review before the request goes out.
Publish from the merged branch, and publish everything that derives from it. If the same source feeds your HTML site, Markdown exports, and an llms.txt file, they should all update together. AI coding assistants can recommend outdated APIs when the documentation they read describes an older release, so a stale machine-readable copy sends wrong answers into your users' editors.
Run the same loop on every merge:
If you want to see what the trace turns up on your own repositories before changing your process, Thally Track runs an impact analysis on your last five merged pull requests.
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.