Plan and audit UI with @cascivo/design
@cascivo/design gives an AI agent (or a person) two things a prompt cannot: a page plan chosen
from a fixed catalogue, and a measurement of the page that was actually rendered. Every command
is deterministic: the same input gives the same output, and no model is involved.
When to use it
| You want | Use |
|---|---|
| A page structure for a brief, before writing code | cascivo design plan "<brief>" |
| To know if a rendered page is sound | cascivo design check <url> |
| To look at a page for about 1.3k vision tokens | cascivo design see <url> |
| The project's design limits in one file | cascivo design init |
| A whole theme from one brand colour | cascivo design theme --seed |
It works on any page a browser can open: React, htmx, static HTML, a .cv render. The page does
not have to use cascivo components.
Install
pnpm add -D cascivo @cascivo/design playwright
npx playwright install chromium
plan, init and theme need no browser. check and see drive Chromium through Playwright;
set CASCIVO_CHROMIUM=/path/to/chrome to use a browser that is already installed.
Install the agent skill
The cascivo-design skill ships inside the cascivo package, so it matches your installed
version and needs no GitHub access:
npx cascivo design skill # writes .claude/skills/cascivo-design/
npx cascivo design skill --dir .agents/skills # another agent's skills directory
npx cascivo design skill --force # replace an existing copy (after upgrading cascivo)
It refuses to overwrite an existing folder without --force, and writes only inside
<dir>/cascivo-design. To take the latest skill from GitHub instead, with the open
Agent Skills CLI (it detects Claude Code, Cursor, Codex and others):
npx skills add cascivo/cascivo --skill cascivo-design
The loop
npx cascivo design init # writes DESIGN.md; keeps an existing one
npx cascivo design plan "a pricing page with three plans"
# build the page from the plan, start the app
npx cascivo design check http://localhost:5173/pricing
# apply the fix each finding names, check again; stop after 3 rounds
npx cascivo design see http://localhost:5173/pricing --width 390
check prints one line per finding and exits 1 while an error is left:
score 67/100 — mobile 50 · a11y 75 · contrast 75 · tokens 92 · hierarchy 43 — 5 errors, 5 warnings
error contrast div.wide > p.faint — 2.11:1, needs 4.5:1 (#aaaaaa on #f4f4f4) → color: #6f6f6f or stronger
warn token/spacing main > div.card ×4 — padding 13px is off the spacing scale → var(--cascivo-space-3) (12px)
It measures mobile overflow and touch targets (320 to 414px), WCAG 2.2 AA (axe-core), text
contrast, token adherence and heading and type hierarchy. The rule table is in the
package README. --json gives the full report, --max N caps the text.
A direction, written down
A page can pass every rule and still look like every other page. So choose a look first and
record it: init takes it as flags, writes it into the DESIGN.md front matter and prints the
:root block that applies it.
npx cascivo design init --accent "#b4532a" --background "oklch(0.975 0.012 85)" \
--font-display '"Iowan Old Style", Palatino, Georgia, serif' \
--signature "a double ruled ledger line under every section heading" \
--composition "the page hangs from the left edge; the right third stays empty"
Colour flags: --primary, --accent, --background, --surface, --text (hex or a functional
CSS colour). Type: --font-display, --font-body. --composition records the one layout move (asymmetry, scale contrast, a broken grid, overlap, full bleed): plan fixes what a page says and in what order, not how it is laid out. check then treats the project's own tokens
as part of the scale: everything in the front matter of ./DESIGN.md (or --design <path>), and
every custom property the page defines on :root. A custom palette that is declared is not a
finding; a hard-coded value that is declared nowhere still is.
plan picks one archetype from the catalogue (landing, pricing, dashboard, settings, list and
detail, wizard and more) and prints its slots as .cv text, or as ViewConfig JSON with
--format view, with the layout, state, mobile and accessibility rules for that kind of page.
The copy in a plan is a placeholder; the structure is the point.
Pages that do not use cascivo
check detects whether the page resolves --cascivo-* tokens. When it does not, the token/*
rules give way to scale/spacing (a 4px grid) and scale/colors (at most 12 colours). The other
rules and the score are the same, so a score compares across both kinds of page. Declared
lengths pass the grid and declared colours do not count toward the 12.
Pages behind a login
check and see accept --storage-state <file>, a Playwright storage state
JSON (cookies and localStorage) that is loaded into every browser context:
npx playwright codegen --save-storage=auth.json http://localhost:5173/login # log in once, close the window
npx cascivo design check http://localhost:5173/account --storage-state auth.json
The library takes the same path: check(url, { storageState: 'auth.json' }), see(url, { storageState });
the design_check MCP tool takes storageState. A missing or malformed file is an error that names
the problem and never prints a cookie value.
- Gitignore
auth.json. It holds live session cookies; treat it like a password. - The model sees the page.
seescreenshots andcheckfindings (selectors, text) of a logged-in page go to the model. Real customer data in them leaves your machine. - Prefer a mock or demo mode (seeded data, no real accounts) for the improvement loop, and use a storage state only for a final check on the live app.
For agents
- Skill:
skills/cascivo-design(install:npx cascivo design skill) chooses and records a direction, then runs the loop above with a 3-round cap and one rubric critique at the end. - MCP (
@cascivo/mcp):design_plananddesign_checkrun the same two commands. - Library:
import { plan, check, see, init, theme, catalogue } from '@cascivo/design'.
Does it help?
design-eval.md compares six briefs built with and without this loop, with the cases where it did not help.
As Markdown: /docs/using-cascivo-design.md