Renderer styling — design tokens only, never hardcoded colours. A repository rule for apps/ui/src/renderer/**, apps/ui/.storybook/**; read it before editing a file there.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Rule Renderer Design System?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/geniro-io-rule-renderer-design-system)
---
name: rule-renderer-design-system
description: "Renderer styling — design tokens only, never hardcoded colours. A repository rule for apps/ui/src/renderer/**, apps/ui/.storybook/**; read it before editing a file there."
---
<!-- GENERATED by scripts/sync-agent-rules.mjs from .claude/rules/renderer-design-system.md. DO NOT EDIT: edit the source, then run `pnpm sync:agent-rules`. -->
# Renderer design system — tokens & styling
Style only from design tokens (Tailwind CSS v4, CSS-first `@theme`); never hardcode a colour.
## Tokens and themes
- `styles/themes/<id>.css` is the only source of token values, one file per theme. `styles/global.css` maps them to utilities in `@theme inline` and holds no value of its own. Components never define a token.
- Adding a token: add it to every file in `styles/themes/` and to the `@theme inline` map, then reference it. The light theme's values are also the artifact page's fallbacks (`FALLBACK` in the daemon's `v1/agents/utils/artifact-runtime.ts`, pinned by its spec), so the two change together.
- Every theme file declares the same tokens; a missing one silently falls back to light. `styles/themes/theme-tokens.spec.ts` catches it.
- Adding a theme: a file in `styles/themes/` plus a row in `shared/themes.ts` (id, label, appearance, window background). `shared/themes.spec.ts` fails if they disagree.
- The theme marker is `data-theme` on `<html>`, written only by `renderer/theme/apply-theme.ts`. Never use a `.dark` class or the OS media query; Tailwind's `dark:` is re-keyed onto `data-theme`. A component that must name the theme uses that module's hooks.
## Colours
- Every colour, radius and shadow comes from a semantic utility (`bg-primary`, `text-muted-foreground`, `shadow-panel-sm`) or `var(--token)`.
- Raw hex / `rgb()` / `hsl()` / `oklch()` / `oklab()` are banned. The `no-restricted-syntax` override in `eslint.config.mjs` catches them in Tailwind arbitrary values and `#hex` literals, but not a bare `rgb(…)`-style string (e.g. in `style={{}}`) — never write one.
- Non-colour arbitrary values are fine (`size-[26px]`, `shadow-[0_0_0_1px_var(--border)]`).
- Sizes in the shared components are the sheet's pixels (`h-[24px]`, `px-[12px]`, `size-[14px]`, `text-[12px]`), never Tailwind's rem steps: the root font is 15px (`--font-size`), so `h-6` draws 22.5 and `text-xs` 11.25.
- Floating panels use the shared `popoverSurface` constant (`components/ui/popover.tsx`: `shadow-panel-lg` + `border-border/60` hairline). Panels that sit in the page (dialog) use `shadow-panel-md`.
- A control that opens a `fixed` panel (`anchor="viewport"`) sits under no `backdrop-*`, `filter`, `transform`, `translate`, `will-change` or `contain`: each captures the panel's box, so it lands far from its trigger and is clipped by the scroller.
## Roles: colour, size, focus, motion
- `primary` is neutral ink: the primary action and a selected or checked control. Never a state.
- Colour carries meaning: `attention` needs the user (an approval, a question, an unread mark), `info` is new, working or live, `success` is done or ready, `violet` is the third kind (Fixed, Feedback), `destructive` failed or destroys. A state is never colour alone: it keeps its glyph and its word. `violet` is for glyphs, dots and fills, never text.
- The map: change kinds New / Improved / Fixed / Internal are sky / green / violet / neutral; memory types Project / Reference / Feedback / About you the same four; chat and agent states working / completed / needs you / failed / stopped are sky / green / caramel / crimson / neutral, and Ready / Not signed in / Not installed green / caramel / crimson.
- Each hue has a soft fill (`bg-info-soft`, `bg-success-soft`, `bg-violet-soft`, `bg-attention-soft`, `bg-destructive-soft`) for a tag or a tinted row. Text on it stays ink; the hue is on the icon, the dot and the fill. Hints, counts, chevrons and placeholders are `text-hint`.
- Surfaces: `bg-window` behind the side columns and the title bar, `bg-sidebar` the side columns, `bg-background` the page, `bg-card` a block or a field's ground, `bg-accent` hover, selected and the chips tone; `border-border` the hairline.
- A coloured accent on a new surface is a short straight bar or a dot, never a border that follows a rounded corner (`AttentionBar`).
- Heights: `h-control` (28px: button, select, chip, stepper), `h-field` (32px: text field), `h-menu-item` (30), `min-h-row` (44: a setting row), `h-page-header` (46), `h-touch` (40: a phone button). Radii: `rounded-sm` 4 (a type tag, a checkbox), `rounded-md` 6 (tag, icon button), `rounded-control` 7 (button), `rounded-lg` 8 (field, menu item), `rounded-card` or `rounded-xl` 10 (block), `rounded-dialog` 14, `rounded-sheet` 16 (a phone sheet).
- Phone sizes, below `sm`: a field, select and stepper are 34px, a segmented control 30, a switch 40×24, a setting row at least 52 with a 15px label, a button `size="touch"` 40, and a select opens a `BottomSheet`.
- Type: one `type-*` utility per role (`type-screen-title` 24/600, `type-phone-title` 22/650, `type-page-header` 14/600, `type-group-title` 13/600, `type-body` 13 or 15 on a phone, `type-description` 12.5, `type-meta` 12, `type-mono` 12 without ligatures, `type-figures` tabular). The face is the system font.
- Focus is `focus-outline` on a control and `focus-field` on a field (`styles/global.css`); never a new `ring-*` focus.
- Motion: fast 120ms (a hover tone, a switch, a checkbox, a button's label), base 160–180 (a notice, a tooltip, a strip, a row opening), panel 200–220 (a sheet, a dialog); one curve, `ease-standard`. A `transition-*` utility takes the fast step; `duration-fast|base|panel` name the others. A surface appears with `animate-fade-in`, a sheet with `animate-sheet-in-right` or `animate-sheet-in-up`, a notice with `animate-notice-in`; leaving is a third faster (`animate-fade-out`, `animate-sheet-out-*`, kept mounted by `ui/use-presence.ts`). Under reduced motion whatever travels only fades. Nothing loops but the working spinner: a skeleton is static.
- Hover and press change tone only, never position, size or shadow (`is-hover:`, `is-active:`), and nothing shifts the layout: space for what appears later is reserved (a field's error line, a row's error, a save state), and a button working on its press is `Button busy`, which keeps its width.
- Whatever stands in one row shares one centre line: build it on `ui/row.tsx` (`Row`, `RowText`), whose items are centred, carry no vertical margin and cut text with an ellipsis. `node scripts/stand/cdp.mjs <cdp port> align` lists the rows on screen that break it.
## Redesign in progress: build to the reference
- The redesign's decisions, mock pages and reference screenshots are in `docs/redesign/`; start at its `README.md`. The design-system sheet is `docs/redesign/step-13-design-system.html` with its pictures in `docs/redesign/shots/step-13/`; every shared piece is built to it. A screen the redesign covers is built to its reference, never to taste: geometry, order, copy and states from the reference image and the mock page's CSS, colour from the tokens by meaning.
- Every reference image of the screen is reproduced on a stand at the same theme, viewport width and state, and shown beside the reference in the pull request and the card report. A difference is fixed or named for the owner; none ships unnamed.
- A decision in `docs/redesign/spec.md` wins over an older rule line: rewrite that line in the same pull request.
## Class names
- Compose with `cn()` (`components/ui/utils.ts`) and express variants with `cva`; never string-concatenate classes or branch long literals with ternaries.