/boxel-skills:boxel-ui-component-discoveryfrom boxel-skills
MANDATORY before writing any UI in a `.gts` template, including a quick fix to an existing card (turning a styled span or div into a button, wiring a dead control, a design-review fix) and the reuse search design-review runs for each gap. Search the catalog for a component Spec and reuse it — Pret UI first, boxel-ui only where Pret UI has no equivalent yet. Fall back to raw HTML only when no matching spec exists, and surface the gap when you do.
Ships in boxel-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Before you write any UI in a .gts template — anything you'd describe
as a UI primitive (button, input, dropdown, modal, tooltip, pill, menu,
accordion, …) — you must first search the catalog for an existing
component Spec and reuse it. The catalog holds two component
libraries:
ref.module starts with
@cardstack/pretui/components/. This is the default for every
control and display primitive.ref.module is
@cardstack/boxel-ui/components. Use one only when no Pret UI spec
covers the primitive (layout shells such as CardContainer and
FittedCard, KanbanPlane, FilterList, …).Tell the two libraries apart by ref.module. When both libraries
match, use the Pret UI one. To see which boxel-ui components a Pret UI
component replaces, use the replacement table in
boxel-ui-guidelines/references/use-boxel-ui-components.md.
ref and follow
its documented API (step 3 says where that lives for each library). No raw <button>, <input>,
<textarea>, <select>, <details>, etc. Visual styling — even
unconventional aesthetics — is never a reason to drop down to raw
HTML. Restyle it in the order of
restyle-component.md: theme tokens, documented
attributes and CSS variables, then (Pret UI only) a CSS rule of your own.@cardstack/pretui/components/… or @cardstack/boxel-ui/components
import that wasn't in the search results — names not present in the catalog don't exist for your
purposes.This rule is intentionally not a fixed HTML→component mapping. The catalog's inventory changes over time and the spec readMe is the source of truth for what's available and what each component is called.
Enumerate first. Before any search, read the brief and your planned template and list every UI primitive it implies — in plain language ("button", "dropdown", "tag-style indicator", "expandable section") — and every structure: app frame, navigation, panel layout, KPI or stat, chart, table, empty and loading state. The partial-compliance failure mode is "agent finds one match, uses it, hand-rolls everything else" — enumerating up front prevents it. Dashboards and tools hand-roll their frame when only primitives are searched.
| App type | Search terms (not component names; the catalog decides) |
|---|---|
| Dashboard, admin | app shell, sidebar, dashboard grid, stat, chart, data table |
| Data tool, back-office | data grid, filter set, form layout, split panes |
| Mobile app | bottom nav, sheet, tabs |
| Landing page | hero split, cta band |
Give every structure hit a disposition in the reply: adopted, or
refused with a reason (for example, on a consumer app: "four
destinations, so top tabs per layout-gravity.md"). On an admin,
dashboard or back-office surface the sidebar is not optional: it is
the shell surface-types.md sets, so adopt the app shell or name the
catalog Spec that replaces it.
Query the catalog once, broadly. Use the catalog realm for the
environment you are working against — take it from your context if
one is provided, otherwise list the realms available to your session
(npx boxel realm ls from a CLI session) or ask; do not invent a host.
{
"filter": {
"on": { "module": "@cardstack/base/spec", "name": "Spec" },
"eq": { "specType": "component" }
}
}
Run the filter through your session's search transport. Write it
card-rooted (on/type anchors, bare field names) like every other
card query — the transport translates it to the search endpoint's
wire form itself; never hand-write item.-prefixed paths.
From a CLI session, npx boxel search --realm <catalog-realm-url> --query '<filter-json>' --json returns the full inventory (well
over 100 specs across both libraries) in one call. Match each item in your enumeration to a result
by reading attributes.cardTitle and attributes.cardDescription.
In an assistant room, search in one run-realm-code script
with realm.entries.search(query, { realms, scope: 'cards', limit }).
This skill declares the run-realm-code tool. The sandbox rules
for the script are in source-code-editing. Pass realms with only
the catalog realm: without it, the search also reads every
workspace the user can read, and a component Spec that a user
wrote in a workspace is not a catalog component. The catalog realm
is @cardstack/catalog/, or the catalog URL from your context.
Run one query per enumerated item, all in the same script. The
realm calls of a run go one at a time, also in Promise.all, and
a run has 55 seconds. If a run with many items stops at that
limit, split the items across two runs. Add
{ "matches": "<the item's plain-language name>" } beside the
specType constraint, and return only what you will use. Each
entry is { url, kind, ref, specType, cardTitle, cardDescription, name, readMe }. The fields are at the top level, not under
attributes, and readMe is the full readMe. An entry does not
carry the spec's other fields or its links (for example the
writeup link of a Pret UI spec):
const items = ['button', 'text input', 'dropdown', 'modal'];
const found = {};
for (const item of items) {
const { entries, total, truncated, incomplete } =
await realm.entries.search(
{
filter: {
on: { module: '@cardstack/base/spec', name: 'Spec' },
every: [{ eq: { specType: 'component' } }, { matches: item }],
},
},
{ realms: ['@cardstack/catalog/'], scope: 'cards', limit: 10 },
);
found[item] = {
total,
truncated,
incomplete,
specs: entries.map((e) => ({
title: e.cardTitle,
description: e.cardDescription,
ref: e.ref,
readMe: e.readMe,
})),
};
}
return found;
Check total, truncated and incomplete for each item before
you choose. total is how many specs match. truncated is true
when more specs match than the answer holds; a search returns at
most 50 entries and does not page. Then the Pret UI spec can be
one of the specs you did not see, so raise limit (at most 50) or
narrow the query, and search again before you choose a boxel-ui
spec or declare a gap. incomplete is true when a realm did not answer;
search again before you declare a gap. The script above returns
each spec's readMe, so step 3 needs no second search for a
boxel-ui spec.
Narrow with contains on the title or matches (full-text over the
readMe) if a query is noisy. See boxel/references/query-systems.md
for full query syntax.
Read each chosen spec's API.
Pret UI: the readMe holds only the import line. The
contract (args, accessibility, theming knobs) is the component's
write-up, the <name>.md file beside the module. Worked examples
are in <name>.usage.gts. Read the write-up before you use the
component. The search entry does not carry its path, so make the
path from ref.module: for @cardstack/pretui/components/button
the write-up is components/button.md in the Pret UI realm. Read it
in a second run-realm-code run with realm set to the Pret UI
realm's full https:// URL; realm refuses the @cardstack/pretui/
prefix. A run can read a realm
that the user can only read. Read all the write-ups you need in
that one run. If the run is refused, choose from the spec's
readMe and cardDescription, and tell the user that you could
not read the write-up:
const writeups = {};
for (const p of ['components/button.md', 'components/select.md']) {
writeups[p] = await realm.fs.readText(p);
}
return writeups;
boxel-ui: the readMe has the Import line, the API
table (arg / type / required / default / options / description),
an example snippet, and CSS variables. It comes in the search
entry; no second read is needed.
Use the components. Translate each ref to an
import line directly (the readMe gives you the exact statement).
Copy an example as a template and substitute your own args following
the contract or API table. Never carry boxel-ui arg names (@kind,
@as, @size='extra-small') onto a Pret UI component. Required args must be
present; defaults are listed for every optional arg.
The component supplies behaviour and accessibility; the app's theme and Look supply the style. Restyle through its theme tokens, documented attributes and CSS variables, then, for a Pret UI component, a CSS rule of your own, judged from a capture. The steps: restyle-component.md.
Re-read your finished template. For each interactive or form-shaped
HTML element it contains, ask: would I have searched the catalog for
this if I were writing it from scratch? If yes, did I? Replace any raw
HTML primitive that has a spec'd equivalent, and any boxel-ui component
that has a Pret UI replacement, re-run lint/parse, and
only then call it done. Raw <input> / <select> / <details> lint
and parse clean — only this audit catches them.
catalog-reuse — the general form of this discipline: search the
catalog for an existing card, field, command, app, or asset before
building one. This skill is the specialized front-end for UI
primitives in a .gts template; reach for it whenever the task is
writing template UI.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
27 skills in this plugin
/api-integrationsUse when a card needs data from, or sends data to, a third-party API — "show my GitHub pull requests in a card", "pull my open issues", "a card that calls the weather API with my key", "integrate with Stripe/Twilio/OpenAI", "how often can this card poll", "build a PR inbox". Takes a card author from "I want data from this vendor" to a working card: classifying the integration (no key, a key the workspace shares, the user's own key, a key that can write), choosing a live card or a scheduled pipeline (and why private data takes the pipeline), declaring the `callApi` operations with labels and credential slots, estimating polling cost, and recipes for GitHub (GraphQL, a GitHub App or a read-only fine-grained token, the PR inbox as a pipeline and as a live card), for a plain API key sent in a header, and for images from an AI vendor called with the user's own key (an automation run's own AI requests carry text only). Activates on "third-party API", "vendor API", "integration", "pipeline", "live card", "On a schedule and when the card is opened", "poll", "GitHub API", "GraphQL", `callApi`, `{{userKey}}`, `{{apiKey}}`, "image generation", "AI vendor key", "automation image"./api-keysUse when a card or the AI assistant needs a user's API key, or a key shared into a workspace — "this card needs my GitHub token", "the forecast operation was refused binding-not-approved", "let the user add their key", "share my key with this workspace", "add a key button". Also "sign in to GitHub from this card", "connect my account", "the operation was refused credential-rejected", "the service rejected my key", "should I register a GitHub App or an OAuth App". Covers getting a key from the user only through Boxel's secure window, with the open-secure-window tool: opening it from a card through `@context.toolContext` or from the assistant, its modes (enter a key, replace the key an operation sends, share a key, connect an account through OAuth, approve a card's requests for scheduled pipelines or also for when the card is opened, review what changed in them), passing only the operation the card is blocked on and letting the window gather the card's other operations into one approval, what the tool answers, the blocked-popup fallback, telling the user to check the address bar, what to do when the service rejects a key (stop polling, offer Try again, and Reconnect, which opens the window to replace the key), OAuth clients and connections (when to use a connection rather than a static key, what the card declares, opening connect mode, `credential-rejected` and its reasons, sharing a client into a workspace, and why GitHub takes a GitHub App), and never asking for a credential in the chat or building a form for one. Also covers asking first with `@context.keyReadiness` — the answers (`ready`, `needs-connect`, `needs-approval`, `needs-reapproval`, `needs-admin`, `needs-sign-in`, `rate-limited`, `over-budget`), what a card shows for each and what the secure window can fix, and treating `undefined` as "not known yet" so prerendered HTML never shows Connect. Also covers a call refused for the key owner's limits (`rate-limited`, `over-budget`, `rate-limit-unavailable`): backing off by `retryAfterSeconds` and saying the limit is reached without naming a budget. Activates on "approve", "Allow", "review changes", `needs-approval`, `needs-reapproval`, `open-secure-window`, `OpenSecureWindowTool`, `keyReadiness`, "secure window", "API key", "enter a key", "replace a key", "share a key", "OAuth", "connect", "Reconnect", "GitHub App", `{{userKey}}`, `{{apiKey}}`, `binding-not-approved`, `interactive-use-not-approved`, `anonymous-use-not-approved`, "On a schedule and when the card is opened", "people who aren't signed in", "anonymous cap", `credential-rejected`, `rate-limited`, `over-budget`./boxelUse whenever creating, reading, or editing Boxel cards (.gts files), card instances (.json), fields, templates, queries, or anything in a Boxel realm. Required for any Boxel coding work — covers CardDef, FieldDef, contains/linksTo, templates, formats, queries, and core patterns. Companion skills - boxel-design (visual decisions), boxel-ui-guidelines (template UI), source-code-editing (`run-realm-code` tool), boxel-environment (running the Boxel app)./boxel-create-edit-cardsUse when choosing the realm.* calls in a run-realm-code script that create new cards or edit existing instances from the AI assistant./boxel-designUse when DECIDING a Boxel card's visual language — mood, palette, typography direction, asset direction, one visual signature, the design-playbook process. This is the taste/decision layer. NOT for implementing tokens or CSS inside templates (that's boxel-ui-guidelines) and NOT for creating/editing Theme, StyleReference, or BrandGuide card artifacts (that's boxel-theme-development)./boxel-environmentUse when running, navigating, or orchestrating tasks inside the live Boxel application — switching between Code Mode and Interact Mode, searching and editing cards, indexing, or any operation that drives the Boxel UI, all through `realm.*` and `room.*` calls in a run-realm-code script. Also for a user's questions about using Boxel itself: working from Claude Code or another editor, publishing a workspace, and their credits. Activates for Boxel-app runtime work, not for writing card definitions (see boxel for that).boxel-skills@cardstack-boxel is listed by cardstack/boxel — review the source before installing
npx claudepluginhub cardstack/boxel --plugin boxel-skills