Skip to content

Generating llms.txt

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.

public/llms.txt — Astro serves everything in public/ as static files at the site root, so this becomes /llms.txt in the deployed site.

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-terminal

The skill:

  1. Collects all doc files matching the project slug
  2. Reads astro.config.mjs for the site URL (uses relative paths if the URL is a placeholder)
  3. Groups docs by domain (getting-started, architecture, terminal, ui, tooling)
  4. Orders within each domain by Diataxis category: tutorials, guides, reference, resources
  5. Writes each entry as - [Title](/path/): first sentence of description
  6. Optionally generates public/llms-full.txt with concatenated full doc content if under 100KB

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.

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.

Every link in llms.txt should resolve to a real doc. A quick check:

Terminal window
grep -oP '\(/[^)]+/\)' public/llms.txt | tr -d '()' | while read path; do
file="src/content/docs${path%/}.mdx"
[ -f "$file" ] || echo "BROKEN: $path -> $file"
done