Generate llms.txt files to train large language models on your Starlight documentation website
open sourceMITself-hostablefree
starlight-llms-txt is a plugin for Starlight docs sites that writes llms.txt files at build time: llms.txt as the entry point, llms-full.txt with the whole documentation as Markdown, llms-small.txt trimmed for small context windows, and any custom subsets you define by path globs (useful for large sites). It renders each page and converts the HTML to Markdown, so you can strip elements with CSS selectors, drop asides and <details> from the small file, and promote or demote pages in the order; a raw mode skips rendering for speed and is needed when pages use React, Vue or Svelte components. It only generates these files: it adds no buttons to the pages. It is written by Chris Swithinbank, who is also the author of Starlight's own npm package.
Problems it solves
- give AI assistants a single Markdown file with all of our documentation in it
- publish an llms.txt index for our Astro docs site automatically on every build
- make a smaller version of our docs that fits in a model's context window
- split a large documentation site into separate AI-readable bundles for the API reference and the guides
- coding agents scrape our docs HTML badly; give them clean Markdown instead
- strip navigation, callouts and collapsible sections out of the docs text we feed to LLMs
- control which docs pages come first when an agent reads the whole site as one file
- keep the AI-readable copy of our docs in sync with the site without a separate export script
Features
- generates llms.txt, llms-full.txt and llms-small.txt at build time
- custom documentation sets from page slugs or globs, each linked from llms.txt
- project name, description, details and optional links for the llms.txt entry point
- promote and demote patterns to order pages; exclude pages from the small file
- minify options for llms-small.txt: drop note and tip asides and <details>, collapse whitespace
- custom CSS selectors to remove elements before conversion, per file
- raw content mode that skips rendering for faster builds
- configurable separator between pages
Limitations
Alternatives
The same job
These do what starlight-llms-txt does.
- Starlight Page Actions A Starlight plugin that adds page action buttons to your documentation
- starlight-llm-actions Starlight plugin: Page Actions dropdown with Copy/View/PDF and Open-in-LLM buttons