llms-maintainer — Claude Code subagent: generate llms.txt
A subagent that builds and updates the llms.txt roadmap from your site structure. Handy after a build or a routing change.
npx claude-code-templates@latest --agent ai-specialists/llms-maintainerWhat llms-maintainer does
llms-maintainer walks your project and writes llms.txt, the page map AI crawlers read. It starts by detecting the framework from config files: Astro and Nuxt get public/llms.txt, Svelte, Hugo and Docusaurus get static/llms.txt, VitePress gets <srcDir>/public/llms.txt, Jekyll gets llms.txt at the repo root. Then it looks for the base URL in environment variables or package.json, and asks you for the domain if it finds neither.
Next it scans the content directories and pulls titles and descriptions from metadata, front-matter or <Head>. Titles are trimmed to 70 characters, descriptions to 120. Paths like /api/, /admin/ and test files are skipped. Past roughly 50 candidates it switches to batched Grep extraction to stay inside the turn budget. Anything between # BEGIN CUSTOM and # END CUSTOM is left untouched.
The agent asks for confirmation before committing and never pushes on its own. It only creates llms-full.txt when you ask for it. Above 500 entries it warns you and asks how to curate. It runs on the haiku model with Read, Write, Bash, Grep and Glob.
What it helps with
- generate llms.txt after a production build
- refresh the page map after routes change
- pull titles and descriptions out of page metadata
- set up navigation for AI crawlers
- keep hand-written blocks intact on rewrite
Example prompts for the agent
- Generate llms.txt for this project
- Update llms.txt after the route changes
- Check whether llms.txt is current and add the new pages
How to install llms-maintainer
1claude-code-templates
npx claude-code-templates@latest --agent ai-specialists/llms-maintainer2Manually: put the files in place
.claude/agents/llms-maintainer.mdFor all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention
Manually: put the files in place
.codex/agents/llms-maintainer.tomlCodex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/
Manually: put the files in place
.cursor/agents/llms-maintainer.mdCursor also reads .claude/agents/
Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean
Questions about llms-maintainer
How do I install llms-maintainer in Claude?
Use the templates CLI: npx claude-code-templates@latest --agent ai-specialists/llms-maintainer. The agent file then sits at .claude/agents/llms-maintainer.md.
What does llms-maintainer do?
It detects your framework, scans content pages and writes or updates llms.txt with links and descriptions. Your custom blocks inside the file survive the rewrite.
What do I need before running it?
A base URL for the site. The agent reads it from environment variables or package.json, and asks you for the domain if neither has it. Without that URL the page entries can't be built.