@mstar-harness/opencode 0.6.13 → 0.6.14

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.
@@ -0,0 +1,143 @@
1
+ ---
2
+ name: mstar-design-md
3
+ description: DESIGN.md design system specification for Morning Star projects. Create, audit, and maintain project-level design tokens (Colors, Typography, Spacing, Elevation, Motion, Shapes, Components, Voice & Content) using Vercel Geist as reference template. Three-level completeness checklist (MVP/Standard/Production) with built-in upgrade placeholders. Supports light/dark dual-theme via DESIGN.md + DESIGN.dark.md sharing same token names with different values. Prepare 阶段由 @architect 主责创建,@product-manager 提供设计需求;@frontend-dev / @fullstack-dev 实现 UI 时消费;@qc-specialist / @qa-engineer 审查 UI 对齐 DESIGN.md。Read when PM assigns DESIGN.md creation in Prepare, initiating a new UI project, @architect defining a design system, implementing styled components, auditing UI against design spec, adding dark theme, or user mentions "DESIGN.md" / "design tokens" / "design system". Phase gate → **mstar-phase-gates**; paths → **mstar-plan-conventions**.
4
+ ---
5
+
6
+ ## Load order
7
+
8
+ **Before first Read of this skill: Read `mstar-harness-core` (SKILL.md).** For Prepare phase integration and gate rules, read `mstar-phase-gates`. For plan directory paths (`{HARNESS_DIR}`, `{SPECS_DIR}`), read `mstar-plan-conventions`. On conflict, **`mstar-harness-core` wins**.
9
+
10
+ | 你还可能要 Read | 何时 |
11
+ |-----------------|------|
12
+ | `mstar-phase-gates` | Prepare 阶段判定 gate、何时 DESIGN.md 必须就绪 |
13
+ | `mstar-plan-conventions` | `{HARNESS_DIR}` / `{SPECS_DIR}` 路径解析 |
14
+ | `mstar-roles` | `@architect` / `@product-manager` / `@frontend-dev` / `@qc-specialist` / `@qa-engineer` 角色职责边界 |
15
+ | `mstar-coding-behavior` | 实现角色消费 DESIGN.md 前的通用编码约束 |
16
+
17
+ ## Scope (DESIGN.md lifecycle)
18
+
19
+ | Topic | See |
20
+ |-------|-----|
21
+ | Normative spec: section definitions, token naming, light/dark rules | `references/design-md-spec.md` |
22
+ | Three-level completeness checklist (MVP / Standard / Production) | `references/completeness-checklist.md` |
23
+ | Vercel Geist DESIGN.md as annotated reference | `references/vercel-example.md` |
24
+ | Full template with Level 2/3 placeholders | `templates/DESIGN.md.template` |
25
+ | Dark theme template (same token names, different values) | `templates/DESIGN.dark.md.template` |
26
+
27
+ **Out of scope:** rendered UI artifacts (use Open Design MCP `user-open-design`); frontend implementation that consumes DESIGN.md tokens (use `@frontend-dev` / `@fullstack-dev`); QC review verdict rules (→ **`mstar-review-qc`**).
28
+
29
+ ## Location
30
+
31
+ - **Primary**: project root `DESIGN.md` (human + agent visible, aligns with `AGENTS.md`)
32
+ - **Dark theme**: project root `DESIGN.dark.md` (same token names, different values)
33
+ - `DESIGN.md` is a **project-level design contract**, not a harness internal artifact. It lives beside `README.md` and `AGENTS.md`.
34
+
35
+ ## Role lifecycle
36
+
37
+ ### Creator: `@architect` (primary) + `@product-manager` (requirements)
38
+
39
+ `@architect` owns DESIGN.md content — token selection, naming, completeness level decisions. `@product-manager` provides design intent: brand identity, target audience, must-have UI patterns, accessibility requirements.
40
+
41
+ ### Orchestrator: `@project-manager`
42
+
43
+ In Prepare phase, PM decides whether the project needs a DESIGN.md. If yes, dispatches to `@architect` with product requirements from `@product-manager`. PM checks DESIGN.md exists and meets the assigned completeness level before `plan(locked)`.
44
+
45
+ ### Consumers
46
+
47
+ - `@frontend-dev` / `@fullstack-dev` — read DESIGN.md before implementing styled components; map tokens to CSS/theme variables
48
+ - `@qc-specialist` — verify UI implementation aligns with DESIGN.md tokens
49
+ - `@qa-engineer` — verify visual output matches design spec
50
+
51
+ ## Phase gate integration
52
+
53
+ DESIGN.md is a **Prepare-stage artifact** (like spec). It must be created and reviewed before `plan(locked)` for any plan that includes UI work.
54
+
55
+ 1. PM includes "DESIGN.md creation/audit" in Prepare tracking checklist when the plan involves UI
56
+ 2. `@architect` creates or updates DESIGN.md; `@product-manager` reviews design intent alignment
57
+ 3. PM gates on: DESIGN.md exists, meets completeness level declared in plan, `@product-manager` signed off
58
+
59
+ For **hotfix** or plans with no UI changes, DESIGN.md check may be skipped.
60
+
61
+ ## Completeness levels
62
+
63
+ DESIGN.md supports three levels, each with built-in upgrade path:
64
+
65
+ 1. **Level 1 — MVP** (minimal, prevents guesswork): palette, base typography, spacing scale
66
+ 2. **Level 2 — Standard** (consistent components): full token scales, breakpoints, component tokens (Button, Input)
67
+ 3. **Level 3 — Production** (complete design system): dual theme, elevation, motion, shapes, component library, voice
68
+
69
+ The template includes all levels; Level 2 and 3 sections are commented out with `<!-- LEVEL2_PLACEHOLDER: ... -->` markers that explain when to activate them. The audit workflow detects these placeholders and can recommend upgrade.
70
+
71
+ Full checklist → `references/completeness-checklist.md`.
72
+
73
+ ## Workflows
74
+
75
+ ### Workflow 1: Create DESIGN.md (Prepare phase)
76
+
77
+ 1. Read `references/design-md-spec.md` for section definitions
78
+ 2. Copy `templates/DESIGN.md.template` to `{PROJECT_ROOT}/DESIGN.md`
79
+ 3. Interview `@product-manager` for brand colors, typography preferences, must-have patterns
80
+ 4. Fill Level 1 sections; leave Level 2/3 as-is (commented placeholders)
81
+ 5. If plan requires Level 2+ out of the gate, fill those sections too
82
+ 6. Run the completeness audit workflow below to confirm level
83
+ 7. Report to PM: path created, level achieved, what's needed for next level
84
+
85
+ ### Workflow 2: Audit DESIGN.md completeness
86
+
87
+ 1. Read `DESIGN.md` and `DESIGN.dark.md` (if exists)
88
+ 2. Load `references/completeness-checklist.md`
89
+ 3. Check each checklist item; note gaps
90
+ 4. Report:
91
+ - Current completeness level
92
+ - Gaps preventing next level
93
+ - Presence of upgrade placeholders (`LEVEL2_PLACEHOLDER`, `LEVEL3_PLACEHOLDER`)
94
+ - Recommendation: whether to upgrade now or defer
95
+ 5. Update DESIGN.md level tag (e.g., `<!-- COMPLETENESS_LEVEL: 1 -->`) if changed
96
+
97
+ ### Workflow 3: Add dark theme
98
+
99
+ 1. Read existing `DESIGN.md` to extract token names
100
+ 2. Copy `templates/DESIGN.dark.md.template` to `{PROJECT_ROOT}/DESIGN.dark.md`
101
+ 3. For each token in DESIGN.md, define the dark-theme equivalent value
102
+ 4. Preserve same token names; only values change (see `references/design-md-spec.md` § Light/Dark rules)
103
+ 5. Audit with Workflow 2 to confirm Level 3 completeness
104
+
105
+ ### Workflow 4: Consume DESIGN.md (implementation roles)
106
+
107
+ Before writing styled UI code:
108
+ 1. Read `DESIGN.md` (and `DESIGN.dark.md` if exists)
109
+ 2. Extract tokens into implementation layer (CSS custom properties, Tailwind config, theme object, etc.)
110
+ 3. Follow DESIGN.md Voice & Content rules for copy text
111
+ 4. If DESIGN.md is missing or incomplete, report to PM — do not guess tokens
112
+
113
+ ## Light/Dark dual-theme rules
114
+
115
+ Dual theme uses **same token names, different values** across two files:
116
+
117
+ ```
118
+ DESIGN.md DESIGN.dark.md
119
+ ----------- --------------
120
+ gray-100: #fff gray-100: #111
121
+ gray-1000: #000 gray-1000: #eee
122
+ ```
123
+
124
+ - Token names are the **SSOT interface** — consumers reference tokens by name, not raw values
125
+ - `references/design-md-spec.md` § Light/Dark rules defines the contract
126
+
127
+ ## Open Design integration
128
+
129
+ If `user-open-design` MCP is available:
130
+ - DESIGN.md is the **design intent** (tokens + rules)
131
+ - Open Design manages **rendered artifacts** (HTML/CSS/JSX previews)
132
+ - When DESIGN.md is updated, recommend syncing the Open Design project to reflect new tokens
133
+ - DESIGN.md does not replace Open Design; they are complementary
134
+
135
+ ## References
136
+
137
+ - `references/design-md-spec.md` — normative spec: section definitions, token naming conventions, light/dark contract
138
+ - `references/completeness-checklist.md` — three-level audit checklist with detailed criteria per level
139
+ - `references/vercel-example.md` — Vercel Geist DESIGN.md as annotated reference (read when creating from scratch or needing design inspiration)
140
+
141
+ **Templates (this skill):**
142
+ - `templates/DESIGN.md.template` — full template including all Level 1-3 sections with placeholder comments
143
+ - `templates/DESIGN.dark.md.template` — dark theme template with same token names, different values
@@ -0,0 +1,175 @@
1
+ # DESIGN.md Completeness Checklist
2
+
3
+ Three-level progressive checklist for evaluating whether a `DESIGN.md` is sufficient to drive agent UI generation. Each level builds on the previous level's requirements.
4
+
5
+ ## How to use
6
+
7
+ 1. Read `DESIGN.md` (and `DESIGN.dark.md` if exists)
8
+ 2. Check each item in the target level (and all lower levels)
9
+ 3. An item is **complete** only when concrete values exist — placeholder comments do not count
10
+ 4. A `DESIGN.md` is at **Level N** when all items in Level N and below are complete
11
+ 5. Record the result in a comment at the top of DESIGN.md:
12
+
13
+ ```
14
+ <!-- COMPLETENESS_LEVEL: N — last audited YYYY-MM-DD -->
15
+ ```
16
+
17
+ ## Level 1 — MVP (prevents guesswork)
18
+
19
+ The minimum bar for an agent to produce UI without hallucinating colors and typography. Sufficient for early-stage projects, prototypes, and CLI tools with minimal UI.
20
+
21
+ ### Checklist
22
+
23
+ - [ ] **Overview** — design system name and aesthetic principles stated
24
+ - [ ] **Colors — Background** — at least one surface color (`background-100`)
25
+ - [ ] **Colors — Text** — at least one text color (`gray-1000` or equivalent)
26
+ - [ ] **Colors — Accent** — at least one accent color for links/actions (`blue*` or brand equivalent)
27
+ - [ ] **Colors — Semantic** — at least one error color (`red*`) and warning color (`amber*`)
28
+ - [ ] **Typography — Body** — at least one body text token with font family, size, weight, line height
29
+ - [ ] **Typography — Heading** — at least one heading token
30
+ - [ ] **Spacing** — base unit declared (4px or 8px) and at least 5 scale steps
31
+ - [ ] **Breakpoints** — at least 2 responsive breakpoints defined
32
+
33
+ ### What an agent CAN do at Level 1
34
+
35
+ - Style a basic page with correct brand colors
36
+ - Choose readable typography
37
+ - Apply consistent spacing
38
+ - Make a responsive layout that works on mobile and desktop
39
+ - Signal errors with the correct color
40
+
41
+ ### What an agent CANNOT do at Level 1
42
+
43
+ - Build a consistent component library (no component tokens)
44
+ - Apply elevation/shadow correctly (will guess)
45
+ - Use motion responsibly (will guess)
46
+ - Generate dark mode (no DESIGN.dark.md)
47
+ - Apply voice rules to copy text
48
+
49
+ ### Verdict
50
+
51
+ - **All 9 items checked → Level 1 complete**
52
+ - **Missing items → below Level 1 (insufficient for agent UI generation)**
53
+
54
+ ## Level 2 — Standard (consistent components)
55
+
56
+ Sufficient for building a consistent, polished UI with reusable components. The expected level for production codebases with a frontend.
57
+
58
+ Prerequisite: Level 1 complete.
59
+
60
+ ### Checklist
61
+
62
+ - All Level 1 items complete
63
+ - [ ] **Colors — Full background scale** — `background-100` through at least `background-300`
64
+ - [ ] **Colors — Full gray solid scale** — `gray-100` through `gray-1000` (10 steps)
65
+ - [ ] **Colors — Gray alpha scale** — at least `gray-alpha-100` through `gray-alpha-600`
66
+ - [ ] **Colors — All accent scales** — `blue`, `red`, `amber`, `green`, `teal`, `purple`, `pink` with at least `700`/`800`/`900`/`1000` steps each
67
+ - [ ] **Typography — Headings** — at least 3 heading levels (e.g., `heading-32`, `heading-24`, `heading-20`)
68
+ - [ ] **Typography — Labels** — at least one label token
69
+ - [ ] **Typography — Buttons** — at least one button typography token
70
+ - [ ] **Spacing** — full 9-step scale (4, 8, 12, 16, 24, 32, 40, 64, 96px) and three-step rhythm documented
71
+ - [ ] **Breakpoints** — at least 4 breakpoints
72
+ - [ ] **Components — Button** — at least primary and secondary variants with size variants (default 40px, small 32px), plus hover/active/disabled/focus states
73
+ - [ ] **Components — Input** — at least default variant with size variants, plus hover/active/disabled/focus/error states
74
+
75
+ ### What an agent CAN do at Level 2
76
+
77
+ - Everything from Level 1
78
+ - Build a consistent Button component with all states
79
+ - Build a consistent Input component with all states
80
+ - Use the full color scale for nuanced visual hierarchy
81
+ - Apply correct typography to every text role
82
+ - Use translucent overlays and borders (alpha scale)
83
+ - Pick the right accent color for each semantic purpose
84
+
85
+ ### What an agent CANNOT do at Level 2
86
+
87
+ - Generate dark mode (no DESIGN.dark.md)
88
+ - Apply elevation/shadows with confidence (may guess)
89
+ - Use motion consistently (may guess)
90
+ - Enforce voice rules on copy text
91
+ - Know the correct border radius for each component type
92
+
93
+ ### Verdict
94
+
95
+ - **All 11 items checked (on top of Level 1) → Level 2 complete**
96
+ - **1–3 items missing → Level 2 partial; useable but expect component inconsistencies**
97
+ - **4+ items missing → below Level 2; recommend completing Level 1 only deploy**
98
+
99
+ ## Level 3 — Production (complete design system)
100
+
101
+ Full design system ready for production at scale. Includes dual theme, motion, and voice.
102
+
103
+ Prerequisite: Level 2 complete.
104
+
105
+ ### Checklist
106
+
107
+ - All Level 1 and Level 2 items complete
108
+ - [ ] **DESIGN.dark.md exists** — dark theme file with same token names, dark-appropriate values
109
+ - [ ] **Dark theme covers all tokens** — every token in DESIGN.md has a corresponding entry in DESIGN.dark.md
110
+ - [ ] **Elevation — Shadows** — at least 3 elevation levels (card, popover, modal) with explicit `box-shadow` values
111
+ - [ ] **Motion — Easing** — easing curve declared
112
+ - [ ] **Motion — Durations** — at least state change, popover, modal durations
113
+ - [ ] **Motion — Reduced motion** — `prefers-reduced-motion` rule declared
114
+ - [ ] **Shapes — Border radius** — at least 4 radius tokens (surface/input, menu/modal, fullscreen, pill)
115
+ - [ ] **Components — Full library** — at least Card, Modal, Tooltip, Menu/Dropdown tokens
116
+ - [ ] **Voice & Content** — writing rules documented: casing conventions, action naming, error format, toast format, empty state format
117
+
118
+ ### What an agent CAN do at Level 3
119
+
120
+ - Everything from Levels 1 and 2
121
+ - Generate dark-mode-compatible UI
122
+ - Apply elevation correctly for every UI layer
123
+ - Animate state changes consistently
124
+ - Apply correct border radius per element type
125
+ - Write correct microcopy (button labels, errors, toasts, empty states)
126
+ - Build a full component library (Card, Modal, Tooltip, Menu)
127
+
128
+ ### Verdict
129
+
130
+ - **All 9 items checked → Level 3 complete (production-ready)**
131
+ - **DESIGN.dark.md missing but rest complete → Level 2+ (partial Level 3, no dark mode)**
132
+
133
+ ## Audit workflow
134
+
135
+ ### When auditing existing DESIGN.md
136
+
137
+ 1. Load the DESIGN.md file
138
+ 2. Start at Level 1 checklist — check each item against actual content
139
+ 3. If Level 1 complete, proceed to Level 2
140
+ 4. If Level 2 complete, proceed to Level 3
141
+ 5. Record the level as `<!-- COMPLETENESS_LEVEL: N -->` at top of DESIGN.md
142
+ 6. For each incomplete item, note what's missing and which level it belongs to
143
+ 7. Check for `LEVEL2_PLACEHOLDER` / `LEVEL3_PLACEHOLDER` markers — if present and the project is ready for upgrade, recommend activation
144
+
145
+ ### When creating new DESIGN.md
146
+
147
+ 1. Decide target level with PM/architect:
148
+ - Prototype / early project → Level 1
149
+ - Production frontend → Level 2
150
+ - Full design system → Level 3
151
+ 2. Copy the template from `templates/DESIGN.md.template`
152
+ 3. Fill all items in the target level
153
+ 4. Run this checklist to confirm
154
+ 5. Leave higher-level placeholders as-is
155
+
156
+ ### When upgrading DESIGN.md
157
+
158
+ 1. Read current DESIGN.md and note the level tag
159
+ 2. Identify which items in the next level are missing
160
+ 3. For each missing item, either:
161
+ - Fill with concrete values if known
162
+ - Leave the `LEVEL*_PLACEHOLDER` marker if deferred
163
+ 4. Re-audit and update the level tag
164
+
165
+ ## Upgrade trigger conditions
166
+
167
+ Agents encountering a DESIGN.md with placeholders should evaluate these conditions:
168
+
169
+ | Condition | Action |
170
+ |-----------|--------|
171
+ | `LEVEL2_PLACEHOLDER` found AND plan includes component work | Recommend completing the Level 2 sections |
172
+ | `LEVEL3_PLACEHOLDER` found AND plan includes dark mode | Recommend creating DESIGN.dark.md |
173
+ | `LEVEL3_PLACEHOLDER` found AND plan targets production release | Recommend completing Level 3 |
174
+ | `COMPLETENESS_LEVEL: 1` AND project has >3 UI views | Recommend upgrading to Level 2 |
175
+ | `COMPLETENESS_LEVEL: 2` AND project has dark mode requirement | Recommend upgrading to Level 3 |
@@ -0,0 +1,378 @@
1
+ # DESIGN.md Normative Spec
2
+
3
+ This document defines the normative structure, token naming conventions, and rules for a properly formed `DESIGN.md` file. It is the single source of truth for what each section means and how tokens should be defined.
4
+
5
+ ## 1. File format
6
+
7
+ - Plain Markdown (`.md`) in project root
8
+ - UTF-8 encoding
9
+ - Multi-theme: `DESIGN.md` (light/default) + `DESIGN.dark.md` (dark variant, same token names)
10
+
11
+ ## 2. Section definitions
12
+
13
+ Each section below maps to one heading in `DESIGN.md`. Sections are ordered as shown in Vercel Geist (recommended), but projects may omit sections not yet relevant.
14
+
15
+ ### 2.1 Overview
16
+
17
+ **Purpose:** Declare the design system's identity — a short statement that grounds all downstream decisions.
18
+
19
+ **What to include:**
20
+ - Name of the design system
21
+ - Core aesthetic principles (e.g., minimal, high-contrast, playful)
22
+ - Primary audience (developer tools, consumer app, dashboard, etc.)
23
+ - Note whether this is a light theme, dark theme, or references another file for the opposite theme
24
+
25
+ **Example (minimal):**
26
+
27
+ ```
28
+ # Acme Design
29
+
30
+ Acme Design is a minimal, high-contrast design system for our developer dashboard.
31
+ Prioritize readability and signal state through color and iconography, not decoration.
32
+
33
+ This is the Light theme. The Dark theme lives at `/DESIGN.dark.md`.
34
+ ```
35
+
36
+ **Level relevance:** Level 1+
37
+
38
+ ### 2.2 Colors
39
+
40
+ **Purpose:** Define every color used in the UI, organized into scales.
41
+
42
+ **Conventions:**
43
+ - Each color scale has 10 steps (`100`–`1000`), encoding intent:
44
+ - `100`: default background
45
+ - `200`: hover background
46
+ - `300`: active background
47
+ - `400`: default border
48
+ - `500`: hover border
49
+ - `600`: active border
50
+ - `700`: solid fill
51
+ - `800`: solid fill hover
52
+ - `900`: secondary text/icons
53
+ - `1000`: primary text/icons
54
+ - **Background scales** (`background-100`, `background-200`): page/card surfaces
55
+ - **Alpha scales** (`gray-alpha-*`): translucent overlays, borders, dividers — layer over any background
56
+ - **Solid scales** (`gray-*`): text, opaque fills — hold contrast on any surface
57
+ - **Accent scales** (`blue`, `red`, `amber`, `green`, `teal`, `purple`, `pink`): carry meaning — success, error, warning, links, focus
58
+ - Accent scales may use fewer steps if not all needed
59
+
60
+ **Values:** sRGB hex (`#ffffff`), optionally with wide-gamut equivalents in `oklch()`.
61
+
62
+ **Example:**
63
+
64
+ ```
65
+ ## Colors
66
+
67
+ ### Background
68
+ | Token | Value |
69
+ |-------|-------|
70
+ | background-100 | #ffffff |
71
+ | background-200 | #f5f5f5 |
72
+
73
+ ### Gray (solid)
74
+ | Token | Value |
75
+ |-------|-------|
76
+ | gray-100 | #f5f5f5 |
77
+ | gray-700 | #333333 |
78
+ | gray-1000 | #111111 |
79
+
80
+ ### Accent
81
+ | Token | Value |
82
+ |-------|-------|
83
+ | blue-700 | #0066ff |
84
+ | red-700 | #e60000 |
85
+ ```
86
+
87
+ **Level relevance:** Level 1+ requires at least background, gray, and one accent. Level 2+ requires full 10-step scales, alpha scale, and all accent colors.
88
+
89
+ ### 2.3 Typography
90
+
91
+ **Purpose:** Define font families, sizes, weights, line heights, and letter spacing for every text role.
92
+
93
+ **Conventions:**
94
+ - **Heading tokens** (`heading-72` through `heading-14`): title pages and section headings
95
+ - **Label tokens** (`label-20` through `label-12`): single-line scannable text — navigation, form labels, table headers
96
+ - **Copy tokens** (`copy-24` through `copy-13`): multi-line body text with taller line height
97
+ - **Button tokens** (`button-16` through `button-12`): medium-weight labels for buttons
98
+ - **Mono tokens**: same metrics with monospace font for code/data
99
+ - Each token carries: `fontFamily`, `fontSize`, `fontWeight`, `lineHeight`, `letterSpacing`
100
+ - Token name encodes intended font size (e.g., `copy-14` ≈ 14px body copy)
101
+ - Use tabular figures for numbers that need alignment
102
+
103
+ **Example (minimal):**
104
+
105
+ ```
106
+ ## Typography
107
+
108
+ ### Headings
109
+ | Token | Font | Size | Weight | Line | Spacing |
110
+ |-------|------|------|--------|------|---------|
111
+ | heading-32 | Inter | 32px | 600 | 1.2 | -0.02em |
112
+ | heading-20 | Inter | 20px | 600 | 1.3 | -0.01em |
113
+
114
+ ### Body
115
+ | Token | Font | Size | Weight | Line | Spacing |
116
+ |-------|------|------|--------|------|---------|
117
+ | copy-16 | Inter | 16px | 400 | 1.6 | 0 |
118
+ | copy-14 | Inter | 14px | 400 | 1.5 | 0 |
119
+ ```
120
+
121
+ **Level relevance:** Level 1+ requires at least body text (one copy token) and one heading token. Level 2+ requires full heading/label/copy/button typography scale.
122
+
123
+ ### 2.4 Spacing & Layout
124
+
125
+ **Purpose:** Define the spatial grid and responsive breakpoints.
126
+
127
+ **Conventions:**
128
+ - Base unit: 4px or 8px (consistent across the system)
129
+ - Scale: `4, 8, 12, 16, 24, 32, 40, 64, 96` (on 4px) or equivalent on 8px
130
+ - Three-step rhythm: small inside group → medium between groups → large between sections
131
+ - Card padding: 24px default, 16px compact, 32px hero
132
+ - Content max-width with responsive side padding
133
+ - Breakpoints: provide explicit pixel values and names
134
+
135
+ **Example:**
136
+
137
+ ```
138
+ ## Layout
139
+
140
+ ### Spacing scale
141
+ 4px, 8px, 12px, 16px, 24px, 32px, 40px, 64px, 96px
142
+
143
+ ### Rhythm
144
+ - 8px: inside a group (label + input, icon + text)
145
+ - 16px: between related groups
146
+ - 32-40px: between sections
147
+
148
+ ### Breakpoints
149
+ | Name | Width |
150
+ |------|-------|
151
+ | sm | 401px |
152
+ | md | 601px |
153
+ | lg | 961px |
154
+ | xl | 1200px |
155
+ ```
156
+
157
+ **Level relevance:** Level 1+ requires spacing scale and at least 2 breakpoints.
158
+
159
+ ### 2.5 Elevation & Depth
160
+
161
+ **Purpose:** Define shadow values for layered UI elements.
162
+
163
+ **Conventions:**
164
+ - Use tonal surfaces first, shadows second — keep shadows subtle
165
+ - Define shadow values per elevation level: cards, popovers, modals
166
+ - Pair each elevation with a matching border radius
167
+
168
+ **Example:**
169
+
170
+ ```
171
+ ## Elevation
172
+
173
+ ### Shadows
174
+ | Level | Value |
175
+ |-------|-------|
176
+ | Card | 0 2px 2px rgba(0,0,0,0.04) |
177
+ | Popover | 0 1px 1px rgba(0,0,0,0.02), 0 4px 8px -4px rgba(0,0,0,0.04), 0 16px 24px -8px rgba(0,0,0,0.06) |
178
+ | Modal | 0 1px 1px rgba(0,0,0,0.02), 0 8px 16px -4px rgba(0,0,0,0.04), 0 24px 32px -8px rgba(0,0,0,0.06) |
179
+ ```
180
+
181
+ **Level relevance:** Level 3 only.
182
+
183
+ ### 2.6 Motion
184
+
185
+ **Purpose:** Define animation durations and easing curves.
186
+
187
+ **Conventions:**
188
+ - Motion clarifies change, never decorates
189
+ - Default: 0ms (instant) is often the best choice
190
+ - When needed: short, physical easing — roughly 150ms state, 200ms popover, 300ms modal
191
+ - Honor `prefers-reduced-motion`
192
+ - No looping or attention-grabbing animations
193
+
194
+ **Example:**
195
+
196
+ ```
197
+ ## Motion
198
+
199
+ ### Easing
200
+ Default: cubic-bezier(0.175, 0.885, 0.32, 1.1)
201
+
202
+ ### Durations
203
+ | Context | Duration |
204
+ |---------|----------|
205
+ | State change | 150ms |
206
+ | Popover/Tooltip | 200ms |
207
+ | Modal/Overlay | 300ms |
208
+ ```
209
+
210
+ **Level relevance:** Level 3 only.
211
+
212
+ ### 2.7 Shapes
213
+
214
+ **Purpose:** Define border radius values.
215
+
216
+ **Conventions:**
217
+ - Keep radii tight and consistent
218
+ - One radius family per view, never mix rounded and sharp corners
219
+ - Common values: 6px (surfaces), 12px (menus/modals), 16px (fullscreen), 9999px (pills)
220
+
221
+ **Example:**
222
+
223
+ ```
224
+ ## Shapes
225
+
226
+ ### Border Radius
227
+ | Context | Value |
228
+ |---------|-------|
229
+ | Surface, Input, Button | 6px |
230
+ | Menu, Modal, Popover | 12px |
231
+ | Fullscreen | 16px |
232
+ | Pill, Avatar | 9999px |
233
+ ```
234
+
235
+ **Level relevance:** Level 3 only.
236
+
237
+ ### 2.8 Components
238
+
239
+ **Purpose:** Define ready-to-use token values for common components.
240
+
241
+ **Conventions:**
242
+ - Each component gets: `backgroundColor`, `textColor`, `rounded`, `height` (and `borderColor` where applicable)
243
+ - Size variants: default (40px), small (32px), large (48px)
244
+ - State mappings: hover steps foreground up one, active steps up two; border from 400→500→600
245
+ - Focus ring: two-layer box-shadow (surface gap + accent ring)
246
+ - Disabled: 100 fill + 700 text + not-allowed cursor
247
+
248
+ **Example:**
249
+
250
+ ```
251
+ ## Components
252
+
253
+ ### Button
254
+ | Variant | Background | Text | Border | Radius | Height |
255
+ |---------|-----------|------|--------|--------|--------|
256
+ | primary | gray-1000 | background-100 | — | 6px | 40px |
257
+ | secondary | background-100 | gray-1000 | gray-alpha-400 | 6px | 40px |
258
+ | tertiary | transparent | gray-1000 | — | 6px | 40px |
259
+ | error | red-800 | #fff | — | 6px | 40px |
260
+
261
+ ### Input
262
+ | Variant | Background | Text | Border | Radius | Height |
263
+ |---------|-----------|------|--------|--------|--------|
264
+ | default | background-100 | gray-1000 | gray-alpha-400 | 6px | 40px |
265
+ ```
266
+
267
+ **Level relevance:** Level 2+ requires at least Button and Input tokens. Level 3 requires full component library.
268
+
269
+ ### 2.9 Voice & Content
270
+
271
+ **Purpose:** Define content writing rules for the UI.
272
+
273
+ **Conventions:**
274
+ - Title Case for labels, buttons, titles, tabs
275
+ - Sentence case for body, helper text, toasts
276
+ - Verb + Noun for actions (`Deploy Project`, never `Confirm`)
277
+ - Errors: what happened + what to do
278
+ - Toasts: specific thing + no trailing period + no `successfully`
279
+ - Empty states: describe the first action
280
+ - In-progress: present participle + ellipsis (`Deploying…`)
281
+ - Use numerals, curly quotes, the ellipsis character
282
+
283
+ **Example:**
284
+
285
+ ```
286
+ ## Voice & Content
287
+
288
+ - Use Title Case for labels, buttons, titles, and tabs
289
+ - Sentence case for body, helper text, and toasts
290
+ - Name actions with a verb and a noun: `Deploy Project`, `Delete Member`
291
+ - Write errors as what happened plus what to do next
292
+ - Toasts name the specific thing that changed, drop the trailing period
293
+ - Empty states point to the first action: `No deployments yet. Push to your Git repository to create one.`
294
+ ```
295
+
296
+ **Level relevance:** Level 3 only.
297
+
298
+ ## 3. Token naming conventions
299
+
300
+ ### Color tokens
301
+
302
+ ```
303
+ {namespace}-{step}
304
+ ```
305
+
306
+ - `namespace`: `background`, `gray`, `gray-alpha`, `blue`, `red`, `amber`, `green`, `teal`, `purple`, `pink`
307
+ - `step`: `100`–`1000` (10-step scale encoding intent as defined in §2.2)
308
+
309
+ ### Typography tokens
310
+
311
+ ```
312
+ {role}-{size}
313
+ ```
314
+
315
+ - `role`: `heading`, `label`, `copy`, `button`
316
+ - `size`: approximate font size in pixels
317
+ - Mono variant: `{role}-{size}-mono`
318
+
319
+ ### Breakpoint tokens
320
+
321
+ Lowercase short names: `sm`, `md`, `lg`, `xl`, `2xl`
322
+
323
+ ## 4. Light/Dark dual-theme rules
324
+
325
+ ### Contract
326
+
327
+ Dual theme uses **same token names with different values** in two separate files:
328
+
329
+ - `DESIGN.md` — light (or default) theme
330
+ - `DESIGN.dark.md` — dark theme
331
+
332
+ ### Rules
333
+
334
+ 1. **Token names are identical** across both files
335
+ 2. **Only the values differ** — a light `background-100: #ffffff` becomes dark `background-100: #111111`
336
+ 3. **Both files define the same token set** — no token can exist in only one file
337
+ 4. **DESIGN.md is always the SSOT for token names** — DESIGN.dark.md copies the structure
338
+ 5. If a token isn't relevant to dark mode (e.g., a light-only accent), include it in DESIGN.dark.md anyway with a sensible dark-equivalent value
339
+ 6. Add `DESIGN.dark.md` path reference in DESIGN.md Overview
340
+
341
+ ### Naming
342
+
343
+ Dark theme file must be named `DESIGN.dark.md` (not `design-dark.md` or `DESIGN_DARK.md`).
344
+
345
+ ## 5. Upgrade placeholders
346
+
347
+ Sections not yet filled should use HTML comment markers:
348
+
349
+ ```
350
+ <!-- LEVEL2_PLACEHOLDER: Complete the 10-step color scales and add alpha scale when the design matures. See `references/completeness-checklist.md` § Level 2. -->
351
+ ```
352
+
353
+ ```
354
+ <!-- LEVEL3_PLACEHOLDER: Add Elevation, Motion, Shapes, Voice & Content, and full Component library when ready for production design system. See `references/completeness-checklist.md` § Level 3. -->
355
+ ```
356
+
357
+ Agents encountering these placeholders understand that:
358
+ - The section is intentionally deferred, not accidentally empty
359
+ - The placeholder describes what's missing and when to revisit
360
+ - An upgrade workflow can detect these markers and recommend progression
361
+
362
+ ## 6. Mapping to implementation
363
+
364
+ DESIGN.md tokens should map to implementation as follows:
365
+
366
+ | DESIGN.md | Implementation |
367
+ |-----------|---------------|
368
+ | Color tokens | CSS custom properties (`--color-gray-100`) or theme object |
369
+ | Typography tokens | CSS classes or Tailwind prose config |
370
+ | Spacing scale | CSS custom properties or Tailwind spacing config |
371
+ | Breakpoints | CSS media queries or Tailwind screens |
372
+ | Elevation | `box-shadow` or Tailwind shadow config |
373
+ | Motion | `transition` or animation library config |
374
+ | Shapes | `border-radius` or Tailwind radius config |
375
+ | Component tokens | Component prop defaults or CSS classes |
376
+ | Voice rules | Linter rules or prompt context for copy generation |
377
+
378
+ The agent consuming DESIGN.md is responsible for this mapping, not DESIGN.md itself. DESIGN.md stays implementation-agnostic.