ada-agent 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +262 -256
  2. package/docs/architecture.md +38 -14
  3. package/docs/cloudflare.md +81 -0
  4. package/docs/connectors.md +2 -1
  5. package/docs/integrations.md +4 -1
  6. package/package.json +4 -2
  7. package/skills/aesthetic-direction/SKILL.md +24 -24
  8. package/skills/color-palette/SKILL.md +24 -24
  9. package/skills/component-library/SKILL.md +23 -23
  10. package/skills/dark-mode/SKILL.md +24 -24
  11. package/skills/dashboard-ui/SKILL.md +23 -23
  12. package/skills/design-system/SKILL.md +24 -24
  13. package/skills/design-tokens/SKILL.md +24 -24
  14. package/skills/empty-states/SKILL.md +23 -23
  15. package/skills/hero-section/SKILL.md +23 -23
  16. package/skills/micro-interactions/SKILL.md +23 -23
  17. package/skills/motion-design/SKILL.md +23 -23
  18. package/skills/page-transitions/SKILL.md +23 -23
  19. package/skills/pricing-page/SKILL.md +23 -23
  20. package/skills/scroll-animation/SKILL.md +23 -23
  21. package/skills/skeleton-loader/SKILL.md +23 -23
  22. package/skills/tailwind-theme/SKILL.md +24 -24
  23. package/skills/typography/SKILL.md +24 -24
  24. package/skills/ui-polish/SKILL.md +24 -24
  25. package/skills/ui-review/SKILL.md +24 -24
  26. package/skills/web-fonts/SKILL.md +24 -24
  27. package/src/client/autostart.ts +93 -0
  28. package/src/client/catalog.json +1 -0
  29. package/src/client/cli.ts +23 -1
  30. package/src/client/models-dev.ts +57 -3
  31. package/src/selfcheck.ts +404 -364
  32. package/src/server/config.ts +7 -0
  33. package/src/server/providers/openai-compat.ts +4 -2
  34. package/src/server/providers/registry.ts +1 -0
  35. package/src/server/router.ts +5 -1
  36. package/src/shared/types.ts +1 -0
