|
| 1 | +--- |
| 2 | +name: design-md |
| 3 | +version: 2026-04-26 |
| 4 | +triggers: ["DESIGN.md", "design.md", "Google Stitch", "Stitch", "design tokens", "design system", "visual design"] |
| 5 | +tools: [bash, memory_reflect] |
| 6 | +preconditions: ["DESIGN.md exists at project root"] |
| 7 | +constraints: ["prefer DESIGN.md tokens over invented values", "do not modify DESIGN.md unless the user explicitly asks", "preserve unknown sections when an edit IS authorised", "validate when tooling is available"] |
| 8 | +--- |
| 9 | + |
| 10 | +# DESIGN.md — portable visual system contract |
| 11 | + |
| 12 | +Use this skill when a task touches Google Stitch's `DESIGN.md` format or |
| 13 | +the project explicitly references its design system / design tokens. The |
| 14 | +skill loads only when `DESIGN.md` exists at the project root (see |
| 15 | +`preconditions` above), so general UI / frontend / component work that |
| 16 | +isn't tied to a `DESIGN.md` won't trip it. |
| 17 | + |
| 18 | +## Source of truth |
| 19 | +- `DESIGN.md` is a contract file. Read it before changing visual UI. |
| 20 | +- Treat YAML front matter tokens as normative values: colors, typography, |
| 21 | + spacing, radius, and component tokens are exact inputs to code. |
| 22 | +- Treat the Markdown body as design rationale: it explains mood, hierarchy, |
| 23 | + interaction intent, and where tokens should or should not be used. |
| 24 | +- If no `DESIGN.md` exists this skill is inactive; for new UI, offer to |
| 25 | + create one or ask for a brand/reference, but don't generate one |
| 26 | + unprompted. |
| 27 | + |
| 28 | +## Default: read-only |
| 29 | +**Do not modify `DESIGN.md` unless the user explicitly asks for a design |
| 30 | +system change.** Implementation work consumes the contract; it does not |
| 31 | +edit it. Token additions, renames, or section restructures land in their |
| 32 | +own commit with a clear message and (ideally) a Stitch round-trip. |
| 33 | + |
| 34 | +## Implementation rules |
| 35 | +1. Map tokens into the local styling system already in use: CSS variables, |
| 36 | + Tailwind theme values, design-token JSON, component props, or native |
| 37 | + styles. |
| 38 | +2. Use token references and component patterns from `DESIGN.md` instead of |
| 39 | + hard-coded one-off values. |
| 40 | +3. Keep accessibility constraints intact. Do not weaken contrast, focus, |
| 41 | + reduced-motion, or touch-target guidance unless the user explicitly |
| 42 | + asks. |
| 43 | + |
| 44 | +## When an edit IS authorised |
| 45 | +1. Preserve unknown headings and extra prose; other agents or Stitch may |
| 46 | + own them. |
| 47 | +2. Express component variants as related entries |
| 48 | + (`button-primary`, `button-primary-hover`, etc.). |
| 49 | +3. Land token / structure changes in their own commit, separate from the |
| 50 | + feature consuming them. |
| 51 | + |
| 52 | +## Validation |
| 53 | +- If Node/npm tooling is available, lint with: |
| 54 | + |
| 55 | + ```bash |
| 56 | + npx @google/design.md lint DESIGN.md |
| 57 | + ``` |
| 58 | + |
| 59 | +- For design system changes, diff before/after: |
| 60 | + |
| 61 | + ```bash |
| 62 | + npx @google/design.md diff DESIGN.before.md DESIGN.md |
| 63 | + ``` |
| 64 | + |
| 65 | +- If the CLI is unavailable or network/dependency policy blocks it, the |
| 66 | + manual fallback is best-effort only — check for broken `{path.to.token}` |
| 67 | + references, missing primary color / typography tokens, duplicate section |
| 68 | + headings, and section order. The CLI ALSO checks contrast ratios and |
| 69 | + orphaned tokens; the manual fallback does not, so re-run the CLI when |
| 70 | + you regain network access. |
| 71 | + |
| 72 | +## Expected sections |
| 73 | +The Google draft spec uses YAML front matter plus Markdown sections. |
| 74 | +Common sections: |
| 75 | + |
| 76 | +- `## Overview` |
| 77 | +- `## Colors` |
| 78 | +- `## Typography` |
| 79 | +- `## Layout` |
| 80 | +- `## Elevation & Depth` |
| 81 | +- `## Shapes` |
| 82 | +- `## Components` |
| 83 | +- `## Do's and Don'ts` |
| 84 | + |
| 85 | +## Self-rewrite hook |
| 86 | +After every 5 uses OR on any failure: |
| 87 | +1. Read the last N skill-specific episodic entries. |
| 88 | +2. If a new failure mode has appeared (e.g. tokens drifting away from |
| 89 | + DESIGN.md, accessibility rules being weakened, unauthorised edits to |
| 90 | + the contract file), append it to this skill's `KNOWLEDGE.md`. |
| 91 | +3. If a constraint was violated, escalate to `semantic/LESSONS.md`. |
| 92 | +4. Commit: `skill-update: design-md, <one-line reason>`. |
0 commit comments