document.md

  1Generate a `DESIGN.md` file at the project root that captures the current visual design system, so AI agents generating new screens stay on-brand.
  2
  3DESIGN.md follows the [official Google Stitch DESIGN.md format](https://stitch.withgoogle.com/docs/design-md/format/): YAML frontmatter carrying machine-readable design tokens, followed by a markdown body with exactly six sections in a fixed order. **Tokens are normative; prose provides context for how to apply them.** Sections may be omitted when not relevant, but **do not reorder them and do not rename them**. Section headers must match the spec character-for-character so the file stays parseable by other DESIGN.md-aware tools (Stitch itself, awesome-design-md, skill-rest, etc.).
  4
  5## The frontmatter: token schema
  6
  7The YAML frontmatter is the machine-readable layer. It's what Stitch's linter validates and what the live panel renders tiles from. Keep it tight; every entry should correspond to a token the project actually uses.
  8
  9```yaml
 10---
 11name: <project title>
 12description: <one-line tagline>
 13colors:
 14  primary: "#b8422e"
 15  neutral-bg: "#faf7f2"
 16  # ...one entry per extracted color; key = descriptive slug
 17typography:
 18  display:
 19    fontFamily: "Cormorant Garamond, Georgia, serif"
 20    fontSize: "clamp(2.5rem, 7vw, 4.5rem)"
 21    fontWeight: 300
 22    lineHeight: 1
 23    letterSpacing: "normal"
 24  body:
 25    # ...
 26rounded:
 27  sm: "4px"
 28  md: "8px"
 29spacing:
 30  sm: "8px"
 31  md: "16px"
 32components:
 33  button-primary:
 34    backgroundColor: "{colors.primary}"
 35    textColor: "{colors.neutral-bg}"
 36    rounded: "{rounded.sm}"
 37    padding: "16px 48px"
 38  button-primary-hover:
 39    backgroundColor: "{colors.primary-deep}"
 40---
 41```
 42
 43Rules that matter:
 44
 45- **Token refs** use `{path.to.token}` (e.g. `{colors.primary}`, `{rounded.md}`). Components may reference primitives; primitives may not reference each other.
 46- **Stitch validates colors as hex sRGB only** (`#RGB` / `#RGBA` / `#RRGGBB` / `#RRGGBBAA`); OKLCH/HSL/P3 trigger a linter warning, not a hard error. YAML accepts the string either way and our own parser is format-agnostic. Choose based on project posture: (a) if the project has an "OKLCH-only" doctrine or uses Display-P3 values that don't round-trip through sRGB, put OKLCH directly in the frontmatter and accept the Stitch linter warning; (b) if the project wants strict Stitch compliance or plans to use their Tailwind/DTCG export pipeline, put hex in the frontmatter and keep OKLCH in prose as the canonical reference. Never split the source of truth without explicit reason.
 47- **Component sub-tokens** are limited to 8 props: `backgroundColor`, `textColor`, `typography`, `rounded`, `padding`, `size`, `height`, `width`. Shadows, motion, focus rings, backdrop-filter: none of those fit. Carry them in the sidecar (Step 4b).
 48- **Scale keys are open-ended.** Use whatever names the project already uses (`warm-ash-cream`, `surface-container-low`). Don't rename to Material defaults.
 49- **Variants are naming convention, not schema.** `button-primary` / `button-primary-hover` / `button-primary-active` as sibling keys.
 50
 51## The markdown body: six sections (exact order)
 52
 531. `## Overview`
 542. `## Colors`
 553. `## Typography`
 564. `## Elevation`
 575. `## Components`
 586. `## Do's and Don'ts`
 59
 60Optional evocative subtitles are allowed in the form `## 2. Colors: The [Name] Palette` (Stitch's own outputs do this), but the literal word in each header (Overview, Colors, Typography, Elevation, Components, Do's and Don'ts) must be present. Do NOT add extra top-level sections (Layout Principles, Responsive Behavior, Motion, Agent Prompt Guide). Fold that content into the six spec sections where it naturally belongs.
 61
 62## When to run
 63
 64- The user just ran `/impeccable teach` and needs the visual side documented.
 65- The skill noticed no `DESIGN.md` exists and nudged the user to create one.
 66- An existing `DESIGN.md` is stale (the design has drifted).
 67- Before a large redesign, to capture the current state as a reference.
 68
 69If a `DESIGN.md` already exists, **do not silently overwrite it**. Show the user the existing file and STOP and call the `question` tool to clarify. whether to refresh, overwrite, or merge.
 70
 71## Two paths
 72
 73- **Scan mode** (default): the project has design tokens, components, or rendered output. Extract, then confirm descriptive language. Use when there's code to analyze.
 74- **Seed mode**: the project is pre-implementation (fresh teach, nothing built yet). Interview for five high-level answers, write a minimal DESIGN.md marked `<!-- SEED -->`. Re-run in scan mode once there's code.
 75
 76Decide by scanning first (Scan mode Step 1). If the scan finds no tokens, no component files, and no rendered site, offer seed mode; don't silently switch. `/impeccable document --seed` forces seed mode regardless of code presence.
 77
 78## Scan mode (approach C: auto-extract, then confirm descriptive language)
 79
 80### Step 1: Find the design assets
 81
 82Search the codebase in priority order:
 83
 841. **CSS custom properties**: grep for `--color-`, `--font-`, `--spacing-`, `--radius-`, `--shadow-`, `--ease-`, `--duration-` declarations in CSS files (usually `src/styles/`, `public/css/`, `app/globals.css`, etc.). Record name, value, and the file it's defined in.
 852. **Tailwind config**: if `tailwind.config.{js,ts,mjs}` exists, read the `theme.extend` block for colors, fontFamily, spacing, borderRadius, boxShadow.
 863. **CSS-in-JS theme files**: styled-components, emotion, vanilla-extract, stitches; look for `theme.ts`, `tokens.ts`, or equivalent.
 874. **Design token files**: `tokens.json`, `design-tokens.json`, Style Dictionary output, W3C token community group format.
 885. **Component library**: scan the main button, card, input, navigation, dialog components. Note their variant APIs and default styles.
 896. **Global stylesheet**: the root CSS file usually has the base typography and color assignments.
 907. **Visible rendered output**: if browser automation tools are available, load the live site and sample computed styles from key elements (body, h1, a, button, .card). This catches values that tokens miss.
 91
 92### Step 2: Auto-extract what can be auto-extracted
 93
 94Build a structured draft from the discovered tokens. For each token class:
 95
 96- **Colors**: Group into Primary / Secondary / Tertiary / Neutral (the Material-derived roles Stitch uses). If the project only has one accent, express it as Primary + Neutral; omit Secondary and Tertiary rather than inventing them.
 97- **Typography**: Map observed sizes and weights to the Material hierarchy (display / headline / title / body / label). Note font-family stacks and the scale ratio.
 98- **Elevation**: Catalogue the shadow vocabulary. If the project is flat and uses tonal layering instead, that's a valid answer; state it explicitly.
 99- **Components**: For each common component (button, card, input, chip, list item, tooltip, nav), extract shape (radius), color assignment, hover/focus treatment, internal padding.
100- **Spacing + layout**: Fold into Overview or relevant Components. The spec does NOT have a Layout section.
101
102### Step 2b: Stage the frontmatter
103
104From the auto-extracted tokens, draft the YAML frontmatter now (you'll write it at the top of DESIGN.md in Step 4). This is the machine-readable layer: what the live panel and Stitch's linter consume.
105
106- **Colors**: one entry per extracted color. Key = descriptive slug (`warm-ash-cream`, `editorial-magenta`, not `blue-800`). Value = whichever format the project treats as canonical (OKLCH or hex; see the frontmatter rules above). Don't split the source of truth: one format in the frontmatter, don't redefine the same token in prose with a different value.
107- **Typography**: one entry per role (`display`, `headline`, `title`, `body`, `label`). Typography is an object; include only the props that are real for the project (`fontFamily`, `fontSize`, `fontWeight`, `lineHeight`, `letterSpacing`, `fontFeature`, `fontVariation`).
108- **Rounded / Spacing**: whatever scale steps the project actually uses, keyed by whatever scale name the project uses (`sm` / `md` / `lg`, or `surface-sm`, or numeric steps).
109- **Components**: one entry per variant (`button-primary`, `button-primary-hover`, `button-ghost`). Reference primitives via `{colors.X}`, `{rounded.Y}`. If a variant needs a property Stitch's 8-prop set doesn't cover (shadow, focus ring, backdrop-filter), carry the full snippet in the sidecar instead.
110
111Skip anything the project doesn't have. Empty scale keys or fabricated tokens pollute the spec.
112
113### Step 3: Ask the user for qualitative language
114
115The following require creative input that cannot be auto-extracted. Group them into one `AskUserQuestion` interaction:
116
117- **Creative North Star**: a single named metaphor for the whole system ("The Editorial Sanctuary", "The Golden State Curator", "The Lab Notebook"). Offer 2-3 options that honor PRODUCT.md's brand personality.
118- **Overview voice**: mood adjectives, aesthetic philosophy in 2-3 sentences, anti-references (what the system should not feel like).
119- **Color character** (for auto-extracted colors): descriptive names ("Deep Muted Teal-Navy", not "blue-800"). Suggest 2-3 options per key color based on hue/saturation.
120- **Elevation philosophy**: flat/layered/lifted. If shadows exist, is their role ambient or structural?
121- **Component philosophy**: the feel of buttons, cards, inputs in one phrase ("tactile and confident" vs. "refined and restrained").
122
123Quote a line from PRODUCT.md when possible so the user sees their own strategic language carry forward.
124
125### Step 4: Write DESIGN.md
126
127The file opens with the YAML frontmatter staged in Step 2b (schema documented at the top of this reference), then the markdown body using the structure below. Headers must match character-for-character. Optional evocative subtitles (e.g. `## 2. Colors: The Coastal Palette`) are allowed.
128
129```markdown
130---
131name: [Project Title]
132description: [one-line tagline]
133colors:
134  # ... staged frontmatter from Step 2b
135---
136
137# Design System: [Project Title]
138
139## 1. Overview
140
141**Creative North Star: "[Named metaphor in quotes]"**
142
143[2-3 paragraph holistic description: personality, density, aesthetic philosophy. Start from the North Star and work outward. State what this system explicitly rejects (pulled from PRODUCT.md's anti-references). End with a short **Key Characteristics:** bullet list.]
144
145## 2. Colors
146
147[Describe the palette character in one sentence.]
148
149### Primary
150- **[Descriptive Name]** (#HEX / oklch(...)): [Where and why this color is used. Be specific about context, not just role.]
151
152### Secondary (optional; omit if the project has only one accent)
153- **[Descriptive Name]** (#HEX): [Role.]
154
155### Tertiary (optional)
156- **[Descriptive Name]** (#HEX): [Role.]
157
158### Neutral
159- **[Descriptive Name]** (#HEX): [Text / background / border / divider role.]
160- [...]
161
162### Named Rules (optional, powerful)
163**The [Rule Name] Rule.** [Short, forceful prohibition or doctrine, e.g. "The One Voice Rule. The primary accent is used on ≀10% of any given screen. Its rarity is the point."]
164
165## 3. Typography
166
167**Display Font:** [Family] (with [fallback])
168**Body Font:** [Family] (with [fallback])
169**Label/Mono Font:** [Family, if distinct]
170
171**Character:** [1-2 sentence personality description of the pairing.]
172
173### Hierarchy
174- **Display** ([weight], [size/clamp], [line-height]): [Purpose; where it appears.]
175- **Headline** ([weight], [size], [line-height]): [Purpose.]
176- **Title** ([weight], [size], [line-height]): [Purpose.]
177- **Body** ([weight], [size], [line-height]): [Purpose. Include max line length like 65–75ch if relevant.]
178- **Label** ([weight], [size], [letter-spacing], [case if uppercase]): [Purpose.]
179
180### Named Rules (optional)
181**The [Rule Name] Rule.** [Short doctrine about type use.]
182
183## 4. Elevation
184
185[One paragraph: does this system use shadows, tonal layering, or a hybrid? If "no shadows", say so explicitly and describe how depth is conveyed instead.]
186
187### Shadow Vocabulary (if applicable)
188- **[Role name]** (`box-shadow: [exact value]`): [When to use it.]
189- [...]
190
191### Named Rules (optional)
192**The [Rule Name] Rule.** [e.g. "The Flat-By-Default Rule. Surfaces are flat at rest. Shadows appear only as a response to state (hover, elevation, focus)."]
193
194## 5. Components
195
196For each component, lead with a short character line, then specify shape, color assignment, states, and any distinctive behavior.
197
198### Buttons
199- **Shape:** [radius described, exact value in parens]
200- **Primary:** [color assignment + padding, in semantic + exact terms]
201- **Hover / Focus:** [transitions, treatments]
202- **Secondary / Ghost / Tertiary (if applicable):** [brief description]
203
204### Chips (if used)
205- **Style:** [background, text color, border treatment]
206- **State:** [selected / unselected, filter / action variants]
207
208### Cards / Containers
209- **Corner Style:** [radius]
210- **Background:** [colors used]
211- **Shadow Strategy:** [reference Elevation section]
212- **Border:** [if any]
213- **Internal Padding:** [scale]
214
215### Inputs / Fields
216- **Style:** [stroke, background, radius]
217- **Focus:** [treatment, e.g. glow, border shift, etc.]
218- **Error / Disabled:** [if applicable]
219
220### Navigation
221- **Style, typography, default/hover/active states, mobile treatment.**
222
223### [Signature Component] (optional; if the project has a distinctive custom component worth documenting)
224[Description.]
225
226## 6. Do's and Don'ts
227
228Concrete, forceful guardrails. Lead each with "Do" or "Don't". Be specific: include exact colors, pixel values, and named anti-patterns the user mentioned in PRODUCT.md. **Every anti-reference in PRODUCT.md should show up here as a "Don't" with the same language**, so the visual spec carries the strategic line through. Quote PRODUCT.md directly where possible: if PRODUCT.md says *"avoid dark mode with purple gradients, neon accents, glassmorphism"*, the Don'ts here should repeat that by name.
229
230### Do:
231- **Do** [specific prescription with exact values / named rule].
232- **Do** [...]
233
234### Don't:
235- **Don't** [specific prohibition, e.g. "use border-left greater than 1px as a colored stripe"].
236- **Don't** [...]
237- **Don't** [...]
238```
239
240### Step 4b: Write .impeccable/design.json sidecar (extensions only)
241
242The frontmatter owns token primitives (colors, typography, rounded, spacing, components). The sidecar at `.impeccable/design.json` carries **what Stitch's schema can't hold**: tonal ramps per color, shadow/elevation tokens, motion tokens, breakpoints, full component HTML/CSS snippets (the panel renders these into a shadow DOM), and narrative (north star, rules, do's/don'ts). It extends the frontmatter, it doesn't duplicate it.
243
244Regenerate the sidecar whenever you regenerate root `DESIGN.md`. If the user only asks to refresh the sidecar (e.g., from the live panel's stale-hint), preserve `DESIGN.md` and write only `.impeccable/design.json`.
245
246#### Schema
247
248```json
249{
250  "schemaVersion": 2,
251  "generatedAt": "ISO-8601 string",
252  "title": "Design System: [Project Title]",
253  "extensions": {
254    "colorMeta": {
255      "primary":        { "role": "primary",  "displayName": "Editorial Magenta", "canonical": "oklch(60% 0.25 350)", "tonalRamp": ["...", "...", "..."] },
256      "warm-ash-cream": { "role": "neutral",  "displayName": "Warm Ash Cream",    "canonical": "oklch(96% 0.005 350)", "tonalRamp": ["...", "...", "..."] }
257    },
258    "typographyMeta": {
259      "display": { "displayName": "Display", "purpose": "Hero headlines only." }
260    },
261    "shadows": [
262      { "name": "ambient-low", "value": "0 4px 24px rgba(0,0,0,0.12)", "purpose": "Diffuse hover glow under accent elements." }
263    ],
264    "motion": [
265      { "name": "ease-standard", "value": "cubic-bezier(0.4, 0, 0.2, 1)", "purpose": "Default easing for state transitions." }
266    ],
267    "breakpoints": [
268      { "name": "sm", "value": "640px" }
269    ]
270  },
271  "components": [
272    {
273      "name": "Primary Button",
274      "kind": "button | input | nav | chip | card | custom",
275      "refersTo": "button-primary",
276      "description": "One-line what and when.",
277      "html": "<button class=\"ds-btn-primary\">GET STARTED</button>",
278      "css": ".ds-btn-primary { background: #191c1d; color: #fff; padding: 16px 48px; letter-spacing: 0.05em; text-transform: uppercase; font-weight: 500; border: none; border-radius: 0; transition: background 0.2s, transform 0.2s; } .ds-btn-primary:hover { background: oklch(60% 0.25 350); transform: translateY(-2px); }"
279    }
280  ],
281  "narrative": {
282    "northStar": "The Editorial Sanctuary",
283    "overview": "2-3 paragraphs of the philosophy, pulled from DESIGN.md Overview section.",
284    "keyCharacteristics": ["...", "..."],
285    "rules": [{ "name": "The One Voice Rule", "body": "...", "section": "colors|typography|elevation" }],
286    "dos":   ["Do use ..."],
287    "donts": ["Don't use ..."]
288  }
289}
290```
291
292**What changed from schemaVersion 1.** The old sidecar carried token primitive arrays (`tokens.colors[]`, `tokens.typography[]`, etc.). Those values now live in the frontmatter. The sidecar only carries metadata that can't live in the frontmatter (tonal ramps, canonical OKLCH when the hex is an approximation, display names, role hints), keyed by the frontmatter token name (`colorMeta.<token-name>`, `typographyMeta.<token-name>`). Components still carry full HTML/CSS because Stitch's 8-prop set can't hold them.
293
294#### Component translation rules
295
296The `html` and `css` fields must be **self-contained, drop-in snippets** that render correctly when injected into a shadow DOM. The panel applies them directly: no post-processing, no framework runtime.
297
2981. **Tailwind expansion.** If the source uses Tailwind (className="bg-primary text-white rounded-lg px-6 py-3"), expand every utility to literal CSS properties in the `css` string. Do **not** reference Tailwind classes; do **not** assume a Tailwind CSS bundle is loaded. Each component is self-contained.
2992. **Token resolution.** If the project exposes tokens as CSS custom properties on `:root` (e.g. `--color-primary`, `--radius-md`), reference them via `var(--color-primary)`; they inherit through the shadow DOM and stay live-bound. If tokens live only in JS theme objects (styled-components, CSS-in-JS), resolve to literal values at generation time.
3003. **Icons.** Inline as SVG. Do not reference Lucide/Heroicons packages, icon fonts, or `<img src="...">`. A typical icon is 16-24px; copy the SVG path data directly.
3014. **States.** Include `:hover`, `:focus-visible`, and (if meaningful) `:active` rules inline. A static default-only snapshot makes the panel feel dead. Hover + focus rules in the CSS make it feel alive.
3025. **Reset bloat.** Extract only the component's *distinctive* CSS (background, color, padding, border-radius, typography, transition). Skip universal resets (`box-sizing: border-box`, `line-height: inherit`, `-webkit-font-smoothing`). The panel already has a neutral canvas; don't re-ship resets.
3036. **Scoped class names.** Prefix every class with `ds-` (e.g. `ds-btn-primary`, `ds-input-search`) so component CSS doesn't collide with other components' CSS in the same shadow DOM.
304
305#### What to include
306
307Aim for a tight set of **5-10 components** that best represent the visual system:
308
309- **Canonical primitives (always include if the project has them):** button (each variant as a separate component entry), input/text field, navigation, chip/tag, card.
310- **Signature components (include if distinctive):** hero CTA, featured card, filter pill, any custom pattern the user mentioned as important in PRODUCT.md.
311- **Skip the rest.** Utility components, form building blocks, wrapper layouts: not worth documenting unless visually distinctive.
312
313If the project has **no component library yet** (bare landing page, new project), synthesize canonical primitives from the tokens using best-practice defaults consistent with the DESIGN.md's rules. Every `.impeccable/design.json` has *something* to render, even on day zero.
314
315#### Tonal ramps
316
317For each color token, generate an 8-step `tonalRamp` array: dark to light, same hue and chroma, stepped lightness from ~15% to ~95%. The panel renders this as a strip under the swatch. If the project already defines a tonal scale (Material `surface-container-low` family, Tailwind-style `blue-50..blue-900`), use those values. Otherwise synthesize in OKLCH.
318
319#### Narrative mapping
320
321Pull directly from the DESIGN.md you just wrote:
322
323- `narrative.northStar` β†’ the `**Creative North Star: "..."**` line from Overview
324- `narrative.overview` β†’ the philosophy paragraphs from Overview
325- `narrative.keyCharacteristics` β†’ the bulleted `**Key Characteristics:**` list
326- `narrative.rules` β†’ every `**The [Name] Rule.** [body]` across all sections, tagged with `section`
327- `narrative.dos` / `narrative.donts` β†’ the bullet lists from Do's and Don'ts verbatim
328
329Do not reword. The panel shows these as secondary collapsible context; the same voice that's in the Markdown carries through.
330
331### Step 5: Confirm, refine, and refresh session cache
332
3331. Show the user the full DESIGN.md you wrote. Briefly highlight the non-obvious creative choices (descriptive color names, atmosphere language, named rules).
3342. Mention that `.impeccable/design.json` was also written alongside; the live panel will now render this project's actual button/input/nav primitives instead of generic approximations.
3353. Offer to refine any section: "Want me to revise a section, add component patterns I missed, or adjust the atmosphere language?"
3364. **Refresh the session cache.** Run `node .opencode/skills/impeccable/scripts/load-context.mjs` one final time so the newly-written DESIGN.md lands in conversation. Subsequent commands in this session will use the fresh version automatically without re-reading.
337
338## Seed mode
339
340For projects with no visual system to extract yet. Produces a minimal scaffold, not a full spec.
341
342### Step 1: Confirm seed mode
343
344Before interviewing: "There's no existing visual system to scan. I'll ask five quick questions to seed a starter DESIGN.md. You can re-run `/impeccable document` once there's code, to capture the real tokens and components. OK?"
345
346If the user prefers to skip, stop. No file.
347
348### Step 2: Five questions
349
350Group into one `AskUserQuestion` interaction. Options must be concrete.
351
3521. **Color strategy.** Pick one:
353   - Restrained: tinted neutrals + one accent ≀10%
354   - Committed: one saturated color carries 30–60% of the surface
355   - Full palette: 3–4 named color roles, each deliberate
356   - Drenched: the surface IS the color
357   
358   Then: one hue family or anchor reference ("deep teal", "mustard", "Klim #ff4500 orange").
359
3602. **Typography direction.** Pick one (specific fonts come later):
361   - Serif display + sans body
362   - Single sans (warm / technical / geometric / humanist; pick a feel)
363   - Display + mono
364   - Mono-forward
365   - Editorial script + sans
366
3673. **Motion energy.** Pick one:
368   - Restrained: state changes only
369   - Responsive: feedback + transitions, no choreography
370   - Choreographed: orchestrated entrances, scroll-driven sequences
371
3724. **Three named references.** Brands, products, printed objects. Not adjectives.
373
3745. **One anti-reference.** What it should NOT feel like. Also named.
375
376### Step 3: Write seed DESIGN.md
377
378Use the six-section spec from Scan mode. Populate what the interview answers; leave the rest as honest placeholders. The seed is a scaffold, not a fabricated spec.
379
380Lead the file with:
381
382```markdown
383<!-- SEED: re-run /impeccable document once there's code to capture the actual tokens and components. -->
384```
385
386Per-section guidance in seed mode:
387
388- **Overview**: Creative North Star and philosophy phrased from the answers (color strategy + motion energy + references). Reference the user's anti-reference directly.
389- **Colors**: Color strategy as a Named Rule (e.g. *"The Drenched Rule. The surface IS the color."*). Hue family or anchor reference. No hex values; mark as `[to be resolved during implementation]`.
390- **Typography**: the direction the user picked (e.g. "Serif display + sans body"). No font names yet: `[font pairing to be chosen at implementation]`.
391- **Elevation**: inferred from motion energy. Restrained/Responsive β†’ flat by default; Choreographed β†’ layered. One sentence.
392- **Components**: omit entirely; no components exist yet.
393- **Do's and Don'ts**: carry PRODUCT.md's anti-references directly plus the anti-reference named in Q5.
394
395Seed mode writes a minimal frontmatter with `name` and `description` only; no colors, typography, rounded, spacing, or components yet. Real tokens land on the next Scan-mode run. Skip the `.impeccable/design.json` sidecar in seed mode for the same reason: nothing to render.
396
397### Step 4: Confirm and refresh session cache
398
3991. Show the seed DESIGN.md. Call out that it is a seed (the marker is the literal commitment).
4002. Tell the user: "Re-run `/impeccable document` once you have some code. That pass will extract real tokens and generate the sidecar."
4013. Run `node .opencode/skills/impeccable/scripts/load-context.mjs` once so the seed lands in conversation for the rest of the session.
402
403## Style guidelines
404
405- **Frontmatter first, prose second.** Tokens go in the YAML frontmatter; prose contextualizes them. Don't redefine a token value in two places; the frontmatter is normative.
406- **Cite PRODUCT.md anti-references by name** in the Do's and Don'ts section. If PRODUCT.md lists "SaaS landing-page clichΓ©s" or "generic AI tool marketing" as anti-references, the DESIGN.md Don'ts should repeat those phrases verbatim so the visual spec enforces the strategic line.
407- **Match the spec, don't invent new sections.** The six section names are fixed. If you have Layout/Motion/Responsive content to document, fold it into Overview (philosophy-level rules) or Components (per-component behavior).
408- **Descriptive > technical**: "Gently curved edges (8px radius)" > "rounded-lg". Include the technical value in parens, lead with the description.
409- **Functional > decorative**: for each token, explain WHERE and WHY it's used, not just WHAT it is.
410- **Exact values in parens**: hex codes, px/rem values, font weights; always the number in parens alongside the description.
411- **Use Named Rules**: `**The [Name] Rule.** [short doctrine]`. These are memorable, citable, and much stickier for AI consumers than bullet lists. Stitch's own outputs use them heavily ("The No-Line Rule", "The Ghost Border Fallback"). Aim for 1-3 per section.
412- **Be forceful**. The voice of a design director. "Prohibited", "forbidden", "never", "always", not "consider", "might", "prefer". Match PRODUCT.md's tone.
413- **Concrete anti-pattern tests**. Stitch writes things like *"If it looks like a 2014 app, the shadow is too dark and the blur is too small."* A one-sentence audit test beats a paragraph of principle.
414- **Reference PRODUCT.md**. The anti-references section of PRODUCT.md should directly inform the Do's and Don'ts section here. Quote or paraphrase.
415- **Group colors by role**, not by hex-order or hue-order. Primary / Secondary / Tertiary / Neutral is the spec ordering.
416
417## Pitfalls
418
419- Don't paste raw CSS class names. Translate to descriptive language.
420- Don't extract every token. Stop at what's actually reused; one-offs pollute the system.
421- Don't invent components that don't exist. If the project only has buttons and cards, only document those.
422- Don't overwrite an existing DESIGN.md without asking.
423- Don't duplicate content from PRODUCT.md. DESIGN.md is strictly visual.
424- Don't add a "Layout Principles" or "Motion" or "Responsive Behavior" top-level section. The spec has six, not nine. Fold that content where it belongs.
425- Don't rename sections even slightly. "Colors" not "Color Palette & Roles". "Typography" not "Typography Rules". Tooling parsing depends on exact headers.
426- Don't duplicate token values between frontmatter and prose. If a color is in `colors.primary` as hex, the prose can name it and describe its role but should not reassert a different hex. The frontmatter is normative.
427- Don't invent frontmatter token groups outside Stitch's schema (no `motion:`, `breakpoints:`, `shadows:` at the top level). Stitch's Zod schema only accepts `colors`, `typography`, `rounded`, `spacing`, `components`. Anything else belongs in the sidecar's `extensions`.