# `brand/design-system.md` — Schema This file documents the exact shape of `brand/design-system.md` that `/design-system` generates. Downstream agents/references (`screen-builder`, Tamagui integration, `/preview-screens`) read this file as the visual source of truth. ## Location ``` / ├── brand/ │ ├── design-system.md ← this schema │ ├── tokens.ts ← importable Tamagui tokens │ ├── tokens.dark.ts ← optional approved custom-dark palette │ ├── design-system.html ← visual gallery (optional) │ └── .history/ ← version snapshots ``` `brand/tokens.dark.ts` is optional, not a prerequisite for default dark mode. When custom dark is approved, use the named `darkTokens` export and complete color contract in [Approved dark palette](./tamagui-integration.md#approved-dark-palette-conditional). Its presence alone does not authorize wiring it. Refresh and rollback use the [snapshot contract](./refresh-flow.md#snapshot-contract) to retain exact spec and token contents plus dark artifact presence/absence and approved selection. ## Full schema ```markdown # {{App Name}} — Design System Generated: {{ISO 8601 timestamp}} | Direction: {{inspection | saas | product | hybrid(...)}} ## Brand - Identity: {{one-line description of app purpose and audience}} - Voice: {{tone: direct | professional | conversational}} - References: {{comma-separated reference apps, e.g. "ServiceTitan, Procore, Linear"}} - Brand notes: {{user's free-text notes, or "none"}} ## Palette | Token | Hex | Usage | |-------------|-----------|-------------------------| | bg | {{hex}} | screen background | | surface | {{hex}} | cards, inputs, modals | | primary | {{hex}} | primary CTAs, links | | accent | {{hex}} | secondary accent | | text | {{hex}} | body text | | text-muted | {{hex}} | captions, meta | | border | {{hex}} | dividers, input borders | ## Status palette | Token | Hex | |----------------|-----------| | status-success | {{hex}} | | status-warning | {{hex}} | | status-danger | {{hex}} | | status-info | {{hex}} | ## Typography | Role | Family | Size | Weight | Line | Tracking | |----------|-----------|------|--------|------|-----------| | Display | {{font}} | {{}} | {{}} | {{}} | {{}} | | Heading | {{font}} | {{}} | {{}} | {{}} | {{}} | | Title | {{font}} | {{}} | {{}} | {{}} | {{}} | | Body | {{font}} | 16 | 400 | 1.5 | 0 | | Body-sm | {{font}} | 14 | 400 | 1.4 | 0 | | Caption | {{font}} | 12 | 500 | 1.3 | {{}} | | Mono | {{mono}} | 14 | 400 | 1.4 | 0 | ## Spacing {{scale: e.g. 4 / 8 / 12 / 16 / 24 / 32 / 48 / 64}} ## Components ### Button - Primary: bg {{primary}}, text white, radius {{md}}, height {{48|52}}px - Secondary: bg transparent, border 1px {{border}}, text {{primary}}, same radius - Tertiary: bg transparent, no border, text {{primary}}, underline on pressed - Destructive: bg {{status-danger}}, text white, same radius ### Card - bg: {{surface}} - border: {{border policy — "1px border" or "shadow" or "none"}} - radius: {{md}}px - padding: {{lg}}px - shadow: {{shadow policy — "none" or "0 1px 3px rgba(0,0,0,0.1)" etc.}} ### Input - height: {{48|52}}px - border: {{border style — "1px solid border" or "2px primary on focus"}} - radius: {{sm}}px - focus: {{focus treatment}} ### List row - style: {{row-with-status-pill | card-with-meta | sentence}} - height: {{56|64|72}}px - status: {{4px left bar | pill badge | dot indicator}} - chevron: {{yes | no}} ### Badge / Status pill - size: {{caption}} font - bg: {{status color at 15% opacity | solid}} - text: {{status color | white}} - radius: full (pill) ### Iconography - Set: {{Ionicons | Lucide | SF Symbols}} - Style: {{outlined | filled}} - Size: 24px default ## Motion - Default: {{duration}}ms {{easing}} - List enter: {{stagger description or "none"}} - Screen transition: {{description or "default Expo Router"}} - Forbidden: {{list of forbidden motion patterns}} ## Negatives (HARD RULES for screen-builder) {{list of forbidden patterns, each prefixed with ✗}} - ✗ {{forbidden pattern 1}} - ✗ {{forbidden pattern 2}} ... ## Provenance - Direction: {{full direction description}} - Industry: {{industry}} ({{confidence}}) - Brand notes: {{whether applied and to which sections}} - Generated by: /design-system v0.1 - Source: {{input mode + file/URL if applicable}} - Confirmed: {{true|false|draft}} - Locked at: {{ISO timestamp}} ``` ## Direction-specific defaults ### Inspection ```markdown ## Palette | Token | Hex | Usage | |-------------|-----------|-------------------------| | bg | #f7f6f3 | screen background | | surface | #ffffff | cards, inputs | | primary | #1e293b | primary CTAs, headers | | accent | #FF6A00 | safety-orange accent | | text | #1a1a1a | body text | | text-muted | #6b6b6b | meta, captions | | border | #d8d6d0 | dividers | ## Status palette | Token | Hex | |----------------|-----------| | status-success | #2d7a3e | | status-warning | #c8881e | | status-danger | #b8321a | | status-info | #1e293b | ## Typography | Role | Family | Size | Weight | Line | Tracking | |----------|--------|------|--------|------|----------| | Display | Inter | 28 | 700 | 1.2 | -0.01em | | Heading | Inter | 22 | 600 | 1.25 | -0.005em | | Title | Inter | 18 | 600 | 1.3 | 0 | | Body | Inter | 16 | 400 | 1.5 | 0 | | Body-sm | Inter | 14 | 400 | 1.4 | 0 | | Caption | Inter | 12 | 500 | 1.3 | 0.02em | | Mono | JetBrains Mono | 14 | 400 | 1.4 | 0 | ## Negatives (HARD RULES) - ✗ No shadows — use border for separation - ✗ No serif fonts — Inter or JetBrains Mono only - ✗ No decorative motion — functional only (150ms ease-out) - ✗ No tap targets under 52px (gloved use) - ✗ No saturated red except status-danger - ✗ No chevrons on list rows — use status pills only - ✗ No display serif fonts ``` ### SaaS ```markdown ## Palette | Token | Hex | Usage | |-------------|-----------|-------------------------| | bg | #ffffff | screen background | | surface | #f8f9fa | cards, sections | | primary | #4f46e5 | primary CTAs, links | | accent | #4f46e5 | (= primary, indigo) | | text | #111827 | body text | | text-muted | #6b7280 | secondary text | | border | #e5e7eb | dividers, input borders | ## Status palette | Token | Hex | |----------------|-----------| | status-success | #dcfce7 | | status-warning | #fef3c7 | | status-danger | #fecaca | | status-info | #dbeafe | ## Negatives (HARD RULES) - ✗ No pill buttons — use standard radius - ✗ No bold colors outside accent — keep neutral - ✗ No decorative illustration in UI chrome - ✗ No custom fonts — system-ui stack or Inter - ✗ No card shadows heavier than 0 1px 3px rgba(0,0,0,0.1) ``` ### Product ```markdown ## Palette | Token | Hex | Usage | |-------------|-----------|-------------------------| | bg | #faf8f5 | warm cream background | | surface | #ffffff | cards, modals | | primary | #1a1614 | headings, primary text | | accent | #7d9b76 | sage accent | | text | #1a1614 | body text | | text-muted | #8a857e | secondary text | | border | #e8e4de | subtle dividers | ## Negatives (HARD RULES) - ✗ No chevrons on list rows — content-led, not action-led - ✗ No status pills — use subtle text indicators - ✗ No uppercase labels — sentence case only - ✗ No information density — sparse is the aesthetic - ✗ No system fonts — display heading must be visually distinct - ✗ No flat/utilitarian card styling — editorial warmth required ``` ## Validation rules A valid `brand/design-system.md` MUST have: 1. A header with app name and direction 2. `## Palette` with at least 7 tokens (bg, surface, primary, accent, text, text-muted, border) 3. `## Status palette` with 4 tokens 4. `## Typography` with at least 5 roles 5. `## Negatives` with at least 3 rules 6. `## Provenance` with direction and timestamp Missing sections → skill surfaces error, asks user to re-run. ## How screen-builder uses this file 1. **Mandatory read** — builder MUST read `brand/design-system.md` if it exists in `/brand/` 2. **Token references** — all color/spacing/radius values come from this spec, never hardcoded hex 3. **Negatives are HARD RULES** — any pattern listed in `## Negatives` is forbidden. Violations are build failures. 4. **Typography mapping** — `## Typography` role table maps to Tamagui font tokens ($heading, $body, $mono) 5. **Component shapes** — `## Components` defines the exact shape for buttons, cards, inputs, list rows ## How Tamagui Integration Uses tokens.ts `brand/tokens.ts` is a plain TypeScript export. `/create-mobile-app` Step 9b and `/edit-app` Step 5 must follow the authoritative [`tamagui-integration.md`](./tamagui-integration.md) implementation rather than maintaining a second config example here: - **Default dark:** use [Brand Import](./tamagui-integration.md#brand-import). Keep Config v5 dark surfaces/text with brand accents/statuses; no dark artifact or import is required. - **Approved custom dark:** also apply [Approved dark palette](./tamagui-integration.md#approved-dark-palette-conditional). `appDarkTheme` consumes `darkTokens.color`, including approved surfaces/text, instead of the base accent-only override. - **Both branches:** apply [Root Provider Wiring](./tamagui-integration.md#root-provider-wiring), mapping the resolved `appDarkTheme` into `brandedDarkTheme`. After rollback, choose the branch from the restored approved state, not a newer plan or file presence.