Using with AI coding agents
ChartslibraryUI is designed so that a coding agent (Claude Code, Cursor, Copilot, v0, Codex…) can pick the right chart, install it and wire it to your data without guessing.
Connect through the shadcn MCP server
The shadcn MCP server lets an agent search registries and install components by name. Add the ChartslibraryUI namespace to components.json once:
{
"registries": {
"@chartslibraryui": "https://chartslibraryui.com/r/{name}.json"
}
}Then set up the MCP server for your client (Claude Code shown; cursor, vscode and opencode also work):
npx shadcn@latest mcp init --client claudeRestart the agent and ask for a chart, for example "add a revenue chart with the forecast marked". It can now search and install free charts directly, e.g. npx shadcn@latest add @chartslibraryui/line-chart. Pro charts install from your local Pro download (see below), so no key is needed.
Machine-readable files
| File | Contents |
|---|---|
/llms.txt |
Index: every chart with a one-line purpose, plus links |
/llms-full.txt |
Everything an agent needs in one file: docs, per-chart guidance, data shapes, install commands |
/charts.json |
Structured catalogue: names, tiers, categories, use/avoid guidance, data shapes, related charts |
/r/index.json |
Registry index (shadcn format), also at /r/registry.json |
/r/<chart>.json |
One chart's files and dependencies |
All of them are generated from the same catalogue as this site, so they never disagree with it.
Add to your agent instructions
Paste this into CLAUDE.md, AGENTS.md, .cursorrules or similar:
## Charts
- Use ChartslibraryUI components from `components/charts/` for all charts.
- Before choosing a chart, read https://chartslibraryui.com/llms.txt and follow each chart's "Avoid when" guidance.
- Install missing charts with `npx chartslibraryui add <chart-name>` (Pro: add `--from ./chartslibraryui-pro`).
- Data is an array of row objects plus the keys to read; use null for missing values, never 0.
- Percent values are fractions (0.12 = 12%). Use favorable="down" for costs, churn and latency.
- Never add a second y-axis: use ComboChart, IndexChart or SmallMultiples.
- Give every chart a title that states the takeaway and a subtitle with unit and period.Why it works well with agents
- Predictable names.
<Name>Chartcomponents in<name>-chart.tsxfiles, with typed props. - One data convention. Rows plus keys everywhere, so agents don't need to learn a per-chart format.
- Visible failures. Bad data produces a message on the chart, not a blank square, so an agent (or a person) reviewing a screenshot sees what went wrong.
- Guidance next to code. Each chart page and
llms-full.txtsay when not to use a chart and what to use instead.