Back to Problem Dictionary
The Problem

How to help AI bots understand your site by generating a /llms.txt file

You are looking for a way to help AI bots understand your site by generating a /llms.txt file. Most people would tell you to buy a SaaS subscription for this.

We say: Build it yourself for free.

The Automation Blueprint

Copy the logic below into a tool like Gemini CLI or Claude Code. It includes the role, constraints, and multi-step workflow needed to help AI bots understand your site by generating a /llms.txt file.


# What This Does
Just like `robots.txt` tells crawlers what to do, `llms.txt` gives Large Language Models (like ChatGPT, Claude, Gemini) a clean, concentrated summary of your website's content so they can answer questions about you more accurately.

# What You Need
- Your documentation files (Markdown) or a list of key public pages
- Node.js environment

# What You Get
- A `public/llms.txt` file following the proposed standard
- Better visibility in AI-generated answers

# How to Use
1. Locate your documentation or key content
2. Open Claude Code, Gemini CLI, or Cursor
3. Copy and paste the prompt below
4. Run the script

---

# Prompt

You are an AI Optimization Specialist. Your job is to build a script that generates an `llms.txt` file for this project.

**Phase 1: Setup**
- Locate the documentation folder (e.g., `docs/` or `content/`).
- If no docs exist, create a dummy `docs/intro.md`.

**Phase 2: The Generator Script (`generate-llms.js`)**
Create a script that:
1. **Header:** Writes the standard header explaining the project name and summary.
2. **File Scanning:** Recursively reads all `.md` files in the documentation folder.
3. **Content Cleaning:**
   - Removes frontmatter (metadata between `---`).
   - Removes excessive newlines.
   - Adds a clear title for each section based on the filename or H1.
4. **Formatting:** Concatenates everything into a single, clean text file.
   - Use strict Markdown formatting.
   - Limit the total character count (optional, e.g., < 1MB) to fit in context windows.

**Phase 3: Output**
- Save the result to `public/llms.txt`.
- Print: "✅ Generated llms.txt context file for AI agents."

Start now.

Want the Full Library?

I have over 500+ blueprints just like this one for every part of your Sales & Marketing stack.

Browse All 500 Blueprints