llmstxt-generator Plugin
Intelligent llms.txt file generator for Claude Code. Automatically generate, validate, and maintain llms.txt files for documentation sites using local Ollama LLM models.
Overview
The llms.txt standard (proposed by Answer.AI/Jeremy Howard, September 2024) provides a lightweight, Markdown-based format for making website content LLM-accessible at inference time. This plugin automates the creation and maintenance of llms.txt files by:
- Auto-analyzing documentation structure (Markdown, HTML, code comments)
- Generating structured llms.txt with Ollama LLM models
- Validating compliance with llmstxt.org specification
- Maintaining llms.txt automatically on documentation changes
- Editing llms.txt with guided workflows
Features
📝 Skills
- llms-format-guide - Comprehensive guide to llms.txt format, best practices, and token optimization
- ollama-integration - Setup and usage guide for Ollama model selection and integration
🎯 Commands
/llmstxt:generate - Interactive guided generation with project analysis
/llmstxt:validate - Validate format compliance, check links, score quality
/llmstxt:edit - Edit with text editor or interactive CLI menu
🤖 Agent
- llmstxt-analyzer - Proactively analyzes documentation and suggests generation/enhancement
🔗 Hooks
- post-commit - Auto-regenerates llms.txt when documentation changes (smart mode)
🐍 Python Script
- generate_llmstxt.py - Core engine that analyzes files and uses Ollama for generation
Prerequisites
Required
- Claude Code (v1.0.0+)
- Ollama - Local LLM runtime
- Installation: https://ollama.ai
- Verify:
ollama list (shows available models)
- Default: runs on
http://localhost:11434
Optional
- Python 3.8+ (for standalone script usage)
- uv (for automatic dependency resolution in script)
Installation
Via Claude Code Plugins Directory
# Copy plugin to Claude Code plugins directory
cp -r llmstxt-generator ~/.claude/plugins/
# Or use symlink for development
ln -s $(pwd)/llmstxt-generator ~/.claude/plugins/
Quick Test
# Verify plugin loads
cc --plugin-dir ./llmstxt-generator --list-commands | grep llmstxt
Configuration
Settings File
Create .claude/llmstxt-generator.local.md in your project:
# llmstxt-generator Configuration
## Ollama Settings
- host: http://localhost:11434
- default_model: llama2
## Generation Preferences
- output_path: ./llms.txt
- include_patterns:
- "**/*.md"
- "**/*.html"
- "src/**/*.{py,ts,swift}"
- exclude_patterns:
- "node_modules/**"
- ".git/**"
- "build/**"
## Style Preferences
- tone: technical
- verbosity: concise
- include_external_links: true
- max_links_per_section: 10
All settings are optional. Defaults will be used if not specified.
Usage
Generate llms.txt (Interactive)
/llmstxt:generate
This triggers an interactive workflow:
- Select project directory to analyze
- Choose Ollama model (auto-detected options)
- Specify output location
- Choose generation style (concise/comprehensive)
- Review generated llms.txt
- Auto-validate against spec
- Option to edit or confirm
Validate Existing llms.txt
/llmstxt:validate
Validates:
- Format compliance with llmstxt.org spec
- All links are accessible (HTTP checks)
- Quality scoring (description clarity, structure quality)
- Suggestions for improvement
Edit llms.txt
/llmstxt:edit
Choose editing mode:
- Text Editor - Opens llms.txt in
$EDITOR
- CLI Menu - Interactive menu to add/remove/edit sections
Using the Python Script Directly
# With uv (automatic dependencies)
uvx --from llmstxt-generator generate_llmstxt.py \
--project /path/to/project \
--model llama2 \
--output ./llms.txt
# With Python directly
python scripts/generate_llmstxt.py \
--project /path/to/project \
--model llama2 \
--output ./llms.txt \
--verbose
Agent Auto-Suggestions
The agent automatically:
- Detects when a project has documentation but no llms.txt
- Suggests generating an initial llms.txt
- Detects existing llms.txt files
- Offers to enhance/refresh existing files
- Runs on project load (with opt-out)
Examples
Example 1: Generate for FastHTML-style Docs
# FastHTML
> FastHTML is a python library which brings together Starlette, Uvicorn, HTMX, and fastcore's FT into a library for creating server-rendered hypermedia applications.
## Docs
- [FastHTML quick start](https://fastht.ml/docs/tutorials/quickstart.html.md): Quick overview of FastHTML features
- [HTMX reference](https://htmx.org/reference/): Complete HTMX attribute reference
## Examples
- [Todo list application](https://github.com/AnswerDotAI/fasthtml/blob/main/examples/adv_app.py): Complete CRUD app walkthrough
## Optional