@tekyzinc/gsd-t 2.53.11 → 2.54.10

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.10",
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,463 @@
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
+ │ Request a screenshot/export of each component at 1x and 2x
43
+ │ Use visual analysis — note reduced precision in the design contract
44
+ ├── Log which tools were used in the design contract Source section
45
+ └── Future MCPs (Sketch, Adobe XD, Penpot) follow the same pattern
46
+ ```
47
+
48
+ **BAD** — Ignoring available MCPs and eyeballing a Figma screenshot.
49
+
50
+ **GOOD** — Detecting Figma MCP, using it to extract exact `fill: #1A73E8`, `font-size: 14px`, `padding: 16px 24px`, then writing CSS from those exact values.
51
+
52
+ ---
53
+
54
+ ## 3. Stack Capability Evaluation
55
+
56
+ ```
57
+ MANDATORY:
58
+ ├── BEFORE implementation, evaluate whether the project's chosen stack
59
+ │ can achieve pixel-perfect fidelity for this specific design:
60
+
61
+ ├── Evaluate these capabilities against design requirements:
62
+ │ CSS Grid / Flexbox support → complex layouts
63
+ │ Custom font loading → non-system typography
64
+ │ CSS custom properties → design token system
65
+ │ Animation / transition support → interactive states, micro-interactions
66
+ │ SVG support → icons, illustrations, complex shapes
67
+ │ Responsive units (clamp, container queries) → fluid scaling
68
+ │ Pseudo-elements (::before, ::after) → decorative elements
69
+ │ Backdrop filters / blend modes → glassmorphism, overlays
70
+ │ Gradient support → complex gradient fills
71
+ │ Component scoping → style isolation (CSS Modules, Shadow DOM, scoped styles)
72
+
73
+ ├── For each design requirement, assess:
74
+ │ Supported → stack handles this natively, proceed
75
+ │ Partial → needs an addon/library — name it, estimate effort
76
+ │ Unsupported → stack CANNOT achieve this — flag as a blocker
77
+
78
+ ├── If ANY requirement is Unsupported:
79
+ │ STOP and present to the user:
80
+ │ 1. What the design requires
81
+ │ 2. What the current stack cannot do
82
+ │ 3. Recommended alternatives that CAN achieve it:
83
+ │ Example: "Design requires backdrop-filter blur — current stack
84
+ │ uses older browser targets that don't support it. Options:
85
+ │ (a) Update browserslist to modern-only
86
+ │ (b) Switch from CSS Modules to Tailwind (has backdrop-blur utility)
87
+ │ (c) Use a polyfill (reduced fidelity)"
88
+ │ 4. Wait for user decision before proceeding
89
+
90
+ ├── If design requires a component library:
91
+ │ Evaluate: Can it be customized to match the design exactly?
92
+ │ Component libraries with opinionated styling (Material UI defaults,
93
+ │ Bootstrap themes) often FIGHT pixel-perfect custom designs
94
+ │ Recommend headless/unstyled alternatives when customization is needed:
95
+ │ Radix UI, Headless UI, React Aria, Shadcn/ui (Tailwind-based)
96
+
97
+ └── Document all findings in the design contract Stack Evaluation table
98
+ ```
99
+
100
+ **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.
101
+
102
+ **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."
103
+
104
+ ---
105
+
106
+ ## 4. Design Token Extraction Protocol
107
+
108
+ ```
109
+ MANDATORY:
110
+ ├── Extract EVERY value before writing any implementation code:
111
+ │ Colors → exact hex/rgba/hsl for every fill, stroke, text color
112
+ │ Typography → family, weight, size, line-height, letter-spacing per text style
113
+ │ Spacing → padding, margin, gap values for every element
114
+ │ Borders → radius, width, style, color
115
+ │ Shadows → x-offset, y-offset, blur, spread, color
116
+ │ Opacity → any transparency values
117
+ │ Sizing → exact width/height for fixed-size elements
118
+ │ Z-index → layering order for overlapping elements
119
+ ├── Record each token with its usage context (which element, which state)
120
+ ├── Group tokens into a consistent naming system (--color-primary, --spacing-md, etc.)
121
+ ├── Cross-reference: if a value appears multiple times, it's a shared token
122
+ └── Write ALL tokens to .gsd-t/contracts/design-contract.md BEFORE coding
123
+ ```
124
+
125
+ **BAD** — Writing `padding: 15px` because "it looks about right."
126
+
127
+ **GOOD** — Extracting `padding: 16px` from the design tool, recording it as `--spacing-md: 1rem`, tracing it to "card container padding" in the design contract.
128
+
129
+ ---
130
+
131
+ ## 5. Design Contract Generation
132
+
133
+ ```
134
+ MANDATORY:
135
+ ├── Write extracted tokens to .gsd-t/contracts/design-contract.md
136
+ │ Use the design-contract template from templates/design-contract.md
137
+ ├── Every CSS value in the implementation MUST trace to a contract entry
138
+ ├── If a value isn't in the contract, the extraction was incomplete — go back
139
+ ├── The contract is the source of truth — not the code, not your memory
140
+ └── Update the contract if the design changes during implementation
141
+ ```
142
+
143
+ 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.
144
+
145
+ ---
146
+
147
+ ## 6. Component Decomposition
148
+
149
+ ```
150
+ MANDATORY:
151
+ ├── Before coding, analyze the design and produce a component tree:
152
+ │ Root container → sections → components → sub-components → atoms
153
+ ├── Identify repeated patterns → these become reusable components
154
+ ├── Identify variant states → these become component props
155
+ │ Example: Button has primary/secondary/ghost → variant prop
156
+ ├── Identify slot boundaries → where dynamic content gets injected
157
+ ├── Map the tree to your framework's component model (React, Vue, etc.)
158
+ ├── Name components semantically — match the design's layer names when clear
159
+ └── Document the tree in the design contract's Component Tree section
160
+ ```
161
+
162
+ **BAD** — Writing one monolithic 400-line component that renders the entire page.
163
+
164
+ **GOOD**
165
+ ```
166
+ Page
167
+ ├── Header
168
+ │ ├── Logo
169
+ │ ├── NavLinks
170
+ │ └── UserMenu (variant: logged-in | logged-out)
171
+ ├── HeroSection
172
+ │ ├── Headline
173
+ │ ├── Subheadline
174
+ │ └── CTAButton (variant: primary)
175
+ ├── FeatureGrid
176
+ │ └── FeatureCard (x3, reusable)
177
+ │ ├── Icon
178
+ │ ├── Title
179
+ │ └── Description
180
+ └── Footer
181
+ ```
182
+
183
+ ---
184
+
185
+ ## 7. Layout Analysis
186
+
187
+ ```
188
+ MANDATORY:
189
+ ├── Identify the layout system for every container:
190
+ │ Is it a grid? → CSS Grid with explicit columns/rows/gaps
191
+ │ Is it a row/column? → Flexbox with explicit direction/gap/alignment
192
+ │ Is it positioned? → Relative/absolute with exact offsets
193
+ ├── Measure exact gap values between elements — never approximate
194
+ ├── Identify alignment: start, center, end, stretch, space-between
195
+ ├── Determine sizing: fixed width/height vs flex-grow vs percentage vs min/max
196
+ ├── Note content overflow behavior: hidden, scroll, wrap, ellipsis
197
+ └── Document layout per breakpoint in the design contract
198
+ ```
199
+
200
+ **BAD** — `display: flex; gap: 10px;` without measuring the actual gap.
201
+
202
+ **GOOD** — Extracting gap as exactly `24px` from the design, then: `display: flex; gap: 1.5rem; /* 24px — design contract: section-gap */`
203
+
204
+ ---
205
+
206
+ ## 8. Responsive Breakpoint Strategy
207
+
208
+ ```
209
+ MANDATORY:
210
+ ├── Analyze the design for breakpoint behavior BEFORE coding
211
+ │ What layout changes? (stack, reorder, hide, resize)
212
+ │ What typography changes? (font-size, line-height)
213
+ │ What spacing changes? (padding, margins, gaps)
214
+ ├── Define breakpoints explicitly — match the design's target viewports
215
+ │ Common: mobile 375px, tablet 768px, desktop 1280px, wide 1440px+
216
+ ├── Choose mobile-first or desktop-first per project convention
217
+ ├── Use fluid values where appropriate:
218
+ │ clamp(min, preferred, max) for font sizes
219
+ │ percentage or vw-based widths for flexible containers
220
+ │ container queries for component-level responsiveness
221
+ ├── NEVER assume "it'll work at intermediate sizes" — test every breakpoint
222
+ └── Document breakpoint behavior in the design contract
223
+ ```
224
+
225
+ **BAD** — Building desktop only, then adding `@media (max-width: 768px)` as an afterthought.
226
+
227
+ **GOOD** — Analyzing all breakpoints upfront, building mobile-first, progressively enhancing:
228
+ ```css
229
+ /* Mobile (default) */
230
+ .feature-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
231
+ /* Tablet */
232
+ @media (min-width: 768px) { .feature-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; } }
233
+ /* Desktop */
234
+ @media (min-width: 1280px) { .feature-grid { grid-template-columns: repeat(3, 1fr); gap: 2rem; } }
235
+ ```
236
+
237
+ ---
238
+
239
+ ## 9. Semantic HTML Structure
240
+
241
+ ```
242
+ MANDATORY:
243
+ ├── Use semantic elements: nav, main, section, article, aside, header, footer
244
+ ├── Heading hierarchy: one h1 per page, h2 → h3 → h4 in order, no skips
245
+ ├── Interactive elements: button for actions, a for navigation — NEVER div with onClick
246
+ ├── Form elements: label + input pairs, fieldset + legend for groups
247
+ ├── ARIA landmarks: role attributes only when semantic HTML doesn't suffice
248
+ ├── Alt text: descriptive for content images, empty (alt="") for decorative
249
+ ├── Tab order: logical, follows visual layout, no positive tabindex values
250
+ └── Focus indicators: visible on every interactive element
251
+ ```
252
+
253
+ **BAD** — `<div class="button" onclick="...">Click me</div>`
254
+
255
+ **GOOD** — `<button type="button" class="cta-button">Click me</button>`
256
+
257
+ ---
258
+
259
+ ## 10. CSS Precision Rules
260
+
261
+ ```
262
+ MANDATORY:
263
+ ├── EVERY value must trace to the design contract — no "looks about right"
264
+ ├── Use CSS custom properties for design tokens:
265
+ │ :root { --color-primary: #1A73E8; --spacing-md: 1rem; }
266
+ ├── NO magic numbers without a comment tracing to the design spec
267
+ │ BAD: padding: 13px;
268
+ │ GOOD: padding: var(--spacing-card); /* 16px — design contract: card-padding */
269
+ ├── Consistent units: rem for spacing/typography, px for borders/shadows
270
+ ├── Box model: use box-sizing: border-box universally
271
+ ├── When the project uses Tailwind: map design tokens to Tailwind config
272
+ │ extend theme with exact values from the design contract
273
+ └── Zero tolerance for deviation — if the design says 16px, the code says 16px
274
+ ```
275
+
276
+ **BAD** — Freestyle CSS with values pulled from thin air.
277
+
278
+ **GOOD** — Every value traceable:
279
+ ```css
280
+ .card {
281
+ padding: var(--spacing-lg); /* 24px — design contract */
282
+ border-radius: var(--radius-md); /* 8px — design contract */
283
+ box-shadow: var(--shadow-card); /* 0 2px 8px rgba(0,0,0,0.1) — design contract */
284
+ background: var(--color-surface); /* #FFFFFF — design contract */
285
+ }
286
+ ```
287
+
288
+ ---
289
+
290
+ ## 11. Typography Rendering
291
+
292
+ ```
293
+ MANDATORY:
294
+ ├── Font loading: preload primary fonts, use font-display: swap
295
+ ├── Exact values from design: family, weight, size, line-height, letter-spacing
296
+ │ NEVER approximate: "looks like 14px" → measure it, confirm it
297
+ ├── Line-height: use unitless values (1.5, not 24px) for scalability
298
+ │ Exception: fixed-height single-line elements where px matches design
299
+ ├── Letter-spacing: convert from design tool units if needed
300
+ │ Figma uses percentage or px; CSS uses em or px
301
+ │ 0.5% in Figma ≈ 0.005em in CSS
302
+ ├── Text overflow: match design behavior (ellipsis, wrap, clamp lines)
303
+ ├── Font weight mapping: design tools may use names — map to numeric values
304
+ │ Thin=100, Light=300, Regular=400, Medium=500, SemiBold=600, Bold=700
305
+ └── Responsive typography: use clamp() or breakpoint-specific sizes per design
306
+ ```
307
+
308
+ **BAD** — `font-size: 16px; line-height: 1.5;` without checking the actual design values.
309
+
310
+ **GOOD** — Exact extraction:
311
+ ```css
312
+ .headline {
313
+ font-family: var(--font-heading); /* Inter — design contract */
314
+ font-weight: 600; /* SemiBold — design contract */
315
+ font-size: clamp(1.5rem, 2vw, 2.25rem); /* 24-36px responsive — design contract */
316
+ line-height: 1.3; /* 31.2px at 24px — design contract */
317
+ letter-spacing: -0.01em; /* -0.16px at 16px — design contract */
318
+ }
319
+ ```
320
+
321
+ ---
322
+
323
+ ## 12. Color Accuracy
324
+
325
+ ```
326
+ MANDATORY:
327
+ ├── Extract exact color values — never approximate
328
+ │ #1A73E8 is NOT #1A74E9 — match exactly
329
+ ├── Use the format from the design tool: hex for solid, rgba for transparent
330
+ ├── Define as CSS custom properties — NEVER hardcode throughout stylesheets
331
+ ├── Gradients: extract exact stops (color + position %)
332
+ ├── Opacity: apply via rgba/hsla or opacity property — match the design's approach
333
+ ├── Dark mode (if applicable):
334
+ │ Map each light token to its dark equivalent
335
+ │ Use prefers-color-scheme or class-based toggle per project convention
336
+ ├── Semantic naming: --color-primary, --color-text-secondary, --color-surface
337
+ │ NOT --blue-500 — use design intent, not visual description
338
+ └── Background images/patterns: export at correct resolution, use srcset for retina
339
+ ```
340
+
341
+ **BAD** — Using `blue` or `#0000ff` when the design uses `#1A73E8`.
342
+
343
+ **GOOD** — Exact match with semantic naming:
344
+ ```css
345
+ :root {
346
+ --color-primary: #1A73E8;
347
+ --color-primary-hover: #1557B0;
348
+ --color-text-primary: #202124;
349
+ --color-text-secondary: #5F6368;
350
+ --color-surface: #FFFFFF;
351
+ --color-border: #DADCE0;
352
+ }
353
+ ```
354
+
355
+ ---
356
+
357
+ ## 13. Interactive States
358
+
359
+ ```
360
+ MANDATORY:
361
+ ├── Every interactive element MUST have ALL states defined:
362
+ │ default, hover, focus-visible, active, disabled
363
+ ├── Extract state styles from the design — designers often spec these
364
+ │ If not specified: derive logically (hover = slightly darker/lighter)
365
+ │ Document derived states in the design contract with "derived" note
366
+ ├── Transitions: specify duration and easing — don't rely on browser defaults
367
+ │ Standard: transition: all 150ms ease-in-out (or per design spec)
368
+ ├── Focus indicators: visible, high-contrast, not just outline:none
369
+ ├── Touch targets: minimum 44x44px on mobile — pad with transparent area if needed
370
+ ├── Cursor states: pointer for clickable, not-allowed for disabled, text for inputs
371
+ └── Loading states: skeleton/spinner/disabled during async operations
372
+ ```
373
+
374
+ **BAD** — Styling only the default state, leaving hover/focus as browser defaults.
375
+
376
+ **GOOD**
377
+ ```css
378
+ .cta-button {
379
+ background: var(--color-primary);
380
+ color: white;
381
+ padding: 12px 24px;
382
+ border-radius: 8px;
383
+ cursor: pointer;
384
+ transition: background 150ms ease-in-out, transform 100ms ease-in-out;
385
+ }
386
+ .cta-button:hover { background: var(--color-primary-hover); }
387
+ .cta-button:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
388
+ .cta-button:active { transform: scale(0.98); }
389
+ .cta-button:disabled { background: var(--color-border); cursor: not-allowed; opacity: 0.6; }
390
+ ```
391
+
392
+ ---
393
+
394
+ ## 14. Visual Verification Loop
395
+
396
+ ```
397
+ MANDATORY:
398
+ ├── After implementing any design component, run a visual verification:
399
+ │ 1. Render the component (Claude Preview, Chrome MCP, or dev server)
400
+ │ 2. Screenshot the rendered output
401
+ │ 3. Compare side-by-side with the source design
402
+ │ 4. Identify EVERY deviation (spacing, color, font, alignment, sizing)
403
+ │ 5. Fix each deviation — trace fix to design contract values
404
+ │ 6. Re-render and re-compare
405
+ ├── Maximum 3 verification iterations per component
406
+ │ If still deviating after 3 → log specific deltas to .gsd-t/qa-issues.md
407
+ ├── Tool priority for rendering:
408
+ │ 1. Claude Preview (if available) — fastest loop
409
+ │ 2. Chrome MCP (if available) — full browser rendering
410
+ │ 3. Dev server + manual screenshot — last resort
411
+ ├── Check at EVERY breakpoint — not just desktop
412
+ │ Mobile (375px), Tablet (768px), Desktop (1280px) minimum
413
+ ├── Verification is NOT optional — skipping it is a task failure
414
+ └── Log verification results in the design contract Verification Status table
415
+ ```
416
+
417
+ **BAD** — Writing CSS, committing, moving on without ever seeing the rendered result.
418
+
419
+ **GOOD** — Render → Screenshot → Compare → Fix spacing from 14px to 16px → Re-render → Confirm match → Log "verified at 3 breakpoints" in design contract.
420
+
421
+ ---
422
+
423
+ ## 15. Anti-Patterns
424
+
425
+ ```
426
+ NEVER DO THESE:
427
+ ├── Eyeballing values — "looks like about 12px padding" (EXTRACT the exact value)
428
+ ├── Hardcoding without traceability — magic numbers with no design reference
429
+ ├── "Close enough" mentality — 14px when the design says 16px is a FAILURE
430
+ ├── Desktop-only implementation — ignoring responsive breakpoints
431
+ ├── State-less components — only styling default, ignoring hover/focus/disabled
432
+ ├── Layout-only testing — checking element existence without visual verification
433
+ ├── Skipping the extraction step — jumping straight to code
434
+ ├── Approximating colors — using a "close" shade instead of the exact value
435
+ ├── Ignoring typography details — wrong font weight, missing letter-spacing
436
+ ├── Fixed pixel values everywhere — not using rem/em for scalable sizing
437
+ ├── Mixing styling approaches — Tailwind + inline styles + CSS modules in one project
438
+ └── Skipping the verification loop — submitting unverified visual output
439
+ ```
440
+
441
+ ---
442
+
443
+ ## 16. Design-to-Code Verification Checklist
444
+
445
+ Before marking any design implementation task as complete:
446
+
447
+ - [ ] Design source identified and documented in design contract
448
+ - [ ] Stack capability evaluated — all design requirements achievable (or alternatives approved)
449
+ - [ ] All design tokens extracted (colors, typography, spacing, borders, shadows)
450
+ - [ ] Tokens written to `.gsd-t/contracts/design-contract.md`
451
+ - [ ] Component tree documented and matches design hierarchy
452
+ - [ ] Every CSS value traces to a design contract entry
453
+ - [ ] CSS custom properties (or Tailwind config) define all design tokens
454
+ - [ ] Semantic HTML used (no div-soup, proper heading hierarchy)
455
+ - [ ] All interactive states implemented (hover, focus, active, disabled)
456
+ - [ ] Responsive behavior implemented for all target breakpoints
457
+ - [ ] Visual verification loop completed at mobile, tablet, and desktop widths
458
+ - [ ] Typography exact: family, weight, size, line-height, letter-spacing all match
459
+ - [ ] Colors exact: every fill, stroke, text color matches design values
460
+ - [ ] Spacing exact: every padding, margin, gap matches design values
461
+ - [ ] Accessibility: focus indicators, alt text, ARIA where needed, 44px touch targets
462
+ - [ ] No magic numbers — every value is documented or uses a design token
463
+ - [ ] Verification results logged in design contract Verification Status table