Skip to content

Commit fc72d33

Browse files
Nick Sullivanclaude
andcommitted
♻️ Refactor generate-llms-txt to follow LLM-to-LLM communication best practices
Remove docs/ directory support and simplify location detection to public/ → static/ → root. Eliminate overly prescriptive step-by-step instructions in favor of goal-focused directives that trust the executing LLM's capabilities. Changes: - Remove docs/ from location detection logic (user preference) - Replace numbered steps with clear objectives and outcomes - Consolidate workflow sections into semantic XML structure - Add two complete, consistent examples showing desired pattern - Remove anti-patterns and "don't do this" guidance - Simplify from prescriptive algorithms to goal statements - Reduce file from 253 to 192 lines while improving clarity Fixes Cursor bot medium severity issue about documentation site priority conflict by removing docs/ entirely. Aligns with prompt-engineering.mdc principles: goals over process, pattern consistency, and trusting LLM capabilities. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 0eff191 commit fc72d33

File tree

1 file changed

+118
-179
lines changed

1 file changed

+118
-179
lines changed

.claude/commands/generate-llms-txt.md

Lines changed: 118 additions & 179 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Generate or update llms.txt file to help LLMs understand and naviga
44

55
# Generate llms.txt
66

7-
Creates or updates `llms.txt` - a standardized file that helps Large Language Models understand and navigate your website or documentation at inference time.
7+
Creates or updates llms.txt - a standardized file that helps Large Language Models understand and navigate your website or documentation at inference time.
88

99
<philosophy>
1010
llms.txt provides LLM-friendly navigation and context for websites and documentation. It should be:
@@ -16,44 +16,21 @@ llms.txt provides LLM-friendly navigation and context for websites and documenta
1616
Think: "What does an LLM need to understand and effectively use this site?"
1717
</philosophy>
1818

19-
<workflow>
20-
<determine-location>
21-
Detect the appropriate location for llms.txt based on project type:
22-
23-
1. Check for `public/` directory (Next.js, React, Vue, many static site generators)
24-
2. Check for `static/` directory (Django, Flask, Hugo)
25-
3. Check for `docs/` directory if this appears to be a documentation site
26-
4. Default to repository root if none found
27-
28-
The file should be placed where it will be accessible at the URL path `/llms.txt` when the site is deployed.
29-
</determine-location>
30-
31-
<analyze-project>
32-
Understand the project structure to generate relevant content:
33-
34-
1. Detect project type:
35-
- Check `package.json` for web frameworks (Next.js, React, Vue, etc.)
36-
- Check `pyproject.toml`, `requirements.txt` for Python frameworks (Django, Flask, FastAPI)
37-
- Check for static site generators (Hugo, Jekyll, Gatsby, etc.)
38-
- Check for documentation tools (MkDocs, Docusaurus, VitePress, etc.)
39-
40-
2. Identify key documentation:
41-
- Look for README.md
42-
- Look for docs/ or documentation/ directory
43-
- Look for CONTRIBUTING.md, ARCHITECTURE.md, API.md
44-
- Check .cursor/rules/ for coding standards
45-
- Check .claude/agents/ for specialized agents
46-
- Check for API documentation (OpenAPI/Swagger files)
47-
48-
3. Identify important links:
49-
- GitHub repository URL (from package.json, git remote)
50-
- Documentation site URL (from package.json, README)
51-
- API reference locations
52-
- Getting started guides
53-
</analyze-project>
54-
55-
<generate-structure>
56-
Create llms.txt following the standard format:
19+
<objective>
20+
Generate or update an llms.txt file that helps LLMs navigate the project's documentation and resources. Place the file where it will be accessible at /llms.txt when deployed.
21+
</objective>
22+
23+
<file-placement>
24+
Determine the appropriate location:
25+
- public/ directory for Next.js, React, Vue, and most static site generators
26+
- static/ directory for Django, Flask, Hugo
27+
- Repository root as fallback
28+
29+
Choose the location that makes the file accessible at /llms.txt when the site is deployed.
30+
</file-placement>
31+
32+
<content-structure>
33+
Follow the llmstxt.org standard format:
5734

5835
```markdown
5936
# Project Name
@@ -85,169 +62,131 @@ Additional context paragraph (optional): More detailed information about the pro
8562
- [Advanced Topics](url): Brief description
8663
```
8764

