Skip to content
Back to skills

Design Prototype

ASecurity

Produce an interactive single-file HTML design prototype using the REAL Caxri design system (the Renderer's shadcn primitives + theme.css tokens + Tailwind v4 semantic utilities) with production-style React; no build step, opens directly in a browser. Use when asked for a design prototype / interactive mockup / 交互原型 / 出个原型 / 讨论原型设计, or to explore a redesign of a surface before committing to implementation. Also use when the user wants to see or compare a visual or motion effect before adoptin...

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 24, 2026
developmenttypescriptbashreactnodegitapidocumentation

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 12 files and shows the line behind each finding

Scanned November 24, 2026

npx -y skills add tjx666/caxri --skill design-prototype --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Design Prototype?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Design Prototype
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tjx666-design-prototype/badge)](https://www.skillsdirectory.com/skills/tjx666-design-prototype)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: design-prototype
description: Produce an interactive single-file HTML design prototype using the REAL Caxri design system (the Renderer's shadcn primitives + theme.css tokens + Tailwind v4 semantic utilities) with production-style React; no build step, opens directly in a browser. Use when asked for a design prototype / interactive mockup / 交互原型 / 出个原型 / 讨论原型设计, or to explore a redesign of a surface before committing to implementation. Also use when the user wants to see or compare a visual or motion effect before adopting it ("得实际看看效果").
---

# Design Prototype

One HTML file, double-click to open, fully interactive, rendered by the **actual design system**:
the Renderer's own `@/components/ui/*` shadcn primitives, the real `theme.css` semantic tokens, and
Tailwind v4 utilities compiled in the browser, while the source stays **production-style React**
(`import { Button } from '@/components/ui/button'`, `className="bg-surface text-muted"`, hooks).
Promotion to production is mostly "split into files", not "rewrite".

Prototype code may be quick-and-dirty (one file, inline data, no IPC), but the **interaction must
be complete**: states, transitions, and affordances are the point of a prototype, not its code
style.

## Showing an effect to the user

When the user wants to judge how something looks or moves before adopting it, hand them a
prototype, not a screen recording: it lets them replay, switch states, and compare variants side by
side. For example, choosing when the composer strip's figures roll took two dev-app recordings with
a temporarily patched fake Agent, while a prototype with "Always roll" and "Roll after quiet" strips
and a phase switch answered it directly. Import the production component when it exists (add it to
`assets/entry.mjs`) so the prototype shows the real behavior. This changes only what the user
reviews: the agent's own acceptance of a Renderer change still uses the CDP checks and recordings
`AGENTS.md` and the `debug` skill require.

## How it works

```text
one-time (~2s, cached):   scripts/build-runtime.ts  →  caxri-prototype-runtime.js (IIFE)
                                                       + caxri-prototype-theme.js (inlined CSS)
                                                       + vendored tailwind-browser.js + babel.min.js
per prototype (no build): single HTML  =  <script runtime + theme> + @tailwindcss/browser
                          + babel-standalone + <script type="text/babel"> production React
```

- The runtime bundles `react`, `react-dom/client`, every `@/components/ui/*` primitive,
  `@/lib/utilities` (`cn`), shared hooks, `lucide-react`, `motion/react`, `cmdk`, and `zustand`
  from this repo's own source and `node_modules`: versions, tokens, and component behavior match
  production by construction.
- `caxri-prototype-theme.js` inlines the real `theme.css` + `styles.css` + `tw-animate-css` into a
  `text/tailwindcss` stylesheet; `@tailwindcss/browser` (pinned to the repo's Tailwind version)
  compiles the prototype's utility classes at runtime, including the `@theme inline` token
  bridge, so `bg-surface` resolves to the live Dracula tokens and `bg-blue-500` fails to compile,
  exactly like production.
- At load the runtime calls `applyCssTheme(draculaTheme)`, as production's `useWorkbenchAppearance`
  does, so the tokens production derives at runtime (`--switch-thumb`, `--switch-thumb-off`,
  `--diff-stat-*`, readable foregrounds) exist; `theme.css` alone leaves every Switch thumbless.
- A small `window.require` shim + babel's `transform-modules-commonjs` lets the prototype keep
  real `import` statements, and a registered TSX preset keeps TypeScript syntax working in the
  inline script.

## Quickstart

1. **Build the runtime into the prototype's directory** (any dir works; `/tmp` is fine):

   ```bash
   bun run .agents/skills/design-prototype/scripts/build-runtime.ts /tmp/my-proto
   ```

   Always rerun after design-system or `entry.mjs` changes: rebuilding is ~2s and always safe.
   The two vendored files cache under `assets/` keyed by exact version, so only the first build on
   a machine needs network access.

2. **Capture the surface you change as it ships today**, from the installed app (or a
   `switch-worktree dev` instance with `--port <its CDP port>`):

   ```bash
   bun run .agents/skills/design-prototype/scripts/capture-surface.ts /tmp/my-proto
   ```

   `surface.html` holds the window's current markup and classes with text masked; copy its
   structure instead of rebuilding the workbench from memory. A from-memory delegation prototype
   came out in English, missing the right file panel and status bar, with invented Session names,
   and did not read as the app the user runs every day. Take labels from the Renderer's `zh-cn` and
   `en` locales, and match the app's current language.

3. **Copy [`references/template.html`](references/template.html)** into the same dir, rename, and
   replace the sample `App` with the real surface. Keep the runtime shim block untouched.

4. **Open it** (`open /tmp/my-proto/xxx.html`), no server, no build.

## Verify before delivering

Headless-check it renders with zero console errors and that the semantic Tailwind tokens actually
compiled, then capture a screenshot:

```bash
bun run .agents/skills/design-prototype/scripts/verify-prototype.ts /tmp/my-proto/xxx.html
```

The script exits 1 on any page/console error and waits for a `bg-surface` probe to resolve
(Tailwind finished compiling) instead of sleeping. It also fails when `--switch-thumb` is unset,
which means the runtime in the prototype's directory is stale: rebuild it.

Then **Read the screenshot**: a prototype is a visual deliverable; don't ship it sight-unseen.
Click through every interactive state (the toggle strip, dialogs, menus) and screenshot the key
ones.

## What's in the runtime (extend freely)

See [`assets/entry.mjs`](assets/entry.mjs): the single source of truth for the importable module
map: every `@/components/ui/*` primitive, `@/components/shortcut-badge`, `@/lib/utilities` (`cn`),
`@/lib/motion`, every `@/hooks/*`, plus `react`, `react-dom(/client)`, `lucide-react`,
`motion/react`, `cmdk`, `zustand`, `class-variance-authority`, `clsx`, and `tailwind-merge`.
`scripts/build-runtime.test.ts` pins the map to the Renderer's actual `ui/` and `hooks/`
directories, so a new primitive fails the suite until it's added here.

Missing a module → the require shim throws with its name; add it to `entry.mjs` and rerun the
build script (~2s). That error is the "extend and rebuild" signal, not a template bug.

## Pitfalls

- The runtime writes the theme as inline styles on `<html>`, so a `<style>:root { --accent: … }`
  override silently loses. Override a token with
  `document.documentElement.style.setProperty('--accent', …)` instead.
- **Keep `import React from 'react'` in the prototype** even when unused: babel-standalone's
  react preset uses the classic JSX runtime. (The bundled runtime itself compiles with
  `--jsx=automatic`; that flag is already in the build script.)
- TypeScript syntax works via the template's registered `tsx` preset (`data-presets="react,tsx"`),
  but it is strip-only; nothing type-checks the prototype; annotations are documentation.
- **Keep the `TooltipProvider` wrapper** from the template (production wraps the whole tree in it,
  `app.tsx`). `CommandTooltip`'s shortcut hint resolves to nothing in a prototype: there is no
  keybinding bootstrap; use plain `Tooltip` content instead.
- A Tooltip opens only after `TOOLTIP_OPEN_DELAY_MS` (1500 ms), as in production. To screenshot
  one, hover and wait for `.tooltip-popup` to be visible with a timeout above that delay; a 700 ms
  sleep captured no tooltip.
- A `file://` prototype cannot load a local CSS `mask` URL (Chrome blocks it as cross-origin),
  even though `<img src="./icons/x.svg">` works. Mask assets such as the Grok Agent icon
  (`agent-icon-registry.ts`, `kind: 'mask-asset'`) need a `data:image/svg+xml,...` URL instead.
- **Only semantic color utilities compile** (`bg-surface`, `text-muted`, `bg-accent`,
  `border-border`, `text-danger`, `bg-[var(--selection)]`), the default palette is unregistered,
  so `bg-zinc-800` silently produces no CSS. An unstyled-looking element usually means a non-token
  color class.
- The primitives are compositional shadcn style: `Empty` + `EmptyTitle` (+ `EmptyMedia`),
  `Dialog` + `DialogContent`…, not prop bags: check the component source in
  `apps/desktop/src/renderer/src/components/ui/` for the exact API.
- `theme.css` sets `html, body, #root { height: 100%; overflow: hidden }` like the real workbench:
  give your surface its own scroll container, as production does.
- Prototypes have no Electron preload: never touch `window.caxri`; fake data inline.

## Design bar (same as production surfaces)

A prototype is a surface: DESIGN.md applies to what it _demonstrates_:

- Show **at least one non-happy-path state** (empty / loading / error / in-progress), ideally
  behind a state-toggle strip like the template's. A happy-path-only prototype under-specifies the
  design and silently blesses missing states.
- Honor the redlines: type-scale tiers (13/12/11px), the 4px spacing grid, radius 4/6/8, one
  durable `--accent` focus per screen, quiet chrome. Loading is `Spinner`/skeleton; boolean
  preferences are `Switch`, pre-submit opt-ins are `Checkbox`.
- When the change modifies an existing surface, rebuild that surface as it ships today (read its
  components and copy, or capture the running app) and add only the requested delta, visibly marked
  behind a toggle. Anything not shipping today and not required by the request is out of the
  prototype: a multi-host sidebar prototype that also invents a "Needs you" list and session-header
  buttons misrepresents what the change touches.
- Research precedent first for substantial new surfaces: Call the Skill tool with "competitors"
  (VS Code / GitLens references) before inventing a new interaction pattern.
- Don't paint affordances you don't wire (a hover tint with no click, a kbd hint with no key
  handler): in an _interactive_ prototype a dead affordance is a spec bug.
- Annotate anything deliberately out of scope in an HTML comment so the implementer knows it's a
  cut, not a decision.

Files in this skill

  • SKILL.md10.1 KB
  • assets/.gitignore139 B
  • assets/entry.mjs7.3 KB
  • references/template.html6.4 KB
  • scripts/build-runtime.test.ts5.6 KB
  • scripts/build-runtime.ts6 KB
  • scripts/capture-surface.test.ts831 B
  • scripts/capture-surface.ts5.8 KB
  • scripts/inline-theme-css.ts1.9 KB
  • scripts/renderer-stylesheets.ts1.3 KB
  • scripts/runtime-esbuild.ts1.3 KB
  • scripts/verify-prototype.ts2.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.