Skip to main content

llms.txt

Large language models work best when they have accurate, structured context about the libraries they’re working with. The llms.txt convention gives LLM-based tools a machine-friendly summary of your package: what it does, what its API looks like, and where to find the full documentation. Great Docs generates two files automatically during every build:

Both files are placed in the root of your documentation site and are available at predictable URLs (e.g., https://your-docs-site.com/llms.txt). No configuration is needed so if your project has an API reference defined in great-docs.yml, the files are generated automatically.

A project that writes its own files can publish them instead, and a project that wants neither can turn them off. See Supplying Your Own Files.

What Goes Into Each File

Great Docs generates both files from the same source data but at different levels of detail. The compact llms.txt is a quick-reference index whereas llms-full.txt is the complete picture.

llms.txt

The compact index follows the llms.txt format:

# my_package

> A short description of the package

## Docs

### API Reference

#### Data Processing
> Functions for loading and transforming data

- [read_csv](https://example.com/reference/read_csv.html): Read a CSV file into a DataFrame
- [to_parquet](https://example.com/reference/to_parquet.html): Write a DataFrame to Parquet format

#### Visualization
> Plotting and display utilities

- [plot](https://example.com/reference/plot.html): Create a plot from a DataFrame
- [show](https://example.com/reference/show.html): Display a plot in the browser

The content is derived from:

  • Package name and description from pyproject.toml
  • Section titles and descriptions from the api-reference.sections block in great-docs.yml
  • Docstring summaries (each docstring’s first paragraph, joined into one line) extracted by importing the package at build time
  • URLs constructed from the site-url in great-docs.yml or the Documentation URL in pyproject.toml

This file is typically small (a few KB) and is designed to give an LLM a quick overview of the API surface without overwhelming its context window.

When WebMCP is turned on, llms.txt ends with a “WebMCP tools” section, so an agent that reads the file learns that it can also call tools on the site’s pages. The last four tools appear when the site has a CLI reference, versions, a changelog or Agent Skills:

## WebMCP tools

An AI agent in a browser that supports WebMCP can call these tools on this site's pages. Results are JSON objects with absolute URLs.

- [WebMCP manifest](https://example.com/gd-webmcp.json): The site's sections, pages and API names, which the tools read

- `get_site_overview`: The package, its version and install commands, the site's sections and these tools
- `get_current_page`: The open page as Markdown, or as an outline of its headings
- `list_pages`: The site's pages grouped by section
- `get_page`: One page, or one section of it, as Markdown
- `search_docs`: Ranked matches for a query, by page section
- `list_api`: The documented objects grouped by reference section
- `get_api_reference`: One object's signature, parameters, returns and examples
- `get_cli_help`: The help text of a CLI command
- `list_versions`: The documented versions, with this page's URL in each
- `get_changelog`: One release's changelog entry, or the latest few
- `get_agent_skill`: A published SKILL.md and its companion files

Scripts on the site's pages can call the same tools:

```js
window.greatDocs.tools.list();
await window.greatDocs.tools.call("search_docs", { query: "install" });
```

llms-full.txt

The comprehensive file includes everything in llms.txt plus:

  • Function and class signatures with the parameters and annotations that the API reference shows
  • Recognized docstring sections, including edits and exclusions from object and docstring hooks
  • CLI help text for all commands and subcommands (if CLI documentation is enabled)
  • User guide content from all user guide pages, with YAML frontmatter stripped

This file can be large (tens of KB to hundreds of KB depending on your API surface and user guide size). It’s intended for tools that can handle larger context windows or that retrieve sections selectively.

How It Works

Great Docs generates both files after it prepares the API reference pages. It reuses the same objects, including any docstring edits and exclusions from object and docstring hooks, without running setup or those hooks again. The text export uses the built-in renderers. See API reference customization for examples of changes that carry through to the export.

The files follow the same parser and dynamic settings as the API reference. Keep the package available in the build environment, because dynamic introspection imports it. Without an API reference, Great Docs skips both files.

The build log shows the generation as a single step:

── Generate llms.txt / llms-full.txt ────────────────────
   ✔ Created llms.txt + llms-full.txt                <0.2s

Supplying Your Own Files

Some projects already generate their own llms.txt in a format they control, with aliases, deprecation markers or an example for each function. Point llms_txt.index or llms_txt.full at such a file and Great Docs publishes it unchanged in place of the generated one:

docs/great-docs.yml
llms_txt:
  enabled: true          # false publishes neither file
  index: llms.txt        # your own llms.txt, relative to great-docs.yml; null generates it
  full: llms-full.txt    # your own llms-full.txt; null generates it

The two settings are independent: you can supply llms.txt and let Great Docs generate llms-full.txt. A supplied file needs no API reference, so a site without one can still publish a hand-written llms.txt.

The homepage’s AI / Agents links and the Resources section of the generated SKILL.md follow what the site publishes. They link to a supplied file, to a generated one, or to neither when enabled is false.

The file must exist when the build starts. If it is missing, the build stops with an error that names the setting, rather than publishing the generated file under your file’s name. A pre_render script runs too late to write it, so generate the file before you run great-docs build. For example, Sciris writes both files with its own docs/make_api.py, which puts them beside great-docs.yml. It sets:

docs/great-docs.yml
llms_txt:
  index: llms.txt
  full: llms-full.txt

and runs its script before each build:

cd docs
python make_api.py
great-docs build --project-path ..

The build log then reports the copies in the llms step:

── Generate llms.txt / llms-full.txt ────────────────────
   ✔ Copied llms.txt; Copied llms-full.txt          <0.1s

Set llms_txt.enabled: false to publish neither file. llms.txt and llms-full.txt cannot be listed in site_root.files; llms_txt is the one place that decides what the site publishes under those names.

Relationship to Agent Skills

The llms.txt files and Agent Skills serve complementary purposes:

llms.txt / llms-full.txt SKILL.md
Audience Any LLM-based tool AI coding agents specifically
Content Auto-generated from code Hand-written (recommended) or auto-generated
Scope Full API surface + docs Curated cheat sheet: gotchas, decisions, patterns
Size Can be very large Under 500 lines (recommended)
Protocol Direct URL fetch .well-known discovery + install CLI

A typical setup uses both: llms-full.txt for comprehensive reference and SKILL.md for opinionated guidance that can’t be inferred from code alone. Skills often link to llms-full.txt in their Resources section so agents can pull in more detail when needed.

Verifying the Output

After a build, you can inspect the generated files directly:

# Check that both files were created
ls -la docs/_site/llms.txt docs/_site/llms-full.txt

# Preview the compact index
head -30 docs/_site/llms.txt

# Check the size of the full file
wc -l docs/_site/llms-full.txt

Or visit them on your deployed site:

https://your-docs-site.com/llms.txt
https://your-docs-site.com/llms-full.txt

If the files are missing after a build, check that llms_txt.enabled is not false, that your great-docs.yml has an api-reference block with at least one section, and that the package is importable in the build environment.

Next Steps

The llms.txt files are generated automatically with no configuration required. For more targeted AI agent context, consider authoring a SKILL.md alongside them.

  • Agent Skills: hand-crafted context for AI coding agents
  • WebMCP: tools that AI agents in the reader’s browser can call
  • Configuration: all great-docs.yml options
  • Building: the full build pipeline and step order
  • API Documentation: configuring the api-reference sections that feed into llms.txt