@tekyzinc/gsd-t 2.53.11 → 2.54.11

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.
package/README.md CHANGED
@@ -12,7 +12,7 @@ A methodology for reliable, parallelizable development using Claude Code with op
12
12
  **Generates visual scan reports** — every `/gsd-t-scan` produces a self-contained HTML report with 6 live architectural diagrams, a tech debt register, and domain health scores; optional DOCX/PDF export via `--export docx|pdf`.
13
13
  **Self-learning rule engine** — declarative rules in rules.jsonl detect failure patterns from task metrics. Candidate patches progress through a 5-stage lifecycle (candidate, applied, measured, promoted, graduated) with >55% improvement gates before becoming permanent methodology artifacts.
14
14
  **Cross-project learning** — proven rules propagate to `~/.claude/metrics/` and sync across all registered projects via `update-all`. Rules validated in 3+ projects become universal; 5+ projects qualify for npm distribution. Cross-project signal comparison and global ELO rankings available via `gsd-t-metrics --cross-project` and `gsd-t-status`.
15
- **Stack Rules Engine** — auto-detects project tech stack (React, TypeScript, Node API, Python, Go, Rust) from manifest files and injects mandatory best-practice rules into subagent prompts at execute-time. Universal security rules always apply; stack-specific rules layer on top. Extensible: drop a `.md` file in `templates/stacks/` to add a new stack.
15
+ **Stack Rules Engine** — auto-detects project tech stack (React, TypeScript, Node API, Python, Go, Rust) from manifest files and injects mandatory best-practice rules into subagent prompts at execute-time. Universal security rules always apply; stack-specific rules layer on top. Includes **design-to-code** rules for pixel-perfect frontend implementation from Figma, screenshots, or design images — with Figma MCP integration, design token extraction, stack capability evaluation, and visual verification loops. Extensible: drop a `.md` file in `templates/stacks/` to add a new stack.
16
16
  **Self-Calibrating QA** — `qa-calibrator.js` tracks QA miss-rates across milestones, detects weak-spot categories (error paths, boundaries, state transitions), and automatically injects targeted guidance into QA subagent prompts. Projects on the same stack share miss-rate data for faster calibration.
17
17
  **Token-Aware Orchestration** — `token-budget.js` tracks session token consumption and applies graduated degradation: downgrade model assignments when approaching limits, checkpoint and skip non-essential operations to conserve budget, and halt cleanly with a resume instruction at the ceiling. Wave and execute phases check budget before each subagent spawn.
18
18
  **Quality North Star** — projects define a `## Quality North Star` section in CLAUDE.md (1–3 sentences, e.g., "This is a published npm library. Every public API must be intuitive and backward-compatible."). `gsd-t-init` auto-detects preset (library/web-app/cli) from package.json signals; `gsd-t-setup` configures it for existing projects. Subagents read it as a quality lens; absent = silent skip (backward compatible).
@@ -343,7 +343,7 @@ get-stuff-done-teams/
343
343
  │ ├── branch.md # Git branch helper
344
344
  │ ├── checkin.md # Auto-version + commit/push helper
345
345
  │ └── Claude-md.md # Reload CLAUDE.md directives
346
- ├── templates/ # Document templates (9 base + stacks/)
346
+ ├── templates/ # Document templates (10 base + stacks/)
347
347
  │ ├── CLAUDE-global.md
348
348
  │ ├── CLAUDE-project.md
349
349
  │ ├── requirements.md
@@ -353,10 +353,12 @@ get-stuff-done-teams/
353
353
  │ ├── progress.md
354
354
  │ ├── backlog.md
355
355
  │ ├── backlog-settings.md
356
+ │ ├── design-contract.md # Design-to-code token extraction template
356
357
  │ └── stacks/ # Stack Rules Engine templates
357
358
  │ ├── _security.md # Universal — always injected
358
359
  │ ├── react.md
359
360
  │ ├── typescript.md
361
+ │ ├── design-to-code.md # Pixel-perfect design implementation
360
362
  │ └── node-api.md
361
363
  ├── scripts/ # Runtime utility scripts (installed to ~/.claude/scripts/)
362
364
  │ ├── gsd-t-tools.js # State CLI (get/set/validate/list)
@@ -53,6 +53,8 @@ if [ -d "$STACKS_DIR" ]; then
53
53
  ([ -f "playwright.config.ts" ] || [ -f "playwright.config.js" ]) && _add playwright.md
54
54
  [ -f "go.mod" ] && _add go.md
55
55
  [ -f "Cargo.toml" ] && _add rust.md
56
+ # Design-to-code detection (design contract, design tokens, or Figma config)
57
+ ([ -f ".gsd-t/contracts/design-contract.md" ] || [ -f "design-tokens.json" ] || [ -d "design-tokens" ] || [ -f ".figmarc" ] || [ -f "figma.config.json" ]) && _add design-to-code.md
56
58
  fi
57
59
  ```
58
60
 
@@ -193,6 +193,8 @@ if [ -d "$STACKS_DIR" ]; then
193
193
  ([ -f "playwright.config.ts" ] || [ -f "playwright.config.js" ]) && _add playwright.md
194
194
  [ -f "go.mod" ] && _add go.md
195
195
  [ -f "Cargo.toml" ] && _add rust.md
196
+ # Design-to-code detection (design contract, design tokens, or Figma config)
197
+ ([ -f ".gsd-t/contracts/design-contract.md" ] || [ -f "design-tokens.json" ] || [ -d "design-tokens" ] || [ -f ".figmarc" ] || [ -f "figma.config.json" ]) && _add design-to-code.md
196
198
  fi
197
199
  ```
198
200
 
@@ -280,20 +282,31 @@ Execute the task above:
280
282
  recovers (retry button works, form can be resubmitted, etc.).
281
283
  A test that would pass on an empty HTML page with the right element IDs is useless.
282
284
  Every assertion must prove the FEATURE WORKS, not that the ELEMENT EXISTS.
