# Agents

Help coding agents find, add and use the components, with shadcn's tools and these docs as Markdown.

Jarvis UI is a shadcn registry, so the tools shadcn makes for coding agents work with it too. And
every page of these docs is also served as Markdown, for agents to read.

## shadcn's tools

[Installation](https://ui.jarv.is/docs/installation.md) adds the `@jarvis` registry to your project's `components.json`.
shadcn's tools read the registries listed there, so an agent can find and add the components by
name, as `@jarvis/dialog`, without being told where the registry is.

### Skill

[shadcn's skill](https://ui.shadcn.com/docs/skills) teaches an agent the shadcn CLI and how a
shadcn project fits together. Add it to your project.

```bash
npx skills add shadcn/ui
```

The agent loads it whenever it works in a project with a `components.json`. It runs `shadcn info`
to learn the project's framework, aliases and installed components, and looks components up before
writing code with them, rather than guessing at their APIs.

### MCP server

[shadcn's MCP server](https://ui.shadcn.com/docs/mcp) gives an agent tools to browse, search and
add items from the project's registries. Set it up for Claude Code.

```bash
npx shadcn@latest mcp init --client claude
```

`--client` also takes `cursor`, `vscode`, `codex` and `opencode`. Then ask for components in plain
language:

- "Show me the components in the @jarvis registry"
- "Add @jarvis/dialog and @jarvis/form"
- "Build a settings page with a side nav, using components from @jarvis"

### CLI

Agents can run the CLI themselves too. `search` finds items in a registry, and `view` shows an
item's files and dependencies before it's added.

```bash
npx shadcn@latest search @jarvis --query dialog
```

```bash
npx shadcn@latest view @jarvis/dialog
```

`shadcn docs` only knows shadcn/ui's own components, though, and many of them share a name with one
of these. `shadcn docs button` describes shadcn/ui's Button, whose variants and props differ from
Jarvis UI's, so point agents at the Markdown below instead.

## Docs as Markdown

Every docs page is also Markdown, at its URL plus `.md`: `/components/button.md`,
`/docs/theming.md`, and `/docs.md` for the [Introduction](https://ui.jarv.is/docs.md). Each example is its source, each
props table a Markdown table, and each command is written for npm. A component's page links to its
source on GitHub as well.

- [`/llms.txt`](https://ui.jarv.is/llms.txt) indexes every page with its description, in the format
  [llmstxt.org](https://llmstxt.org) proposes.
- [`/llms-full.txt`](https://ui.jarv.is/llms-full.txt) has every page in one file, to give an agent all of the docs
  at once.
- [`/components.md`](https://ui.jarv.is/components.md) lists the component pages by group, as the
  [gallery](https://ui.jarv.is/components.md) does.

Agents don't need to know the addresses. A request that accepts `text/markdown` gets the Markdown
at a page's own URL.

```bash
curl -H "Accept: text/markdown" https://ui.jarv.is/components/button
```

Each page also links to its Markdown with `<link rel="alternate" type="text/markdown">`, and to
`/llms.txt` with `<link rel="describedby">`, which the responses repeat as `Link` headers.

The Copy page button at the top of each page copies its Markdown. Its menu opens the Markdown, or
starts a chat in v0, ChatGPT, Claude, Cursor or Grok that begins by reading the page.

### Registry items

A component's page answers the shadcn CLI with its registry item, so an agent holding a link to the
docs can add the component from it.

```bash
npx shadcn@latest add https://ui.jarv.is/components/button
```

[`/r/registry.json`](https://ui.jarv.is/r/registry.json) lists every item, with its files and dependencies.

## Telling your agent

Agents read `AGENTS.md` (or `CLAUDE.md`, for Claude Code) at the start of each session. A few lines
there send them to the right docs.

```md title="AGENTS.md"
## UI components

The components in `components/ui` come from Jarvis UI, a shadcn registry. Before using one, read
its docs at https://ui.jarv.is/components/<name>.md rather than shadcn/ui's, whose components of
the same name differ. Find more at https://ui.jarv.is/llms.txt, and add them with
`npx shadcn@latest add @jarvis/<name>`.
```