@@ -0,0 +1,81 @@
1
+ # Using Cloudflare models with ada
2
+
3
+ Cloudflare gives you two OpenAI-compatible endpoints, and ada speaks OpenAI — so both are just the
4
+ `cloudflare` provider with the right env vars. Pick the one you have:
5
+
6
+ - **Workers AI** — Cloudflare *hosts* the model (Llama, Qwen, Gemma, Kimi, …). Simplest.
7
+ - **AI Gateway** — Cloudflare *proxies* other providers (OpenAI/Anthropic/Workers AI/…) through one
8
+ endpoint, with caching + analytics + optional unified billing.
9
+
10
+ Browse what's available and its pricing any time, offline:
11
+
12
+ ```bash
13
+ ada catalog cloudflare # Workers AI + AI Gateway models, context + $/1M
14
+ ```
15
+
16
+ ---
17
+
18
+ ## Workers AI (recommended start)
19
+
20
+ 1. **Cloudflare dashboard → AI → Workers AI → "Use REST API".** Copy your **Account ID** and
21
+ **create an API token** (Workers AI scope).
22
+ 2. Set the env vars for the backend:
23
+ ```bash
24
+ export CLOUDFLARE_ACCOUNT_ID=your-32-char-account-id
25
+ export CLOUDFLARE_API_TOKEN=your-workers-ai-token
26
+ ```
27
+ 3. Start the backend and run ada with a `@cf/…` model id:
28
+ ```bash
29
+ ada-server
30
+ ada --model "@cf/moonshotai/kimi-k2.7-code" # or any id from `ada catalog cloudflare`
31
+ ```
32
+
33
+ That's it. ada routes `@cf/*` to Cloudflare automatically, sends the full id through, and `/cost`
34
+ already knows the price from the catalog.
35
+
36
+ > The default endpoint ada builds is
37
+ > `https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1` — Workers AI's
38
+ > OpenAI-compatible base. No code change needed.
39
+
40
+ ---
41
+
42
+ ## AI Gateway
43
+
44
+ 1. **Cloudflare dashboard → AI → AI Gateway → create a gateway.** Note your **Account ID** and
45
+ **Gateway ID**, and grab the gateway's **OpenAI-compatible endpoint URL** (the "compat" base).
46
+ 2. Point ada at that URL and supply the token it expects (your gateway token, or the upstream
47
+ provider's key, depending on how the gateway is configured):
48
+ ```bash
49
+ export CLOUDFLARE_BASE_URL="https://gateway.ai.cloudflare.com/v1/<account>/<gateway>/compat"
50
+ export CLOUDFLARE_API_TOKEN=your-gateway-or-provider-key
51
+ ```
52
+ (`CLOUDFLARE_BASE_URL` overrides the Workers AI default, so `CLOUDFLARE_ACCOUNT_ID` isn't needed.)
53
+ 3. Use the model id format your gateway expects (often `provider/model`, e.g. `openai/gpt-4o`), and
54
+ route it explicitly to the `cloudflare` provider — easiest is the `--provider` field or an
55
+ `@cf/`-style id; otherwise send `provider: "cloudflare"` on the request.
56
+
57
+ > Copy the exact base URL from your AI Gateway page — Cloudflare shows the OpenAI-compatible endpoint
58
+ > there. ada just proxies to whatever you set.
59
+
60
+ ---
61
+
62
+ ## How it works (why it's only ~2 lines in ada)
63
+
64
+ ada keys providers by **wire format**, not by vendor. Cloudflare's Workers AI and AI Gateway both
65
+ emit the OpenAI Chat Completions format, so they reuse the shared `openai-compat.ts` adapter — no
66
+ Cloudflare-specific SDK or adapter. The whole integration is:
67
+
68
+ - one `PROVIDERS` entry in [`src/server/config.ts`](../src/server/config.ts) (base URL + key env),
69
+ - one router line in [`src/server/router.ts`](../src/server/router.ts) (`@cf/*` → cloudflare).
70
+
71
+ (Contrast: opencode pulls in dedicated `workers-ai-provider` / `ai-gateway-provider` packages + a
72
+ custom loader, because it's built on the Vercel AI SDK's per-provider abstraction. ada doesn't need
73
+ that for an OpenAI-shaped endpoint.)
74
+
75
+ ## Troubleshooting
76
+
77
+ - **401 / 403** — wrong token or scope. Workers AI needs a Workers-AI-scoped token; the Account ID
78
+ must match the token's account.
79
+ - **404 on the model** — the `@cf/…` id isn't hosted; check `ada catalog cloudflare` or the Workers
80
+ AI catalog in the dashboard.
81
+ - **`/cost` says "no price table"** — the model isn't in the baked catalog; run `npm run catalog:refresh`.
@@ -42,7 +42,8 @@ that project — the connector's tools appear automatically.
42
42
 
43
43
  - MCP servers run code / reach the network, so they load **only in trusted projects** (the same trust
44
44
  gate as `.ada` prompts and settings). Untrusted projects skip them.
45
- - Every MCP tool is **approval-gated** — ada prompts before each call.
45
+ - Every MCP tool is **approval-gated** — ada prompts before each call (in `ask` mode).
46
+ - A server's **resources** are reachable through a generated `<server>__read_resource` tool.
46
47
  - Secrets come from **env vars** (referenced in the server's `env`), never committed to `.ada/mcp.json`.
47
48
  - See the `connectors` skill category (`list_skills {category: "connectors"}`) for per-connector setup
48
49
  walk-throughs, and the `mcp-server` skill to build your own.
@@ -15,12 +15,15 @@ ada serve # → http://localhost:8788 (ADA_HTTP_PORT to change)
15
15
  ## Typed SDK — `src/sdk`
16
16
 
17
17
  ```ts
18
- import { createClient } from "ada/sdk"; // or "./src/sdk/index.ts" in-repo
18
+ import { createClient } from "ada-agent/sdk"; // in-repo: "./src/sdk/index.ts"
19
19
  const ada = createClient("http://localhost:8788");
20
20
  console.log(await ada.health());
21
21
  const { text } = await ada.prompt("list the files in this project");
22
22
  ```
23
23
 
24
+ It's a ~30-line `fetch` wrapper over the HTTP API above — if you'd rather not pull in the source,
25
+ just POST to `/v1/prompt` directly.
26
+
24
27
  ## ACP bridge — `ada acp`
25
28
 
26
29
  A minimal Agent Client Protocol bridge over stdio (JSON-RPC 2.0, newline-delimited): handles
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ada-agent",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "A from-zero terminal coding agent with a Cursor-style routing backend, ~285 skills, MCP connectors, and ask/plan/auto modes",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -49,7 +49,9 @@
49
49
  "server": "tsx src/server/index.ts",
50
50
  "typecheck": "tsc --noEmit",
51
51
  "selfcheck": "tsx src/selfcheck.ts",
52
- "bench:swebench": "node bench/swebench.mjs"
52
+ "bench:swebench": "node bench/swebench.mjs",
53
+ "catalog:refresh": "node scripts/refresh-catalog.mjs",
54
+ "release": "node scripts/release.mjs"
53
55
  },
54
56
  "dependencies": {
55
57
  "@anthropic-ai/sdk": "^0.106.0",
@@ -1,24 +1,24 @@
1
- ---
2
- name: aesthetic-direction
3
- description: Choose an intentional, non-templated visual direction and reference before building any UI
4
- category: ui-design
5
- ---
6
-
7
- # Aesthetic Direction
8
-
9
- Do this before writing component code. The difference between a forgettable, templated UI and a memorable one is a deliberate point of view chosen up front — not defaults stacked by accident.
10
-
11
- 1. Name the feeling in 2–3 adjectives and a reference: "editorial and confident, like Linear meets a print magazine" or "warm utilitarian, like a well-made tool." Vague intent yields vague output.
12
- 2. Pick a stance on each axis deliberately: density (airy vs. compact), shape language (sharp vs. rounded), contrast (muted vs. punchy), and ornament (flat vs. layered/textured). Write the choices down.
13
- 3. Choose ONE signature move the design hangs on — a distinctive typeface, a bold accent, a grain/noise texture, an unusual grid, a motion personality. Without a signature, it reads generic.
14
- 4. Anchor with real references: pull 3–5 screenshots you admire and articulate *what specifically* works (the oversized headers, the restrained palette, the tight grid) — then translate, don't copy.
15
- 5. Pressure-test against templates: if it could be any Bootstrap/default-shadcn site, push harder — change the type, break the symmetry, commit to one strong color, vary the rhythm.
16
- 6. Encode the direction into tokens immediately so the rest of the build inherits the decision instead of re-litigating it per component.
17
- 7. Sanity-check feasibility and accessibility — a daring direction still has to pass contrast and perform.
18
-
19
- ## Rules
20
- - Decide the direction before components; retrofitting taste onto built UI rarely works.
21
- - Commit to one signature element rather than three half-measures.
22
- - "Modern/clean/minimal" is not a direction — name a feeling, a reference, and a specific move.
23
- - Default shadcn/Bootstrap/Tailwind-gray is a starting point to subvert, not a destination.
24
- - Distinctive still means accessible and fast — daring is not an excuse for 2:1 contrast.
1
+ ---
2
+ name: aesthetic-direction
3
+ description: Choose an intentional, non-templated visual direction and reference before building any UI
4
+ category: ui-design
5
+ ---
6
+
7
+ # Aesthetic Direction
8
+
9
+ Do this before writing component code. The difference between a forgettable, templated UI and a memorable one is a deliberate point of view chosen up front — not defaults stacked by accident.
10
+
11
+ 1. Name the feeling in 2–3 adjectives and a reference: "editorial and confident, like Linear meets a print magazine" or "warm utilitarian, like a well-made tool." Vague intent yields vague output.
12
+ 2. Pick a stance on each axis deliberately: density (airy vs. compact), shape language (sharp vs. rounded), contrast (muted vs. punchy), and ornament (flat vs. layered/textured). Write the choices down.
13
+ 3. Choose ONE signature move the design hangs on — a distinctive typeface, a bold accent, a grain/noise texture, an unusual grid, a motion personality. Without a signature, it reads generic.
14
+ 4. Anchor with real references: pull 3–5 screenshots you admire and articulate *what specifically* works (the oversized headers, the restrained palette, the tight grid) — then translate, don't copy.
15
+ 5. Pressure-test against templates: if it could be any Bootstrap/default-shadcn site, push harder — change the type, break the symmetry, commit to one strong color, vary the rhythm.
16
+ 6. Encode the direction into tokens immediately so the rest of the build inherits the decision instead of re-litigating it per component.
17
+ 7. Sanity-check feasibility and accessibility — a daring direction still has to pass contrast and perform.
18
+
19
+ ## Rules
20
+ - Decide the direction before components; retrofitting taste onto built UI rarely works.
21
+ - Commit to one signature element rather than three half-measures.
22
+ - "Modern/clean/minimal" is not a direction — name a feeling, a reference, and a specific move.
23
+ - Default shadcn/Bootstrap/Tailwind-gray is a starting point to subvert, not a destination.
24
+ - Distinctive still means accessible and fast — daring is not an excuse for 2:1 contrast.
@@ -1,24 +1,24 @@
1
- ---
2
- name: color-palette
3
- description: Craft an accessible on-brand palette with checked contrast, perceptual ramps, and semantic color roles
4
- category: ui-design
5
- ---
6
-
7
- # Color Palette
8
-
9
- Use this when choosing or fixing a product's colors — to get past "pick a brand hue and tint it" into a palette that's coherent, accessible, and works in both light and dark.
10
-
11
- 1. Start from one or two brand hues and build perceptually even ramps in `oklch()` (11 steps, 50–950). Even lightness steps mean predictable contrast — RGB tinting gives muddy, uneven ramps.
12
- 2. Reserve saturation for intent: keep most surfaces near-neutral (low-chroma grays carrying a hint of the brand hue) and spend vivid color only on the accent and on calls to action.
13
- 3. Define semantic roles, not raw swatches: `--bg`, `--surface`, `--surface-raised`, `--text`, `--text-muted`, `--border`, `--accent`, `--accent-fg`, plus state colors success/warning/danger/info.
14
- 4. Check contrast for real: body text ≥ 4.5:1, large text and UI components ≥ 3:1 (WCAG AA). Pair every background token with a foreground that passes against it.
15
- 5. Design the dark variant as a sibling, not an inversion — raise surface lightness for elevation instead of adding shadows, and slightly lower accent chroma so it doesn't vibrate on dark.
16
- 6. Don't rely on hue alone to convey meaning; back status colors with an icon or label for color-blind users, and test with a deuteranopia simulation.
17
- 7. Constrain the whole palette: ~2 brand hues + neutrals + 4 state colors. A palette with 9 unrelated hues never feels designed.
18
-
19
- ## Rules
20
- - Every text/background pairing passes WCAG AA (4.5:1 body, 3:1 large/UI) — verify, don't eyeball.
21
- - Build ramps in oklch/HSL for even steps; avoid hand-picked hex stops.
22
- - Most of the screen is neutral; saturated color is an accent, not a background.
23
- - Name by role (`--accent`, `--danger`) so themes remap meaning, not pixels.
24
- - Never encode state in color alone — add an icon, label, or shape.
1
+ ---
2
+ name: color-palette
3
+ description: Craft an accessible on-brand palette with checked contrast, perceptual ramps, and semantic color roles
4
+ category: ui-design
5
+ ---
6
+
7
+ # Color Palette
8
+
9
+ Use this when choosing or fixing a product's colors — to get past "pick a brand hue and tint it" into a palette that's coherent, accessible, and works in both light and dark.
10
+
11
+ 1. Start from one or two brand hues and build perceptually even ramps in `oklch()` (11 steps, 50–950). Even lightness steps mean predictable contrast — RGB tinting gives muddy, uneven ramps.
12
+ 2. Reserve saturation for intent: keep most surfaces near-neutral (low-chroma grays carrying a hint of the brand hue) and spend vivid color only on the accent and on calls to action.
13
+ 3. Define semantic roles, not raw swatches: `--bg`, `--surface`, `--surface-raised`, `--text`, `--text-muted`, `--border`, `--accent`, `--accent-fg`, plus state colors success/warning/danger/info.
14
+ 4. Check contrast for real: body text ≥ 4.5:1, large text and UI components ≥ 3:1 (WCAG AA). Pair every background token with a foreground that passes against it.
15
+ 5. Design the dark variant as a sibling, not an inversion — raise surface lightness for elevation instead of adding shadows, and slightly lower accent chroma so it doesn't vibrate on dark.
16
+ 6. Don't rely on hue alone to convey meaning; back status colors with an icon or label for color-blind users, and test with a deuteranopia simulation.
17
+ 7. Constrain the whole palette: ~2 brand hues + neutrals + 4 state colors. A palette with 9 unrelated hues never feels designed.
18
+
19
+ ## Rules
20
+ - Every text/background pairing passes WCAG AA (4.5:1 body, 3:1 large/UI) — verify, don't eyeball.
21
+ - Build ramps in oklch/HSL for even steps; avoid hand-picked hex stops.
22
+ - Most of the screen is neutral; saturated color is an accent, not a background.
23
+ - Name by role (`--accent`, `--danger`) so themes remap meaning, not pixels.
24
+ - Never encode state in color alone — add an icon, label, or shape.
@@ -1,23 +1,23 @@
1
- ---
2
- name: component-library
3
- description: Build a reusable, composable, accessible component library in the shadcn/ui style with design tokens.
4
- category: ui-design
5
- ---
6
-
7
- # Component Library
8
-
9
- Reach for this when an app has accumulated copy-pasted, drifting UI and needs one coherent, themeable set of primitives that compose cleanly.
10
-
11
- 1. Establish the token layer first: define semantic CSS custom properties (`--background`, `--foreground`, `--primary`, `--muted`, `--border`, `--ring`, radii, spacing) so theming/dark mode is a variable swap, not a rewrite.
12
- 2. Build on accessible headless primitives (Radix UI / React Aria) for behavior — focus management, ARIA, keyboard — and own only the styling layer, shadcn/ui style (copy-in components you can edit, not a locked dependency).
13
- 3. Manage variants with a typed API via `cva` (class-variance-authority): explicit `variant` and `size` props, a single source of truth for every visual state, sane defaults.
14
- 4. Make composition the contract: forward refs, spread `...props`, expose `asChild` (Radix Slot) so a `Button` can render as a link, and prefer slots over a sea of boolean props.
15
- 5. Define every interactive state in the recipe — hover, active, `focus-visible` ring, `disabled`, loading, invalid — and wire motion to your shared duration/easing tokens.
16
- 6. Document with live examples (Storybook or an MDX kitchen-sink page) and lock visual regressions; every component ships with usage + a11y notes.
17
-
18
- ## Rules
19
- - Components are unopinionated about layout — no fixed margins; spacing belongs to the parent. They size to context.
20
- - Accessibility is non-negotiable: keyboard-operable, correct roles/labels, `focus-visible` rings, contrast ≥4.5:1 for text.
21
- - One token system; a hard-coded hex or pixel value inside a component is a leak to fix, not ship.
22
- - Prefer composition over configuration — when prop count explodes, split the component or expose subcomponents (`Card.Header`).
23
- - Keep the bundle lean: tree-shakeable exports, no kitchen-sink barrel that drags in everything.
1
+ ---
2
+ name: component-library
3
+ description: Build a reusable, composable, accessible component library in the shadcn/ui style with design tokens.
4
+ category: ui-design
5
+ ---
6
+
7
+ # Component Library
8
+
9
+ Reach for this when an app has accumulated copy-pasted, drifting UI and needs one coherent, themeable set of primitives that compose cleanly.
10
+
11
+ 1. Establish the token layer first: define semantic CSS custom properties (`--background`, `--foreground`, `--primary`, `--muted`, `--border`, `--ring`, radii, spacing) so theming/dark mode is a variable swap, not a rewrite.
12
+ 2. Build on accessible headless primitives (Radix UI / React Aria) for behavior — focus management, ARIA, keyboard — and own only the styling layer, shadcn/ui style (copy-in components you can edit, not a locked dependency).
13
+ 3. Manage variants with a typed API via `cva` (class-variance-authority): explicit `variant` and `size` props, a single source of truth for every visual state, sane defaults.
14
+ 4. Make composition the contract: forward refs, spread `...props`, expose `asChild` (Radix Slot) so a `Button` can render as a link, and prefer slots over a sea of boolean props.
15
+ 5. Define every interactive state in the recipe — hover, active, `focus-visible` ring, `disabled`, loading, invalid — and wire motion to your shared duration/easing tokens.
16
+ 6. Document with live examples (Storybook or an MDX kitchen-sink page) and lock visual regressions; every component ships with usage + a11y notes.
17
+
18
+ ## Rules
19
+ - Components are unopinionated about layout — no fixed margins; spacing belongs to the parent. They size to context.
20
+ - Accessibility is non-negotiable: keyboard-operable, correct roles/labels, `focus-visible` rings, contrast ≥4.5:1 for text.
21
+ - One token system; a hard-coded hex or pixel value inside a component is a leak to fix, not ship.
22
+ - Prefer composition over configuration — when prop count explodes, split the component or expose subcomponents (`Card.Header`).
23
+ - Keep the bundle lean: tree-shakeable exports, no kitchen-sink barrel that drags in everything.
@@ -1,24 +1,24 @@
1
- ---
2
- name: dark-mode
3
- description: Implement a polished dark mode via semantic tokens and prefers-color-scheme, not naive color inversion
4
- category: ui-design
5
- ---
6
-
7
- # Dark Mode
8
-
9
- Use this to add a dark theme that looks designed rather than inverted. Good dark mode is a parallel palette tuned for a dark substrate — it's not `filter: invert()`.
10
-
11
- 1. Theme through semantic tokens only: components read `--bg`, `--surface`, `--text`, `--border`, `--accent`. Dark mode redefines those aliases; component CSS doesn't change.
12
- 2. Avoid pure black (`#000`) backgrounds — use a very dark neutral (~oklch 0.18–0.22) so OLED smearing and harsh contrast soften, and so elevation can read.
13
- 3. Signal elevation with lighter surfaces, not shadows: raised cards get a slightly lighter `--surface-raised`. Shadows mostly disappear on dark; lightness becomes the depth cue.
14
- 4. Soften text: don't use `#fff` for body — drop to ~85–90% lightness to reduce halation, and re-check that muted text still clears 4.5:1 against the dark surface.
15
- 5. Reduce accent chroma slightly and verify it on dark — saturated hues that pop on white can vibrate on dark; tune `--accent` and `--accent-fg` per theme.
16
- 6. Wire it up: default to `@media (prefers-color-scheme: dark)`, allow a manual override via `[data-theme="dark"]` on `<html>`, persist the choice, and set `<meta name="color-scheme">` to avoid a white flash.
17
- 7. Dim large imagery/illustration in dark (e.g. slightly lower brightness) and provide dark-tuned shadows/borders so nothing glows.
18
-
19
- ## Rules
20
- - Re-check contrast in dark independently — passing in light guarantees nothing.
21
- - No pure `#000` background and no pure `#fff` text; both fatigue the eye.
22
- - Convey depth with surface lightness, not drop shadows, in dark.
23
- - Respect system preference by default, but let users override and persist it.
24
- - Theme via token redefinition; never fork component styles per mode.
1
+ ---
2
+ name: dark-mode
3
+ description: Implement a polished dark mode via semantic tokens and prefers-color-scheme, not naive color inversion
4
+ category: ui-design
5
+ ---
6
+
7
+ # Dark Mode
8
+
9
+ Use this to add a dark theme that looks designed rather than inverted. Good dark mode is a parallel palette tuned for a dark substrate — it's not `filter: invert()`.
10
+
11
+ 1. Theme through semantic tokens only: components read `--bg`, `--surface`, `--text`, `--border`, `--accent`. Dark mode redefines those aliases; component CSS doesn't change.
12
+ 2. Avoid pure black (`#000`) backgrounds — use a very dark neutral (~oklch 0.18–0.22) so OLED smearing and harsh contrast soften, and so elevation can read.
13
+ 3. Signal elevation with lighter surfaces, not shadows: raised cards get a slightly lighter `--surface-raised`. Shadows mostly disappear on dark; lightness becomes the depth cue.
14
+ 4. Soften text: don't use `#fff` for body — drop to ~85–90% lightness to reduce halation, and re-check that muted text still clears 4.5:1 against the dark surface.
15
+ 5. Reduce accent chroma slightly and verify it on dark — saturated hues that pop on white can vibrate on dark; tune `--accent` and `--accent-fg` per theme.
16
+ 6. Wire it up: default to `@media (prefers-color-scheme: dark)`, allow a manual override via `[data-theme="dark"]` on `<html>`, persist the choice, and set `<meta name="color-scheme">` to avoid a white flash.
17
+ 7. Dim large imagery/illustration in dark (e.g. slightly lower brightness) and provide dark-tuned shadows/borders so nothing glows.
18
+
19
+ ## Rules
20
+ - Re-check contrast in dark independently — passing in light guarantees nothing.
21
+ - No pure `#000` background and no pure `#fff` text; both fatigue the eye.
22
+ - Convey depth with surface lightness, not drop shadows, in dark.
23
+ - Respect system preference by default, but let users override and persist it.
24
+ - Theme via token redefinition; never fork component styles per mode.
@@ -1,23 +1,23 @@
1
- ---
2
- name: dashboard-ui
3
- description: Design a clean, scannable data dashboard — clear hierarchy, restrained color, and fast comprehension.
4
- category: ui-design
5
- ---
6
-
7
- # Dashboard UI
8
-
9
- Reach for this when building an analytics or operations dashboard, where the job is to surface signal fast and let users act without hunting.
10
-
11
- 1. Lead with the answer: a top row of 3–5 KPI stat cards (big number, label, trend delta with direction color), then supporting charts, then granular tables — most important, top-left.
12
- 2. Lay out on a 12-column grid with consistent gutters and an 8px spacing rhythm; use container queries so cards reflow by their own width, not just the viewport.
13
- 3. Keep the palette near-monochrome for chrome (neutral surfaces, one muted border token) and reserve saturated color strictly for data and semantic states (up/down, success/warn/error) so meaning pops.
14
- 4. Set an information density that fits the user: align numbers right, use tabular figures (`font-variant-numeric: tabular-nums`), and tighten line-height in tables while keeping comfortable card padding.
15
- 5. Make charts honest and minimal: drop chartjunk, label directly over legends where possible, start bar axes at zero, and cap each chart to one clear question.
16
- 6. Provide structural states — loading skeletons matching card shapes, empty states with a next action, and persistent filters that don't reset on navigation.
17
-
18
- ## Rules
19
- - Color carries data meaning; never decorate the UI with the same hues you use for series, or users misread the charts.
20
- - Whitespace is a feature — resist cramming; a scannable dashboard beats a complete-but-dense one.
21
- - Use semantic green/red for trends but never rely on color alone — pair with arrows/signs for color-blind users (contrast ≥3:1).
22
- - Numbers are the hero: tabular figures, right alignment, sensible rounding and units; no jittering digit widths.
23
- - Keep the navigation/chrome quiet so the data is the brightest thing on screen.
1
+ ---
2
+ name: dashboard-ui
3
+ description: Design a clean, scannable data dashboard — clear hierarchy, restrained color, and fast comprehension.
4
+ category: ui-design
5
+ ---
6
+
7
+ # Dashboard UI
8
+
9
+ Reach for this when building an analytics or operations dashboard, where the job is to surface signal fast and let users act without hunting.
10
+
11
+ 1. Lead with the answer: a top row of 3–5 KPI stat cards (big number, label, trend delta with direction color), then supporting charts, then granular tables — most important, top-left.
12
+ 2. Lay out on a 12-column grid with consistent gutters and an 8px spacing rhythm; use container queries so cards reflow by their own width, not just the viewport.
13
+ 3. Keep the palette near-monochrome for chrome (neutral surfaces, one muted border token) and reserve saturated color strictly for data and semantic states (up/down, success/warn/error) so meaning pops.
14
+ 4. Set an information density that fits the user: align numbers right, use tabular figures (`font-variant-numeric: tabular-nums`), and tighten line-height in tables while keeping comfortable card padding.
15
+ 5. Make charts honest and minimal: drop chartjunk, label directly over legends where possible, start bar axes at zero, and cap each chart to one clear question.
16
+ 6. Provide structural states — loading skeletons matching card shapes, empty states with a next action, and persistent filters that don't reset on navigation.
17
+
18
+ ## Rules
19
+ - Color carries data meaning; never decorate the UI with the same hues you use for series, or users misread the charts.
20
+ - Whitespace is a feature — resist cramming; a scannable dashboard beats a complete-but-dense one.
21
+ - Use semantic green/red for trends but never rely on color alone — pair with arrows/signs for color-blind users (contrast ≥3:1).
22
+ - Numbers are the hero: tabular figures, right alignment, sensible rounding and units; no jittering digit widths.
23
+ - Keep the navigation/chrome quiet so the data is the brightest thing on screen.
@@ -1,24 +1,24 @@
1
- ---
2
- name: design-system
3
- description: Build a cohesive design system from tokens up to components, with one source of truth and zero magic numbers
4
- category: ui-design
5
- ---
6
-
7
- # Design System
8
-
9
- Reach for this when a UI has grown inconsistent — drifting spacings, one-off colors, copy-pasted buttons — or when starting a product that needs to scale past a few screens.
10
-
11
- 1. Audit what exists: screenshot every surface, list every distinct color, font size, radius, shadow, and spacing in use. The sprawl you find is the problem statement.
12
- 2. Define the token layer first (see the design-tokens skill): primitives (`--blue-500`), then semantic aliases (`--color-accent`, `--bg-surface`, `--text-muted`). Components reference semantics only, never primitives.
13
- 3. Lock the foundations: a modular type scale (1.2–1.25 ratio), a 4px spacing base, a radius set (sm/md/lg/full), and 2–3 elevation shadows. Everything downstream composes from these.
14
- 4. Build primitives as composable components: Button (variant × size × state), Input, Card, Badge. Encode every visual decision as a token, so a theme swap is a token swap.
15
- 5. Codify states explicitly — default, hover, focus-visible, active, disabled, loading. A system that only specifies the resting state isn't a system.
16
- 6. Document usage with live examples and do/don't pairs (Storybook or an MDX page). A token nobody knows about gets bypassed.
17
- 7. Ship with lint guardrails: reject raw hex and arbitrary px in PRs so drift can't creep back in.
18
-
19
- ## Rules
20
- - One source of truth: a value lives in exactly one token; if you typed a hex or px in a component, it's a bug.
21
- - Two-tier tokens always — primitive then semantic — so re-theming touches the alias layer only.
22
- - Name by role, not by look: `--color-danger`, not `--color-red` (red may become orange later).
23
- - Every interactive component must define focus-visible and disabled, not just hover.
24
- - Prefer composition over variant explosion; if a component has 12 boolean props, split it.
1
+ ---
2
+ name: design-system
3
+ description: Build a cohesive design system from tokens up to components, with one source of truth and zero magic numbers
4
+ category: ui-design
5
+ ---
6
+
7
+ # Design System
8
+
9
+ Reach for this when a UI has grown inconsistent — drifting spacings, one-off colors, copy-pasted buttons — or when starting a product that needs to scale past a few screens.
10
+
11
+ 1. Audit what exists: screenshot every surface, list every distinct color, font size, radius, shadow, and spacing in use. The sprawl you find is the problem statement.
12
+ 2. Define the token layer first (see the design-tokens skill): primitives (`--blue-500`), then semantic aliases (`--color-accent`, `--bg-surface`, `--text-muted`). Components reference semantics only, never primitives.
13
+ 3. Lock the foundations: a modular type scale (1.2–1.25 ratio), a 4px spacing base, a radius set (sm/md/lg/full), and 2–3 elevation shadows. Everything downstream composes from these.
14
+ 4. Build primitives as composable components: Button (variant × size × state), Input, Card, Badge. Encode every visual decision as a token, so a theme swap is a token swap.
15
+ 5. Codify states explicitly — default, hover, focus-visible, active, disabled, loading. A system that only specifies the resting state isn't a system.
16
+ 6. Document usage with live examples and do/don't pairs (Storybook or an MDX page). A token nobody knows about gets bypassed.
17
+ 7. Ship with lint guardrails: reject raw hex and arbitrary px in PRs so drift can't creep back in.
18
+
19
+ ## Rules
20
+ - One source of truth: a value lives in exactly one token; if you typed a hex or px in a component, it's a bug.
21
+ - Two-tier tokens always — primitive then semantic — so re-theming touches the alias layer only.
22
+ - Name by role, not by look: `--color-danger`, not `--color-red` (red may become orange later).
23
+ - Every interactive component must define focus-visible and disabled, not just hover.
24
+ - Prefer composition over variant explosion; if a component has 12 boolean props, split it.
@@ -1,24 +1,24 @@
1
- ---
2
- name: design-tokens
3
- description: Define color, space, type, radius, and shadow tokens as layered CSS custom properties with semantic roles
4
- category: ui-design
5
- ---
6
-
7
- # Design Tokens
8
-
9
- Use this to turn scattered hardcoded values into a small, principled set of variables that every component reads from — the foundation under any design system or theme.
10
-
11
- 1. Split into two tiers: a primitive scale (`--gray-50`…`--gray-950`, `--blue-500`) that names raw values, and a semantic layer (`--bg`, `--surface`, `--text`, `--border`, `--accent`) that maps roles onto primitives.
12
- 2. Build space on a 4px base as a scale, not ad-hoc: `--space-1: 4px` … `--space-8: 32px`. Components only ever use scale steps, killing 13px and 27px outliers.
13
- 3. Define type tokens from a ratio (see typography): `--text-sm/base/lg/xl/2xl` plus `--leading-tight/normal/relaxed` and `--tracking-tight`. Pair each size with a sensible line-height.
14
- 4. Standardize radius (`--radius-sm/md/lg/full`) and elevation (`--shadow-sm/md/lg`) as layered, low-alpha shadows — never a single harsh `0 2px 4px #000`.
15
- 5. Express color in `oklch()` for perceptually even ramps and easy lightness flips; provide `--color-*` semantic aliases so dark mode redefines the alias, not the component.
16
- 6. Scope tokens to `:root`, override per-theme via `[data-theme]` or `@media (prefers-color-scheme)`, and expose only semantic tokens to component code.
17
- 7. Generate platform outputs (CSS vars, Tailwind config, JSON) from one source file (e.g. Style Dictionary) so web and native never diverge.
18
-
19
- ## Rules
20
- - Components consume semantic tokens only; primitives are private implementation detail.
21
- - No naked values in component CSS — every color, space, radius, and shadow is a `var(--…)`.
22
- - Name tokens by purpose (`--text-muted`) not appearance (`--gray-400`).
23
- - Keep each scale short (5–9 steps); an infinite ramp invites inconsistency.
24
- - Use `oklch()`/`hsl()` over hex so you can derive hover/active states by nudging lightness.
1
+ ---
2
+ name: design-tokens
3
+ description: Define color, space, type, radius, and shadow tokens as layered CSS custom properties with semantic roles
4
+ category: ui-design
5
+ ---
6
+
7
+ # Design Tokens
8
+
9
+ Use this to turn scattered hardcoded values into a small, principled set of variables that every component reads from — the foundation under any design system or theme.
10
+
11
+ 1. Split into two tiers: a primitive scale (`--gray-50`…`--gray-950`, `--blue-500`) that names raw values, and a semantic layer (`--bg`, `--surface`, `--text`, `--border`, `--accent`) that maps roles onto primitives.
12
+ 2. Build space on a 4px base as a scale, not ad-hoc: `--space-1: 4px` … `--space-8: 32px`. Components only ever use scale steps, killing 13px and 27px outliers.
13
+ 3. Define type tokens from a ratio (see typography): `--text-sm/base/lg/xl/2xl` plus `--leading-tight/normal/relaxed` and `--tracking-tight`. Pair each size with a sensible line-height.
14
+ 4. Standardize radius (`--radius-sm/md/lg/full`) and elevation (`--shadow-sm/md/lg`) as layered, low-alpha shadows — never a single harsh `0 2px 4px #000`.
15
+ 5. Express color in `oklch()` for perceptually even ramps and easy lightness flips; provide `--color-*` semantic aliases so dark mode redefines the alias, not the component.
16
+ 6. Scope tokens to `:root`, override per-theme via `[data-theme]` or `@media (prefers-color-scheme)`, and expose only semantic tokens to component code.
17
+ 7. Generate platform outputs (CSS vars, Tailwind config, JSON) from one source file (e.g. Style Dictionary) so web and native never diverge.
18
+
19
+ ## Rules
20
+ - Components consume semantic tokens only; primitives are private implementation detail.
21
+ - No naked values in component CSS — every color, space, radius, and shadow is a `var(--…)`.
22
+ - Name tokens by purpose (`--text-muted`) not appearance (`--gray-400`).
23
+ - Keep each scale short (5–9 steps); an infinite ramp invites inconsistency.
24
+ - Use `oklch()`/`hsl()` over hex so you can derive hover/active states by nudging lightness.
@@ -1,23 +1,23 @@
1
- ---
2
- name: empty-states
3
- description: Design empty, loading, and error states that orient the user and offer a clear next action.
4
- category: ui-design
5
- ---
6
-
7
- # Empty States
8
-
9
- Reach for this whenever a view can have no data, be loading, or fail — these states are most of the real experience and deserve the same care as the happy path.
10
-
11
- 1. Distinguish the three cases and design each: first-run empty (no data yet), cleared empty (filters/search returned nothing), and error (something broke) — they need different copy and actions.
12
- 2. For first-run, make it a launchpad: a short encouraging line, a focused illustration or icon, and one primary CTA that creates the first item — turn the void into onboarding.
13
- 3. For "no results", explain why and give an out: echo the active query/filters and offer "clear filters" or a broader suggestion, not a generic shrug.
14
- 4. For errors, be specific and recoverable: plain-language cause, a "Try again" action, and a path to support — never expose a raw stack trace or a bare "Something went wrong".
15
- 5. Match the layout to the eventual content so the page doesn't jump when data arrives, and keep tone consistent with the product's voice (helpful, not cute-at-the-user's-expense).
16
- 6. Respect hierarchy and restraint: one illustration, one heading, one action; muted supporting text; accessible contrast and a real `role`/announcement for error states.
17
-
18
- ## Rules
19
- - Every empty/error state offers at least one obvious next step — a dead end with no action is a bug.
20
- - Error copy names what happened and what to do; "Oops!" with no recovery path is failure theater.
21
- - Don't reuse the first-run empty state for "no search results" — they imply different user situations.
22
- - Keep illustrations subtle and on-brand; they support the message, they aren't the message.
23
- - Announce errors to assistive tech (`aria-live="assertive"` / `role="alert"`) and keep focus recoverable.
1
+ ---
2
+ name: empty-states
3
+ description: Design empty, loading, and error states that orient the user and offer a clear next action.
4
+ category: ui-design
5
+ ---
6
+
7
+ # Empty States
8
+
9
+ Reach for this whenever a view can have no data, be loading, or fail — these states are most of the real experience and deserve the same care as the happy path.
10
+
11
+ 1. Distinguish the three cases and design each: first-run empty (no data yet), cleared empty (filters/search returned nothing), and error (something broke) — they need different copy and actions.
12
+ 2. For first-run, make it a launchpad: a short encouraging line, a focused illustration or icon, and one primary CTA that creates the first item — turn the void into onboarding.
13
+ 3. For "no results", explain why and give an out: echo the active query/filters and offer "clear filters" or a broader suggestion, not a generic shrug.
14
+ 4. For errors, be specific and recoverable: plain-language cause, a "Try again" action, and a path to support — never expose a raw stack trace or a bare "Something went wrong".
15
+ 5. Match the layout to the eventual content so the page doesn't jump when data arrives, and keep tone consistent with the product's voice (helpful, not cute-at-the-user's-expense).
16
+ 6. Respect hierarchy and restraint: one illustration, one heading, one action; muted supporting text; accessible contrast and a real `role`/announcement for error states.
17
+
18
+ ## Rules
19
+ - Every empty/error state offers at least one obvious next step — a dead end with no action is a bug.
20
+ - Error copy names what happened and what to do; "Oops!" with no recovery path is failure theater.
21
+ - Don't reuse the first-run empty state for "no search results" — they imply different user situations.
22
+ - Keep illustrations subtle and on-brand; they support the message, they aren't the message.
23
+ - Announce errors to assistive tech (`aria-live="assertive"` / `role="alert"`) and keep focus recoverable.
@@ -1,23 +1,23 @@
1
- ---
2
- name: hero-section
3
- description: Design a striking, conversion-focused hero with one clear message, sharp hierarchy, and a single CTA.
4
- category: ui-design
5
- ---
6
-
7
- # Hero Section
8
-
9
- Reach for this for the first screen of a landing page — the hero has ~3 seconds to land the value proposition and drive one action.
10
-
11
- 1. Lock the message architecture: one eyebrow/kicker (optional), one headline stating the outcome (not the feature), one subhead clarifying, one primary CTA. Cut everything else.
12
- 2. Build a real type scale with `clamp()` — e.g. headline `clamp(2.5rem, 5vw + 1rem, 5rem)`, tight `line-height: 1.05`, and `letter-spacing: -0.02em` on large display text for an editorial feel.
13
- 3. Establish hierarchy through contrast, not just size: the CTA is the highest-contrast element on screen; the subhead sits in a muted foreground; supporting visuals never out-shout the headline.
14
- 4. Give it breathing room — generous vertical rhythm on an 8px scale, a constrained measure (~60ch) on the subhead, and asymmetry (off-center text + image) to avoid a sterile centered template.
15
- 5. Add one tasteful motion beat on load: staggered fade-rise of headline → subhead → CTA (40–60ms apart, ease-out, ≤400ms total). Subtle, once, never looping.
16
- 6. Engineer for performance and LCP: the headline is real text (not an image), hero media is `priority`/preloaded and properly sized, and the layout is reserved to prevent CLS.
17
-
18
- ## Rules
19
- - One primary CTA. A secondary "Learn more" can exist as a quieter ghost/text link, never a competing button.
20
- - The headline sells the outcome to the user; if it could appear on a competitor's site verbatim, rewrite it.
21
- - Maintain ≥4.5:1 contrast for headline text over any image/gradient — add a scrim or duotone rather than risk legibility.
22
- - Don't center everything by reflex; intentional asymmetry and a strong grid read as designed, not default.
23
- - Hero must be legible and complete above the fold on a 360px phone before you polish desktop.
1
+ ---
2
+ name: hero-section
3
+ description: Design a striking, conversion-focused hero with one clear message, sharp hierarchy, and a single CTA.
4
+ category: ui-design
5
+ ---
6
+
7
+ # Hero Section
8
+
9
+ Reach for this for the first screen of a landing page — the hero has ~3 seconds to land the value proposition and drive one action.
10
+
11
+ 1. Lock the message architecture: one eyebrow/kicker (optional), one headline stating the outcome (not the feature), one subhead clarifying, one primary CTA. Cut everything else.
12
+ 2. Build a real type scale with `clamp()` — e.g. headline `clamp(2.5rem, 5vw + 1rem, 5rem)`, tight `line-height: 1.05`, and `letter-spacing: -0.02em` on large display text for an editorial feel.
13
+ 3. Establish hierarchy through contrast, not just size: the CTA is the highest-contrast element on screen; the subhead sits in a muted foreground; supporting visuals never out-shout the headline.
14
+ 4. Give it breathing room — generous vertical rhythm on an 8px scale, a constrained measure (~60ch) on the subhead, and asymmetry (off-center text + image) to avoid a sterile centered template.
15
+ 5. Add one tasteful motion beat on load: staggered fade-rise of headline → subhead → CTA (40–60ms apart, ease-out, ≤400ms total). Subtle, once, never looping.
16
+ 6. Engineer for performance and LCP: the headline is real text (not an image), hero media is `priority`/preloaded and properly sized, and the layout is reserved to prevent CLS.
17
+
18
+ ## Rules
19
+ - One primary CTA. A secondary "Learn more" can exist as a quieter ghost/text link, never a competing button.
20
+ - The headline sells the outcome to the user; if it could appear on a competitor's site verbatim, rewrite it.
21
+ - Maintain ≥4.5:1 contrast for headline text over any image/gradient — add a scrim or duotone rather than risk legibility.
22
+ - Don't center everything by reflex; intentional asymmetry and a strong grid read as designed, not default.
23
+ - Hero must be legible and complete above the fold on a 360px phone before you polish desktop.