Skip to content

Conversation

@TechNickAI
Copy link
Owner

@TechNickAI TechNickAI commented Nov 18, 2025

Create new slash command to generate llms.txt files following the llmstxt.org specification. Command intelligently detects project type and places file in appropriate location (public/, static/, or root).

Features:

  • Auto-detects web framework and documentation structure
  • Generates proper markdown format (H1, blockquote, sections)
  • Organizes documentation links by priority
  • Handles updates to existing files
  • Follows llms.txt standard for helping LLMs navigate sites

Similar to generate-AGENTS-file but focused on external site navigation rather than internal project context.


Note

Introduces a new command spec to generate/update llms.txt with auto placement, structured markdown links, optimization, and update workflow.

  • Commands:
    • Add generate-llms-txt specification in .claude/commands/generate-llms-txt.md.
  • Core capabilities:
    • Detects project type and selects location for llms.txt (public/, static/, docs/, or root).
    • Generates structured markdown (H1, blockquote, sections, prioritized links) per llmstxt.org.
    • Optional llms-full.txt guidance (deferred by default).
    • Optimization and reporting steps (prioritization, link validation, size target, output preview).
    • Update mode for existing files with change detection and proposed diffs.
  • Guidance & references:
    • Location detection examples, recommended sections by project type, and final checklist.

Written by Cursor Bugbot for commit 0eff191. This will update automatically on new commits. Configure here.

Create new slash command to generate llms.txt files following the
llmstxt.org specification. Command intelligently detects project type
and places file in appropriate location (public/, static/, or root).

Features:
- Auto-detects web framework and documentation structure
- Generates proper markdown format (H1, blockquote, sections)
- Organizes documentation links by priority
- Handles updates to existing files
- Follows llms.txt standard for helping LLMs navigate sites

Similar to generate-AGENTS-file but focused on external site navigation
rather than internal project context.
3. Check for `docs/` directory if this appears to be a documentation site
4. Default to repository root if none found

The file should be placed where it will be accessible at the URL path `/llms.txt` when the site is deployed.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Documentation Site Priority Conflict

The location detection priority conflicts with the documentation site guidance. The sequential checks prioritize public/ and static/ unconditionally, but the examples section shows docs/ should be used for documentation sites. This creates ambiguity: if a documentation site has both public/ and docs/ directories, the algorithm would incorrectly choose public/. The docs/ check needs clearer prioritization logic for documentation-focused projects.

Fix in Cursor Fix in Web

@claude
Copy link

claude bot commented Nov 18, 2025

Pull Request Review: Generate llms.txt Command

Thank you for creating this PR! I've reviewed the new /generate-llms-txt command against the project's coding standards and prompt engineering best practices. Here's my feedback:

Strengths

Excellent LLM-to-LLM Prompt Structure:

  • Clear XML-based semantic tags (<workflow>, <philosophy>, <key-principles>) that help LLMs parse the command structure
  • Goal-focused approach rather than over-prescriptive step-by-step instructions
  • Consistent with existing command patterns (similar to generate-AGENTS-file.md)
  • Good use of examples showing the correct pattern (lines 58-86)

Comprehensive Coverage:

  • Thoughtful location detection logic for different project types
  • Well-organized section templates for different project types (API/Library, Web App, Documentation, CLI)
  • Update mode for handling existing files (lines 146-160)
  • Clear philosophy statement explaining the "why" behind llms.txt

Good Documentation:

  • Helpful examples for directory structure detection (lines 174-208)
  • Final checklist for validation (lines 242-253)
  • Clear target metrics (under 2KB, focused navigation)

Areas for Improvement

1. Formatting Violations (per prompt-engineering.mdc)

Lines 125-127 use bold formatting unnecessarily. According to the project's prompt engineering guidelines:

"Minimal markdown formatting: No excessive bold, italics, or decorative symbols. These waste tokens and add no semantic value for LLM comprehension."

Current:

1. **Prioritize ruthlessly**: Most important links first
2. **Be concise**: Brief descriptions, not full explanations
3. **Use relative paths**: For internal documentation (easier to maintain)

Should be:

1. Prioritize ruthlessly: Most important links first
2. Be concise: Brief descriptions, not full explanations
3. Use relative paths: For internal documentation (easier to maintain)

The same issue appears in lines 89-95 and 213-239. Bold formatting doesn't help LLM comprehension and increases token usage.

2. Semantic Tag Naming Consistency

The workflow uses numbered steps within sections that could be semantic. For example, in <analyze-project> (lines 34-38), the three numbered items could be wrapped in semantic tags like <detect-project-type>, <identify-documentation>, and <identify-links>.

Current structure:

<analyze-project>
1. Detect project type:
   - Check package.json...
2. Identify key documentation:
   - Look for README.md...
3. Identify important links:
   - GitHub repository URL...
</analyze-project>

Consider (more semantic):

<analyze-project>
<detect-project-type>
- Check package.json for web frameworks (Next.js, React, Vue, etc.)
- Check pyproject.toml, requirements.txt for Python frameworks (Django, Flask, FastAPI)
- Check for static site generators (Hugo, Jekyll, Gatsby, etc.)
- Check for documentation tools (MkDocs, Docusaurus, VitePress, etc.)
</detect-project-type>

<identify-documentation>
- Look for README.md
- Look for docs/ or documentation/ directory
- Look for CONTRIBUTING.md, ARCHITECTURE.md, API.md
- Check .cursor/rules/ for coding standards
- Check .claude/agents/ for specialized agents
- Check for API documentation (OpenAPI/Swagger files)
</identify-documentation>

<identify-links>
- GitHub repository URL (from package.json, git remote)
- Documentation site URL (from package.json, README)
- API reference locations
- Getting started guides
</identify-links>
</analyze-project>

This follows the guideline: "Use semantic names, not numbers: <task-preparation> not <phase-1>"

3. Minor: Example Code Block Could Show More Variety

The example structure (lines 58-86) shows a single pattern. Per the prompt engineering guidelines on pattern reinforcement:

"Flood with correct patterns: Show 5+ examples of the standard approach"

While one comprehensive example is fine for a template, consider showing 2-3 examples of actual llms.txt files for different project types (e.g., one for a Next.js app, one for a Python library, one for documentation site). This would help LLMs better understand the variations.

Code Quality

  • No bugs identified: The logic is sound and follows correct patterns
  • Security: No security concerns - this command generates documentation files
  • Performance: Appropriate for the task - file system operations are straightforward
  • Test coverage: N/A for command spec files, but consider documenting expected behavior in examples

Recommendation

Approve with minor changes. The command is well-structured and follows most project standards. The formatting issues are easy to fix and don't affect functionality. The semantic tag suggestion would improve LLM parsing but isn't critical.

Suggested Changes

  1. Remove bold formatting from list items (lines 89-95, 125-127, 213-239)
  2. Consider adding more semantic sub-tags within workflow sections
  3. Optional: Add 1-2 more concrete examples of llms.txt files for different project types

The command provides real value and follows the project's philosophy of creating LLM-friendly navigation. Great addition to the toolkit!


Files reviewed: .claude/commands/generate-llms-txt.md
Review based on: CLAUDE.md, prompt-engineering.mdc, git-interaction.mdc, common-personality.mdc

@TechNickAI TechNickAI merged commit 0eff191 into main Nov 18, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants