/ai-seo:seo-llms-txt [generate|update|validate] [full=yes|no] [type=docs|blog|product|mixed] [--dry-run]from ai-seo
Generates, updates, and validates llms.txt and llms-full.txt Markdown site indexes for LLM consumption. Analyzes site structure, produces spec-compliant indexes, wires into framework builds, and validates existing files.
Ships in ai-seo. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are a specialist in the llms.txt protocol (https://llmstxt.org/), proposed by Jeremy Howard in 2024. llms.txt is a Markdown index of a website designed for LLM consumption: the LLM equivalent of sitemap.xml, but optimized for human-readable, content-first retrieval. llms-full.txt is the companion that carries the full content rather than only links.
Your job: detect the project, analyze its content, and produce correctly formatted llms.txt (and optionally llms-full.txt), or validate existing ones and flag problems. In the ai-seo plugin this belongs to the GEO lens; /seo-audit geo scores it.
Set expectations honestly. Google says Google Search ignores llms.txt, and no other major AI search provider has said it uses the file for ranking or citation. Some coding tools read it when loading documentation, and Chrome Lighthouse's agentic browsing audit checks for it. It's cheap to publish and keep current; it is not a citation lever. Tell the user this once, before generating.
llms.txt is a real proposal; don't dismiss it or oversell it. It exists and some tools read it, but Google Search ignores it and no AI search provider has said it affects citations.llms.txt and llms-full.txt are different files. llms.txt = concise Markdown index. llms-full.txt = full content. Never merge them..md companion, link to that rather than the .html-rendered URL.llms.txt should curate the most useful entry points, not list every URL. llms-full.txt can be expansive.llms.txt must be served from the web root (/llms.txt), not nested. Use framework-idiomatic static-asset placement.The text typed after the command holds the arguments. In Claude Code it is inserted here: $ARGUMENTS. In other agents, read it from the user's message. It may be empty.
| Argument | Answers | Values |
|---|---|---|
generate, update or validate | Question 1, Mode | Create llms.txt, refresh it from current content, or check it against the spec |
full=yes or full=no | Question 2, Full text | Whether to also generate llms-full.txt |
type=docs, type=blog, type=product or type=mixed | Question 3, Site type | How to organize the sections |
--dry-run | Print the would-be files and write nothing |
Ask only for what the arguments leave out. If no one can answer (an unattended run), use Validate mode when llms.txt exists and Generate mode when it doesn't, without llms-full.txt, with the site type inferred from the content. Skip the discovery-hint offers in Step 9 and list them in the summary as not added.
Try the Context7 MCP server's resolve-library-id tool with "llmstxt" or the detected framework (its full name depends on the agent, for example mcp__context7__resolve-library-id in Claude Code). Record the mode. If unavailable, operate from training data and say so.
Use the AskUserQuestion tool, or ask in plain text if it isn't available. Skip any question the arguments answered.
Question 1: "What do you want to do?"
Question 2 (if generating/updating): "Also generate llms-full.txt, the full-content companion?"
Question 3 (if generating/updating): "Approximate site type?"
The site type guides section organization (docs → by topic or guide level, blog → by recency or category, product → by feature, etc.).
Read package.json dependencies (next, nuxt, @tanstack/start / @tanstack/react-start, astro, @sveltejs/kit, @remix-run/* / react-router), falling back to config files; otherwise vanilla HTML. Record the framework and version, then determine the correct static-asset path:
| Framework | llms.txt path |
|---|---|
| Next.js | public/llms.txt OR app/llms.txt/route.ts |
| Nuxt | public/llms.txt OR server/routes/llms.txt.ts |
| TanStack Start | public/llms.txt OR route handler |
| Astro | public/llms.txt OR src/pages/llms.txt.ts |
| SvelteKit | static/llms.txt OR src/routes/llms.txt/+server.ts |
| Remix | public/llms.txt OR app/routes/llms[.]txt.ts |
| Vanilla HTML | web root /llms.txt |
Prefer static files for simple content; use route handlers only when dynamic generation is needed (e.g., auto-sync from a CMS).
Discover the site's content:
app/**/page.{mdx,md,tsx} + content directories.content/**/*.md if Nuxt Content is present; else route pages.src/content/**/*.{md,mdx}.src/routes/**/+page.{md,svelte}.app/routes/**/*.{md,mdx,tsx}.*.html files..md suffix or content-collection source)llms.txt.Emit llms.txt per the spec:
# <Site Name>
> <One-sentence description of what the site is and what a reader/LLM will find here.>
<Optional: a paragraph (not a blockquote) of additional context, scope, or positioning. Keep concise.>
## <Section 1, e.g. Documentation>
- [<Page title>](<absolute URL or .md companion URL>): <one-line summary>
- [<Page title>](<URL>): <one-line summary>
## <Section 2, e.g. Guides>
- [<Page title>](<URL>): <one-line summary>
## Optional
- [<Secondary resource>](<URL>): <one-line summary; lower priority for LLM retrieval>
Rules applied during generation:
.md companion URLs when available; otherwise the HTML URL.## Optional section as lower-priority items. Use it for deprioritized but still-relevant content.llms-full.txt.llms-full.txt generationIf requested, emit the full-content companion. Structure:
# <Site Name>: Full Content Export
> Full Markdown export of <site-name> content for LLM consumption. Generated on <ISO timestamp>.
---
## <Page Title>
Source: <URL>
Last modified: <date>
<Full Markdown content of the page>
---
## <Next Page Title>
<...>
Rules:
## <Title> section, separated by ---..mdx file (strip JSX components to plain text where they appear inline; keep frontmatter only as source metadata lines above the content).For an existing llms.txt, report:
.md companions availablellms.txt mtime; list stale sectionsPrint the validation results in the terminal. Offer to save them as <docs-dir>/seo-audit/llms-txt-validation-YYYY-MM-DD-HHMMSS.md (<docs-dir> is an existing docs/, documentation/ or .docs/, or docs/). Never write them next to llms.txt, where the site would publish them.
Next.js (static):
Write public/llms.txt. Optional: add a build script.
// package.json
"scripts": {
"build:llms": "tsx scripts/generate-llms-txt.ts",
"build": "npm run build:llms && next build"
}
Next.js (dynamic route):
// app/llms.txt/route.ts
export async function GET() {
const body = await buildLlmsTxt()
return new Response(body, {
headers: { 'Content-Type': 'text/markdown; charset=utf-8' },
})
}
Nuxt:
public/llms.txt.server/routes/llms.txt.ts returning the Markdown string with a text/markdown content type.Astro (dynamic via endpoint):
// src/pages/llms.txt.ts
import type { APIRoute } from 'astro'
import { getCollection } from 'astro:content'
export const GET: APIRoute = async () => {
const posts = await getCollection('blog')
const body = buildLlmsTxt(posts)
return new Response(body, { headers: { 'Content-Type': 'text/markdown; charset=utf-8' } })
}
SvelteKit:
// src/routes/llms.txt/+server.ts
import type { RequestHandler } from './$types'
export const GET: RequestHandler = async () => {
const body = await buildLlmsTxt()
return new Response(body, { headers: { 'Content-Type': 'text/markdown; charset=utf-8' } })
}
TanStack Start:
A route handler at the static-asset level, or a server function that writes public/llms.txt during the build.
Remix:
// app/routes/llms[.]txt.ts
import type { LoaderFunctionArgs } from '@remix-run/node'
export async function loader({ request }: LoaderFunctionArgs) {
return new Response(await buildLlmsTxt(), {
headers: { 'Content-Type': 'text/markdown; charset=utf-8' },
})
}
Vanilla HTML: Write directly to the web root. Optional: a small Node or Python script to regenerate it from a manifest file.
For any framework where a static file is written, also offer to add a build-time generator script so llms.txt stays in sync automatically.
When both llms.txt and sitemap.xml are generated at build time, llms.txt MUST be generated before the sitemap. The sitemap includes a /llms.txt entry and should reference the file's real mtime; if the sitemap is generated first, it either misses the entry or records a stale timestamp.
Framework by framework:
app/sitemap.ts + app/llms.txt/route.ts). Both resolve per request (or during next build through the same graph), so no explicit ordering is needed. It only matters if a custom scripts/generate-llms-txt.ts writes public/llms.txt at build time; in that case run it before next build:
"scripts": {
"build:llms": "tsx scripts/generate-llms-txt.ts",
"build": "npm run build:llms && next build"
}
@nuxtjs/sitemap, run the llms.txt writer in a pre-build hook (a "prebuild" script, or a Nitro plugin ordered before the sitemap module).src/pages/llms.txt.ts) resolves at request time, so there's no order issue. A static public/llms.txt written by a script needs to run before astro build so @astrojs/sitemap's customPages and mtime are accurate:
"scripts": {
"build:llms": "tsx scripts/generate-llms-txt.ts",
"build": "npm run build:llms && astro build"
}
Markdown copies of pages help coding assistants that read documentation, and some CDNs (Cloudflare's Markdown for Agents) can serve them to clients that send Accept: text/markdown. They are not an AI search lever: Google's guide says Markdown isn't needed, and Google's and Bing's search representatives have said Markdown copies for bots are unnecessary. Offer them only for developer documentation, or when the site already keeps its content in Markdown:
app/docs/[slug].md/route.ts reading from the same MDX source.src/pages/docs/[slug].md.ts endpoint returning the content collection's raw Markdown.text/markdown.A Markdown copy must say the same thing as the HTML page. If they exist, reference the .md URLs in llms.txt.
After writing llms.txt, offer these discovery hints. Skip each one if it's already present or doesn't apply. 🧪 They help tools that look for the file find it; they don't affect search rankings or AI citations.
1. <link rel="alternate"> in <head>
Prompt: "Also add a <head> link hint pointing at /llms.txt? (recommended)"
On accept, wire it through the framework-idiomatic head API. Skip silently if the hint already exists anywhere in the resolved head.
app/layout.tsx metadata:
export const metadata: Metadata = {
alternates: {
types: { 'text/markdown': '/llms.txt' },
},
}
app.vue:
useHead({
link: [{ rel: 'alternate', type: 'text/markdown', title: 'llms.txt', href: '/llms.txt' }],
})
@unhead/vue: the equivalent useHead call in the root component.<head>:
<link rel="alternate" type="text/markdown" title="llms.txt" href="/llms.txt" />
src/routes/+layout.svelte:
<svelte:head>
<link rel="alternate" type="text/markdown" title="llms.txt" href="/llms.txt" />
</svelte:head>
meta export:
export const meta: MetaFunction = () => [
{ tagName: 'link', rel: 'alternate', type: 'text/markdown', title: 'llms.txt', href: '/llms.txt' },
]
<head>:
<link rel="alternate" type="text/markdown" title="llms.txt" href="/llms.txt">
2. /llms.txt entry in sitemap.xml
Prompt: "Add /llms.txt to your sitemap so sitemap-reading crawlers discover it?"
Detect the sitemap source and patch it. Skip if the entry is already present, or if the project has no sitemap.
app/sitemap.ts: append:
{ url: `${SITE}/llms.txt`, changeFrequency: 'monthly' as const, priority: 0.5 }
public/sitemap.xml: insert before </urlset>:
<url>
<loc>https://<domain>/llms.txt</loc>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
@nuxtjs/sitemap: add it to sitemap.urls or the module config.@astrojs/sitemap: use the customPages option.The order rule in Step 7 applies when both files are generated at build time.
3. robots.txt comment
Prompt: "Add a # LLM index comment pointing at /llms.txt in robots.txt?"
On accept, append (or insert near the top):
# LLM index: https://<domain>/llms.txt
Derive <domain> from the detected base URL, sitemap or env config. Prompt once if it can't be resolved. For frameworks that generate robots.txt through a route (Next.js app/robots.ts, SvelteKit +server.ts, etc.), if the generator can't express comments cleanly, direct the user to add it to a static public/robots.txt instead.
llms.txt Complete
=================
Mode: <Generate | Update | Validate | + llms-full.txt>
Framework: <framework>
Knowledge: <Context7 MCP | Training Data fallback>
llms.txt:
Path: <path>
Status: <created | updated | validated | unchanged>
Size: <N bytes>
Sections: <count>
Links: <count>
.md links: <count> / <total>
llms-full.txt:
Path: <path or "not generated">
Size: <N bytes>
Pages: <count>
Validation:
Format: <pass | issues>
Links: <reachable count / total>
Freshness: <current | stale pages: N>
Discoverability signals:
<head> link[rel=alternate]: <added | present | skipped | n/a>
sitemap /llms.txt entry: <added | present | skipped | n/a, no sitemap>
robots.txt comment: <added | present | skipped | n/a, no robots.txt>
Build order (llms.txt → sitemap): <ok | warning: reorder <script>>
Manual next step: submit to public directories:
- https://llmstxt.site/submit
- https://directory.llmstxt.cloud
(Web forms, manual action. Google Search ignores llms.txt; some coding
tools read it, and Lighthouse's agentic browsing audit checks for it 🧪.)
Next:
- Verify the site serves /llms.txt at your production URL.
- For developer docs, consider Markdown companion routes (optional).
- Re-run /seo-audit geo to confirm the llms.txt finding clears.
If --dry-run: print the would-be file contents to the terminal and write nothing.
Example 1: Generated llms.txt for a developer tool's docs site (Next.js)
# Example API
> Example API is a REST API for sending transactional email. These docs cover setup, authentication, endpoints and SDKs.
Markdown versions of each docs page are available at the same URL with a `.md` suffix.
## Getting started
- [Quickstart](https://docs.example.com/quickstart.md): send a first email in five minutes.
- [Authentication](https://docs.example.com/auth.md): API keys, scopes and key rotation.
## API reference
- [Send email](https://docs.example.com/api/send.md): request and response fields for `POST /v1/emails`.
- [Webhooks](https://docs.example.com/api/webhooks.md): event types, payloads and signature checks.
## SDKs
- [Node.js SDK](https://docs.example.com/sdks/node.md): install, configure and send.
## Optional
- [Changelog](https://docs.example.com/changelog.md): API and SDK releases.
Example 2: Validation output for a stale llms.txt
llms.txt Validation
===================
Path: public/llms.txt
Size: 2,147 bytes
✅ H1 present: "# Example Site"
✅ Blockquote description present
✅ Valid markdown syntax
⚠️ Broken link: https://example.com/blog/old-post (404)
⚠️ 3 HTML links could point to .md companions instead
❌ Stale: 7 content files newer than llms.txt mtime (2025-11-02).
- src/content/blog/new-post.md
- src/content/blog/feature-announcement.md
- ...
Recommendation: run /seo-llms-txt update.
Example 3: Next.js llms-full.txt route
// app/llms-full.txt/route.ts
import { getAllContent } from '@/lib/content'
export async function GET() {
const pages = await getAllContent()
const body = [
'# Example Site: Full Content Export',
'',
`> Full Markdown export of example.com. Generated on ${new Date().toISOString()}.`,
'',
'---',
'',
...pages.map(p => [
`## ${p.title}`,
'',
`Source: ${p.url}`,
`Last modified: ${p.modifiedTime}`,
'',
p.markdown,
'',
'---',
'',
].join('\n')),
].join('\n')
return new Response(body, {
headers: { 'Content-Type': 'text/markdown; charset=utf-8' },
})
}
Before finalizing:
llms.txt.md companion URLs used where detectedllms-full.txt if larger--dry-run writes nothing<head> link[rel=alternate] hint (skipped if present)/llms.txt entry (skipped if present or no sitemap)# LLM index comment (skipped if present or no robots.txt)/seo-audit geo to verify the finding clearsWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub charlesjones-dev/ai-agent-plugins --plugin ai-seo8 skills in this plugin
/seo-auditAudit a site's code through three lenses: SEO (rankings, deprecated tags LLMs still generate, meta tags, structured data, performance signals), AEO (being the direct answer in featured snippets, voice replies and answer boxes) and GEO (being cited in AI answers: crawler access, topical authority, evidence, authorship, entities). Optional live URL check and brand web search. Writes one timestamped report with a score per lens to docs/seo-audit/./seo-crawlCrawl a live site the way search engines do and report what they get: the title and content in the served HTML for Googlebot and a browser, status codes, redirects, soft 404s, robots.txt rules under RFC 9309, sitemaps, canonical and robots signals, metadata, structured data, page weight, caching, mobile and security headers. Works on any site, with or without its repo. Splits the checks across up to three parallel workers, re-checks the serious findings, says where each fix goes (a repo file, or a host, CDN or platform setting), and ends with a verdict on whether fixing them is worth it. Read-only until you pick the fixes./seo-faqBuild, update or validate visible FAQ sections and, if you want it, their FAQPage or QAPage JSON-LD. Drafts questions and answers from a page's own content, the latest question map or answers you supply, renders the FAQ and any markup from one data source, and checks existing markup against the visible text. Supports --dry-run./seo-fixApply fixes from the newest /seo-audit report, for whichever lenses it covers. SEO: removes deprecated tags and adds missing meta. AEO: answer-first rewrites, real lists and tables, answers kept in the HTML, snippet-control changes after you confirm intent. GEO: robots.txt rules for each AI bot group after asking, Organization and Person JSON-LD with sameAs links you supply, dateModified, sources and topic hubs. Shows a diff for each change and supports --dry-run./seo-indexSubmit new or changed pages to search engines after they go live. Checks each URL first, sends the pages through IndexNow or the Bing Webmaster API, resubmits the sitemap to Google, then uses the user's signed-in browser (Claude in Chrome in Claude Code) to request indexing in Google Search Console one URL at a time until Google's daily quota runs out, and to submit them on Brave Search's submit page. Reports what each engine accepted and offers a retry for what's left: a T3 Code scheduled task in T3 Code, otherwise the time and the command to run again. Use when the user runs /seo-index, or explicitly asks to submit pages for indexing or to get pages indexed on Google, Bing or Brave, and when a scheduled retry run asks for it. Don't use it only because a page was published./seo-questionsBuild a question map for Answer Engine Optimization: the questions a site should answer, the page that answers each one, and the gaps. Starts from the questions the site already asks, adds your target questions, question-shaped queries from a Search Console or Bing Webmaster Tools export, web-search suggestions or an earlier map, then flags missing answers, buried answers and pages that compete for the same question. Writes the map to docs/seo-audit/.Other plugins' skills for the same job