Skip to content

Design skill

Xerobi product design guidance for building and reviewing Xerobi interfaces, as a skill for AI coding tools.

Install

Apply these rules when designing, implementing or reviewing Xerobi product interfaces. Follow the examples marked Good and avoid the ones marked Avoid. When a rule conflicts with a user's explicit request, say so and follow the request.

Download SKILL.md and place it at .claude/skills/xerobi-design/SKILL.md in your project, or in the equivalent skills folder of your tool.

mkdir -p .claude/skills/xerobi-design
curl -o .claude/skills/xerobi-design/SKILL.md https://ui.xerobi.com/skill/SKILL.md

Foundations

Take every value from the tokens token-values

Colour, spacing, radius, shadow, z-index and duration come from `@xerobi/tokens` through Tailwind utilities or CSS variables. No hex values, no numeric z-index, no arbitrary radii or durations.

Good

<div className="rounded-md bg-card text-text-primary z-modal" />

Avoid

<div className="rounded-[7px] bg-[#1a1a1a] text-[#fff] z-[1300]" />

Never use Tailwind's default colour ramps no-default-palette

`bg-blue-500`, `text-gray-700` and similar bypass the brand and break in dark mode. Use the semantic names: `primary`, `secondary`, `info`, `success`, `warning`, `error`, `grey`, and the text and background roles.

Good

<span className="text-text-secondary">Last synced 2 minutes ago</span>

Avoid

<span className="text-gray-500">Last synced 2 minutes ago</span>

Rebrand through the primary colour only brand-is-primary

A product changes `primary`; shades and contrast text are derived. Never hard-code a product colour in a component.

Good

<ThemeProvider brandColor="#7635DC">{children}</ThemeProvider>

Avoid

<Button className="bg-[#7635DC] hover:bg-[#5e2bb0]">Save</Button>

Reserve status colours for status status-colour-meaning

`success`, `warning`, `error` and `info` carry meaning. Do not use them for decoration, categories or emphasis. Use `primary` for emphasis and `grey` for neutral.

Good

<Badge variant="soft" color="success">Active</Badge>

Avoid

<Badge variant="soft" color="success">Premium plan</Badge>

Use soft styles for info, success and warning soft-for-light-status

White text on filled `info` and `success` is below 3:1 contrast. Use the soft variant, or an outlined one, for these colours. Filled is fine for `primary` and `secondary`.

Good

<Alert variant="success">Changes saved.</Alert>
<Button variant="soft" color="info">Learn more</Button>

Avoid

<Button color="info">Learn more</Button>

Typography

Use type roles, not font sizes type-roles

Roles are `text-h1` to `text-h6`, `text-subtitle1`, `text-subtitle2`, `text-body1`, `text-body2`, `text-caption`, `text-overline`, `text-button`. Use `text-body2` (14px) for interface text and `text-body1` for reading text. Do not set `text-[15px]` or stack `text-sm font-semibold` by hand.

Good

<h2 className="text-h6">API tokens</h2>
<p className="text-body2 text-text-secondary">Production tokens expire in 30 days.</p>

Avoid

<h2 className="text-[17px] font-semibold">API tokens</h2>
<p className="text-sm text-gray-500">Production tokens expire in 30 days.</p>

Write headings and buttons in sentence case sentence-case

Capitalise the first word and proper nouns only. Never uppercase with CSS except `overline`.

Good

<Button>Create project</Button>

Avoid

<Button>CREATE PROJECT</Button>

Label buttons with a verb and the object button-labels

Say what happens. Avoid "OK", "Submit" and "Yes".

Good

<Button>Delete project</Button>
<Button variant="outline">Cancel</Button>

Avoid

<Button>OK</Button>

Keep inline code one step smaller inline-code

Inline monospaced text sits at `text-caption` size inside body text so it does not look heavier than its surroundings.

Good

<p className="text-body2">Run <code className="text-caption">xerobi-ui init</code> first.</p>

Avoid

<p className="text-body2">Run <code className="text-body1">xerobi-ui init</code> first.</p>

Actions

One primary action per region one-primary-action

A page region, dialog or card has one filled primary button. Secondary actions use `outline` or `ghost`. Destructive actions use `color="error"`.

Good

<DialogFooter>
  <Button variant="outline">Cancel</Button>
  <Button>Save changes</Button>
</DialogFooter>

Avoid

<DialogFooter>
  <Button>Cancel</Button>
  <Button>Save changes</Button>
</DialogFooter>

Show progress on the control that was activated loading-state

Use the button's `loading` prop. It disables the control and shows a spinner without changing its width. Do not swap the label for "Loading...".

Good

<Button loading={isPending}>Save changes</Button>

Avoid

<Button disabled={isPending}>{isPending ? "Loading..." : "Save changes"}</Button>

Confirm destructive actions in an alert dialog confirm-destructive

Deleting, revoking or anything that cannot be undone uses `AlertDialog`, names the object being affected, and the confirm button uses the error colour. Do not use a plain `Dialog`.

Good

<AlertDialog>
  <AlertDialogTrigger render={<Button variant="outline" color="error">Delete project</Button>} />
  <AlertDialogContent>
    <AlertDialogHeader>
      <AlertDialogTitle>Delete "Billing site"?</AlertDialogTitle>
      <AlertDialogDescription>Its deployments and domains are removed. This cannot be undone.</AlertDialogDescription>
    </AlertDialogHeader>
    <AlertDialogFooter>
      <AlertDialogCancel>Cancel</AlertDialogCancel>
      <AlertDialogAction>Delete project</AlertDialogAction>
    </AlertDialogFooter>
  </AlertDialogContent>