88-
Structure guidelines:
89-
- **H1 title** (required): Project or site name
90-
- **Blockquote** (recommended): Short summary with key information for understanding the rest of the file
91-
- **Additional context** (optional): Detailed background if needed
92-
- **Sections** (H2 headers): Organize documentation by category
93-
- Common categories: Documentation, Guides, Reference, API, Examples, Contributing
94-
- Use "Optional" section for less critical resources
95-
- **Links**: Markdown format with optional brief descriptions
96-
- Use relative paths for internal documentation
97-
- Use absolute URLs for external resources
98-
- Keep descriptions concise
99-
100-
Priority order:
101-
1. Getting started / quickstart guides
65+
Structure requirements:
66+
- H1 title with project name
67+
- Blockquote summary for quick context
68+
- H2 sections organizing documentation by category
69+
- Markdown links with concise descriptions
70+
- "Optional" section for less critical resources
71+
72+
Link format:
73+
- Use relative paths for internal documentation
74+
- Use absolute URLs for external resources
75+
- Prioritize most important links first within each section
76+
</content-structure>
77+
78+
<content-discovery>
79+
Identify documentation and resources to include:
80+
- README.md and primary documentation
81+
- Getting started guides and tutorials
82+
- API documentation and references
83+
- Architecture and technical documentation
84+
- Contributing guidelines
85+
- Coding standards from .cursor/rules/
86+
- Specialized agents from .claude/agents/
87+
88+
Organize by importance:
89+
1. Getting started and quickstart guides
10290
2. Core concepts and tutorials
10391
3. API reference and technical documentation
10492
4. Advanced topics and edge cases
10593
5. Contributing and community resources
106-
</generate-structure>
10794

108-
<create-llms-full-txt>
109-
Optionally create llms-full.txt alongside llms.txt:
95+
Target file size: Under 2KB for focused navigation.
96+
</content-discovery>
11097

111-
- `llms.txt` - Lightweight navigation file (links to docs)
112-
- `llms-full.txt` - Comprehensive file with full documentation content
98+
<update-workflow>
99+
When llms.txt already exists:
100+
- Analyze project for new documentation, features, or structural changes
101+
- Preserve existing organization unless changes warrant restructuring
102+
- Present proposed updates with rationale before modifying
103+
- Show diff of changes for review
104+
</update-workflow>
113105

114-
For most projects, start with just `llms.txt`. Only create `llms-full.txt` if:
115-
- Project has extensive documentation that would benefit from a single-file view
116-
- Documentation is already in markdown format
117-
- Total size would be reasonable (< 100KB)
106+
<examples>
107+
Next.js project with comprehensive docs:
118108

119-
Skip llms-full.txt creation for now unless user specifically requests it.
120-
</create-llms-full-txt>
109+
```markdown
110+
# AI Coding Config
121111

122-
<optimize-for-llms>
123-
Review and optimize the generated content:
112+
> Plugin marketplace for Claude Code and Cursor providing reusable coding standards, workflows, and AI agents.
124113

125-
1. **Prioritize ruthlessly**: Most important links first
126-
2. **Be concise**: Brief descriptions, not full explanations
127-
3. **Use relative paths**: For internal documentation (easier to maintain)
128-
4. **Organize logically**: Group related topics together
129-
5. **Mark optional content**: Use "Optional" section for nice-to-have resources
130-
6. **Keep it current**: Link to actively maintained documentation
131-
7. **Test URLs**: Ensure all links will be valid when deployed
114+
Provides a marketplace of plugins that bundle coding rules, slash commands, and specialized agents. Plugins maintain single source of truth through symlinks.
132115

133-
Target: Under 2KB for most projects (focused navigation, not content duplication)
134-
</optimize-for-llms>
116+
## Documentation
135117

136-
<report>
137-
Show the user:
138-
1. Where the file will be created (with explanation of why)
139-
2. The generated content
140-
3. File size
141-
4. Suggestions for what to add if content seems sparse
142-
5. Next steps (how to verify it works, how to update it)
143-
</report>
144-
</workflow>
118+
- [Getting Started](README.md): Installation and basic setup
119+
- [Plugin Structure](docs/plugin-structure.md): How plugins are organized
120+
- [Available Plugins](plugins/README.md): Browse the marketplace
145121

146-
<update-mode>
147-
When `llms.txt` already exists:
122+
## Development
148123

149-
1. Read existing file to understand current content
150-
2. Analyze project for changes:
151-
- New documentation files added
152-
- Changed project structure
153-
- Updated README or documentation
154-
- New major features or guides
155-
3. Suggest additions or updates with rationale
156-
4. Show diff of proposed changes
157-
5. Let user review before updating
124+
- [Creating Plugins](docs/creating-plugins.md): Build your own plugins
125+
- [Bootstrap Script](scripts/bootstrap.sh): Automated setup
126+
- [Git Workflow](.cursor/rules/git-interaction.mdc): Version control standards
158127

159-
Preserve existing structure and organization unless there's a good reason to change it.
160-
</update-mode>
128+
## Reference
161129

162-
<key-principles>
163-
Navigation over duplication: Link to documentation, don't duplicate it.
130+
- [Cursor Rules](.cursor/rules/): Coding standards and conventions
131+
- [Claude Commands](.claude/commands/): Available slash commands
132+
- [AI Agents](.claude/agents/): Specialized agent capabilities
164133

165-
LLM-friendly format: Markdown is the most widely understood format for LLMs.
134+
## Optional
166135

167-
Prioritize ruthlessly: LLMs have limited context - put most important content first.
136+
- [Contributing](CONTRIBUTING.md): How to contribute
137+
- [Heart-Centered AI](.cursor/rules/heart-centered-ai-philosophy.mdc): Philosophy
138+
```
168139

