# 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.

- Category: AI & Agents · Published: 2026-09-25 · Updated: 2026-11-23 · Reading time: 10 min read
- Canonical URL: https://hazeui.com/guides/llms-txt-markdown-twins-shadcn-mcp-for-coding-agents
- Tags: llms-txt, mcp, ai-agents, markdown, ai-seo

## Executive Summary

Coding agents hallucinate component props and colors when documentation lives only inside interactive HTML pages. Haze UI solves this at build time by generating /llms.txt, /llms-full.txt, a dedicated .md twin for every component and block, /DESIGN.md token rules, and a shadcn-compatible /r/registry.json consumed by Claude Code, Cursor, VS Code, and Codex via MCP.

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`](/llms.txt) | `text/plain` index (`llmstxt.org`) | Compact directory of docs, guides, and every entry with 1-line summary + `.md` link |
| [`/llms-full.txt`](/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`](/DESIGN.md) | `text/plain` design rules | Generated token YAML frontmatter + colors, typography, elevation, and do/don't guardrails |
| [`/r/registry.json`](/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:

```json
{
  "$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):

```json
{
  "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](/docs/ai).

## 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](/docs/ai), inspect [MCP Servers](/blocks/mcp-servers) and [Snippet](/ui/snippet), or read [Designing AI Agent UIs Beyond Chat Bubbles](/guides/designing-ai-agent-interfaces-tool-approvals-traces-diffs) to see how these agent workflows look inside real product interfaces.

## Mentioned Haze UI Entries

- [MCP servers](https://hazeui.com/blocks/mcp-servers.md): Model Context Protocol manager tracking context-token budget across local/remote servers with connect/pause and per-tool toggles.
- [Code block](https://hazeui.com/ui/code-block.md): Multi-line code in a bordered panel with an optional file name and language header and a copy button added by script; no highlighting.
- [Snippet](https://hazeui.com/ui/snippet.md): One-line command in a mono field that scrolls sideways, with an optional prompt prefix and a copy button added by script.
- [Command palette](https://hazeui.com/blocks/command-palette.md): Command palette with keyboard navigation, live filtering, native links and an event for selected actions.
- [AI setup wizard](https://hazeui.com/blocks/ai-setup-wizard.md): Three-step onboarding card for launching workspace AI Q&A: connect sources, configure guardrails and verify a cited test answer.

## Frequently Asked Questions

### 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.
