Generating llms.txt
What llms.txt is
Section titled “What llms.txt is”The llms.txt spec defines a markdown file at /llms.txt on a website that helps LLMs understand what the site contains. Instead of parsing HTML, an LLM fetches /llms.txt and gets a structured summary with links to individual pages.
The file uses a strict markdown format:
# Site Title
> One-line summary.
Context paragraph — tech stack, key concepts, anything the LLM needs before reading individual docs.
## Section Name
- [Doc Title](/path/to/doc/): Short description of the doc.Where it lives
Section titled “Where it lives”public/llms.txt — Astro serves everything in public/ as static files at the site root, so this becomes /llms.txt in the deployed site.
How it’s generated
Section titled “How it’s generated”The /update-llms-txt skill reads every .mdx file under src/content/docs/<project-slug>/, parses frontmatter for title and description, groups docs by domain directory, and writes the result to public/llms.txt.
To run it:
/update-llms-txt electron-terminalThe skill:
- Collects all doc files matching the project slug
- Reads
astro.config.mjsfor the site URL (uses relative paths if the URL is a placeholder) - Groups docs by domain (getting-started, architecture, terminal, ui, tooling)
- Orders within each domain by Diataxis category: tutorials, guides, reference, resources
- Writes each entry as
- [Title](/path/): first sentence of description - Optionally generates
public/llms-full.txtwith concatenated full doc content if under 100KB
When to update
Section titled “When to update”Update public/llms.txt whenever documentation changes:
- New doc written — add the entry in the right section
- Doc removed — delete the line
- Doc renamed or moved — update the link path
- Major description rewrite — update the description text
For a single doc addition, editing public/llms.txt by hand is faster than running the skill. The skill is better after batch operations like /plan-docs or when many docs change at once.
Manual editing
Section titled “Manual editing”The format is simple enough to edit directly. Each entry follows this pattern:
- [Doc Title](/project-slug/domain/category/doc-name/): Short description.Keep descriptions to one sentence — long entries defeat the purpose of a scannable index. The description should tell an LLM whether the doc is relevant to its current task, not summarize the full content.
Verifying
Section titled “Verifying”Every link in llms.txt should resolve to a real doc. A quick check:
grep -oP '\(/[^)]+/\)' public/llms.txt | tr -d '()' | while read path; do file="src/content/docs${path%/}.mdx" [ -f "$file" ] || echo "BROKEN: $path -> $file"done