@zohofinance/commerce 1.0.0 → 1.0.1

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.
Files changed (127) hide show
  1. package/README.md +61 -0
  2. package/package.json +2 -2
  3. package/ts-dist/mocks/init-theme/.claude/CLAUDE.md +6 -0
  4. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/SKILL.md +242 -0
  5. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/inputs/figma.md +81 -0
  6. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/inputs/screenshot.md +54 -0
  7. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/inputs/url.md +88 -0
  8. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/spec-table.md +102 -0
  9. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/verification/accessibility.md +110 -0
  10. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/verification/performance.md +127 -0
  11. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/verification/tokens.md +87 -0
  12. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/verification/visual-diff.md +123 -0
  13. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/SKILL.md +605 -0
  14. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/design-tokens.md +105 -0
  15. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/page-json-contract.md +58 -0
  16. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/qa-accessibility.md +35 -0
  17. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/reference-lookup.md +94 -0
  18. package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/section-anatomy.md +109 -0
  19. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/SKILL.md +313 -0
  20. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/agent-hierarchy.md +142 -0
  21. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/ask-developer.md +113 -0
  22. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/bootstrap.md +260 -0
  23. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/build-metrics.md +89 -0
  24. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/code-quality.md +186 -0
  25. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/common-pages-agent.md +97 -0
  26. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/dev-server-and-urls.md +127 -0
  27. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/exemplars.md +79 -0
  28. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/figma-discovery.md +138 -0
  29. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/figma-extraction.md +132 -0
  30. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/image-sources.md +84 -0
  31. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/inputs/guidelines-frame.md +178 -0
  32. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/page-builder.md +322 -0
  33. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/page-orchestrator.md +199 -0
  34. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/parallel-fanout.md +152 -0
  35. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/a11y.mjs +129 -0
  36. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/lint-section.mjs +502 -0
  37. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/perf.mjs +134 -0
  38. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/pixel-diff.mjs +206 -0
  39. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/record-build-metrics.mjs +118 -0
  40. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/section-builder.md +131 -0
  41. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/subagent-escalation.md +75 -0
  42. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/transcription-rules.md +98 -0
  43. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/verification.md +227 -0
  44. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/visual-verify-loop.md +117 -0
  45. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/_index.md +4 -0
  46. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/assets.md +105 -0
  47. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/best-practices.md +212 -0
  48. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/custom-scripts.md +294 -0
  49. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/i18n.md +155 -0
  50. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/introduction.md +91 -0
  51. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/layouts.md +158 -0
  52. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/pages.md +156 -0
  53. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/_index.md +4 -0
  54. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/filters.md +419 -0
  55. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/global-objects.md +415 -0
  56. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/schema-types.md +926 -0
  57. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/tags.md +259 -0
  58. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/sections.md +203 -0
  59. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/setup-guide.md +424 -0
  60. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/snippets.md +70 -0
  61. package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/theme-structure.md +252 -0
  62. package/ts-dist/mocks/init-theme/.cursor/PLAYBOOK.md +144 -0
  63. package/ts-dist/mocks/init-theme/.cursor/README.md +6 -0
  64. package/ts-dist/mocks/init-theme/.cursor/agents/figma-desktop-mobile-parallel.md +48 -0
  65. package/ts-dist/mocks/init-theme/.cursor/agents/visual-compare.md +221 -0
  66. package/ts-dist/mocks/init-theme/.cursor/commands/add-field.md +83 -0
  67. package/ts-dist/mocks/init-theme/.cursor/commands/add-theme-setting.md +200 -0
  68. package/ts-dist/mocks/init-theme/.cursor/commands/assemble-page.md +72 -0
  69. package/ts-dist/mocks/init-theme/.cursor/commands/audit-page.md +57 -0
  70. package/ts-dist/mocks/init-theme/.cursor/commands/build-page-sections.md +110 -0
  71. package/ts-dist/mocks/init-theme/.cursor/commands/build-section.md +418 -0
  72. package/ts-dist/mocks/init-theme/.cursor/commands/build-theme.md +307 -0
  73. package/ts-dist/mocks/init-theme/.cursor/commands/compare-section.md +358 -0
  74. package/ts-dist/mocks/init-theme/.cursor/commands/create-theme.md +77 -0
  75. package/ts-dist/mocks/init-theme/.cursor/commands/extract-tokens.md +43 -0
  76. package/ts-dist/mocks/init-theme/.cursor/commands/fix-section.md +92 -0
  77. package/ts-dist/mocks/init-theme/.cursor/commands/impact.md +50 -0
  78. package/ts-dist/mocks/init-theme/.cursor/commands/qa-a11y.md +66 -0
  79. package/ts-dist/mocks/init-theme/.cursor/commands/qa-i18n.md +110 -0
  80. package/ts-dist/mocks/init-theme/.cursor/commands/qa-layout.md +127 -0
  81. package/ts-dist/mocks/init-theme/.cursor/commands/qa-performance.md +72 -0
  82. package/ts-dist/mocks/init-theme/.cursor/commands/qa-section.md +84 -0
  83. package/ts-dist/mocks/init-theme/.cursor/commands/qa-sections.md +48 -0
  84. package/ts-dist/mocks/init-theme/.cursor/commands/qa-theme.md +85 -0
  85. package/ts-dist/mocks/init-theme/.cursor/commands/redesign-section.md +177 -0
  86. package/ts-dist/mocks/init-theme/.cursor/commands/refactor-section.md +185 -0
  87. package/ts-dist/mocks/init-theme/.cursor/commands/sync-theme-settings.md +132 -0
  88. package/ts-dist/mocks/init-theme/.cursor/commands/validate-page.md +60 -0
  89. package/ts-dist/mocks/init-theme/.cursor/commands/validate-section-group.md +88 -0
  90. package/ts-dist/mocks/init-theme/.cursor/commands/validate-theme-settings.md +119 -0
  91. package/ts-dist/mocks/init-theme/.cursor/examples/design-instructions-template.md +151 -0
  92. package/ts-dist/mocks/init-theme/.cursor/mcp.json +18 -0
  93. package/ts-dist/mocks/init-theme/.cursor/rules/README.md +160 -0
  94. package/ts-dist/mocks/init-theme/.cursor/rules/accessibility.mdc +24 -0
  95. package/ts-dist/mocks/init-theme/.cursor/rules/add-field.mdc +222 -0
  96. package/ts-dist/mocks/init-theme/.cursor/rules/add-theme-setting.mdc +39 -0
  97. package/ts-dist/mocks/init-theme/.cursor/rules/assemble-page.mdc +130 -0
  98. package/ts-dist/mocks/init-theme/.cursor/rules/audit-page.mdc +92 -0
  99. package/ts-dist/mocks/init-theme/.cursor/rules/build-section.mdc +178 -0
  100. package/ts-dist/mocks/init-theme/.cursor/rules/build-theme.mdc +47 -0
  101. package/ts-dist/mocks/init-theme/.cursor/rules/compare-section.mdc +94 -0
  102. package/ts-dist/mocks/init-theme/.cursor/rules/create-theme.mdc +78 -0
  103. package/ts-dist/mocks/init-theme/.cursor/rules/css.mdc +137 -0
  104. package/ts-dist/mocks/init-theme/.cursor/rules/design-spec-extraction.mdc +255 -0
  105. package/ts-dist/mocks/init-theme/.cursor/rules/extract-tokens.mdc +43 -0
  106. package/ts-dist/mocks/init-theme/.cursor/rules/figma-mcp-resolution.mdc +40 -0
  107. package/ts-dist/mocks/init-theme/.cursor/rules/fix-section.mdc +154 -0
  108. package/ts-dist/mocks/init-theme/.cursor/rules/general.mdc +30 -0
  109. package/ts-dist/mocks/init-theme/.cursor/rules/i18n.mdc +85 -0
  110. package/ts-dist/mocks/init-theme/.cursor/rules/javascript.mdc +85 -0
  111. package/ts-dist/mocks/init-theme/.cursor/rules/liquid-no-hardcoded-strings.mdc +42 -0
  112. package/ts-dist/mocks/init-theme/.cursor/rules/liquid.mdc +171 -0
  113. package/ts-dist/mocks/init-theme/.cursor/rules/mobile-desktop-setting-meta.mdc +34 -0
  114. package/ts-dist/mocks/init-theme/.cursor/rules/naming-convention.mdc +64 -0
  115. package/ts-dist/mocks/init-theme/.cursor/rules/pages.mdc +120 -0
  116. package/ts-dist/mocks/init-theme/.cursor/rules/performance.mdc +51 -0
  117. package/ts-dist/mocks/init-theme/.cursor/rules/qa-section.mdc +134 -0
  118. package/ts-dist/mocks/init-theme/.cursor/rules/redesign-section.mdc +147 -0
  119. package/ts-dist/mocks/init-theme/.cursor/rules/schema-sync.mdc +110 -0
  120. package/ts-dist/mocks/init-theme/.cursor/rules/schema.mdc +360 -0
  121. package/ts-dist/mocks/init-theme/.cursor/rules/share-urls.mdc +68 -0
  122. package/ts-dist/mocks/init-theme/.cursor/skills/browser-verify.md +128 -0
  123. package/ts-dist/mocks/init-theme/.cursor/skills/design-tokens.md +105 -0
  124. package/ts-dist/mocks/init-theme/.cursor/skills/page-json-contract.md +87 -0
  125. package/ts-dist/mocks/init-theme/.cursor/skills/qa-accessibility.md +35 -0
  126. package/ts-dist/mocks/init-theme/.cursor/skills/reference-lookup.md +88 -0
  127. package/ts-dist/mocks/init-theme/.cursor/skills/section-anatomy.md +173 -0
