Skip to content
AI & AgentsPublished Updated 10 min read

Making Your Component Library Readable by AI Coding Agents: llms.txt, Markdown Twins, and shadcn MCP

How Haze UI's generated agent layer eliminates component hallucination across llms.txt, Markdown twins, and shadcn MCP.

View .md

Ask a coding agent to build an Astro modal dialog or a multi-tier pricing section against a traditional UI docs website, and two things go wrong immediately: either the agent fetches heavy HTML stuffed with navigation chrome, or it guesses prop names from memory and invents raw Tailwind colors like bg-neutral-900.

“AI-first” in a component library does not mean sprinkling sparkle icons over buttons. It means designing your site architecture and metadata so coding agents—and AI search engines like ChatGPT Search, Perplexity, Claude, and Google AI Overviews—retrieve exact ground truth in one lightweight read.

Here is the five-part agent discovery layer we built across Haze UI’s 371 entries, and how you can replicate it for any design system.

The five machine-readable endpoints in Haze UI

Rather than maintaining separate documentation by hand, Haze UI generates all five machine-readable endpoints from each entry’s .meta.ts file and .astro source when pnpm gen runs:

Endpoint Format & audience What it delivers
/llms.txt text/plain index (llmstxt.org) Compact directory of docs, guides, and every entry with 1-line summary + .md link
/llms-full.txt text/plain full corpus All component/block specs, props, accessibility notes, and source code concatenated
/ui/<slug>.md & /blocks/<slug>.md text/markdown per entry Clean props table, use-when/avoid-when rules, keyboard bindings, prompts, raw .astro
/DESIGN.md text/plain design rules Generated token YAML frontmatter + colors, typography, elevation, and do/don’t guardrails
/r/registry.json application/json (shadcn schema) Installable registry payload with derived npm + @haze/* dependency graphs

Notice how each HTML page also exposes <link rel="describedby" type="text/plain" href="/llms.txt" /> and <link rel="alternate" type="text/markdown" href="/ui/<slug>.md" /> inside <head>. Tools and crawlers inspecting the HTML document discover the clean Markdown representation immediately.

Writing useWhen, avoidWhen, and alternatives so agents choose accurately

Most component docs describe what a widget looks like. Coding agents need to know when NOT to use it.

Inside every *.meta.ts file, Haze UI enforces three explicit selection fields through scripts/check-meta.mjs:

  • useWhen (2–4 items): Concrete situations where this component or block fits.
  • avoidWhen (1–3 items): Anti-patterns naming the exact sibling slug to pick instead (for instance, ai-tool-approval.meta.ts tells agents: “Reviewing a multi-item backlog of approvals across several background agents; use agent-approvals”).
  • alternatives: Verified slugs cross-linked in both HTML and Markdown twins.

Even more importantly, our validator fails the build if any summary, useWhen, avoidWhen, a11y.notes, or examplePrompts string repeats on more than three entries—guaranteeing no boilerplate copy slips into the registry.

Configuring shadcn MCP for Claude Code, Cursor, VS Code, and Codex

Once your project includes @haze inside components.json, the official shadcn MCP server reads the registry directly without custom middleware:

{
  "$schema": "https://ui.shadcn.com/schema/components.json",
  "registries": {
    "@haze": "https://hazeui.com/r/{name}.json"
  }
}

Add the MCP server entry in .mcp.json (Claude Code) or your editor’s MCP config (Cursor / VS Code / Codex):

{
  "mcpServers": {
    "shadcn": {
      "command": "npx",
      "args": ["shadcn@latest", "mcp"]
    }
  }
}

From there, an agent can query registry metadata, read /ui/<slug>.md or /DESIGN.md, and run npx shadcn@latest add @haze/<slug> knowing upfront about the one-time @haze/theme setup and --overwrite semantics documented on AI and MCP.

Pairing Markdown twins with robots.txt and JSON-LD for AI SEO

The same structure that helps coding agents install components also powers Generative Engine Optimization (GEO) and Answer Engine Optimization (AEO):

  1. Connected JSON-LD entity graphs (@id). Every Haze UI page links Organization, WebSite, SoftwareApplication, WebPage, BreadcrumbList, and SoftwareSourceCode / TechArticle / BlogPosting via stable @id URIs rather than isolated schema fragments.
  2. Clear robots.txt separation. Explicitly allow live AI search and user-triggered citation fetchers (OAI-SearchBot, ChatGPT-User, PerplexityBot, Perplexity-User, Claude-SearchBot, Claude-User, Applebot-Extended) while disallowing utility routes like /preview/ and /api/.
  3. Server-rendered HTML parity. AI fetchers rarely wait on client JS hydration. Keeping primary tables, props, code examples, and FAQs inside static Astro HTML ensures retrieval chunks stay complete on raw GET requests.

Explore AI and MCP, inspect MCP Servers and Snippet, or read Designing AI Agent UIs Beyond Chat Bubbles to see how these agent workflows look inside real product interfaces.

Frequently asked questions

What is the difference between /llms.txt and /llms-full.txt?

/llms.txt is a compact directory following the llmstxt.org specification—grouping documentation, guides, and all 371 components/blocks with one-line summaries and direct links to each entry's .md file. /llms-full.txt concatenates the complete Markdown specification and source code of all entries into a single reference document.

Why does every Haze UI component URL have a .md twin?

Appending .md to any component or block route (for example /ui/dialog.md or /blocks/hero-centered.md) returns clean plain-text Markdown with props tables, use-when/avoid-when rules, accessibility notes, copyable agent prompts, and full .astro source—saving coding agents and AI search crawlers 90%+ of HTML parsing overhead.

Which AI search crawlers should robots.txt distinguish?

Separate live user-triggered search and citation fetchers (OAI-SearchBot, ChatGPT-User, PerplexityBot, Perplexity-User, Claude-SearchBot, Claude-User, Googlebot) from model training bots so you never accidentally drop out of live AI search answers.

How do I wire Haze UI into Claude Code, Cursor, or Codex?

Add the @haze registry URL to components.json, then configure the official shadcn MCP server (npx shadcn@latest mcp) in .mcp.json or your editor's MCP settings.

Components & blocks mentioned

Browse all entries
  • Model Context Protocol manager tracking context-token budget across local/remote servers with connect/pause and per-tool toggles.

    npx shadcn@latest add @haze/mcp-servers
  • Multi-line code in a bordered panel with an optional file name and language header and a copy button added by script; no highlighting.

    npx shadcn@latest add @haze/code-block
  • One-line command in a mono field that scrolls sideways, with an optional prompt prefix and a copy button added by script.

    npx shadcn@latest add @haze/snippet
  • Command palette with keyboard navigation, live filtering, native links and an event for selected actions.

    npx shadcn@latest add @haze/command-palette
  • Three-step onboarding card for launching workspace AI Q&A: connect sources, configure guardrails and verify a cited test answer.

    npx shadcn@latest add @haze/ai-setup-wizard

Start with one component

Try it on its page, then install it with one command.