283
- 7. Run ALL test suites this is NOT optional, not conditional, not "if applicable":
285
+ 7. **Visual Design Verification** (only if design-to-code stack rule is active):
286
+ If the task involves UI implementation from a design reference:
287
+ a. Check if Claude Preview or Chrome MCP browser tools are available
288
+ b. If available: render the implemented component at each target breakpoint (mobile 375px, tablet 768px, desktop 1280px)
289
+ c. Screenshot each rendered breakpoint
290
+ d. Compare against the source design reference (from `.gsd-t/contracts/design-contract.md`)
291
+ e. Identify any deviations: spacing, color, typography, alignment, sizing
292
+ f. Fix deviations — every fix must trace to a design contract value (max 2 fix iterations)
293
+ g. Log verification results in the design contract's Verification Status table
294
+ h. If no browser tools available: log warning "Visual verification unavailable — manual review recommended" to `.gsd-t/qa-issues.md`
295
+ Skip this step entirely if no design-to-code stack rule was injected.
296
+ 8. Run ALL test suites — this is NOT optional, not conditional, not "if applicable":
284
297
  a. Detect configured test runners: check for vitest/jest config, playwright.config.*, cypress.config.*
285
298
  b. Run EVERY detected suite. Unit tests alone are NEVER sufficient when E2E exists.
286
299
  c. If `playwright.config.*` exists → run `npx playwright test` (full suite, not just affected specs)
287
300
  d. If E2E tests fail → fix (up to 2 attempts) before proceeding
288
301
  e. Report ALL suite results: "Unit: X/Y pass | E2E: X/Y pass" — never report just one
289
- 8. Run Pre-Commit Gate checklist from CLAUDE.md — update all affected docs BEFORE committing
290
- 9. Commit immediately: feat({domain-name}/task-{task-id}): {description}
291
- 10. Update .gsd-t/progress.md — mark this task complete; prefix the Decision Log entry:
302
+ 9. Run Pre-Commit Gate checklist from CLAUDE.md — update all affected docs BEFORE committing
303
+ 10. Commit immediately: feat({domain-name}/task-{task-id}): {description}
304
+ 11. Update .gsd-t/progress.md — mark this task complete; prefix the Decision Log entry:
292
305
  - Completed successfully on first attempt → prefix `[success]`
293
306
  - Completed after a fix → prefix `[learning]`
294
307
  - Deferred to .gsd-t/deferred-items.md → prefix `[deferred]`
295
308
  - Failed after 3 attempts → prefix `[failure]`
296
- 11. Spawn QA subagent (model: sonnet) after completing the task:
309
+ 12. Spawn QA subagent (model: sonnet) after completing the task:
297
310
  'Run ALL configured test suites — detect and run every one:
298
311
  a. Unit tests (vitest/jest/mocha): run the full suite, report pass/fail counts
299
312
  b. E2E tests: check for playwright.config.* or cypress.config.* — if found, run the FULL E2E suite
@@ -728,7 +741,7 @@ Report: 'Doc-ripple: {N} checked, {N} updated, {N} skipped'"
728
741
 
729
742
  ## Document Ripple
730
743
 
731
- Execute modifies source code, so the Pre-Commit Gate (referenced in Step 9) covers document updates. For clarity, the key documents affected by execution:
744
+ Execute modifies source code, so the Pre-Commit Gate (referenced in Step 10) covers document updates. For clarity, the key documents affected by execution:
732
745
 
733
746
  ### Always update:
734
747
  1. **`.gsd-t/progress.md`** — Mark tasks complete, update domain status, log execution summary
@@ -260,6 +260,7 @@ Use these when user asks for help on a specific command:
260
260
  - **Note (M22)**: Task-level fresh dispatch (one subagent per task, ~10-20% context each). Team mode uses worktree isolation (`isolation: "worktree"`) — zero file conflicts. Adaptive replanning between domain completions.
261
261
  - **Note (M26)**: Active rule injection — evaluates declarative rules from rules.jsonl before dispatching each domain's tasks. Fires matching rules as warnings in subagent prompts.
262
262
  - **Note (M29)**: Stack Rules Engine — auto-detects project tech stack from manifest files and injects mandatory best-practice rules into each task subagent prompt. Universal rules (`_security.md`, `_auth.md`) always apply; stack-specific rules layer on top. Violations are task failures (same weight as contract violations).