169-
Keep it current: Outdated links are worse than missing links.
140+
Django API project:
170141

171-
Test the result: After generating, consider "Would an LLM understand how to navigate this site?"
172-
</key-principles>
142+
```markdown
143+
# Payment Processing API
173144

174-
<location-detection-examples>
175-
Example directory structures and where to place llms.txt:
145+
> RESTful API for processing payments across multiple providers with unified interface.
176146

177-
Next.js project:
178-
```
179-
project/
180-
├── public/ ← Place llms.txt here
181-
├── src/
182-
└── package.json
183-
```
147+
Supports Stripe, PayPal, and Square with automatic failover and transaction reconciliation.
184148

185-
Django project:
186-
```
187-
project/
188-
├── static/ ← Place llms.txt here
189-
├── myapp/
190-
└── manage.py
191-
```
149+
## Documentation
192150

193-
Documentation site:
194-
```
195-
project/
196-
├── docs/ ← Consider placing here if this is the deployed location
197-
├── README.md
198-
└── mkdocs.yml
199-
```
151+
- [Quick Start](README.md#quick-start): Get running in 5 minutes
152+
- [API Overview](docs/api-overview.md): Core concepts and authentication
153+
- [API Reference](docs/api-reference.md): Complete endpoint documentation
200154

201-
Plain repository (no public/static):
202-
```
203-
project/
204-
├── llms.txt ← Place in root
205-
├── README.md
206-
└── src/
155+
## Guides
156+
157+
- [Payment Flow](docs/guides/payment-flow.md): Understanding the payment lifecycle
158+
- [Webhooks](docs/guides/webhooks.md): Handling payment events
159+
- [Testing](docs/guides/testing.md): Using test mode
160+
161+
## Reference
162+
163+
- [Configuration](docs/configuration.md): Environment variables and settings
164+
- [Error Codes](docs/errors.md): Error handling and status codes
165+
- [Rate Limits](docs/rate-limits.md): API throttling and quotas
166+
167+
## Optional
168+
169+
- [Architecture](docs/architecture.md): System design
170+
- [Contributing](CONTRIBUTING.md): Development setup
207171
```
208-
</location-detection-examples>
209-
210-
<common-sections>
211-
Recommended section organization based on project type:
212-
213-
**API/Library Project:**
214-
- Documentation (getting started, core concepts)
215-
- API Reference
216-
- Examples
217-
- Guides
218-
- Optional (advanced topics, contributing)
219-
220-
**Web Application:**
221-
- Documentation (overview, quickstart)
222-
- User Guides
223-
- API Documentation (if applicable)
224-
- Architecture
225-
- Optional (deployment, troubleshooting)
226-
227-
**Documentation Site:**
228-
- Getting Started
229-
- Tutorials
230-
- Reference
231-
- Guides
232-
- Optional (FAQ, community)
233-
234-
**Developer Tool/CLI:**
235-
- Documentation (installation, quickstart)
236-
- Commands Reference
237-
- Configuration
238-
- Examples
239-
- Optional (plugins, advanced usage)
240-
</common-sections>
241-
242-
<final-checklist>
243-
- File location is appropriate for project type
244-
- H1 title reflects project name
245-
- Blockquote provides clear project summary
246-
- Sections are logically organized
247-
- Most important links come first
248-
- "Optional" section for less critical resources
249-
- Link descriptions are concise and helpful
250-
- All URLs will be valid when site is deployed
251-
- File is under 2KB (focused navigation)
252-
- Format follows llms.txt specification from llmstxt.org
253-
</final-checklist>
172+
</examples>
173+
174+
<quality-criteria>
175+
Ensure the generated file:
176+
- Places most important resources first
177+
- Uses concise, helpful descriptions
178+
- Links to documentation rather than duplicating content
179+
- Contains valid URLs that work when deployed
180+
- Stays under 2KB for optimal LLM processing
181+
- Follows llmstxt.org specification
182+
- Provides clear navigation for LLMs discovering the site
183+
</quality-criteria>
184+
185+
<output>
186+
Present to the user:
187+
- Chosen file location with rationale
188+
- Complete generated content
189+
- File size
190+
- Suggestions for additional content if sparse
191+
- Instructions for verification and updates
192+
</output>

0 commit comments

Comments
 (0)