--- name: design description: "Design system reasoning. Use when starting UI work in a project with no .rune/design-system.md, when UI looks generic or inconsistent, or when choosing style, palette, and typography. Maps product domain to platform-specific patterns and generates .rune/design-system.md as the shared design contract for all UI-generating skills." metadata: author: runedev version: "0.9.0" layer: L2 model: opus group: creation tools: "Read, Write, Edit, Glob, Grep" --- # design ## Purpose Design system reasoning layer. Converts a product description into a concrete design system — style, color direction, typography pairing, platform conventions, and an explicit anti-pattern list for this domain. Writes `.rune/design-system.md` as the persistent design contract that all UI-generating skills read before producing code. Prevents AI-generated UI from defaulting to generic patterns ("purple accent, card grids, centered everything") that signal "not designed by a human." ## Triggers - `/rune design` — manual invocation when starting a new UI project - Called by `cook` (L1): frontend task detected, no `.rune/design-system.md` exists - Called by `review` (L2): AI anti-pattern detected — recommended to run design skill - Called by `perf` (L2): Lighthouse Accessibility BLOCK — design foundation may be missing ## Calls (outbound) - `scout` (L2): detect existing design tokens, component library, platform targets - `asset-creator` (L3): generate base visual assets (logo, OG image) from design system - `browser-pilot` (L3): render the surface and inspect it before claiming any visual property holds (Step 5.4) - `review` (L2): accessibility violations found → flag for fix in next code review ## Called By (inbound) - `cook` (L1): before any frontend code generation - `scaffold` (L1): design system for new project - `brainstorm` (L2): when selected approach has UI/UX implications - `ba` (L2): when requirements include UI/UX components - `review` (L2): when AI anti-pattern detected in diff - `perf` (L2): when Lighthouse Accessibility score blocks - User: `/rune design` direct invocation ## Output Files ``` .rune/ └── design-system.md # Design contract for all UI-generating skills ``` ## Executable Steps ### Step 0 — Load Design Reference Load the design knowledge base before reasoning: 1. Check for user-level override: `~/.claude/docs/design-dna.md` - If exists → `Read` it. This is the primary reference (user's curated taste). 2. If no user override → `Read` the baseline: `skills/design/DESIGN-REFERENCE.md` (shipped with Rune) 3. The loaded reference provides: font pairings, chart selection, component architecture, color principles, UX checklist, interaction patterns, anti-pattern signatures 4. Apply reference knowledge throughout Steps 3-5 (domain reasoning, token generation, checklist) 5. **When the domain involves any UI motion** (transitions, animations, gestures, springs, micro-interactions) → also `Read` `skills/design/MOTION-CRAFT.md`. It is the canonical motion authority: the should-it-animate frequency gate, easing/duration budgets (including peak-slope curve selection for large travel, and velocity continuity across keyframe joins), physicality (never `scale(0)`, origin-aware popovers), spring physics, gesture handoff, motion performance, the role→strategy reduced-motion framework, SVG-specific mechanics (user units, `pathLength`, SVGO), and a reverse-lookup vocabulary. Cite its exact values in the design-system motion section; never approximate curves or durations. **When MOTION-CRAFT.md and DESIGN-REFERENCE.md disagree on a motion detail (easing, duration, interaction timing), MOTION-CRAFT.md wins** — it is the deeper, motion-specific source; DESIGN-REFERENCE.md's Animation Timing / Interaction Patterns tables are the general baseline. > **Advisory motion-audit mode**: When asked to "improve the animations" / "make this feel better" / "what could be animated here", operate read-only — survey the motion surface against MOTION-CRAFT.md, report frequency-gated findings (and deliberately rejected candidates), and hand precise recipes to `cook`/`fix`. Suggesting motion everywhere is worse than useless; expect to reject most candidates. > **Why two layers**: The baseline ships "good enough" universal design knowledge. Users who care about aesthetics create their own `design-dna.md` with curated palettes, font pairings, and style preferences. The design skill works well with either — it just works _better_ with a curated reference. ### External Data Source Design intelligence data from [UI/UX Pro Max](https://github.com/nextlevelbuilder/ui-ux-pro-max-skill) (MIT, 42.8k★). Located at `references/ui-pro-max-data/` — 161 palettes, 84 styles, 73 font pairings, 161 reasoning rules, 99 UX guidelines. When `references/ui-pro-max-data/` is available: - Step 2: query `styles.csv` for domain-matched visual styles (expands from 10 → 84) - Step 3: query `ui-reasoning.csv` for industry-specific design rules (161 rules) - Step 3: query `colors.csv` for palette alternatives (expands from 10 → 161) - Step 6 (Anti-AI): cross-check proposed style against reasoning DB — if flagged as "AI-generic", suggest 3 alternatives ### Step 1 — Discover Invoke `scout` to detect: - **Platform target**: `web` | `ios` (SwiftUI) | `android` (Compose) | `react-native` | `multi-platform` - **Existing design tokens**: check for `tokens.json`, `design-system/`, `theme.ts`, `tailwind.config.*`, `variables.css` - **Component library in use**: shadcn/ui | Radix | MUI | Ant Design | custom | none - **Framework**: Next.js | Vite+React | SvelteKit | Vue | SwiftUI | Jetpack Compose | other If `.rune/design-system.md` already exists: Read it, check `Last Updated` date. If < 30 days old, ask user whether to refresh or keep. Do NOT silently overwrite. ### Step 2 — Classify Product Domain From the user's task description + codebase context, classify product type: | Category | Examples | |----------|---------| | **Trading/Fintech** | trading dashboard, portfolio tracker, payment app, crypto wallet | | **SaaS Dashboard** | admin panel, analytics, CRM, project management | | **Landing/Marketing** | landing page, product site, marketing page, waitlist | | **Healthcare** | patient portal, medical dashboard, health tracker | | **E-commerce** | product catalog, cart, checkout, marketplace | | **Developer Tools** | IDE plugin, CLI dashboard, API explorer, devtool | | **Creative/Portfolio** | portfolio, design showcase, art gallery, agency site | | **Social/Community** | social feed, forum, messaging, community platform | | **Mobile Consumer** | iOS/Android consumer app — entertainment, productivity, lifestyle | | **AI-Native** | AI assistant interface, chatbot, model explorer | If domain is unclear: ask one clarifying question — "Is this closer to X or Y?" ### Step 2.5 — Mood-to-Constraint Mapping After classifying domain, ask ONE question: **"What should users feel when they use this?"** Accept a single mood keyword (or infer from context if obvious). Map mood to concrete design constraints: | Mood | Color Temp | Typography Weight | Whitespace | Animation | Shadow | |------|-----------|-------------------|------------|-----------|--------| | **Impressed** | Cool (blue-slate) | Heavy display (700-800) | Generous (xl-3xl) | Dramatic reveals (0.8-1.2s ease-out) | Deep, layered | | **Excited** | Warm (amber-orange) | Bold contrasts (400 vs 800) | Tight-medium (sm-lg) | Energetic springs (0.4-0.6s spring) | Elevation lifts | | **Calm** | Neutral-warm (stone-sage) | Light-medium (300-500) | Very generous (2xl-3xl) | Slow fades (0.6-0.8s ease-out-quad) | Soft, minimal | | **Confident** | Cool-neutral (zinc-slate) | Medium-heavy (500-700) | Structured (md-xl) | Precise slides (0.3-0.5s ease) | Crisp, defined | | **Playful** | Saturated (multi-hue) | Round + bold (600-700) | Medium, irregular (md-lg) | Bouncy springs (0.4-0.6s spring, overshoot) | Hard/comic (3-5px offset) | | **Techy** | Cold (gray-cyan) | Mono-heavy, crisp (400-600) | Dense, grid-aligned (sm-md) | Sharp snaps (0.15-0.3s ease-out) | Minimal or glow | | **Professional** | Muted neutrals | System fonts, readable (400-500) | Balanced (md-lg) | Subtle (0.2-0.3s ease) | Standard elevation | | **Inspired** | Rich-warm (gold-terracotta) | Editorial display (300-700 range) | Asymmetric, generous | Scroll-driven reveals (0.5-0.8s) | Dramatic, directional | **Mapping rules:** 1. Mood constraints OVERRIDE generic domain defaults where they conflict (mood is user intent, domain is convention) 2. If mood contradicts domain safety (e.g., "Playful" + Healthcare), WARN user: "Playful tone may reduce trust in medical context — proceed?" 3. Write selected mood + resolved constraints to `.rune/design-system.md` under `## Mood` section 4. Downstream skills (`animation-patterns`, `palette-picker`, `type-system`) read mood constraints from design-system.md **Skip if**: User says "no preference" or "just follow domain defaults" — proceed to Step 3 with domain-only reasoning. ### Step 2.7 — Tweaks, Not Menus (Default Style Pattern) Picking from a 10-option style menu is how AI UI gets generic. Instead: 1. **Propose ONE opinionated default** based on domain + mood (from Step 2.5). Describe it in 2-3 lines — style, palette direction, typography pairing. 2. **Ask for tweaks, not choices.** The question is **"Any tweaks to this, or ship it?"** — not "Which of these do you prefer?" 3. **Accept natural-language adjustments.** Map phrases → design system edits: - "more professional" → heavier type weights, reduce saturation, tighter spacing - "less corporate" → looser weights, brighter accent, more whitespace - "darker" → swap base for darker neutral, raise contrast on elevated surfaces - "more playful" → add subtle animation, soften corners, bolder accent - "more trust" → cooler palette (slate/blue), heavier headers, smaller radius 4. **If the user asks for a menu**, provide max 3 options — but mark one as the recommended default. Never present a neutral list of 5+ equivalent styles. Why: Every menu option dilutes commitment. A single confident default gets committed, tweaked, and shipped. A menu gets deliberated, A/B'd, and abandoned. This is the **Tweaks Default** pattern from Anthropic's design system guidance — the AI commits first, humans steer second. ### Step 2.9 — Universal Anti-AI Rules (apply to ALL domains) These rules apply regardless of domain, mood, or platform. Every generated design system MUST comply. **Enforcement**: `rune:review` v1.1.0+ reads `.rune/design-system.md` § Scale Minimums and flags violations of Rules 1–3 below as MEDIUM/HIGH findings. Rules 4–6 (Measurable Constraints, No-Pure-No-Lorem, CJK-First) are design-time guidance — added in design v0.6.0, review enforcement forthcoming. Design defines, review enforces — this is the contract. #### Rule 1 — Scale Minimums > Full detail moved to [`references/anti-ai-rules.md`](references/anti-ai-rules.md) (progressive disclosure). **Read that file before executing this section.** #### Rule 2 — Placeholder Over Bad SVG > Full detail moved to [`references/anti-ai-rules.md`](references/anti-ai-rules.md) (progressive disclosure). **Read that file before executing this section.** #### Rule 3 — Color Derivation via oklch(), not Manual Shading > Full detail moved to [`references/anti-ai-rules.md`](references/anti-ai-rules.md) (progressive disclosure). **Read that file before executing this section.** #### Rule 4 — Measurable Constraints, Not Vague Directives > Full detail moved to [`references/anti-ai-rules.md`](references/anti-ai-rules.md) (progressive disclosure). **Read that file before executing this section.** #### Rule 5 — No Pure Black, No Pure White, No Lorem Ipsum > Full detail moved to [`references/anti-ai-rules.md`](references/anti-ai-rules.md) (progressive disclosure). **Read that file before executing this section.** #### Rule 6 — CJK-First Font Stack (Multi-Language Products Only) > Full detail moved to [`references/anti-ai-rules.md`](references/anti-ai-rules.md) (progressive disclosure). **Read that file before executing this section.** ### Step 3 — Apply Domain Reasoning Rules > Full detail moved to [`references/domain-rules.md`](references/domain-rules.md) (progressive disclosure). **Read that file before executing this section.** ### Step 4 — Platform-Specific Overrides > Full detail moved to [`references/platform-overrides.md`](references/platform-overrides.md) (progressive disclosure). **Read that file before executing this section.** ### Step 5 — Generate Design System File Use `Write` to create `.rune/design-system.md`: ```markdown # Design System: [Project Name] Last Updated: [YYYY-MM-DD] Platform: [web | ios | android | multi-platform] Domain: [product category] Style: [chosen style] ## Color Tokens ### Primitive (raw values) --color-[name]-[scale]: [hex] ### Semantic (meaning-mapped) --bg-base: [value] — page background --bg-surface: [value] — card/panel background --bg-elevated: [value] — modal/dropdown background --text-primary: [value] — primary text --text-secondary: [value] — secondary/muted text --border: [value] — default border --accent: [value] — primary action/brand --success: [value] — positive/profit signal --danger: [value] — error/loss signal --warning: [value] — caution signal ## Typography | Role | Font | Weight | Size | |------|------|--------|------| | Display | [font] | [weight] | [px range] | | H1 | [font] | [weight] | [px] | | H2/H3 | [font] | [weight] | [px] | | Body | [font] | [weight] | [px] | | Mono/Numbers | [font] | [weight] | [px] | Numbers rule: [monospace font] for ALL numeric values in this domain (prices, metrics, IDs) ## Spacing (8px base) xs: 4px | sm: 8px | md: 16px | lg: 24px | xl: 32px | 2xl: 48px | 3xl: 64px ## Border Radius sm: 6px | md: 8px | lg: 12px | xl: 16px | full: 9999px ## Effects [signature effects for this style — gradients, shadows, blur, etc.] ## Anti-Patterns (MUST NOT generate these) [domain-specific list from Step 3 + platform overrides] - ❌ [anti-pattern 1] — [why it fails in this domain] - ❌ [anti-pattern 2] ## Platform Notes [platform-specific implementation requirements from Step 4] ## Component Library [detected library or "custom"] ## Pre-Delivery Checklist > Items marked 👁 describe what a human would SEE — tick them only from a render, or mark them ASSUMED (Step 5.4). - [ ] 👁 Color contrast ≥ 4.5:1 for all text - [ ] 👁 Focus-visible ring on ALL interactive elements (never outline-none alone) - [ ] 👁 Touch targets ≥ 44×44px on mobile / ≥ 24×24px on desktop, with 8px gap between targets (matches Step 2.9 Rule 1) - [ ] All icon-only buttons have aria-label - [ ] All inputs have associated