`llms.txt` is the file AI tools read to understand your site fast. Most implementations fail in one boring way: they list **bare paths** instead of links, so the model gets a table of contents it cannot follow. This skill is the format that survives real audits (BotView, `tools/botview.py`, checks for exactly this). Run it for one site at a time. A first draft is one sitting; the verify step is one command. The file is only done when the **live** `/llms.txt` passes the checks in Step 7 — a dr...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Llms Txt?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/loophalt-llms-txt)
# Writing an llms.txt That Actually Works
`llms.txt` is the file AI tools read to understand your site fast. Most implementations fail in one boring way: they list **bare paths** instead of links, so the model gets a table of contents it cannot follow. This skill is the format that survives real audits (BotView, `tools/botview.py`, checks for exactly this).
Run it for one site at a time. A first draft is one sitting; the verify step is one command. The file is only done when the **live** `/llms.txt` passes the checks in Step 7 — a draft in the repo is not a finished file.
## Preconditions
Do not start without all of these. If one is missing, say which and stop — do not guess it.
- **Site URL** (apex domain, `https://`) — the file lives at `<site>/llms.txt`, so this is the live site, not a staging copy.
- **What the site is, in one line** — what it covers, for whom, and its scope (states, cities, categories). This becomes the H1 blockquote an AI quotes verbatim; if you cannot state it, you cannot write the file.
- **The key pages** — the pages AI answers should point at (services / practice areas, locations, resources), or a sitemap to generate the list from (Step 2). A file built from a sitemap alone has no human judgement in it yet — see the Step 2 warning.
- **2–3 checkable key facts** about the site/niche (typical price ranges, coverage, rules that vary, common misconceptions) — sourced from your own content. "Affordable" is not a fact; "$200–$500/hr typical" is.
- **A way to publish a file at `/llms.txt` on the live site** (deploy access). Without it you can draft, not finish — say so and stop after Step 6.
- **Live fetch access** — the verify step fetches the live file. If you cannot reach the site, stop: a file you cannot fetch is not evidence.
## Evidence rule (read this first)
Every claim in the output must be backed by something actually fetched or observed in this run — the live file, a link check, the audit output. Never report a link count you did not count, a link as working that you did not fetch, or a fact you did not source from the site's own content. A file with 4 good links is a finding; a file with 40 untested links is not.
## Step 1 — Fetch the live file (or confirm it is missing)
Before writing anything, fetch the file as it exists right now:
```bash
curl -s https://example.com/llms.txt
```
- If it returns 200, read it top to bottom and record what is there: does it start with `#`? How many real markdown links does it have (`grep -c '](http'`)? Are they bare paths or real links? This is the baseline — the rewrite in Steps 3–6 is measured against it.
- If it returns 404 (or anything else), record "missing" and go to Step 2 — there is nothing to fix, only something to write.
Checklist:
- [ ] Live file fetched (or its absence recorded with the status seen).
- [ ] Markdown link count recorded (`grep -c '](http'`), and whether the entries are bare paths or real links.
Evidence to record: the fetch status, the link count, and one quoted line showing the current format (bare path or real link).
## Step 2 — Draft from the sitemap (or the key-pages list)
If the file is missing, or the live file is a bare-path list, generate a draft from the sitemap:
```bash
python3 tools/botview.py generate https://example.com
```
What this actually produces: the page title as H1, the meta description as the blockquote, then a single `## Pages` section with up to 60 URLs from `/sitemap.xml`, each as `- [url](url)`. It prints to stdout — it does not write a file. If there is no sitemap it prints "No sitemap found — cannot generate. Add a sitemap first." and stops; add the sitemap first, then come back.
**The draft is not the file.** It has three gaps you must close by hand in the steps below: the link text is the URL itself (no human label), there are no sections (one flat list), and there is no key-facts section and no sitemap link. Shipping the draft as-is is the same failure in a tidier font.
If there is no sitemap, draft from the key-pages list in the preconditions instead — same shape (H1, blockquote, links), built by hand.
Checklist:
- [ ] Draft generated (or the reason it could not be: no sitemap).
- [ ] The draft's three gaps noted: URL-as-label, no sections, no key facts / sitemap link.
Evidence to record: the draft as generated, and the sitemap URL count it came from.
## Step 3 — Write the header: what the site is
Lead with what the site is. H1 = site name; the blockquote under it is a 2–3 sentence summary an AI can quote verbatim: what the site covers, for whom, any key scope facts.
Rules:
- Every word in the blockquote must be true of the site as it is now. If a claim needs a source, the source is the site's own content — quote it or cut the claim.
- No adjectives doing the work of facts. "The largest directory" needs a number; "covering all 50 states" is a fact.
Checklist:
- [ ] H1 is the site name, nothing else.
- [ ] Blockquote is 2–3 sentences: what it is, for whom, scope — each sentence checkable against the site.
Evidence to record: the header as written, and the site page each sentence is sourced from.
## Step 4 — Group links into sections, every entry a real link
Group links into sections that mirror **how users ask questions** (services / practice areas, locations, resources) — not your internal folder tree. Every entry is a real markdown link with a human label and one line on what it answers:
```markdown
- [Business Lawyer](https://example.com/business-lawyer): what a visitor finds there.
```
Never a bare path:
```markdown
- Business Lawyer (/business-lawyer)
```
A bare path gives the model a table of contents it cannot follow — this exact bug shipped on a production directory site and scored a silent fail in the audit until it was caught.
Checklist:
- [ ] Every entry is `[Label](https://…)` — zero bare paths (check with `grep -c '](http'` against the entry count; they must match).
- [ ] Sections follow user questions, not the folder tree.
- [ ] Every entry has one line saying what it answers — a label with no line is a guess about what the page is for.
Evidence to record: the section list, and the link count vs entry count.
## Step 5 — Add a "Key facts" section
The specific, checkable facts you want AI answers to get right about your niche/site: typical price ranges, coverage ("all 50 states"), rules that vary, common misconceptions. Models cite concrete facts; give them yours instead of a competitor's.
Rules:
- Every fact is sourced from your own content — name the page it comes from.
- Ranges beat adjectives ("$200–$500/hr typical", not "affordable").
- A fact that is no longer true is worse than no fact: if the price changed, the file is stale (see Step 8).
Checklist:
- [ ] 2–3 facts, each with its source page named.
- [ ] No adjectives standing in for numbers.
Evidence to record: each fact with its source page.
## Step 6 — Link the sitemap last
Full URL, on its own line at the end. It's the escape hatch for anything you didn't list.
```markdown
## Sitemap
- [Sitemap](https://example.com/sitemap.xml)
```
Checklist:
- [ ] Sitemap link present, full URL, last section in the file.
Evidence to record: the sitemap URL as written.
## Step 7 — Publish and verify against the live file
Publish the file, then verify the **live** `/llms.txt` — not the repo copy. The repo copy proves nothing; the live file is what AI tools read.
```bash
curl -s https://example.com/llms.txt | grep -c '](http'
```
Checklist:
- [ ] Live file fetched; it starts with `#` and returns 200.
- [ ] Markdown link count is > 0 and roughly matches the section count (a count far below the entries means bare paths slipped back in).
- [ ] Every link returns 200. Check all of them — a dead link in the file is a dead end for the model. (Fetch each URL; a 404 is a failed check, not a typo to note and move on from.)
- [ ] `python3 tools/botview.py audit <site>` passes "llms.txt links to key pages" with a real link count. The audit checks presence (16 points) and ≥ 3 markdown links (6 points) — both must pass; see the [ai-visibility skill](../ai-visibility/SKILL.md) for the full score.
- [ ] Optional bonus: `llms-full.txt` with full content for small sites. It is a bonus, not a substitute for a correct llms.txt — a correct llms.txt with no llms-full.txt passes; a broken llms.txt with an llms-full.txt does not.
Evidence to record: the live link count, the per-link status results, and the audit's two llms.txt lines.
## Step 8 — Keep it current
When you add a content cluster, add its hub page here in the same deploy. A file that was right in October and stale in December teaches AI tools the old site. The re-check is Step 7, repeated: fetch live, count links, run the audit.
Checklist:
- [ ] The file's last-updated date is recorded in the output (Step "Output format").
- [ ] Any content added since that date is checked against the file — a new hub page with no entry is an open gap.
Evidence to record: last-updated date, and any new pages missing from the file.
## Output format
Return exactly this, filled in. Every field is filled or marked `n/a` with the reason — never left blank, never guessed.
```markdown
## llms.txt — <domain> (<date>)
### Live file
- Status: <200 / 404 / other — as fetched>
- Markdown links: <count> (entries: <count> — must match)
- Audit: llms.txt present <pass/fail>, links to key pages <pass/fail>
### The file
<the full llms.txt as published, verbatim>
### Link check
| Link | Status |
|---|---|
| <url> | <200 / 404 / other> |
### Key facts (with sources)
- <fact> — source: <site page>
### Last updated
<date> — next re-check when <what changes next: new cluster / price change / new section>
### Open gaps
1. <what is still missing, and which step it belongs to>
```
The file itself follows this template (keep it — it is the format that survives audits):
```markdown
# Site Name — llms.txt
> Site Name (https://example.com) is a [what it is] covering [scope].
> [One sentence on what makes it useful / different.] [Disclaimer line if the niche needs one.]
## Site sections
- [Homepage](https://example.com/): what a visitor finds there.
- [Main index](https://example.com/index): what it lists.
- [About](https://example.com/about)
## [Core topic sections]
- [Topic page](https://example.com/topic): one line on what it answers.
## Key facts AI assistants should know
- Fact one — concrete, checkable, sourced from your own content.
- Fact two — ranges beat adjectives ("$200–$500/hr typical", not "affordable").
## Sitemap
- [Sitemap](https://example.com/sitemap.xml)
```
## Traps
- **Bare paths.** The original failure: entries like `- Business Lawyer (/business-lawyer)` look complete and give the model nothing to follow. Count markdown links, not lines — the two numbers must match.
- **Shipping the generated draft as-is.** `botview.py generate` gives URL-as-label links, one flat section, no key facts, no sitemap link. It is a starting point (Step 2), not a file. Steps 3–6 are the work.
- **Verifying the repo copy instead of the live file.** The deploy is the file. If the live file is older than the repo copy, the audit scores the old one — fetch live, always.
- **A stale file.** A new content cluster with no hub-page entry, a price range that changed — the file teaches the old site. Step 8 is not optional.
- **llms-full.txt as a substitute.** The full-content file is a bonus for small sites. It does not fix a broken llms.txt — the audit's llms.txt checks still fail.
- **Facts from memory.** A key fact with no source page is an invented fact. If it cannot be sourced from the site's own content, cut it.