@@ -0,0 +1,313 @@
1
+ ---
2
+ name: theme-from-figma
3
+ description: Build a complete ZCommerce Liquid theme from a Figma file in a single command. Provide theme name + figma file key; the agent auto-discovers pages via get_metadata (Website View / Mobile View). Fans out parallel page-agents with Chrome DevTools MCP visual verify. Use for "build a new theme", "create a theme from Figma", "/build-theme". Per-page URLs are fallback only when discovery fails. Single entry point — replaces archived zcommerce-theme-builder and zcommerce-section-from-design skills.
4
+ ---
5
+
6
+ # theme-from-figma — one command, Level 0 → A → B hierarchy, verified output
7
+
8
+ This is the only skill developers need for theme construction. It uses a **three-level agent hierarchy** (see `agent-hierarchy.md`): Level 0 discovers pages and bootstraps; Level A identifies sections per page and spawns Level B; Level B builds **one section from its Figma node only** and verifies lint + visual before Level A assembles the page.
9
+
10
+ ## How accuracy is achieved — four non-negotiables
11
+
12
+ Earlier versions produced themes structurally similar to Figma but visually far off. Four rules fix that:
13
+
14
+ 1. **Per-element Figma extraction, not imagination.** Every section is built from `figma-spec.json` via `get_design_context` on the section's Figma node. See `figma-extraction.md`.
15
+
16
+ 2. **Chrome DevTools MCP visual verify on every section AND every page.** Mandatory 3-gate loop: visual screenshot diff + `lighthouse_audit` a11y + perf baseline. See `visual-verify-loop.md` and `.cursor/skills/browser-verify.md`. A section without `visual-diff.md` showing **0 CRITICAL** does not ship.
17
+
18
+ 3. **Correct image `src` in dev.** Schema JSON stores filenames — always pipe theme assets through `asset_url`. Product CDN URLs use `?organization_id=`. See `image-sources.md`. Check `list_network_requests` for 404s during visual verify.
19
+
20
+ 4. **Simple, reliable code.** Transcribe the Figma spec into straightforward Liquid + scoped `{% style %}`. No over-engineered conditionals. Lint at write time; fix CRITICAL visual items only in re-loops (max 3 per section).
21
+
22
+ `verify-theme.mjs` + `record-build-metrics.mjs` run at Stage 2. Every build ends with time/token insights in `report.md`. See `build-metrics.md`.
23
+
24
+ ## Official ZCommerce docs — bundled at `zcommerce-docs/`
25
+
26
+ This skill ships with the complete official ZCommerce theme documentation. **The docs are the source of truth for anything not explicitly handled by this skill** — Liquid filters, schema field types, global objects, layout primitives, asset filters, i18n filter semantics, best practices.
27
+
28
+ | When you need to know… | Read |
29
+ |---|---|
30
+ | What Liquid filters exist and how to use them | `zcommerce-docs/reference/filters.md` |
31
+ | What `{% schema %}` field types are valid and their default formats | `zcommerce-docs/reference/schema-types.md` |
32
+ | What global Liquid objects are available (`organization`, `pageinfo`, `cart`, `product`, etc.) | `zcommerce-docs/reference/global-objects.md` |
33
+ | What Liquid tags work (only 13 — no `paginate`, `form`, `javascript`, etc.) | `zcommerce-docs/reference/tags.md` |
34
+ | Required folder layout and naming | `zcommerce-docs/theme-structure.md` |
35
+ | Layout file conventions (`theme.liquid`, `content_for_*`) | `zcommerce-docs/layouts.md` |
36
+ | Section + block anatomy | `zcommerce-docs/sections.md` |
37
+ | Snippet rules + variable scoping | `zcommerce-docs/snippets.md` |
38
+ | Page JSON contract | `zcommerce-docs/pages.md` |
39
+ | Asset filter + fingerprint.json | `zcommerce-docs/assets.md` |
40
+ | i18n key conventions | `zcommerce-docs/i18n.md` |
41
+ | Performance / security / a11y / deploy checklist | `zcommerce-docs/best-practices.md` |
42
+ | CLI commands + `?format=json` data inspection | `zcommerce-docs/setup-guide.md` |
43
+ | Custom JS integration patterns | `zcommerce-docs/custom-scripts.md` |
44
+
45
+ Agents should consult these docs **before inventing patterns**. The most common bug from the v5 build (`{% paginate %}` crashing) came from an agent extrapolating from Shopify knowledge instead of reading `reference/tags.md` which explicitly lists what's supported.
46
+
47
+ ## TL;DR — what the developer types
48
+
49
+ **Preferred (auto-discovery):**
50
+ ```
51
+ /build-theme <theme_name> <figma_file_key> [<root_node_id>]
52
+ ```
53
+
54
+ Example: `/build-theme my_theme <figma_file_key>`
55
+
56
+ The agent calls Figma MCP `get_metadata` on the theme canvas, finds **Website View** + **Mobile View** children, and builds the page map **without asking for per-page URLs**. See `figma-discovery.md`.
57
+
58
+ **Optional** — paste per-page URLs only if discovery fails or the file is non-standard:
59
+ ```
60
+ build theme {theme_name}
61
+ figma_file: {file_key_or_url}
62
+ pages: (fallback only)
63
+ index: {figma_url}
64
+ ...
65
+ ```
66
+
67
+ Selecting a frame in Figma before running the command is a **hint** for which page you're focused on — it does **not** replace canvas discovery. The agent still walks the full file.
68
+
69
+ Optional override clause for brand changes that post-date the Figma file:
70
+ ```
71
+ override:
72
+ primary = #4A1525
73
+ body_font = "Inter"
74
+ ```
75
+
76
+ **Never** ask for per-page Figma URLs when `figma_file_key` was provided and discovery succeeded. **Never** ask for token values — they live in the guidelines frame. **Never** ask which theme to use as a reference. See `figma-discovery.md`, `inputs/guidelines-frame.md`, `exemplars.md`.
77
+
78
+ ---
79
+
80
+ ## The pipeline — Level 0 → A → B
81
+
82
+ See `agent-hierarchy.md` for the full spec. Summary:
83
+
84
+ ```
85
+ LEVEL 0 Main orchestrator (serial)
86
+ ├─ figma-discovery.md → page map from file key
87
+ ├─ bootstrap.md → tokens + dev-config.json
88
+ └─ developer approves page map
89
+
90
+ LEVEL A Page orchestrator — one per page (index first, then parallel)
91
+ ├─ identify sections + Figma node ID each → sections.plan.md
92
+ ├─ does NOT write section Liquid
93
+ ├─ spawn LEVEL B in parallel (one per section)
94
+ ├─ assemble pages/<page>.json after all B pass
95
+ └─ whole-page visual verify vs Figma PAGE frame
96
+
97
+ LEVEL B Section builder — one per section
98
+ ├─ get_design_context on SECTION node only (not parent page)
99
+ ├─ figma-spec.json → transcribe → sections/<name>.liquid
100
+ ├─ transcription-rules.md (no radius/colors unless in spec)
101
+ ├─ lint-section.mjs (syntax)
102
+ └─ Chrome DevTools visual verify vs Figma SECTION crop
103
+
104
+ Stage 2 Consolidation — verify-theme.mjs + build-metrics.md
105
+ ```
106
+
107
+ **Why two levels:** Level B scope = one Figma section → less hallucination (wrong border-radius, wrong colors, uneven product card heights). Level A only assembles and checks inter-section layout.
108
+
109
+ Read each `.md` file referenced above before executing that stage. The files are short — they exist precisely to keep this entry doc light.
110
+
111
+ ---
112
+
113
+ ## Preconditions (auto-checked at start)
114
+
115
+ The skill runs these checks before Stage 0. If any fail, stop and surface to the user with a one-line fix.
116
+
117
+ 1. **Ask developer for `storeUrl`.** Do not hardcode a demo store. Record in `dev-config.json`. See `dev-server-and-urls.md`.
118
+ 2. **Confirm page URLs before any browser navigation.** Home is often `/home` not `/`. Product/collection handles vary by store. Ask once; write confirmed URLs to `dev-config.json`.
119
+ 3. **Dev server.** Ask developer to start it, or start it yourself: `yarn run dev --storeUrl=<confirmed>`. Notify developer either way.
120
+ 4. **`npx @zohofinance/commerce --version` works from inside the theme folder.** If not, run `npm install @zohofinance/commerce` in the theme directory.
121
+ 5. **Figma MCP authenticated.** Otherwise: ask user to open Figma desktop with the first frame selected.
122
+ 6. **Chrome DevTools MCP available** (`.cursor/mcp.json`). See `.cursor/skills/browser-verify.md`.
123
+ 7. **Theme name is valid.** Snake-case. If folder exists, ask whether to continue or pick a new name.
124
+ 8. **Subagent escalation.** All page/section agent questions and blockers surface on the main agent screen. See `subagent-escalation.md`.
125
+
126
+ ---
127
+
128
+ ## Core principle — never copy design from another theme
129
+
130
+ There is no "base theme" in the design sense. Every theme is its own product with its own colors, fonts, spacing, radius, and visual flavour. Pulling design decisions from sibling themes — even subconsciously, even "for inspiration" — produces wrong output every time.
131
+
132
+ What CAN be referenced from sibling themes:
133
+ - **Liquid logic patterns** — how a `{% for %}` loop is structured, how a variant picker delegates to a snippet, how a `{% case %}` branches on block types.
134
+ - **Schema patterns** — which `{% schema %}` field types are used, how defaults are formatted for url / image_picker / select, where blocks are introduced. **Heading/title fields → `text`; body/description → `richtext` (never `richtext` on heading blocks).**
135
+ - **Snippet implementations** — how `add-to-cart.liquid` wires up `mcp__plugin_product-management_figma__*` (or `quantity-counter` web component), how `pagination.liquid` handles edge cases.
136
+ - **JS / web-component usage patterns** — when a section uses `<dot-slider>`, `<expand-accordion>`, `<add-to-cart>`, etc.
137
+ - **Accessibility patterns** — how a header implements skip-links, how a modal traps focus.
138
+ - **i18n key patterns** — what kinds of keys live in en.json vs en.schema.json.
139
+ - **File and folder conventions** — same across all themes.
140
+
141
+ What CANNOT be referenced from sibling themes — must come from the developer's Figma + the theme's own tokens, never from another `.liquid` file, asset, or font:
142
+ - **Assets** — images, logos, icons, hero/banner graphics, decorative SVGs. All must be extracted from the input Figma. Bootstrap leaves `assets/` empty (only `fingerprint.json`); page agents populate it. Hashing siblings' assets vs the new theme's catches violations (`verify-theme.mjs` → `assets_diverge`).
143
+ - **Fonts** — font files. Reference Google Fonts via `<link>` for common faces, or download from the design system if proprietary. Never `.woff2` files copied from sibling themes.
144
+ - Colors (anywhere, including hover/disabled states)
145
+ - Typography (font family, weight, size, line-height)
146
+ - Spacing (padding, margin, gap)
147
+ - Border radius
148
+ - Box shadows
149
+ - Component visual style (button shape, card shadow, input border treatment)
150
+ - Layout density / whitespace rhythm
151
+
152
+ The lint script enforces this at the technical level — zero hardcoded hex, zero hardcoded inline px font-sizes, zero hardcoded inline px paddings. But the rule is also conceptual: when an agent reads a sibling theme's section file for reference, it reads for *how the logic flows*, not *what the design looks like*. Two themes can have the same Liquid skeleton and produce totally different visual outputs — that's the goal.
153
+
154
+ ## Failure modes this skill explicitly defends against
155
+
156
+ Every safeguard below exists because the corresponding bug actually shipped in real-world builds. The defenses are mechanical (lint checks, verify-theme assertions) — not just docs.
157
+
158
+ | Failure | Defense | Where enforced |
159
+ |---|---|---|
160
+ | **Header/footer copied or "retokenized" from a sibling theme** — index agent skipped Figma extraction. | Bootstrap does not create header.liquid/footer.liquid. Index agent must build them from the Figma. `verify-theme.mjs` `header_diverges` / `footer_diverges` checks fail the build if either file has > 70% normalized line similarity to ANY sibling theme's equivalent. | `bootstrap.md` §6 · `page-builder.md` "Special case" · `scripts/verify-theme.mjs` |
161
+ | **Images/logos/icons reused from a sibling theme's `assets/`** — even with new .liquid, pages "looked like" the source theme because the visual assets were someone else's brand. | Bootstrap does NOT copy `assets/`. The folder starts empty (only `fingerprint.json`). Each page agent extracts assets from the Figma per `page-builder.md` "Asset extraction protocol". `verify-theme.mjs` `assets_diverge` check hashes every file in `assets/` and fails if any is byte-identical to a sibling. | `bootstrap.md` step 2 · `page-builder.md` "Asset extraction" · `scripts/verify-theme.mjs` |
162
+ | **project.json / package.json `name` field unchanged** — every theme shipped with a default template name instead of the new theme's name. | Bootstrap sets `package.json` name to the **folder name** (snake_case) and `project.json` name to **kebab-case** (`my_theme` → `my-theme`). Both must include `prebuild`, `prebuild:dev`, and `dev` scripts matching the standard theme layout. | `bootstrap.md` step 6 · `scripts/verify-theme.mjs` |
163
+ | **Invalid Liquid tag like `{% paginate %}`** — agent used Shopify-only tags the ZCommerce engine doesn't register; pages crashed at render time. | `lint-section.mjs` `liquid_tags_valid` check enforces an allow-list pulled from the bundled `zcommerce-docs/reference/tags.md` docs. Anything else fails the file. | `scripts/lint-section.mjs` |
164
+ | **Runtime translation crash** — agent put schema-label keys in `en.schema.json` but used them at runtime via `\| t`, which only resolves against `en.json`. | `lint-section.mjs` `i18n_keys_resolve` check fails files where runtime `\| t` keys are missing from `en.json` or misplaced in `en.schema.json`, with a hint about which file the key should move to. | `scripts/lint-section.mjs` |
165
+ | **Snippet variable scope bug** — snippet used bare `settings.X` (not `section.settings.X`), accessing a non-existent global. | `lint-section.mjs` `snippet_scope_sanity` check: failure when the file is a section, warning when it's a snippet (since snippets can legitimately receive `settings` as a render parameter). | `scripts/lint-section.mjs` |
166
+ | **Verification skipped entirely** — agents reported "passed" without invoking the puppeteer scripts. | Page agent's output contract requires four JSON files in scratchpad. Stage-2 consolidator refuses to ship if any are missing. | `page-builder.md` Phase 5 · `verification.md` |
167
+ | **Hardcoded hex / inline-px design values** snuck into copied common-page sections from a sibling theme. | `lint-section.mjs` `hardcoded_hex` and `hardcoded_inline_px` checks. `verify-theme.mjs` `no_hardcoded_design` aggregates across all .liquid files. | `scripts/lint-section.mjs` · `scripts/verify-theme.mjs` |
168
+ | **Any `.liquid` file too similar to a sibling theme's** — agent copied or lightly-modified rather than exploring multiple themes and writing fresh. | `verify-theme.mjs` `all_sections_diverge` runs structural-similarity check on every section + snippet file. Fails if any has > 70% normalized line overlap with any sibling. | `scripts/verify-theme.mjs` |
169
+ | **Extra section in `pages/<page>.json` that isn't in the Figma** (e.g., a "Why families pick us" / value-props block that the Figma doesn't show — agent added it from a sibling theme's template). | The page orchestrator's section-identification phase MUST produce a list that matches what's visually in the Figma frame and ONLY what's visually there. Any section in the Figma → add. Any section the agent "thinks would be useful" → reject. The `sections.plan.md` artefact in scratchpad lists each section's Figma node ID — if a planned section has no node ID, it shouldn't be in the page. | `page-orchestrator.md` §Phase 2 |
170
+ | **Repeated placeholder content across multiple blocks** (e.g., three blog cards all titled "Where little hands find their bunny buddies"). | Block defaults in `pages/<page>.json` must be distinct per block instance. If the Figma shows three blog cards, the agent must transcribe each card's distinct title/excerpt/date into the corresponding block's settings — not leave `settings: {}` (which falls back to repeated schema defaults). | `page-orchestrator.md` §Phase 7 + new `verify-theme.mjs` check |
171
+ | **Block settings left as `{}` in page JSON** — agent wrote schema with reasonable defaults but didn't transcribe Figma content into the page JSON, so every block falls back to the same schema default. | New `verify-theme.mjs` check `block_settings_populated`: scans every `pages/*.json`, fails if any block of a multi-block section has `"settings": {}` while sibling blocks of the same section have non-empty settings. Catches the "agent forgot to transcribe" pattern. | `scripts/verify-theme.mjs` |
172
+ | **Repeating block defaults inside section schema** (e.g., all three "blog_post" block defaults set to the same title — so empty page JSON blocks all show the same content). | Schema defaults for repeating block types must either be (a) left blank/null so missing settings are visually obvious, or (b) authored as a progressive set (`post_1_default`, `post_2_default`, `post_3_default`). Lint check `schema_defaults_distinct`: when a block type appears multiple times in a page JSON's `block_order` with empty settings, the agent must populate distinct values OR the schema must use blank defaults. | `scripts/lint-section.mjs` |
173
+
174
+ The skill SHIPS a theme only when `verify-theme.mjs` returns verdict PASS. Anything else is a bug to fix, not a tolerated deviation.
175
+
176
+ ## What this skill enforces that the old ones didn't
177
+
178
+ 1. **No `extract-tokens` command, no developer-supplied preset.** Token extraction is folded into Stage 0 — the agent reads the guidelines frame screenshot, extracts typography / colors / button states / component micro-specs via vision, and writes `theme.json` + `figma-variables.json` automatically. Falls back to `get_variable_defs` for files without a guidelines frame.
179
+ 2. **Write-time code lint.** Every section file is linted *before* being written. The lint enforces hard budgets (see `code-quality.md`). A file that would exceed budgets is rejected and the agent re-plans rather than emitting bloat.
180
+ 3. **Exemplar-anchored output.** New sections are compared structurally to the gold-standard exemplars in `exemplars.md`. If the planned section's DOM depth or class count exceeds the exemplar's by more than 20%, the build pauses and the agent justifies the deviation or simplifies.
181
+ 4. **Parallel page builds.** Five page-agents work concurrently. Each has its own scratchpad and never touches another page's files. The result: ~5× faster than the old serial flow.
182
+ 5. **Verification via Chrome DevTools MCP first.** `lighthouse_audit`, `take_screenshot`, `list_console_messages`, `list_network_requests`, and `performance_start_trace` are the primary gates during build. Puppeteer scripts are optional CI artefacts — not a substitute for MCP visual compare during the dev loop.
183
+ 6. **Single source of truth for tokens.** Header + footer + all "common" pages (cart, checkout, account, 404, signin/signup) inherit colors/fonts/radius/spacing from one place — Stage 0's `tailwind.config.js` + `theme.json`. Changing a token automatically updates everything.
184
+
185
+ ---
186
+
187
+ ## What the developer sees during a run
188
+
189
+ ```
190
+ [stage 0] bootstrap ✓ 32s
191
+ ├─ scaffolded lush_market/
192
+ ├─ guidelines frame parsed: Oswald + Lato, 10 color tokens
193
+ ├─ 3 button variants with 4 states each, 6 component specs
194
+ ├─ tailwind.config.js + theme.json + figma-variables.json written
195
+ └─ header.liquid + footer.liquid locked
196
+
197
+ [stage 1] parallel page builds (5 agents)
198
+ ├─ index building 5 sections building 4/5 verify ✓ 4m12s
199
+ ├─ listing building 3 sections verify ✓ 3m20s
200
+ ├─ product building 6 sections building 5/6 verify ✓ 5m04s (1 iteration: a11y contrast fix)
201
+ ├─ blog_list building 2 sections verify ✓ 2m48s
202
+ └─ blog_detail building 2 sections verify ✓ 3m15s
203
+ total ~5m04s (slowest agent)
204
+
205
+ [stage 2] consolidation
206
+ ├─ cross-page token consistency ✓
207
+ ├─ navigation parity ✓
208
+ ├─ page JSONs + i18n keys ✓
209
+ └─ build metrics + token estimate ✓
210
+
211
+ theme ready at lush_market/
212
+ report at .claude/scratchpad/lush_market/report.md
213
+
214
+ ## Build metrics (example)
215
+ Wall-clock: 42m 18s
216
+ Sections: 23 built, 21/23 visual PASS (0 CRITICAL)
217
+ Token estimate: ~2.8M input / ~420K output (medium profile)
218
+ Slowest page: product (8m 22s, 2 visual iterations)
219
+ ```
220
+
221
+ The developer reviews the report — especially visual-diff CRITICAL counts and build metrics. **Figma fidelity is proven by screenshots, not by code inspection alone.**
222
+
223
+ ---
224
+
225
+ ## When to step out of the pipeline
226
+
227
+ The pipeline is the right tool for: building a new theme from scratch with full Figma coverage.
228
+
229
+ It is the **wrong** tool for, and should not be used for:
230
+ - **Bug fix in an existing theme** → just open the file and fix it. No skill needed.
231
+ - **One-off section change** → edit the section directly, then `cd <theme> && yarn run dev` to verify visually. No skill needed.
232
+ - **Adding a theme setting** → edit `settings/schema.json` + `theme.json` directly.
233
+ - **A new section that doesn't fit any of the 5 pages this skill handles** → also direct edit; the lint rules in `code-quality.md` still apply, but you don't need the orchestration.
234
+
235
+ Keeping this skill scoped to its job is what makes it work without prompting overhead.
236
+
237
+ ---
238
+
239
+ ## File index
240
+
241
+ | File | Purpose |
242
+ |---|---|
243
+ | `SKILL.md` | This document — the entry point. |
244
+ | `bootstrap.md` | Stage 0 — scaffold + token wiring. No file copies from any theme. |
245
+ | `figma-extraction.md` | **NEW.** Per-element measurement extraction from Figma. The contract for what to build. |
246
+ | `visual-verify-loop.md` | Mandatory 3-gate verify: visual + a11y + perf via Chrome DevTools MCP. |
247
+ | `image-sources.md` | `asset_url` vs product CDN URLs — fixes the #1 dev-server image bug. |
248
+ | `build-metrics.md` | End-of-run time + token estimate template. |
249
+ | `agent-hierarchy.md` | Level 0 / A / B roles, scope boundaries, spawn rules. |
250
+ | `transcription-rules.md` | Border-radius, colors, product card heights — spec → code. |
251
+ | `figma-discovery.md` | Auto-discover pages from file key — do NOT ask for URLs first. |
252
+ | `dev-server-and-urls.md` | Collect storeUrl, confirm page URLs, dev server workflow. |
253
+ | `subagent-escalation.md` | Subagent questions/blockers must reach main agent + developer. |
254
+ | `page-orchestrator.md` | Stage 1 page-level agent: identifies sections, plans snippets, spawns section subagents, batches developer questions, assembles page JSON, runs whole-page visual verify. |
255
+ | `section-builder.md` | Section-level subagent: extracts Figma Spec, transcribes to Liquid, runs per-section visual verify loop. |
256
+ | `ask-developer.md` | When to surface ambiguity vs decide. Format for `unresolved.md` entries. The batched-question protocol. |
257
+ | `common-pages-agent.md` | Stage 1c — orchestrator for cart/checkout/account/auth/404/etc. Builds from logic patterns + tokens (no Figma per page). |
258
+ | `inputs/guidelines-frame.md` | How to parse the guidelines frame: typography, colors, button states, component specs. |
259
+ | `parallel-fanout.md` | Stage 1 — spawning the 5 page agents and managing their reports. |
260
+ | `page-builder.md` | What runs inside each parallel page agent. |
261
+ | `code-quality.md` | The strict budgets and the write-time lint procedure. |
262
+ | `exemplars.md` | Logic patterns per archetype, built from the bundled docs (no other themes). |
263
+ | `verification.md` | Four-gate verify + Stage 2 consolidation. |
264
+ | `scripts/pixel-diff.mjs` | Puppeteer + pixelmatch — rendered vs. Figma. |
265
+ | `scripts/a11y.mjs` | Puppeteer + axe-core — WCAG 2.1 AA scoped to a section. |
266
+ | `scripts/perf.mjs` | Puppeteer + Lighthouse — CWV + perf score per page. |
267
+ | `scripts/lint-section.mjs` | Write-time AST lint — DOM depth, class count, schema field wiring. |
268
+ | `scripts/record-build-metrics.mjs` | Aggregates wall-clock, section counts, visual-verify pass rate. |
269
+
270
+ ---
271
+
272
+ ## Scratchpad layout
273
+
274
+ Everything intermediate lives under `.claude/scratchpad/<theme_name>/` (gitignored).
275
+
276
+ ```
277
+ .claude/scratchpad/<theme_name>/
278
+ bootstrap/
279
+ figma-variables.raw.json (raw get_variable_defs output)
280
+ token-map.json (resolved tokens applied to theme)
281
+ pages/
282
+ index/
283
+ figma-desktop.png
284
+ figma-mobile.png
285
+ figma-context.json
286
+ spec-table.md
287
+ sections.plan.md (which sections to build, in order)
288
+ lint-reports/ (one per section)
289
+ verify/
290
+ pixel-diff.json
291
+ axe.json
292
+ lighthouse.json
293
+ iterations.log
294
+ listing/ (same shape)
295
+ product/ (same shape)
296
+ blog_list/ (same shape)
297
+ blog_detail/(same shape)
298
+ report.md (final consolidated report)
299
+ ```
300
+
301
+ Each parallel page agent owns its subdirectory exclusively. No cross-writes.
302
+
303
+ ---
304
+
305
+ ## Quick start (the only command developers need to remember)
306
+
307
+ ```
308
+ /build-theme {name} {figma_file_key} [{root_node_id}]
309
+ ```
310
+
311
+ Discovery finds pages automatically. Optional: `override: primary=#hex` for brand updates.
312
+
313
+ Ask developer only when: discovery fails, URLs unconfirmed for browser verify, or ambiguous design. Otherwise: run.
@@ -0,0 +1,142 @@
1
+ # Agent hierarchy — Level 0 → A → B
2
+
3
+ This is the **only** build architecture for `/build-theme`. Each level has a narrow scope to prevent hallucination (wrong border-radius, wrong colors, uneven product cards).
4
+
5
+ ```
6
+ LEVEL 0 — Main orchestrator (serial)
7
+ │
8
+ ├─ figma-discovery.md → identify ALL pages from file key
9
+ ├─ bootstrap.md → tokens, dev-config.json
10
+ ├─ developer approves page map
11
+ │
12
+ └─ spawns LEVEL A agents (one per page, parallel after index)
13
+
14
+ LEVEL A — Page orchestrator (one page, does NOT write sections)
15
+ │
16
+ ├─ get_design_context on PAGE frame only (desktop + mobile)
17
+ ├─ identify SECTION list + Figma node ID per section
18
+ ├─ write sections.plan.md
19
+ ├─ spawn LEVEL B agents (one per section, PARALLEL)
20
+ ├─ wait for all Level B PASS
21
+ ├─ assemble pages/<page>.json
22
+ └─ whole-page visual verify vs Figma PAGE frame
23
+
24
+ LEVEL B — Section builder (ONE section, does NOT see other sections)
25
+ │
26
+ ├─ get_design_context on SECTION node only (not parent page)
27
+ ├─ write figma-spec.json (every visual value transcribed)
28
+ ├─ transcribe → sections/<name>.liquid (no improvisation)
29
+ ├─ lint-section.mjs (syntax / docs compliance)
30
+ ├─ Chrome DevTools visual verify vs Figma SECTION crop
31
+ └─ report PASS only when visual-diff.md has 0 CRITICAL
32
+ ```
33
+
34
+ ---
35
+
36
+ ## Scope boundaries (prevents hallucination)
37
+
38
+ | Level | May read | Must NOT read |
39
+ |---|---|---|
40
+ | **0** | Full file metadata, all pages | Section markup, sibling theme CSS |
41
+ | **A** | Page frame tree, section boundaries | Build section Liquid; full-page design values for coding |
42
+ | **B** | **One section node** + theme tokens + logic exemplars | Parent page frame; other sections; sibling theme colors/spacing |
43
+
44
+ **Level B context window = one Figma section frame.** That is the fix for "agent guessed border-radius / colors from memory."
45
+
46
+ ---
47
+
48
+ ## Level 0 — Main orchestrator
49
+
50
+ **File:** `SKILL.md`, `figma-discovery.md`, `parallel-fanout.md`
51
+
52
+ 1. Discover pages (`get_metadata` on theme canvas)
53
+ 2. Bootstrap theme + `dev-config.json`
54
+ 3. Show page map → developer **YES**
55
+ 4. Spawn Level A for index **first** (header/footer)
56
+ 5. After `header-footer-ready`, spawn Level A for product, collection, blog_list, blog_detail **in parallel**
57
+ 6. Stage 2 consolidation + `record-build-metrics.mjs`
58
+
59
+ **Level 0 never writes `sections/*.liquid`.**
60
+
61
+ ---
62
+
63
+ ## Level A — Page orchestrator
64
+
65
+ **File:** `page-orchestrator.md`
66
+
67
+ ### Responsibilities
68
+
69
+ | Do | Don't |
70
+ |---|---|
71
+ | Identify sections from page Figma frame | Write section HTML/CSS |
72
+ | Assign each section a **unique node ID** | Pass whole-page screenshot to Level B as build input |
73
+ | Spawn Level B subagent per section | Copy design from sibling themes |
74
+ | Assemble `pages/<page>.json` after all B pass | Skip whole-page visual verify |
75
+ | Whole-page visual compare (inter-section spacing) | Fix section internals (delegate to B) |
76
+
77
+ ### Output before spawning Level B
78
+
79
+ `sections.plan.md` — every row must have a Figma node ID:
80
+
81
+ ```
82
+ | # | section_name | desktop_node | mobile_node | archetype |
83
+ |---|--------------------|--------------|-------------|----------------|
84
+ | 1 | header | 2613:152 | 2375:4031 | header |
85
+ | 2 | featured-products | 2613:400 | 2375:4100 | product-grid |
86
+ ```
87
+
88
+ ### Level B spawn (parallel)
89
+
90
+ One `Task` / `Agent` per section. Prompt must include:
91
+
92
+ - `figma_node_id` (desktop; mobile as separate if differs)
93
+ - `section_name`
94
+ - `scratchpad` path
95
+ - `page_url` from `dev-config.json`
96
+ - **Explicit:** "You are Level B. Scope = this section node only. Do not read parent page Figma."
97
+
98
+ ---
99
+
100
+ ## Level B — Section builder
101
+
102
+ **File:** `section-builder.md`, `figma-extraction.md`, `transcription-rules.md`
103
+
104
+ ### Responsibilities
105
+
106
+ | Do | Don't |
107
+ |---|---|
108
+ | `get_design_context` on **section node ID only** | `get_design_context` on full page |
109
+ | Transcribe `figma-spec.json` → Liquid | Add `rounded-*` unless spec has `border_radius > 0` |
110
+ | Lint + visual verify **this section** | Assemble page JSON |
111
+ | Use theme tokens mapped in spec | Hardcode hex or copy sibling theme styles |
112
+
113
+ ### Verify gates (Level B only)
114
+
115
+ 1. **Syntax** — `lint-section.mjs` PASS
116
+ 2. **Docs** — valid tags/filters per `zcommerce-docs/`
117
+ 3. **Visual** — Chrome DevTools screenshot of **this section** vs Figma **section crop**; `visual-diff.md` 0 CRITICAL
118
+
119
+ Level B does **not** pass until all three pass.
120
+
121
+ ---
122
+
123
+ ## After Level B — Level A assembles + verifies page
124
+
125
+ 1. Wire sections in `pages/<page>.json` (order from `sections.plan.md`)
126
+ 2. Populate block settings from Figma (distinct per block)
127
+ 3. Navigate to `page_url` from `dev-config.json`
128
+ 4. Full-page screenshot vs Figma **page** frame
129
+ 5. Fix **only** inter-section issues (order, gap, missing section)
130
+ 6. If a section looks wrong internally → re-spawn Level B for that section only
131
+
132
+ ---
133
+
134
+ ## Common failures this hierarchy fixes
135
+
136
+ | Symptom | Cause | Fix |
137
+ |---|---|---|
138
+ | Border radius where Figma is square | Agent used theme default `rounded-card` | Level B: `border_radius: 0` in spec → no `rounded-*` |
139
+ | Product cards different heights | Images without fixed media box | Level B: spec `position.h` on media + `object-fit` + `aspect-ratio` |
140
+ | Wrong colors | Agent read sibling theme or guessed token | Level B: colors only from `figma-spec.json` token map |
141
+ | Extra sections on page | Level A invented sections | Level A: section list = Figma children only |
142
+ | Page looks wrong but sections "pass" | Level A skipped whole-page verify | Level A Phase 8 mandatory |
@@ -0,0 +1,113 @@
1
+ # Ask the developer — checkpoints, format, what to ask, what NEVER to ask
2
+
3
+ Every previous build failed in part because the agent guessed when it should have asked. This doc enumerates the exact checkpoints where asking is mandatory, with templates.
4
+
5
+ ## The principle
6
+
7
+ A question to the developer costs ~10 seconds of their attention. A wrong guess costs a full iteration cycle plus their trust. **When the answer isn't in the bundled docs (`zcommerce-docs/`), the theme tokens (`theme.json` / `figma-variables.json`), or the Figma's structured `get_design_context` output — ASK. Always.**
8
+
9
+ When the answer IS in any of those three sources — look it up. Don't ask.
10
+
11
+ ## Hard checkpoints (asking is mandatory if condition holds)
12
+
13
+ ### Bootstrap (Stage 0)
14
+
15
+ - **No guidelines frame URL provided** → ask. Without it, no tokens.
16
+ - **Two or more candidate guidelines frames found** → ask which one. Don't pick.
17
+ - **A token in the guidelines frame is unreadable** (low resolution, OCR ambiguous) → ask the developer for the hex / size value directly. Don't guess.
18
+ - **Figma auto-discovery failed** (`get_metadata` returned nothing usable, no Website View / Mobile View) → ask for missing page frame URLs. **Do NOT ask if discovery already produced a page map** — see `figma-discovery.md`.
19
+ - **No `storeUrl` provided** → ask before starting dev server. See `dev-server-and-urls.md`.
20
+ - **Page URLs not confirmed** → ask before any `navigate_page`. Defaults are guesses only:
21
+ - Home: `http://localhost:3000/home` (NOT `/`)
22
+ - Product: `http://localhost:3000/products/item-1`
23
+ - Collection: `http://localhost:3000/collections/all-products`
24
+ Write confirmed URLs to `dev-config.json`.
25
+ - **Dev server not running** → ask developer to start it, or start it yourself with their `storeUrl` and notify them.
26
+
27
+ ### Section identification (page orchestrator Phase 2)
28
+
29
+ - **A region in the page Figma doesn't correspond to any sibling theme's archetype** (e.g. a brand-new section type not in any theme) → ask whether to (a) build from scratch from docs, (b) skip with a placeholder, or (c) the developer will provide a reference.
30
+ - **Two adjacent regions could be one section with 2 blocks OR 2 separate sections** → ask. Don't decide.
31
+ - **A region is in the Figma but the developer said "ignore non-Figma sections"** → ask whether to include it (because it IS in the Figma) or skip per their note.
32
+
33
+ ### Figma extraction (section builder Phase 2)
34
+
35
+ - **`get_design_context` fails on the section's node** ("nothing selected", network error, file access) → ask the developer to open Figma desktop and select the section, or to provide a fresh URL.
36
+ - **An image node returns an empty / non-PNG `get_screenshot`** → ask the developer to export it manually and drop into assets/.
37
+ - **A color in the Figma doesn't map to any theme token (ΔE > 1.5)** → ask whether to add a new theme token or use a one-off hex.
38
+ - **A font weight in the Figma isn't available in the theme's font setup** (e.g. Figma uses Oswald 850, but only 400/500/600/700 are loaded) → ask whether to add the weight to webfont imports, or use closest available.
39
+ - **A text element shows "Lorem ipsum" or other placeholder copy** → ask for the real copy. Never invent customer-facing copy.
40
+
41
+ ### Build (section builder Phase 4-5)
42
+
43
+ - **Schema setting has no obvious default** (e.g. CTA URL — should it be `/all-products`, `/cart`, or developer's choice?) → ask.
44
+ - **A section spans both desktop and mobile Figma frames that materially differ** (not just responsive resize — actually different layouts) → ask which is canonical and whether to implement both as separate variants.
45
+
46
+ ### Visual verify loop (Phase 7)
47
+
48
+ - **After 5 iterations of the verify loop, CRITICAL mismatches remain** → ask the developer for a specific call (e.g. "this hero text is supposed to be at bottom-left but I can't anchor it without affecting the next section's top spacing — should I add an absolute-positioned container, or use min-height on the panel?").
49
+ - **A visual element appears in the Figma but the agent can't reproduce it** (custom gradient, complex mask, blur, mix-blend mode) → ask how to handle.
50
+
51
+ ### State / interactivity
52
+
53
+ - **Hover / focus / pressed / disabled / loading state not shown in static Figma** → ask. Static design doesn't show these by default.
54
+ - **Animation or transition specs** (entrance animation, hover transition, scroll behavior) → ask.
55
+ - **Mobile breakpoints between 375 and 1440** (tablet 768px, desktop md/lg) → ask.
56
+ - **Conditional rendering rules** (show only if X, hide on Y page) → ask.
57
+
58
+ ## NEVER ask — look it up
59
+
60
+ - **Token values.** `theme.json`, `figma-variables.json`. Read them.
61
+ - **Tailwind class names.** Derived from `tailwind.config.js`. Read it.
62
+ - **Schema field types.** `zcommerce-docs/reference/schema-types.md`. Read it.
63
+ - **Liquid filter names.** `zcommerce-docs/reference/filters.md`. Read it.
64
+ - **Liquid tag names.** `zcommerce-docs/reference/tags.md`. Read it.
65
+ - **Global object properties.** `zcommerce-docs/reference/global-objects.md`. Read it.
66
+ - **File / folder conventions.** `zcommerce-docs/theme-structure.md`. Read it.
67
+ - **Performance / accessibility best practices.** `zcommerce-docs/best-practices.md`. Read it.
68
+ - **Asset filter syntax.** `zcommerce-docs/assets.md`. Read it.
69
+ - **i18n key conventions.** `zcommerce-docs/i18n.md`. Read it.
70
+ - **Pixel coordinates of elements in the Figma.** `get_design_context` returns these. Use it.
71
+
72
+ ## Format
73
+
74
+ Section subagents write to `<scratchpad>/sections/<section>/unresolved.md`. Page orchestrators collect them and ask the developer in ONE batch per page.
75
+
76
+ Each entry has this shape:
77
+
78
+ ```
79
+ ### Q{N} — {one-line summary}
80
+ **section:** hero-banner
81
+ **phase:** figma-extraction | build | verify-loop | other
82
+ **type:** missing-asset | unmapped-color | placeholder-copy | layout-stuck | state-undefined | other
83
+ **context:** {one paragraph explaining what you tried and what's stuck}
84
+ **options:**
85
+ a) {first concrete option}
86
+ b) {second concrete option}
87
+ c) {third concrete option}
88
+ **recommended:** a — {one-line justification}
89
+ **blocking:** true | false
90
+ **deadline:** {how long the orchestrator will wait before defaulting to `recommended`}
91
+ ```
92
+
93
+ The page orchestrator uses `AskUserQuestion` with up to 4 questions per page batch. If more than 4 unresolved, ask the 4 with `blocking: true` first; defer the rest with `recommended` answers and log to NEEDS_REVIEW.
94
+
95
+ **All subagent questions must also surface on the main agent screen.** See `subagent-escalation.md` — the main orchestrator posts a summary after each page agent completes, even if the page agent already asked the developer.
96
+
97
+ ## What good vs bad questions look like
98
+
99
+ **Bad (vague, unanswerable, indicates agent didn't try):**
100
+ - "What should the hero look like?"
101
+ - "How should I style the button?"
102
+ - "Is this section important?"
103
+
104
+ **Good (specific, with concrete options, ask only when the doc/spec lookup truly fails):**
105
+ - "The hero's right-panel has a #FFAB4A background in the Figma but the closest theme token is `--color-accent` (#FF8F6B, ΔE 2.1). Should I (a) add a new `--color-accent-warm` token, (b) use the closest existing `--color-accent`, or (c) hardcode the hex for this one-off?"
106
+ - "Figma node 2613:148 (the penguin plush image) returned an empty result from `get_screenshot`. Can you export this image manually from Figma and drop it into `assets/hero-banner-panel-left-penguin.png`?"
107
+ - "Hero text needs to be at bottom-left of the panel per Figma, but my CSS keeps causing the next section to overflow. I tried `justify-content: flex-end` (broke responsive), `padding-top: 60%` (broke at narrow viewports). Should I (a) use absolute positioning, (b) add a min-height to the panel, or (c) accept text-in-middle as a deviation?"
108
+
109
+ ## When the developer can't be reached promptly
110
+
111
+ For `blocking: false` questions, proceed with `recommended` after the deadline (default 2 minutes for a section subagent, 5 minutes for a page orchestrator batch). Log to NEEDS_REVIEW.
112
+
113
+ For `blocking: true` questions, the page orchestrator does NOT ship the page. It writes a NEEDS_REVIEW report and the main orchestrator surfaces to the developer as a build halt.