@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,418 @@
1
+ ---
2
+
3
+ description: Build a single section for a theme using Figma + reference + token map — with integrated design verification
4
+ alwaysApply: false
5
+ ---
6
+
7
+
8
+ # /build-section
9
+
10
+ Build ONE section at a time. Never build multiple sections in a single run.
11
+ This command produces a section that matches the Figma design on the FIRST pass
12
+ by extracting exact values, building to spec, and self-verifying before saving.
13
+
14
+ ## Usage
15
+ ```
16
+ /build-section <theme_name> <section_name> [figma_url_or_node_id]
17
+ ```
18
+
19
+ ---
20
+
21
+
22
+ ## Pre-flight Checks
23
+ Before writing any code, verify:
24
+ 1. `figma-variables.json` exists
25
+ - If missing → STOP: ask designer to export Figma variables JSON and place it here
26
+ 2. Identify the reference section from the audit plan or by scanning `sections/`
27
+ 3. Fetch the Figma frame automatically — see below
28
+
29
+ ## Figma Frame — via Cursor Figma MCP
30
+
31
+ Cursor reads the Figma frame from whatever is currently selected in the Figma app
32
+ via the Figma Dev Mode MCP plugin. The developer selects the correct frame in Figma
33
+ before running this command.
34
+
35
+ The MCP frame data is already in your context if the developer had a frame selected.
36
+ Look for it — it contains layout, typography, color, and spacing values.
37
+
38
+ If no Figma MCP context is present:
39
+ ```
40
+ ⚠️ No Figma frame data found.
41
+ Please:
42
+ 1. Open your Figma file in the browser
43
+ 2. Click on the <section_name> frame
44
+ 3. Re-run this command in Cursor
45
+ ```
46
+
47
+ **MCP fallback:** If Figma MCP is unavailable, ask: "You can paste a structured design spec (e.g. spacing, typography, colours, layout, CTA dimensions) and I'll build the section from that plus an existing section in this theme."
48
+
49
+ **Both frames required:** Ask for BOTH desktop and mobile Figma frames. If only one is provided, build from that but warn: "⚠️ Missing [desktop/mobile] frame — responsive overrides may be inaccurate."
50
+
51
+ ---
52
+
53
+
54
+ ## Stage 1 — Read Reference Section
55
+ Open the reference section file from this theme's `sections/` folder.
56
+ Extract and note down:
57
+ - All `{% schema %}` settings (field IDs, types, defaults, labels)
58
+ - All `{% liquid %}` assign statements
59
+ - All conditional logic (`{% if %}`, `{% unless %}`, `{% case %}`)
60
+ - All loops (`{% for %}`)
61
+ - All `{% render %}` calls
62
+ - Any JS component tag names (e.g. `<app-header>`, `<product-card>`)
63
+ - Any `{% style %}` blocks
64
+
65
+ This logic will be preserved exactly in the new section.
66
+
67
+ ---
68
+
69
+
70
+ ## Stage 2 — Extract Detailed Design Spec from Figma
71
+
72
+ **THIS IS THE MOST CRITICAL STAGE. Do not rush it. Do not skip elements.**
73
+
74
+ Follow the **Design Spec Extraction Protocol** in `.cursor/rules/design-spec-extraction.mdc`.
75
+
76
+ ### 2a. Extract the Element Hierarchy Tree (STRUCTURAL CONTRACT)
77
+ Read the Figma MCP response and map out the COMPLETE structure as a nested tree.
78
+ List EVERY element, its layout type (row/column/grid), children, and key structural properties.
79
+ This tree defines what HTML elements must exist and how they nest.
80
+ **If the Figma structure differs from the reference section, the Figma tree wins for HTML structure** — but preserve the reference's Liquid logic (loops, conditions, assigns).
81
+
82
+ Example:
83
+ ```
84
+ Section wrapper (column)
85
+ ├── Header row (row, justify-between)
86
+ │ ├── Title block (column)
87
+ │ │ ├── Heading H2
88
+ │ │ └── Description paragraph
89
+ │ └── Sort block (row)
90
+ │ ├── Label text
91
+ │ └── Dropdown
92
+ └── Content area (row)
93
+ ├── Filter sidebar (column, w-300px)
94
+ │ └── Filter groups...
95
+ └── Product grid (grid, 3 cols)
96
+ └── Product cards...
97
+ ```
98
+
99
+ ### 2b. Resolve ALL var() values
100
+ Read `figma-variables.json`.
101
+ For every `var(--name, fallback)` in the Figma MCP data:
102
+ - Look up the variable name by path in the JSON
103
+ - If `$value` exists → use it
104
+ - If not found → use the fallback
105
+ - If neither → STOP and flag as unresolved
106
+
107
+ ### 2c. Extract EXACT values for EVERY visible element
108
+ For every element in the Figma frame, extract exact resolved values:
109
+
110
+ **Per TEXT element:** font-size (px → Tailwind), font-weight (number → Tailwind), line-height, letter-spacing, text-color (hex → CSS var), text-align, max-width
111
+
112
+ **Per CONTAINER:** layout (flex/grid), columns, gap (px → Tailwind), padding (all sides, px → Tailwind), margin, alignment, background (hex → CSS var)
113
+
114
+ **Per IMAGE:** width, height, aspect-ratio, object-fit, border-radius (px → Tailwind)
115
+
116
+ **Per BUTTON/CTA:** padding (px → Tailwind), font-size, font-weight, background (hex → CSS var), text-color (hex → CSS var), border, border-radius
117
+
118
+ **Per CARD:** internal padding, background, border, border-radius, shadow, internal layout/gap, children
119
+
120
+ **Section-level:** padding-top, padding-bottom, background, container width, horizontal padding
121
+
122
+ ### 2d. Extract responsive differences from mobile frame
123
+ If mobile frame available, extract ONLY what differs: column count, font sizes, gaps, padding, visibility, stack direction.
124
+
125
+ ### 2e. Produce the Design Spec Table
126
+ Compile ALL extracted values into a structured table. This table is the BUILD CONTRACT.
127
+ Every row in this table MUST appear in the final HTML/CSS.
128
+
129
+ ```
130
+ DESIGN SPEC — <section_name>
131
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
132
+ # | Element | Property | Desktop Value | Mobile Override | Tailwind/CSS
133
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
134
+ 1 | Section heading | font-size | 48px | 30px | text-5xl md:text-3xl
135
+ ...
136
+ ```
137
+
138
+ **Print this table before proceeding to Stage 3.** This is the reference for everything that follows.
139
+
140
+ ---
141
+
142
+
143
+ ## Stage 3 — Map Figma Values to Tokens
144
+ Read `figma-variables.json`.
145
+
146
+ This JSON contains all resolved token values directly — no aliases, no guessing needed.
147
+ To find any token value:
148
+ - Font sizes are under `font > size > <name> > $value` (e.g. `font/size/9xl → 56`)
149
+ - Colors are under `color > <group> > <name> > $value > hex`
150
+ - Padding under `Padding > P - N > $value`
151
+ - Gap under `Gap > G - N > $value`
152
+ - Radius under `radius > <name> > $value`
153
+
154
+ For every value in the Design Spec Table:
155
+ - Font size → Tailwind class from token map (e.g. 56px → `text-[56px]`)
156
+ - Color → CSS variable from token map (e.g. #1a1a1a → `var(--color-heading)`)
157
+ - Spacing/gap → Tailwind class from token map (e.g. 24px → `gap-6`)
158
+ - Border radius → Tailwind class from token map (e.g. 12px → `rounded-xl`)
159
+ - If a value is NOT in the token map → use Tailwind arbitrary value and add a comment:
160
+ `{{-- ⚠️ token not mapped: 22px → using text-[22px] --}}`
161
+
162
+ Update the Design Spec Table's "Tailwind/CSS" column with the mapped values.
163
+
164
+ ---
165
+
166
+
167
+ ## Stage 4 — Build HTML Structure
168
+ Write the HTML/Liquid markup using the Design Spec Table as your blueprint.
169
+
170
+ **For each row in the spec table, apply the exact Tailwind/CSS value.** Do not deviate.
171
+
172
+ Rules:
173
+ - Use semantic HTML: `<section>`, `<article>`, `<nav>`, `<header>`, `<footer>`, `<ul>/<li>`
174
+ - Layout: Tailwind flexbox or grid — never absolute positioning
175
+ - Colors: only `var(--color-*)` tokens — never raw hex inline
176
+ - Typography: only Tailwind text classes from token map — never inline font-size
177
+ - Spacing: only Tailwind spacing classes from token map
178
+ - Responsive: use mobile-first approach. Base classes = mobile, `md:` prefix = desktop.
179
+ Example: `class="text-3xl md:text-5xl gap-4 md:gap-6 grid-cols-2 md:grid-cols-4"`
180
+ - All dynamic content uses Liquid variables with placeholder assigns:
181
+ `{% assign heading = section.settings.heading %}`
182
+ - Images use:
183
+ ```liquid
184
+ <img src="{{ section.settings.image_field.url }}" alt="{{ section.settings.alt | escape }}"
185
+ width="800" height="600" loading="lazy">
186
+ ```
187
+ - Wrap section in:
188
+ ```liquid
189
+ <section id="section-{{ section.id }}" class="...">
190
+ ```
191
+
192
+ **IMPORTANT — Match spec exactly:**
193
+ - If the spec says `gap-6`, use `gap-6` — not `gap-4` or `gap-8`
194
+ - If the spec says `text-5xl font-bold`, use both — do not omit font-weight
195
+ - If the spec says `rounded-xl`, use `rounded-xl` — not `rounded-lg`
196
+ - If the spec has mobile overrides, include responsive prefixes
197
+
198
+ ---
199
+
200
+
201
+ ## Stage 5 — Add Schema
202
+ Add `{% schema %}` at the bottom of the file.
203
+
204
+ For every Liquid variable used in Stage 4, create the correct schema field.
205
+ Always use custom schema syntax from schema.mdc — never standard Shopify syntax:
206
+
207
+ - url → `{ "display_name": "t:...", "handle": "/path" }`
208
+ - image_picker → `{ "url": "file.webp", "enable_customisation": true }`
209
+ - media_picker (video) → `{ "url": "video.mp4", "is_video": true }`
210
+ - select → `{ "display_name": "t:...", "value": "option-value" }`
211
+ - menu → `{ "display_name": "t:...", "handle": "" }`
212
+ - text default → `"t:sections.<name>.settings.<id>.default"`
213
+ - All labels → `"t:sections.<name>.settings.<id>.label"`
214
+
215
+ **Heading vs content field types:**
216
+ - Heading/title/eyebrow/badge/button-label fields → `type: "text"` (never `richtext`); render with `{{ field | escape }}`
217
+ - Description/body/paragraph content → `type: "richtext"`; render with `{{ field | raw }}`
218
+ - Heading blocks (`heading`, `title`, etc.) → `text` settings only
219
+
220
+ Copy schema fields from the reference section first, then add any NEW fields identified in Stage 2.
221
+
222
+ Always include at the end of settings:
223
+ ```jsonc
224
+ { "type": "range", "id": "padding_top", "min": 0, "max": 100, "step": 4, "unit": "px", "default": 40, "label": "t:sections.<name>.settings.padding_top.label" },
225
+ { "type": "range", "id": "padding_bottom", "min": 0, "max": 100, "step": 4, "unit": "px", "default": 40, "label": "t:sections.<name>.settings.padding_bottom.label" }
226
+ ```
227
+
228
+ **Set padding_top/padding_bottom defaults from the Figma spec** — not always 40. If Figma shows 48px top and 64px bottom, use those as defaults.
229
+
230
+ ---
231
+
232
+
233
+ ## Stage 6 — Add Style Block and Script
234
+ Add `{% style %}` block above the HTML:
235
+ ```liquid
236
+ {% style %}
237
+ #section-{{ section.id }} {
238
+ padding-top: {{ section.settings.padding_top }}px;
239
+ padding-bottom: {{ section.settings.padding_bottom }}px;
240
+ }
241
+ {% endstyle %}
242
+ ```
243
+
244
+ Add script tag if the reference section used a JS component:
245
+ ```liquid
246
+ <script src="{{ 'component-name.js' | asset_url }}" defer></script>
247
+ ```
248
+
249
+ ---
250
+
251
+
252
+ ## Stage 7 — Self-Compare Against Design Spec (CRITICAL — DO NOT SKIP)
253
+
254
+ Before saving the file, run a compare pass using the Design Spec Table from Stage 2d.
255
+
256
+ **For every row in the spec table:**
257
+ 1. Find the corresponding HTML element in your generated code
258
+ 2. Verify the Tailwind class / CSS variable matches EXACTLY
259
+ 3. If it doesn't match → fix it immediately
260
+
261
+ ### Check each property:
262
+ - [ ] Font size: does the Tailwind class match the spec? (e.g. spec says `text-5xl`, code has `text-5xl`?)
263
+ - [ ] Font weight: does the Tailwind class match? (e.g. spec says `font-bold`, code has `font-bold`?)
264
+ - [ ] Text color: does the CSS variable match? (e.g. spec says `var(--color-heading)`, code uses it?)
265
+ - [ ] Spacing/gap: do Tailwind gap/padding/margin classes match spec exactly?
266
+ - [ ] Border radius: does the Tailwind class match spec?
267
+ - [ ] Layout direction: does the flex/grid setup match spec?
268
+ - [ ] Column count: does grid-cols match spec at each breakpoint?
269
+ - [ ] Background color: does the CSS variable match spec?
270
+ - [ ] Button styling: do all button properties match spec?
271
+ - [ ] Image properties: aspect-ratio, object-fit, border-radius match?
272
+ - [ ] Responsive overrides: are mobile-first classes with `md:` prefixes present for all mobile overrides in spec?
273
+
274
+ ### Produce a self-compare report:
275
+ ```
276
+ SELF-COMPARE — <section_name>
277
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
278
+ Spec rows checked: <n>
279
+ Matches: <n>
280
+ Mismatches found and auto-fixed: <n>
281
+ - [list each mismatch and what was corrected]
282
+ Unresolvable: <n>
283
+ - [list any that couldn't be resolved]
284
+ ```
285
+
286
+ **If ANY mismatches are found, fix them in the code BEFORE proceeding.**
287
+
288
+ ---
289
+
290
+
291
+ ## Stage 8 — Code QA Before Saving
292
+ After the self-compare pass, also check:
293
+ - [ ] Every `section.settings.X` has a matching schema field
294
+ - [ ] No raw hex colors inline (all use `var(--color-*)`)
295
+ - [ ] No raw px font sizes inline (all use Tailwind classes)
296
+ - [ ] All loops have empty state handling
297
+ - [ ] All images have width, height, alt, loading attributes
298
+ - [ ] Video fields use `media_picker` schema with default `{ "url": "video.mp4", "is_video": true }`
299
+ - [ ] All labels/defaults use `t:` translation keys
300
+ - [ ] Schema has padding_top and padding_bottom settings (with Figma-accurate defaults)
301
+ - [ ] Schema has at least one preset
302
+ - [ ] No static px/color values in `{% style %}` block that should be Tailwind classes
303
+ - [ ] Responsive classes present for all mobile overrides from spec
304
+ - [ ] Heading/title fields use `text`; body/description fields use `richtext` (never `richtext` on heading blocks)
305
+
306
+ ---
307
+
308
+
309
+ ## Output
310
+ Save to: `sections/<section_name>.liquid`
311
+
312
+ After saving, report:
313
+ ```
314
+ ✅ Section built: sections/<section_name>.liquid
315
+
316
+ DESIGN SPEC SUMMARY (from Figma):
317
+ - [number] elements extracted, [number] properties mapped
318
+
319
+ SELF-COMPARE RESULT:
320
+ - Spec rows: <n> | Matches: <n> | Auto-fixed: <n> | Unresolvable: <n>
321
+
322
+ WHAT WAS PRESERVED FROM REFERENCE:
323
+ - [list schema fields kept]
324
+ - [list logic/loops kept]
325
+
326
+ WHAT WAS NEW FROM FIGMA:
327
+ - [list new schema fields added]
328
+ - [list structural changes]
329
+
330
+ ⚠️ UNMAPPED TOKENS (review these):
331
+ - [any values not found in figma-variables.json]
332
+
333
+ ⚠️ UNRESOLVABLE MISMATCHES (need manual review):
334
+ - [any spec rows that couldn't be matched]
335
+
336
+ NEXT: Run /compare-section <theme_name> <section_name> for final Figma verification
337
+ Or run /build-section <theme_name> <next_section_name>
338
+ ```
339
+
340
+ ---
341
+
342
+
343
+ ## Section File Anatomy — Required Structure (top to bottom)
344
+
345
+ Every section file must follow this exact order:
346
+
347
+ ```liquid
348
+ {{-- 1. SCRIPT TAGS --}}
349
+ <script src="{{ 'component-name.js' | asset_url }}" defer></script>
350
+
351
+ {{-- 2. STYLE BLOCK --}}
352
+ {% style %}
353
+ #section-{{ section.id }} {
354
+ padding-top: {{ section.settings.padding_top }}px;
355
+ padding-bottom: {{ section.settings.padding_bottom }}px;
356
+ }
357
+ {% endstyle %}
358
+
359
+ {{-- 3. LIQUID ASSIGNS --}}
360
+ {% liquid
361
+ assign heading = section.settings.heading
362
+ assign cta_url = section.settings.cta_url
363
+ assign bg_image = section.settings.bg_image
364
+ assign show_section = section.settings.show_section
365
+ %}
366
+
367
+ {{-- 4. CONDITIONAL VISIBILITY --}}
368
+ {% if show_section %}
369
+
370
+ {{-- 5. SECTION WRAPPER --}}
371
+ <section id="section-{{ section.id }}" class="section-name w-full">
372
+ <div class="max-w-container-theme mx-auto"
373
+ style="padding-left: var(--section-padding-x, 16px); padding-right: var(--section-padding-x, 16px);">
374
+
375
+ {{-- 6. CONTENT --}}
376
+ {% if heading != blank %}
377
+ <h2 class="text-4xl font-bold" style="color: var(--color-heading);">{{ heading | escape }}</h2>
378
+ {% endif %}
379
+
380
+ {{-- 7. LOOPS — always with empty state --}}
381
+ {% if items.size > 0 %}
382
+ {% for item in items %}
383
+ {{-- item markup --}}
384
+ {% endfor %}
385
+ {% else %}
386
+ <p class="text-center" style="color: var(--color-heading);">No items found.</p>
387
+ {% endif %}
388
+
389
+ </div>
390
+ </section>
391
+
392
+ {% endif %}
393
+
394
+ {{-- 8. SCHEMA — always last --}}
395
+ {% schema %}
396
+ {
397
+ "name": "t:sections.<n>.name",
398
+ "tag": "section",
399
+ "class": "section",
400
+ "settings": [
401
+ { "type": "text", "id": "heading", "label": "t:sections.<n>.settings.heading.label", "default": "t:sections.<n>.settings.heading.default" },
402
+ { "type": "checkbox", "id": "show_section", "label": "t:sections.<n>.settings.show_section.label", "default": true },
403
+ { "type": "range", "id": "padding_top", "min": 0, "max": 100, "step": 4, "unit": "px", "default": 40, "label": "t:sections.<n>.settings.padding_top.label" },
404
+ { "type": "range", "id": "padding_bottom", "min": 0, "max": 100, "step": 4, "unit": "px", "default": 40, "label": "t:sections.<n>.settings.padding_bottom.label" }
405
+ ],
406
+ "blocks": [],
407
+ "presets": [{ "name": "t:sections.<n>.presets.default.name" }]
408
+ }
409
+ {% endschema %}
410
+ ```
411
+
412
+ ### Order Rules
413
+ - Script tags → TOP
414
+ - Style block → after scripts, before assigns
415
+ - All assigns → single `{% liquid %}` block
416
+ - Schema → ALWAYS last, never in the middle
417
+ - Every loop → MUST have `{% else %}` empty state
418
+ - Every heading/text → check `!= blank` before rendering