263
+ - **Note (M33)**: Design-to-code — when a design contract, design tokens, or Figma config is detected, injects pixel-perfect implementation rules: Figma MCP auto-detection, design token extraction, stack capability evaluation (recommends alternatives if stack can't achieve the design), visual verification loop via Claude Preview or Chrome MCP. Adds Step 7 (Visual Design Verification) to task execution flow.
263
264
 
264
265
  ### test-sync
265
266
  - **Summary**: Keep tests aligned with code changes
@@ -64,7 +64,7 @@ If rolled-back domains exist, report them to the user (or if Level 3: log to `.g
64
64
 
65
65
  **Stack Rules Detection (before spawning subagent):**
66
66
  Run via Bash to detect project stack and collect matching rules:
67
- `GSD_T_DIR=$(npm root -g 2>/dev/null)/@tekyzinc/gsd-t; STACKS_DIR="$GSD_T_DIR/templates/stacks"; STACK_RULES=""; if [ -d "$STACKS_DIR" ]; then for f in "$STACKS_DIR"/_*.md; do [ -f "$f" ] && STACK_RULES="${STACK_RULES}$(cat "$f")"$'\n\n'; done; if [ -f "package.json" ]; then grep -q '"react"' package.json 2>/dev/null && [ -f "$STACKS_DIR/react.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/react.md")"$'\n\n'; (grep -q '"typescript"' package.json 2>/dev/null || [ -f "tsconfig.json" ]) && [ -f "$STACKS_DIR/typescript.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/typescript.md")"$'\n\n'; grep -qE '"(express|fastify|hono|koa)"' package.json 2>/dev/null && [ -f "$STACKS_DIR/node-api.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/node-api.md")"$'\n\n'; fi; [ -f "requirements.txt" ] || [ -f "pyproject.toml" ] && [ -f "$STACKS_DIR/python.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/python.md")"$'\n\n'; [ -f "go.mod" ] && [ -f "$STACKS_DIR/go.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/go.md")"$'\n\n'; [ -f "Cargo.toml" ] && [ -f "$STACKS_DIR/rust.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/rust.md")"$'\n\n'; fi`
67
+ `GSD_T_DIR=$(npm root -g 2>/dev/null)/@tekyzinc/gsd-t; STACKS_DIR="$GSD_T_DIR/templates/stacks"; STACK_RULES=""; if [ -d "$STACKS_DIR" ]; then for f in "$STACKS_DIR"/_*.md; do [ -f "$f" ] && STACK_RULES="${STACK_RULES}$(cat "$f")"$'\n\n'; done; if [ -f "package.json" ]; then grep -q '"react"' package.json 2>/dev/null && [ -f "$STACKS_DIR/react.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/react.md")"$'\n\n'; (grep -q '"typescript"' package.json 2>/dev/null || [ -f "tsconfig.json" ]) && [ -f "$STACKS_DIR/typescript.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/typescript.md")"$'\n\n'; grep -qE '"(express|fastify|hono|koa)"' package.json 2>/dev/null && [ -f "$STACKS_DIR/node-api.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/node-api.md")"$'\n\n'; fi; [ -f "requirements.txt" ] || [ -f "pyproject.toml" ] && [ -f "$STACKS_DIR/python.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/python.md")"$'\n\n'; [ -f "go.mod" ] && [ -f "$STACKS_DIR/go.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/go.md")"$'\n\n'; [ -f "Cargo.toml" ] && [ -f "$STACKS_DIR/rust.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/rust.md")"$'\n\n'; ([ -f ".gsd-t/contracts/design-contract.md" ] || [ -f "design-tokens.json" ] || [ -d "design-tokens" ] || [ -f ".figmarc" ] || [ -f "figma.config.json" ]) && [ -f "$STACKS_DIR/design-to-code.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/design-to-code.md")"$'\n\n'; fi`
68
68
 
69
69
  If STACK_RULES is non-empty, append to the subagent prompt:
70
70
  ```
@@ -68,6 +68,8 @@ if [ -d "$STACKS_DIR" ]; then
68
68
  ([ -f "playwright.config.ts" ] || [ -f "playwright.config.js" ]) && _add playwright.md
69
69
  [ -f "go.mod" ] && _add go.md
70
70
  [ -f "Cargo.toml" ] && _add rust.md
71
+ # Design-to-code detection (design contract, design tokens, or Figma config)
72
+ ([ -f ".gsd-t/contracts/design-contract.md" ] || [ -f "design-tokens.json" ] || [ -d "design-tokens" ] || [ -f ".figmarc" ] || [ -f "figma.config.json" ]) && _add design-to-code.md
71
73
  fi
72
74
  ```
73
75
 
@@ -67,7 +67,7 @@ For each phase, spawn the agent like this:
67
67
 
68
68
  **Stack Rules Detection (before spawning subagent):**
69
69
  Run via Bash to detect project stack and collect matching rules:
70
- `GSD_T_DIR=$(npm root -g 2>/dev/null)/@tekyzinc/gsd-t; STACKS_DIR="$GSD_T_DIR/templates/stacks"; STACK_RULES=""; if [ -d "$STACKS_DIR" ]; then for f in "$STACKS_DIR"/_*.md; do [ -f "$f" ] && STACK_RULES="${STACK_RULES}$(cat "$f")"$'\n\n'; done; if [ -f "package.json" ]; then grep -q '"react"' package.json 2>/dev/null && [ -f "$STACKS_DIR/react.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/react.md")"$'\n\n'; (grep -q '"typescript"' package.json 2>/dev/null || [ -f "tsconfig.json" ]) && [ -f "$STACKS_DIR/typescript.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/typescript.md")"$'\n\n'; grep -qE '"(express|fastify|hono|koa)"' package.json 2>/dev/null && [ -f "$STACKS_DIR/node-api.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/node-api.md")"$'\n\n'; fi; [ -f "requirements.txt" ] || [ -f "pyproject.toml" ] && [ -f "$STACKS_DIR/python.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/python.md")"$'\n\n'; [ -f "go.mod" ] && [ -f "$STACKS_DIR/go.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/go.md")"$'\n\n'; [ -f "Cargo.toml" ] && [ -f "$STACKS_DIR/rust.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/rust.md")"$'\n\n'; fi`
70
+ `GSD_T_DIR=$(npm root -g 2>/dev/null)/@tekyzinc/gsd-t; STACKS_DIR="$GSD_T_DIR/templates/stacks"; STACK_RULES=""; if [ -d "$STACKS_DIR" ]; then for f in "$STACKS_DIR"/_*.md; do [ -f "$f" ] && STACK_RULES="${STACK_RULES}$(cat "$f")"$'\n\n'; done; if [ -f "package.json" ]; then grep -q '"react"' package.json 2>/dev/null && [ -f "$STACKS_DIR/react.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/react.md")"$'\n\n'; (grep -q '"typescript"' package.json 2>/dev/null || [ -f "tsconfig.json" ]) && [ -f "$STACKS_DIR/typescript.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/typescript.md")"$'\n\n'; grep -qE '"(express|fastify|hono|koa)"' package.json 2>/dev/null && [ -f "$STACKS_DIR/node-api.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/node-api.md")"$'\n\n'; fi; [ -f "requirements.txt" ] || [ -f "pyproject.toml" ] && [ -f "$STACKS_DIR/python.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/python.md")"$'\n\n'; [ -f "go.mod" ] && [ -f "$STACKS_DIR/go.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/go.md")"$'\n\n'; [ -f "Cargo.toml" ] && [ -f "$STACKS_DIR/rust.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/rust.md")"$'\n\n'; ([ -f ".gsd-t/contracts/design-contract.md" ] || [ -f "design-tokens.json" ] || [ -d "design-tokens" ] || [ -f ".figmarc" ] || [ -f "figma.config.json" ]) && [ -f "$STACKS_DIR/design-to-code.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/design-to-code.md")"$'\n\n'; fi`
71
71
 
72
72
  If STACK_RULES is non-empty, append to the subagent prompt:
73
73
  ```
@@ -239,7 +239,7 @@ GSD-T auto-detects your project's tech stack and injects mandatory best-practice
239
239
  4. Project-level overrides in `.gsd-t/stacks/` replace global files of the same name.
240
240
  5. Rules are appended to the subagent prompt as a `## Stack Rules (MANDATORY)` section.
241
241
 
242
- ### Stack Detection (27 files)
242
+ ### Stack Detection (28 files)
243
243
 
244
244
  | Project File | Detected Stack(s) |
245
245
  |---|---|
@@ -270,6 +270,7 @@ GSD-T auto-detects your project's tech stack and injects mandatory best-practice
270
270
  | `requirements.txt` with `celery`, `dramatiq`, `rq`, or `arq` | `queues.md` |
271
271
  | `requirements.txt` with `openai`, `anthropic`, `langchain` | `llm.md` |
272
272
  | `pubspec.yaml` | `flutter.md` |
273
+ | `.gsd-t/contracts/design-contract.md`, `design-tokens.json`, `design-tokens/`, `.figmarc`, or `figma.config.json` | `design-to-code.md` |
273
274
 
274
275
  ### Commands That Inject Stack Rules
275
276
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekyzinc/gsd-t",
3
- "version": "2.53.11",
3
+ "version": "2.54.11",
4
4
  "description": "GSD-T: Contract-Driven Development for Claude Code — 51 slash commands with headless CI/CD mode, graph-powered code analysis, real-time agent dashboard, execution intelligence, task telemetry, doc-ripple enforcement, backlog management, impact analysis, test sync, milestone archival, and PRD generation",
5
5
  "author": "Tekyz, Inc.",
6
6
  "license": "MIT",
@@ -617,6 +617,8 @@ GSD-T auto-detects project tech stack at subagent spawn time and injects mandato
617
617
 
618
618
  **Stack-specific rules**: Injected only when the matching stack is detected (e.g., `react.md` when `"react"` is in `package.json`).
619
619
 
620
+ **Design-to-code**: Activated when `.gsd-t/contracts/design-contract.md`, `design-tokens.json`, `design-tokens/`, `.figmarc`, or `figma.config.json` exists. Enforces pixel-perfect frontend implementation from designs with: Figma MCP auto-detection, design token extraction protocol, stack capability evaluation (recommends alternatives if stack can't achieve the design), component decomposition, responsive breakpoint strategy, and a visual verification loop using Claude Preview or Chrome MCP.
621
+
620
622
  **Enforcement**: Stack rule violations have the same weight as contract violations — they are task failures, not warnings.
621
623
 
622
624
  **Extensible**: Drop a `.md` file into `templates/stacks/` in the GSD-T package to add rules for a new stack. If the directory is missing, detection skips silently.
@@ -0,0 +1,128 @@
1
+ # Design Contract: {Component/Page Name}
2
+
3
+ ## Source
4
+
5
+ | Property | Value |
6
+ |------------------|---------------------------------------------------|
7
+ | Source Type | {Figma MCP / Image / Screenshot / Prototype URL} |
8
+ | Source Reference | {Figma URL, file path, image path, etc.} |
9
+ | Extracted Via | {Figma MCP / Visual Analysis / Design Tokens File} |
10
+ | Extracted Date | {YYYY-MM-DD} |
11
+ | Precision Level | {Exact (MCP) / High (exported tokens) / Estimated (visual analysis)} |
12
+ | Breakpoints | {mobile: 375px, tablet: 768px, desktop: 1280px} |
13
+
14
+ ## Stack Evaluation
15
+
16
+ | Requirement | Stack Capability | Notes |
17
+ |----------------------|------------------|----------------------------------------------|
18
+ | {CSS Grid layouts} | {Supported} | {e.g., framework supports CSS Grid natively} |
19
+ | {Custom fonts} | {Supported} | {e.g., font loading via next/font} |
20
+ | {Complex animations} | {Partial} | {e.g., may need Framer Motion addon} |
21
+ | {SVG manipulation} | {Supported} | {e.g., inline SVG supported} |
22
+
23
+ ## Color Palette
24
+
25
+ | Token Name | Value | Usage |
26
+ |------------------------|--------------------------|------------------------------|
27
+ | --color-primary | {#1A73E8} | {Primary buttons, links} |
28
+ | --color-primary-hover | {#1557B0} | {Primary button hover state} |
29
+ | --color-text-primary | {#202124} | {Body text, headings} |
30
+ | --color-text-secondary | {#5F6368} | {Captions, helper text} |
31
+ | --color-surface | {#FFFFFF} | {Card backgrounds} |
32
+ | --color-border | {#DADCE0} | {Dividers, input borders} |
33
+
34
+ ## Typography
35
+
36
+ | Token Name | Family | Weight | Size | Line-Height | Letter-Spacing | Usage |
37
+ |----------------|---------|--------|--------|-------------|----------------|----------------|
38
+ | --font-h1 | {Inter} | {700} | {36px} | {1.2} | {-0.02em} | {Page title} |
39
+ | --font-h2 | {Inter} | {600} | {24px} | {1.3} | {-0.01em} | {Section head} |
40
+ | --font-body | {Inter} | {400} | {16px} | {1.5} | {normal} | {Body text} |
41
+ | --font-caption | {Inter} | {400} | {12px} | {1.4} | {0.01em} | {Helper text} |
42
+
43
+ ## Spacing System
44
+
45
+ | Token Name | Value | Usage |
46
+ |---------------|--------|------------------------------------|
47
+ | --spacing-xs | {4px} | {Inline element gaps} |
48
+ | --spacing-sm | {8px} | {Tight element spacing} |
49
+ | --spacing-md | {16px} | {Standard padding, component gaps} |
50
+ | --spacing-lg | {24px} | {Section padding, card padding} |
51
+ | --spacing-xl | {32px} | {Section margins} |
52
+ | --spacing-2xl | {48px} | {Page-level spacing} |
53
+
54
+ ## Borders & Shadows
55
+
56
+ | Token Name | Property | Value |
57
+ |-----------------|---------------|----------------------------------|
58
+ | --radius-sm | border-radius | {4px} |
59
+ | --radius-md | border-radius | {8px} |
60
+ | --radius-lg | border-radius | {16px} |
61
+ | --radius-full | border-radius | {9999px} |
62
+ | --shadow-sm | box-shadow | {0 1px 2px rgba(0,0,0,0.05)} |
63
+ | --shadow-card | box-shadow | {0 2px 8px rgba(0,0,0,0.1)} |
64
+ | --shadow-modal | box-shadow | {0 8px 32px rgba(0,0,0,0.15)} |
65
+ | --border-default| border | {1px solid var(--color-border)} |
66
+
67
+ ## Component Tree
68
+
69
+ ```
70
+ {Page/Component Name}
71
+ ├── {Section}
72
+ │ ├── {Component} (variant: {variants})
73
+ │ │ ├── {SubComponent}
74
+ │ │ └── {SubComponent}
75
+ │ └── {Component}
76
+ ├── {Section}
77
+ │ └── {Component} (x{count}, reusable)
78
+ │ ├── {Element}
79
+ │ └── {Element}
80
+ └── {Section}
81
+ ```
82
+
83
+ ## Layout Specifications
84
+
85
+ ### Mobile ({breakpoint}px)
86
+
87
+ | Container | Layout | Columns/Direction | Gap | Alignment | Notes |
88
+ |----------------|---------|-------------------|--------|-----------|----------------|
89
+ | {.page} | {grid} | {1fr} | {16px} | {stretch} | {full-width} |
90
+ | {.feature-grid}| {grid} | {1fr} | {16px} | {stretch} | {stacked} |
91
+
92
+ ### Tablet ({breakpoint}px)
93
+
94
+ | Container | Layout | Columns/Direction | Gap | Alignment | Notes |
95
+ |----------------|---------|-------------------|--------|-----------|----------------|
96
+ | {.page} | {grid} | {1fr} | {24px} | {stretch} | {centered} |
97
+ | {.feature-grid}| {grid} | {repeat(2, 1fr)} | {24px} | {stretch} | {2-column} |
98
+
99
+ ### Desktop ({breakpoint}px)
100
+
101
+ | Container | Layout | Columns/Direction | Gap | Alignment | Notes |
102
+ |----------------|---------|-------------------|--------|-----------|----------------|
103
+ | {.page} | {grid} | {max-width 1280px}| {32px} | {center} | {contained} |
104
+ | {.feature-grid}| {grid} | {repeat(3, 1fr)} | {32px} | {stretch} | {3-column} |
105
+
106
+ ## Interactive States
107
+
108
+ | Component | Default | Hover | Focus | Active | Disabled |
109
+ |--------------|-----------------|------------------|--------------------|------------------|------------------|
110
+ | {CTAButton} | {bg: primary} | {bg: primary-hover}| {outline: 2px primary}| {scale: 0.98} | {bg: border, 0.6}|
111
+ | {NavLink} | {color: text} | {color: primary} | {underline} | {font-weight: 600}| {color: muted} |
112
+ | {TextInput} | {border: default}| {border: primary}| {ring: 2px primary}| {—} | {bg: gray-50} |
113
+
114
+ ## Verification Status
115
+
116
+ | Check | Status | Notes |
117
+ |------------------------------------|-------------|-----------------------------------|
118
+ | Token extraction complete | {pending} | |
119
+ | Component tree matches design | {pending} | |
120
+ | Mobile layout verified | {pending} | |
121
+ | Tablet layout verified | {pending} | |
122
+ | Desktop layout verified | {pending} | |
123
+ | Typography matches design | {pending} | |
124
+ | Colors match design | {pending} | |
125
+ | Spacing matches design | {pending} | |
126
+ | Interactive states implemented | {pending} | |
127
+ | Accessibility checks pass | {pending} | |
128
+ | Visual verification loop completed | {pending} | |
@@ -0,0 +1,466 @@
1
+ # Design-to-Code Standards
2
+
3
+ These rules are MANDATORY. Violations fail the task. No exceptions.
4
+
5
+ These rules apply when implementing a visual design as frontend code. The design already exists (Figma, screenshot, image, prototype) — your job is to replicate it faithfully in code with pixel-perfect accuracy.
6
+
7
+ ---
8
+
9
+ ## 1. Design Source Setup
10
+
11
+ ```
12
+ MANDATORY:
13
+ ├── NEVER write CSS or layout code without a design reference
14
+ ├── Identify the source type: Figma file, image, screenshot, prototype URL
15
+ ├── If source is a Figma URL/file → check if Figma MCP is available
16
+ │ YES → Use Figma MCP to extract component data, styles, and layout
17
+ │ NO → Inform user: "Figma MCP recommended for precise extraction"
18
+ │ Fallback: use image analysis (Claude's multimodal vision)
19
+ ├── If source is an image/screenshot → use visual analysis to extract values
20
+ ├── Store the source reference in the design contract
21
+ └── NEVER proceed to implementation without completing the extraction step
22
+ ```
23
+
24
+ **BAD** — Glancing at a design and writing CSS from memory or approximation.
25
+
26
+ **GOOD** — Systematically extracting every value from the design before writing a single line of CSS.
27
+
28
+ ---
29
+
30
+ ## 2. MCP & Tool Detection
31
+
32
+ ```
33
+ MANDATORY:
34
+ ├── Before extraction, detect available tools:
35
+ │ Figma MCP → precise token extraction from Figma files
36
+ │ Claude Preview → render + screenshot for verification loop
37
+ │ Chrome MCP → alternative render + screenshot for verification
38
+ ├── If Figma MCP is available and source is Figma:
39
+ │ Use MCP to get exact colors, spacing, typography, component structure
40
+ │ MCP values are authoritative — override visual estimates
41
+ ├── If no Figma MCP but source is Figma:
42
+ │ Recommend setup: "For precise extraction, install the Figma MCP server.
43
+ │ Remote (recommended): https://mcp.figma.com/mcp
44
+ │ Or install the Figma Plugin for Claude Code which includes MCP settings."
45
+ │ Fallback: request a screenshot/export of each component at 1x and 2x
46
+ │ Use visual analysis — note reduced precision in the design contract
47
+ ├── Log which tools were used in the design contract Source section
48
+ └── Future MCPs (Sketch, Adobe XD, Penpot) follow the same pattern
49
+ ```
50
+
51
+ **BAD** — Ignoring available MCPs and eyeballing a Figma screenshot.
52
+
53
+ **GOOD** — Detecting Figma MCP, using it to extract exact `fill: #1A73E8`, `font-size: 14px`, `padding: 16px 24px`, then writing CSS from those exact values.
54
+
55
+ ---
56
+
57
+ ## 3. Stack Capability Evaluation
58
+
59
+ ```
60
+ MANDATORY:
61
+ ├── BEFORE implementation, evaluate whether the project's chosen stack
62
+ │ can achieve pixel-perfect fidelity for this specific design:
63
+
64
+ ├── Evaluate these capabilities against design requirements:
65
+ │ CSS Grid / Flexbox support → complex layouts
66
+ │ Custom font loading → non-system typography
67
+ │ CSS custom properties → design token system
68
+ │ Animation / transition support → interactive states, micro-interactions
69
+ │ SVG support → icons, illustrations, complex shapes
70
+ │ Responsive units (clamp, container queries) → fluid scaling
71
+ │ Pseudo-elements (::before, ::after) → decorative elements
72
+ │ Backdrop filters / blend modes → glassmorphism, overlays
73
+ │ Gradient support → complex gradient fills
74
+ │ Component scoping → style isolation (CSS Modules, Shadow DOM, scoped styles)
75
+
76
+ ├── For each design requirement, assess:
77
+ │ Supported → stack handles this natively, proceed
78
+ │ Partial → needs an addon/library — name it, estimate effort
79
+ │ Unsupported → stack CANNOT achieve this — flag as a blocker
80
+
81
+ ├── If ANY requirement is Unsupported:
82
+ │ STOP and present to the user:
83
+ │ 1. What the design requires
84
+ │ 2. What the current stack cannot do
85
+ │ 3. Recommended alternatives that CAN achieve it:
86
+ │ Example: "Design requires backdrop-filter blur — current stack
87
+ │ uses older browser targets that don't support it. Options:
88
+ │ (a) Update browserslist to modern-only
89
+ │ (b) Switch from CSS Modules to Tailwind (has backdrop-blur utility)
90
+ │ (c) Use a polyfill (reduced fidelity)"
91
+ │ 4. Wait for user decision before proceeding
92
+
93
+ ├── If design requires a component library:
94
+ │ Evaluate: Can it be customized to match the design exactly?
95
+ │ Component libraries with opinionated styling (Material UI defaults,
96
+ │ Bootstrap themes) often FIGHT pixel-perfect custom designs
97
+ │ Recommend headless/unstyled alternatives when customization is needed:
98
+ │ Radix UI, Headless UI, React Aria, Shadcn/ui (Tailwind-based)
99
+
100
+ └── Document all findings in the design contract Stack Evaluation table
101
+ ```
102
+
103
+ **BAD** — Starting implementation with Material UI and discovering halfway through that you can't match the design's custom border radius, shadow, and spacing because MUI's theme system fights you.
104
+
105
+ **GOOD** — Evaluating upfront: "Design uses custom card shadows and non-standard spacing. MUI's elevation system won't match. Recommend: Tailwind + Radix for full styling control, or MUI with a fully custom theme override."
106
+
107
+ ---
108
+
109
+ ## 4. Design Token Extraction Protocol
110
+
111
+ ```
112
+ MANDATORY:
113
+ ├── Extract EVERY value before writing any implementation code:
114
+ │ Colors → exact hex/rgba/hsl for every fill, stroke, text color
115
+ │ Typography → family, weight, size, line-height, letter-spacing per text style
116
+ │ Spacing → padding, margin, gap values for every element
117
+ │ Borders → radius, width, style, color
118
+ │ Shadows → x-offset, y-offset, blur, spread, color
119
+ │ Opacity → any transparency values
120
+ │ Sizing → exact width/height for fixed-size elements
121
+ │ Z-index → layering order for overlapping elements
122
+ ├── Record each token with its usage context (which element, which state)
123
+ ├── Group tokens into a consistent naming system (--color-primary, --spacing-md, etc.)
124
+ ├── Cross-reference: if a value appears multiple times, it's a shared token
125
+ └── Write ALL tokens to .gsd-t/contracts/design-contract.md BEFORE coding
126
+ ```
127
+
128
+ **BAD** — Writing `padding: 15px` because "it looks about right."
129
+
130
+ **GOOD** — Extracting `padding: 16px` from the design tool, recording it as `--spacing-md: 1rem`, tracing it to "card container padding" in the design contract.
131
+
132
+ ---
133
+
134
+ ## 5. Design Contract Generation
135
+
136
+ ```
137
+ MANDATORY:
138
+ ├── Write extracted tokens to .gsd-t/contracts/design-contract.md
139
+ │ Use the design-contract template from templates/design-contract.md
140
+ ├── Every CSS value in the implementation MUST trace to a contract entry
141
+ ├── If a value isn't in the contract, the extraction was incomplete — go back
142
+ ├── The contract is the source of truth — not the code, not your memory
143
+ └── Update the contract if the design changes during implementation
144
+ ```
145
+
146
+ The design contract serves the same purpose as API contracts in GSD-T: it defines the exact interface between design and code. Any deviation is a violation.
147
+
148
+ ---
149
+
150
+ ## 6. Component Decomposition
151
+
152
+ ```
153
+ MANDATORY:
154
+ ├── Before coding, analyze the design and produce a component tree:
155
+ │ Root container → sections → components → sub-components → atoms
156
+ ├── Identify repeated patterns → these become reusable components
157
+ ├── Identify variant states → these become component props
158
+ │ Example: Button has primary/secondary/ghost → variant prop
159
+ ├── Identify slot boundaries → where dynamic content gets injected
160
+ ├── Map the tree to your framework's component model (React, Vue, etc.)
161
+ ├── Name components semantically — match the design's layer names when clear
162
+ └── Document the tree in the design contract's Component Tree section
163
+ ```
164
+
165
+ **BAD** — Writing one monolithic 400-line component that renders the entire page.
166
+
167
+ **GOOD**
168
+ ```
169
+ Page
170
+ ├── Header
171
+ │ ├── Logo
172
+ │ ├── NavLinks
173
+ │ └── UserMenu (variant: logged-in | logged-out)
174
+ ├── HeroSection
175
+ │ ├── Headline
176
+ │ ├── Subheadline
177
+ │ └── CTAButton (variant: primary)
178
+ ├── FeatureGrid
179
+ │ └── FeatureCard (x3, reusable)
180
+ │ ├── Icon
181
+ │ ├── Title
182
+ │ └── Description
183
+ └── Footer
184
+ ```
185
+
186
+ ---
187
+
188
+ ## 7. Layout Analysis
189
+
190
+ ```
191
+ MANDATORY:
192
+ ├── Identify the layout system for every container:
193
+ │ Is it a grid? → CSS Grid with explicit columns/rows/gaps
194
+ │ Is it a row/column? → Flexbox with explicit direction/gap/alignment
195
+ │ Is it positioned? → Relative/absolute with exact offsets
196
+ ├── Measure exact gap values between elements — never approximate
197
+ ├── Identify alignment: start, center, end, stretch, space-between
198
+ ├── Determine sizing: fixed width/height vs flex-grow vs percentage vs min/max
199
+ ├── Note content overflow behavior: hidden, scroll, wrap, ellipsis
200
+ └── Document layout per breakpoint in the design contract
201
+ ```
202
+
203
+ **BAD** — `display: flex; gap: 10px;` without measuring the actual gap.
204
+
205
+ **GOOD** — Extracting gap as exactly `24px` from the design, then: `display: flex; gap: 1.5rem; /* 24px — design contract: section-gap */`
206
+
207
+ ---
208
+
209
+ ## 8. Responsive Breakpoint Strategy
210
+
211
+ ```
212
+ MANDATORY:
213
+ ├── Analyze the design for breakpoint behavior BEFORE coding
214
+ │ What layout changes? (stack, reorder, hide, resize)
215
+ │ What typography changes? (font-size, line-height)
216
+ │ What spacing changes? (padding, margins, gaps)
217
+ ├── Define breakpoints explicitly — match the design's target viewports
218
+ │ Common: mobile 375px, tablet 768px, desktop 1280px, wide 1440px+
219
+ ├── Choose mobile-first or desktop-first per project convention
220
+ ├── Use fluid values where appropriate:
221
+ │ clamp(min, preferred, max) for font sizes
222
+ │ percentage or vw-based widths for flexible containers
223
+ │ container queries for component-level responsiveness
224
+ ├── NEVER assume "it'll work at intermediate sizes" — test every breakpoint
225
+ └── Document breakpoint behavior in the design contract
226
+ ```
227
+
228
+ **BAD** — Building desktop only, then adding `@media (max-width: 768px)` as an afterthought.
229
+
230
+ **GOOD** — Analyzing all breakpoints upfront, building mobile-first, progressively enhancing:
231
+ ```css
232
+ /* Mobile (default) */
233
+ .feature-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
234
+ /* Tablet */
235
+ @media (min-width: 768px) { .feature-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; } }
236
+ /* Desktop */
237
+ @media (min-width: 1280px) { .feature-grid { grid-template-columns: repeat(3, 1fr); gap: 2rem; } }
238
+ ```
239
+
240
+ ---
241
+
242
+ ## 9. Semantic HTML Structure
243
+
244
+ ```
245
+ MANDATORY:
246
+ ├── Use semantic elements: nav, main, section, article, aside, header, footer
247
+ ├── Heading hierarchy: one h1 per page, h2 → h3 → h4 in order, no skips
248
+ ├── Interactive elements: button for actions, a for navigation — NEVER div with onClick
249
+ ├── Form elements: label + input pairs, fieldset + legend for groups
250
+ ├── ARIA landmarks: role attributes only when semantic HTML doesn't suffice
251
+ ├── Alt text: descriptive for content images, empty (alt="") for decorative
252
+ ├── Tab order: logical, follows visual layout, no positive tabindex values
253
+ └── Focus indicators: visible on every interactive element
254
+ ```
255
+
256
+ **BAD** — `<div class="button" onclick="...">Click me</div>`
257
+
258
+ **GOOD** — `<button type="button" class="cta-button">Click me</button>`
259
+
260
+ ---
261
+
262
+ ## 10. CSS Precision Rules
263
+
264
+ ```
265
+ MANDATORY:
266
+ ├── EVERY value must trace to the design contract — no "looks about right"
267
+ ├── Use CSS custom properties for design tokens:
268
+ │ :root { --color-primary: #1A73E8; --spacing-md: 1rem; }
269
+ ├── NO magic numbers without a comment tracing to the design spec
270
+ │ BAD: padding: 13px;
271
+ │ GOOD: padding: var(--spacing-card); /* 16px — design contract: card-padding */
272
+ ├── Consistent units: rem for spacing/typography, px for borders/shadows
273
+ ├── Box model: use box-sizing: border-box universally
274
+ ├── When the project uses Tailwind: map design tokens to Tailwind config
275
+ │ extend theme with exact values from the design contract
276
+ └── Zero tolerance for deviation — if the design says 16px, the code says 16px
277
+ ```
278
+
279
+ **BAD** — Freestyle CSS with values pulled from thin air.
280
+
281
+ **GOOD** — Every value traceable:
282
+ ```css
283
+ .card {
284
+ padding: var(--spacing-lg); /* 24px — design contract */
285
+ border-radius: var(--radius-md); /* 8px — design contract */
286
+ box-shadow: var(--shadow-card); /* 0 2px 8px rgba(0,0,0,0.1) — design contract */
287
+ background: var(--color-surface); /* #FFFFFF — design contract */
288
+ }
289
+ ```
290
+
291
+ ---
292
+
293
+ ## 11. Typography Rendering
294
+
295
+ ```
296
+ MANDATORY:
297
+ ├── Font loading: preload primary fonts, use font-display: swap
298
+ ├── Exact values from design: family, weight, size, line-height, letter-spacing
299
+ │ NEVER approximate: "looks like 14px" → measure it, confirm it
300
+ ├── Line-height: use unitless values (1.5, not 24px) for scalability
301
+ │ Exception: fixed-height single-line elements where px matches design
302
+ ├── Letter-spacing: convert from design tool units if needed
303
+ │ Figma uses percentage or px; CSS uses em or px
304
+ │ 0.5% in Figma ≈ 0.005em in CSS
305
+ ├── Text overflow: match design behavior (ellipsis, wrap, clamp lines)
306
+ ├── Font weight mapping: design tools may use names — map to numeric values
307
+ │ Thin=100, Light=300, Regular=400, Medium=500, SemiBold=600, Bold=700
308
+ └── Responsive typography: use clamp() or breakpoint-specific sizes per design
309
+ ```
310
+
311
+ **BAD** — `font-size: 16px; line-height: 1.5;` without checking the actual design values.
312
+
313
+ **GOOD** — Exact extraction:
314
+ ```css
315
+ .headline {
316
+ font-family: var(--font-heading); /* Inter — design contract */
317
+ font-weight: 600; /* SemiBold — design contract */
318
+ font-size: clamp(1.5rem, 2vw, 2.25rem); /* 24-36px responsive — design contract */
319
+ line-height: 1.3; /* 31.2px at 24px — design contract */
320
+ letter-spacing: -0.01em; /* -0.16px at 16px — design contract */
321
+ }
322
+ ```
323
+
324
+ ---
325
+
326
+ ## 12. Color Accuracy
327
+
328
+ ```
329
+ MANDATORY:
330
+ ├── Extract exact color values — never approximate
331
+ │ #1A73E8 is NOT #1A74E9 — match exactly
332
+ ├── Use the format from the design tool: hex for solid, rgba for transparent
333
+ ├── Define as CSS custom properties — NEVER hardcode throughout stylesheets
334
+ ├── Gradients: extract exact stops (color + position %)
335
+ ├── Opacity: apply via rgba/hsla or opacity property — match the design's approach
336
+ ├── Dark mode (if applicable):
337
+ │ Map each light token to its dark equivalent
338
+ │ Use prefers-color-scheme or class-based toggle per project convention
339
+ ├── Semantic naming: --color-primary, --color-text-secondary, --color-surface
340
+ │ NOT --blue-500 — use design intent, not visual description
341
+ └── Background images/patterns: export at correct resolution, use srcset for retina
342
+ ```
343
+
344
+ **BAD** — Using `blue` or `#0000ff` when the design uses `#1A73E8`.
345
+
346
+ **GOOD** — Exact match with semantic naming:
347
+ ```css
348
+ :root {
349
+ --color-primary: #1A73E8;
350
+ --color-primary-hover: #1557B0;
351
+ --color-text-primary: #202124;
352
+ --color-text-secondary: #5F6368;
353
+ --color-surface: #FFFFFF;
354
+ --color-border: #DADCE0;
355
+ }
356
+ ```
357
+
358
+ ---
359
+
360
+ ## 13. Interactive States
361
+
362
+ ```
363
+ MANDATORY:
364
+ ├── Every interactive element MUST have ALL states defined:
365
+ │ default, hover, focus-visible, active, disabled
366
+ ├── Extract state styles from the design — designers often spec these
367
+ │ If not specified: derive logically (hover = slightly darker/lighter)
368
+ │ Document derived states in the design contract with "derived" note
369
+ ├── Transitions: specify duration and easing — don't rely on browser defaults
370
+ │ Standard: transition: all 150ms ease-in-out (or per design spec)
371
+ ├── Focus indicators: visible, high-contrast, not just outline:none
372
+ ├── Touch targets: minimum 44x44px on mobile — pad with transparent area if needed
373
+ ├── Cursor states: pointer for clickable, not-allowed for disabled, text for inputs
374
+ └── Loading states: skeleton/spinner/disabled during async operations
375
+ ```
376
+
377
+ **BAD** — Styling only the default state, leaving hover/focus as browser defaults.
378
+
379
+ **GOOD**
380
+ ```css
381
+ .cta-button {
382
+ background: var(--color-primary);
383
+ color: white;
384
+ padding: 12px 24px;
385
+ border-radius: 8px;
386
+ cursor: pointer;
387
+ transition: background 150ms ease-in-out, transform 100ms ease-in-out;
388
+ }
389
+ .cta-button:hover { background: var(--color-primary-hover); }
390
+ .cta-button:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
391
+ .cta-button:active { transform: scale(0.98); }
392
+ .cta-button:disabled { background: var(--color-border); cursor: not-allowed; opacity: 0.6; }
393
+ ```
394
+
395
+ ---
396
+
397
+ ## 14. Visual Verification Loop
398
+
399
+ ```
400
+ MANDATORY:
401
+ ├── After implementing any design component, run a visual verification:
402
+ │ 1. Render the component (Claude Preview, Chrome MCP, or dev server)
403
+ │ 2. Screenshot the rendered output
404
+ │ 3. Compare side-by-side with the source design
405
+ │ 4. Identify EVERY deviation (spacing, color, font, alignment, sizing)
406
+ │ 5. Fix each deviation — trace fix to design contract values
407
+ │ 6. Re-render and re-compare
408
+ ├── Maximum 3 verification iterations per component
409
+ │ If still deviating after 3 → log specific deltas to .gsd-t/qa-issues.md
410
+ ├── Tool priority for rendering:
411
+ │ 1. Claude Preview (if available) — fastest loop
412
+ │ 2. Chrome MCP (if available) — full browser rendering
413
+ │ 3. Dev server + manual screenshot — last resort
414
+ ├── Check at EVERY breakpoint — not just desktop
415
+ │ Mobile (375px), Tablet (768px), Desktop (1280px) minimum
416
+ ├── Verification is NOT optional — skipping it is a task failure
417
+ └── Log verification results in the design contract Verification Status table
418
+ ```
419
+
420
+ **BAD** — Writing CSS, committing, moving on without ever seeing the rendered result.
421
+
422
+ **GOOD** — Render → Screenshot → Compare → Fix spacing from 14px to 16px → Re-render → Confirm match → Log "verified at 3 breakpoints" in design contract.
423
+
424
+ ---
425
+
426
+ ## 15. Anti-Patterns
427
+
428
+ ```
429
+ NEVER DO THESE:
430
+ ├── Eyeballing values — "looks like about 12px padding" (EXTRACT the exact value)
431
+ ├── Hardcoding without traceability — magic numbers with no design reference
432
+ ├── "Close enough" mentality — 14px when the design says 16px is a FAILURE
433
+ ├── Desktop-only implementation — ignoring responsive breakpoints
434
+ ├── State-less components — only styling default, ignoring hover/focus/disabled
435
+ ├── Layout-only testing — checking element existence without visual verification
436
+ ├── Skipping the extraction step — jumping straight to code
437
+ ├── Approximating colors — using a "close" shade instead of the exact value
438
+ ├── Ignoring typography details — wrong font weight, missing letter-spacing
439
+ ├── Fixed pixel values everywhere — not using rem/em for scalable sizing
440
+ ├── Mixing styling approaches — Tailwind + inline styles + CSS modules in one project
441
+ └── Skipping the verification loop — submitting unverified visual output
442
+ ```
443
+
444
+ ---
445
+
446
+ ## 16. Design-to-Code Verification Checklist
447
+
448
+ Before marking any design implementation task as complete:
449
+
450
+ - [ ] Design source identified and documented in design contract
451
+ - [ ] Stack capability evaluated — all design requirements achievable (or alternatives approved)
452
+ - [ ] All design tokens extracted (colors, typography, spacing, borders, shadows)
453
+ - [ ] Tokens written to `.gsd-t/contracts/design-contract.md`
454
+ - [ ] Component tree documented and matches design hierarchy
455
+ - [ ] Every CSS value traces to a design contract entry
456
+ - [ ] CSS custom properties (or Tailwind config) define all design tokens
457
+ - [ ] Semantic HTML used (no div-soup, proper heading hierarchy)
458
+ - [ ] All interactive states implemented (hover, focus, active, disabled)
459
+ - [ ] Responsive behavior implemented for all target breakpoints
460
+ - [ ] Visual verification loop completed at mobile, tablet, and desktop widths
461
+ - [ ] Typography exact: family, weight, size, line-height, letter-spacing all match
462
+ - [ ] Colors exact: every fill, stroke, text color matches design values
463
+ - [ ] Spacing exact: every padding, margin, gap matches design values
464
+ - [ ] Accessibility: focus indicators, alt text, ARIA where needed, 44px touch targets
465
+ - [ ] No magic numbers — every value is documented or uses a design token
466
+ - [ ] Verification results logged in design contract Verification Status table