</AlertDialog>

Give icon-only buttons an accessible name icon-button-name

Use `aria-label`, and a tooltip when the icon is not self-evident.

Good

<Button size="icon" variant="ghost" aria-label="Open settings"><SettingsIcon /></Button>

Avoid

<Button size="icon" variant="ghost"><SettingsIcon /></Button>

Feedback and states

Design loading, empty, error and success design-every-state

Every list, table and form has all four. Use `Skeleton` for loading, `EmptyContent` for empty, `Alert` for persistent errors and `toast` (from `snackbar`) for transient confirmation.

Good

{items.length === 0 ? (
  <EmptyContent title="No projects yet" description="Create a project to get started." action={<Button>Create project</Button>} />
) : (
  <ProjectList items={items} />
)}

Avoid

{items.map((item) => <ProjectRow key={item.id} {...item} />)}

Say what failed and how to fix it error-messages

Inline, next to the field, in plain language. Never "Invalid input".

Good

<HelperText errorMessage="Use 3 to 32 characters: letters, numbers and hyphens." />

Avoid

<HelperText errorMessage="Invalid input" />

Transient feedback is a toast, persistent feedback is an alert toast-vs-alert

A toast confirms something that already happened and goes away. An alert stays until the condition is resolved.

Good

toast.success("Project created")
<Alert variant="warning">Your plan expires in 3 days.</Alert>

Avoid

toast.warning("Your plan expires in 3 days.")

Forms

Build forms with the form block forms-on-tanstack

Use `useForm`, `Form` and the `Field*` components. They wire validation, error text and accessibility. Do not combine raw inputs with ad hoc state.

Good

const form = useForm({ defaultValues: { name: "" }, onSubmit: save })
<Form form={form}>
  <Field.Text name="name" label="Project name" />
  <Button type="submit" loading={form.state.isSubmitting}>Create project</Button>
</Form>

Every field has a visible label labels-always

Placeholders are examples, not labels. Mark optional fields, not required ones.

Good

<Field.Text name="domain" label="Custom domain" helperText="Optional" placeholder="app.example.com" />

Avoid

<Input placeholder="Custom domain" />

Keep inputs at 16px below the sm breakpoint input-size-mobile

The library does this for you. Do not override the input font size, or iOS zooms the page on focus.

Layout

Use Xerobi breakpoints breakpoints

`sm` 600, `md` 900, `lg` 1200, `xl` 1536. They differ from Tailwind's defaults and there is no `2xl`. Design at 360px first.

Good

<div className="grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3" />

Use named layers layer-tokens

`z-local`, `z-appBar`, `z-drawer`, `z-modal`, `z-snackbar`, `z-tooltip`. Do not invent a number to win a stacking fight; fix the stacking context.

Good

<header className="sticky top-0 z-appBar" />

Avoid

<header className="sticky top-0 z-[9999]" />

Use the radius scale radius-scale

`rounded-md` (8px) is the default for controls and cards. Nested elements use a smaller step than their container so corners stay concentric.

Good

<Card className="rounded-xl p-2"><div className="rounded-md" /></Card>

Interaction and accessibility

Never remove the focus indicator focus-visible

If you remove the default outline, add `focus-visible:ring-3 focus-visible:ring-ring`. Programmatic-focus containers such as dialog popups are the only exception.

Good

<div tabIndex={0} className="outline-none focus-visible:ring-3 focus-visible:ring-ring" />

Avoid

<div tabIndex={0} className="outline-none" />

Everything reachable by pointer is reachable by keyboard keyboard-parity

Use Base UI based components for menus, dialogs, tabs and selects. Do not build interactive widgets from `div` and `onClick`.

Good

<Button onClick={open}>Open</Button>

Avoid

<div onClick={open}>Open</div>

Use motion tokens and respect reduced motion motion-tokens

Durations are `duration-150`, `duration-200`, `duration-300`. The global stylesheet turns motion off for `prefers-reduced-motion`, so do not add JavaScript animation that ignores it.

Good

<div className="transition-opacity duration-200 ease-out" />

Avoid

<div className="transition-all duration-[1700ms]" />

Keep targets at least 24px target-size

Controls are 24, 30, 36 or 48px high. Icon buttons below `size="icon-xs"` are not allowed.

Do not use colour as the only signal colour-not-alone

Pair status colours with an icon or text. A red border alone does not tell a colour-blind user a field failed.

Good

<Alert variant="error"><AlertTitle>Payment failed</AlertTitle></Alert>

Dialogs and overlays

Control dialogs with `open`, do not conditionally render them dialog-always-mounted

Conditional rendering skips exit animation and loses focus restoration.

Good

<Dialog open={open} onOpenChange={setOpen}>...</Dialog>

Avoid

{open && <Dialog open>...</Dialog>}

Tooltips add a name, not essential information tooltip-content

Anything the user needs to complete a task belongs in the interface, not a tooltip. Touch users never see tooltips.

Testing

Query by role and accessible name test-roles

Good

screen.getByRole("button", { name: "Create project" })

Avoid

container.querySelector(".bg-primary")

Run the design audit audit-before-merge

`bun run audit:design` must report zero errors. New exceptions go in `scripts/audit-allowlist.json` with a reason.

Search documentation

Search pages, components and blocks.