@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.
- package/README.md +61 -0
- package/package.json +2 -2
- package/ts-dist/mocks/init-theme/.claude/CLAUDE.md +6 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/SKILL.md +242 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/inputs/figma.md +81 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/inputs/screenshot.md +54 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/inputs/url.md +88 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/spec-table.md +102 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/verification/accessibility.md +110 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/verification/performance.md +127 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/verification/tokens.md +87 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/verification/visual-diff.md +123 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/SKILL.md +605 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/design-tokens.md +105 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/page-json-contract.md +58 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/qa-accessibility.md +35 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/reference-lookup.md +94 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/section-anatomy.md +109 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/SKILL.md +313 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/agent-hierarchy.md +142 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/ask-developer.md +113 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/bootstrap.md +260 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/build-metrics.md +89 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/code-quality.md +186 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/common-pages-agent.md +97 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/dev-server-and-urls.md +127 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/exemplars.md +79 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/figma-discovery.md +138 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/figma-extraction.md +132 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/image-sources.md +84 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/inputs/guidelines-frame.md +178 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/page-builder.md +322 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/page-orchestrator.md +199 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/parallel-fanout.md +152 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/a11y.mjs +129 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/lint-section.mjs +502 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/perf.mjs +134 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/pixel-diff.mjs +206 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/record-build-metrics.mjs +118 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/section-builder.md +131 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/subagent-escalation.md +75 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/transcription-rules.md +98 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/verification.md +227 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/visual-verify-loop.md +117 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/_index.md +4 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/assets.md +105 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/best-practices.md +212 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/custom-scripts.md +294 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/i18n.md +155 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/introduction.md +91 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/layouts.md +158 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/pages.md +156 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/_index.md +4 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/filters.md +419 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/global-objects.md +415 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/schema-types.md +926 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/tags.md +259 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/sections.md +203 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/setup-guide.md +424 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/snippets.md +70 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/theme-structure.md +252 -0
- package/ts-dist/mocks/init-theme/.cursor/PLAYBOOK.md +144 -0
- package/ts-dist/mocks/init-theme/.cursor/README.md +6 -0
- package/ts-dist/mocks/init-theme/.cursor/agents/figma-desktop-mobile-parallel.md +48 -0
- package/ts-dist/mocks/init-theme/.cursor/agents/visual-compare.md +221 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/add-field.md +83 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/add-theme-setting.md +200 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/assemble-page.md +72 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/audit-page.md +57 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/build-page-sections.md +110 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/build-section.md +418 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/build-theme.md +307 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/compare-section.md +358 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/create-theme.md +77 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/extract-tokens.md +43 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/fix-section.md +92 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/impact.md +50 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/qa-a11y.md +66 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/qa-i18n.md +110 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/qa-layout.md +127 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/qa-performance.md +72 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/qa-section.md +84 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/qa-sections.md +48 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/qa-theme.md +85 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/redesign-section.md +177 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/refactor-section.md +185 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/sync-theme-settings.md +132 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/validate-page.md +60 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/validate-section-group.md +88 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/validate-theme-settings.md +119 -0
- package/ts-dist/mocks/init-theme/.cursor/examples/design-instructions-template.md +151 -0
- package/ts-dist/mocks/init-theme/.cursor/mcp.json +18 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/README.md +160 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/accessibility.mdc +24 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/add-field.mdc +222 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/add-theme-setting.mdc +39 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/assemble-page.mdc +130 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/audit-page.mdc +92 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/build-section.mdc +178 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/build-theme.mdc +47 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/compare-section.mdc +94 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/create-theme.mdc +78 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/css.mdc +137 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/design-spec-extraction.mdc +255 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/extract-tokens.mdc +43 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/figma-mcp-resolution.mdc +40 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/fix-section.mdc +154 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/general.mdc +30 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/i18n.mdc +85 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/javascript.mdc +85 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/liquid-no-hardcoded-strings.mdc +42 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/liquid.mdc +171 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/mobile-desktop-setting-meta.mdc +34 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/naming-convention.mdc +64 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/pages.mdc +120 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/performance.mdc +51 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/qa-section.mdc +134 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/redesign-section.mdc +147 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/schema-sync.mdc +110 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/schema.mdc +360 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/share-urls.mdc +68 -0
- package/ts-dist/mocks/init-theme/.cursor/skills/browser-verify.md +128 -0
- package/ts-dist/mocks/init-theme/.cursor/skills/design-tokens.md +105 -0
- package/ts-dist/mocks/init-theme/.cursor/skills/page-json-contract.md +87 -0
- package/ts-dist/mocks/init-theme/.cursor/skills/qa-accessibility.md +35 -0
- package/ts-dist/mocks/init-theme/.cursor/skills/reference-lookup.md +88 -0
- package/ts-dist/mocks/init-theme/.cursor/skills/section-anatomy.md +173 -0
|
@@ -0,0 +1,178 @@
|
|
|
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>
|
|
17
|
+
```
|
|
18
|
+
Provide the Figma frame for this specific section via MCP or screenshot.
|
|
19
|
+
**Request BOTH desktop and mobile frames** for accurate responsive output.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## Pre-flight Checks
|
|
25
|
+
Before writing any code, verify:
|
|
26
|
+
1. `figma-variables.json` exists
|
|
27
|
+
- If missing → STOP: ask designer to export Figma variables JSON and place it here
|
|
28
|
+
2. Identify the reference section from the audit plan or by scanning `sections/`
|
|
29
|
+
3. Confirm Figma frame is available (MCP or screenshot)
|
|
30
|
+
4. Read `.cursor/rules/design-spec-extraction.mdc` — the extraction protocol
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## Stage 1 — Read Reference Section
|
|
36
|
+
Open the reference section file from this theme's `sections/` folder.
|
|
37
|
+
Extract and note down:
|
|
38
|
+
- All `{% schema %}` settings (field IDs, types, defaults, labels)
|
|
39
|
+
- All `{% liquid %}` assign statements
|
|
40
|
+
- All conditional logic (`{% if %}`, `{% unless %}`, `{% case %}`)
|
|
41
|
+
- All loops (`{% for %}`)
|
|
42
|
+
- All `{% render %}` calls
|
|
43
|
+
- Any JS component tag names (e.g. `<app-header>`, `<product-card>`)
|
|
44
|
+
- Any `{% style %}` blocks
|
|
45
|
+
|
|
46
|
+
This logic will be preserved exactly in the new section.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Stage 2 — Extract Detailed Design Spec from Figma
|
|
52
|
+
|
|
53
|
+
**THIS IS THE MOST CRITICAL STAGE. Do not rush it. Do not skip elements.**
|
|
54
|
+
|
|
55
|
+
Follow the **Design Spec Extraction Protocol** in `.cursor/rules/design-spec-extraction.mdc`.
|
|
56
|
+
|
|
57
|
+
### 2a. Resolve ALL var() values first
|
|
58
|
+
For every `var(--name, fallback)` in the Figma MCP data:
|
|
59
|
+
- Look up in `figma-variables.json` by path → use `$value` if present, fallback otherwise
|
|
60
|
+
- If neither → STOP and flag as unresolved
|
|
61
|
+
|
|
62
|
+
### 2b. Extract EXACT values for EVERY visible element
|
|
63
|
+
Per TEXT: font-size, font-weight, line-height, letter-spacing, color, text-align, max-width
|
|
64
|
+
Per CONTAINER: layout, columns, gap, padding, margin, alignment, background
|
|
65
|
+
Per IMAGE: width, height, aspect-ratio, object-fit, border-radius
|
|
66
|
+
Per BUTTON: padding, font-size, font-weight, background, text-color, border, border-radius
|
|
67
|
+
Per CARD: padding, background, border, border-radius, shadow, internal layout, children
|
|
68
|
+
Section-level: padding-top, padding-bottom, background, container width
|
|
69
|
+
|
|
70
|
+
### 2c. Extract responsive differences from mobile frame
|
|
71
|
+
Column count, font sizes, gaps, padding, visibility, stack direction.
|
|
72
|
+
|
|
73
|
+
### 2d. Produce the Design Spec Table
|
|
74
|
+
Every row = one element+property. This table is the BUILD CONTRACT.
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
# | Element | Property | Desktop Value | Mobile Override | Tailwind/CSS
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Print this table before proceeding.** Every row MUST appear in the final code.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
## Stage 3 — Map Figma Values to Tokens
|
|
86
|
+
Read `figma-variables.json`.
|
|
87
|
+
|
|
88
|
+
For every value in the Design Spec Table:
|
|
89
|
+
- Font size → Tailwind class from token map
|
|
90
|
+
- Color → CSS variable from token map
|
|
91
|
+
- Spacing/gap → Tailwind class from token map
|
|
92
|
+
- Border radius → Tailwind class from token map
|
|
93
|
+
- If NOT in token map → use Tailwind arbitrary value + comment: `{{-- ⚠️ token not mapped: 22px → using text-[22px] --}}`
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## Stage 4 — Build HTML Structure
|
|
99
|
+
Use the Design Spec Table as your blueprint. For each row, apply the exact Tailwind/CSS value.
|
|
100
|
+
|
|
101
|
+
Rules:
|
|
102
|
+
- Semantic HTML: `<section>`, `<article>`, `<nav>`, `<header>`, `<footer>`, `<ul>/<li>`
|
|
103
|
+
- Layout: Tailwind flexbox or grid — never absolute positioning
|
|
104
|
+
- Colors: only `var(--color-*)` tokens — never raw hex inline
|
|
105
|
+
- Typography: only Tailwind text classes — never inline font-size
|
|
106
|
+
- Spacing: only Tailwind spacing classes from token map
|
|
107
|
+
- Responsive: mobile-first. Base = mobile, `md:` = desktop
|
|
108
|
+
- Dynamic content via Liquid assigns: `{% assign heading = section.settings.heading %}`
|
|
109
|
+
|
|
110
|
+
**Match the spec table EXACTLY. Do not approximate.**
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
## Stage 5 — Add Schema
|
|
116
|
+
Custom syntax from schema.mdc — never Shopify syntax.
|
|
117
|
+
Set padding_top/padding_bottom defaults from the Figma spec (not always 40).
|
|
118
|
+
|
|
119
|
+
**Heading vs content field types:**
|
|
120
|
+
- Heading/title/eyebrow/badge/button-label fields → `type: "text"` (never `richtext`); render with `{{ field | escape }}`
|
|
121
|
+
- Description/body/paragraph content → `type: "richtext"`; render with `{{ field | raw }}`
|
|
122
|
+
- Heading blocks (`heading`, `title`, etc.) → `text` settings only
|
|
123
|
+
|
|
124
|
+
**Blocks — choose the right model:**
|
|
125
|
+
- **Repeating content unique to this section** → local block (inline `settings` in section schema)
|
|
126
|
+
- **Reusable across sections** (text, button, image, carousel, accordion) → theme block in `blocks/<name>.liquid`; section schema opts in with `{ "type": "zc_theme__<name>" }`; render with `{% render_blocks %}` or `{% render block %}`
|
|
127
|
+
- **Mixed** → list both in section schema; local types in `{% case %}`, theme types via `{% render block %}`
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
## Stage 6 — Add Style Block and Script
|
|
133
|
+
`{% style %}` for dynamic schema values only. Static values go in Tailwind classes.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## Stage 7 — Self-Compare Against Design Spec (CRITICAL)
|
|
139
|
+
|
|
140
|
+
For EVERY row in the Design Spec Table:
|
|
141
|
+
1. Find the corresponding HTML element in the generated code
|
|
142
|
+
2. Verify the Tailwind class / CSS variable matches EXACTLY
|
|
143
|
+
3. If mismatch → fix immediately
|
|
144
|
+
|
|
145
|
+
Produce a self-compare report:
|
|
146
|
+
```
|
|
147
|
+
Spec rows: <n> | Matches: <n> | Auto-fixed: <n> | Unresolvable: <n>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Fix ALL mismatches before proceeding.**
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
## Stage 8 — Code QA Before Saving
|
|
156
|
+
- [ ] Every `section.settings.X` has a matching schema field
|
|
157
|
+
- [ ] No raw hex colors (all use `var(--color-*)`)
|
|
158
|
+
- [ ] No raw px font sizes (all use Tailwind classes)
|
|
159
|
+
- [ ] All loops have empty state handling
|
|
160
|
+
- [ ] All images have width, height, alt, loading
|
|
161
|
+
- [ ] All labels/defaults use `t:` translation keys
|
|
162
|
+
- [ ] Schema has padding_top/padding_bottom with Figma-accurate defaults
|
|
163
|
+
- [ ] Schema has at least one preset
|
|
164
|
+
- [ ] Responsive classes present for all mobile overrides in spec
|
|
165
|
+
- [ ] Heading/title fields use `text`; body/description fields use `richtext` (never `richtext` on heading blocks)
|
|
166
|
+
- [ ] Theme blocks: if used, `blocks/<name>.liquid` exists with `presets`; section schema opts in; page JSON uses `zc_theme__<name>` types
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
## Output
|
|
172
|
+
Save to: `sections/<section_name>.liquid`
|
|
173
|
+
|
|
174
|
+
Report: section path, self-compare results, preserved reference items, new Figma items, unmapped tokens.
|
|
175
|
+
|
|
176
|
+
## Section File Anatomy — Required Structure (top to bottom)
|
|
177
|
+
|
|
178
|
+
Script tags → Style block → Liquid assigns → Conditional visibility → Section wrapper → Content → Loops with empty states → Schema (always last)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Autopilot — scaffold, extract tokens, audit pages, build all sections with design verification, assemble pages, and QA an entire theme from a Figma file
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /build-theme
|
|
7
|
+
|
|
8
|
+
Full autopilot: takes a Figma file and a theme name and orchestrates every step from scaffold to final QA. Includes integrated design verification — sections are built to match Figma on the first pass.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
```
|
|
12
|
+
/build-theme <theme_name> <figma_file_key> [<root_node_id>]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Agent hierarchy — Level 0 → A → B
|
|
16
|
+
|
|
17
|
+
See `.claude/skills/theme-from-figma/agent-hierarchy.md`.
|
|
18
|
+
|
|
19
|
+
| Level | Role | Scope |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| **0** | Main orchestrator | Discover pages, bootstrap, spawn Level A |
|
|
22
|
+
| **A** | Page orchestrator | Identify sections + node IDs; spawn Level B; assemble page JSON; whole-page visual verify |
|
|
23
|
+
| **B** | Section builder | **One section Figma node only** → `figma-spec.json` → Liquid; lint + section visual verify |
|
|
24
|
+
|
|
25
|
+
**Anti-hallucination rules** (`transcription-rules.md`):
|
|
26
|
+
- No `rounded-*` unless Figma spec has `border_radius > 0`
|
|
27
|
+
- Colors only from spec → token map (not sibling themes)
|
|
28
|
+
- Product grids: fixed media box `w`×`h` + `object-fit` (prevents uneven card heights)
|
|
29
|
+
|
|
30
|
+
## Phases
|
|
31
|
+
|
|
32
|
+
0. **Discover** — `figma-discovery.md`: page map from file key
|
|
33
|
+
1. **Bootstrap** — tokens, `dev-config.json`, developer approves page map
|
|
34
|
+
2. **Stage 1** — Level A per page (`parallel-fanout.md`): index first, then parallel
|
|
35
|
+
- Level A → Level B per section (parallel within page)
|
|
36
|
+
- Level B: `section-builder.md` + `figma-extraction.md` + `transcription-rules.md`
|
|
37
|
+
3. **Stage 2** — `verify-theme.mjs`, `build-metrics.md`, consolidation
|
|
38
|
+
|
|
39
|
+
### Rules
|
|
40
|
+
- Level B MUST call `get_design_context` on **section node ID only** — never parent page
|
|
41
|
+
- Level B PASS = `lint-section.mjs` + `visual-diff.md` with 0 CRITICAL (section crop)
|
|
42
|
+
- Level A MUST NOT write section Liquid — only assemble + whole-page visual verify
|
|
43
|
+
- Both desktop and mobile Figma nodes per section
|
|
44
|
+
- `figma-spec.json` is the contract — zero improvisation
|
|
45
|
+
- Heading blocks and title fields → `text` only; body/description → `richtext`
|
|
46
|
+
|
|
47
|
+
See `.cursor/commands/build-theme.md` and `.claude/skills/theme-from-figma/SKILL.md`.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
description: Compare a built section against its Figma design and report all mismatches by severity
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# /compare-section
|
|
9
|
+
|
|
10
|
+
Compare a built section file against its Figma design source.
|
|
11
|
+
Produces a structured mismatch report grouped by severity.
|
|
12
|
+
Does NOT fix anything — approval required before any changes.
|
|
13
|
+
Always run /qa-section first, then /compare-section, then /fix-section.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
```
|
|
17
|
+
/compare-section <theme_name> <section_name>
|
|
18
|
+
/compare-section <theme_name> <section_name> --visual [--page <page_name>] [--store-url <url>]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Modes
|
|
22
|
+
- **Default (code compare):** Extracts values from code and Figma, compares numerically. Fast, precise.
|
|
23
|
+
- **Visual (`--visual`):** Delegates to the `visual-compare` subagent (`.cursor/agents/visual-compare.md`). Launches dev server, screenshots the rendered section in browser (desktop + mobile), fetches Figma screenshot, and produces a visual diff report. Requires Claude in Chrome + Figma MCP.
|
|
24
|
+
- **Combined (recommended for final QA):** Run both modes sequentially.
|
|
25
|
+
|
|
26
|
+
Provide design input in one of these forms (best to worst accuracy):
|
|
27
|
+
1. Figma MCP frame data (exact values — preferred)
|
|
28
|
+
2. Figma screenshot + browser screenshot of rendered section
|
|
29
|
+
3. Figma screenshot only
|
|
30
|
+
4. Written description of design intent
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## Pre-flight — Files to Read Automatically
|
|
36
|
+
|
|
37
|
+
Before comparing, read ALL of these without being asked:
|
|
38
|
+
|
|
39
|
+
1. `sections/<section_name>.liquid` — the section file
|
|
40
|
+
2. Every snippet referenced via `{% render 'snippet-name' %}` inside the section
|
|
41
|
+
- Read `snippets/<snippet-name>.liquid` for each
|
|
42
|
+
- Repeat recursively — if a snippet renders another snippet, read that too
|
|
43
|
+
3. `figma-variables.json` — the token map for this theme
|
|
44
|
+
4. `.cursor/rules/css.mdc` — to reference the Figma → Tailwind conversion table
|
|
45
|
+
5. `.cursor/rules/design-spec-extraction.mdc` — the extraction protocol
|
|
46
|
+
|
|
47
|
+
Never ask the developer to paste file contents — read them directly.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## Core Process
|
|
53
|
+
|
|
54
|
+
### Stage 1 — Extract Code Values
|
|
55
|
+
Extract current values for EVERY element: typography, spacing, layout, visual, images, buttons.
|
|
56
|
+
Produce a structured list (element → property → current value).
|
|
57
|
+
|
|
58
|
+
### Stage 2 — Extract Figma Values Using Design Spec Extraction Protocol
|
|
59
|
+
Follow `.cursor/rules/design-spec-extraction.mdc`:
|
|
60
|
+
- Resolve ALL var() from `figma-variables.json` first
|
|
61
|
+
- Extract exact values per element
|
|
62
|
+
- Produce the Design Spec Table
|
|
63
|
+
|
|
64
|
+
### Stage 3 — Compare and Classify
|
|
65
|
+
For every spec row, compare Figma value vs code value.
|
|
66
|
+
Classify mismatches as 🔴 CRITICAL, 🟡 MINOR, or ⚪ SUGGESTION.
|
|
67
|
+
Include a design accuracy percentage (matched / total rows).
|
|
68
|
+
|
|
69
|
+
### Stage 4 — Check Responsive
|
|
70
|
+
Compare mobile frame differences: columns, fonts, gaps, padding, visibility.
|
|
71
|
+
|
|
72
|
+
### Stage 5 — Apply Approved Fixes
|
|
73
|
+
Only after developer approval. Reference issue numbers in comments.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Key Rules
|
|
78
|
+
- Follow Design Spec Extraction Protocol for ALL Figma data
|
|
79
|
+
- Always resolve var() from figma-variables.json before comparing
|
|
80
|
+
- Only compare resolved px/hex values — never variable names
|
|
81
|
+
- Output includes the full Design Spec Table for developer reference
|
|
82
|
+
- Never change schema fields or Liquid logic — HTML/CSS only
|
|
83
|
+
|
|
84
|
+
### Visual Mode (`--visual`)
|
|
85
|
+
When `--visual` is passed, delegate to the `visual-compare` subagent instead of running the code compare stages. The subagent:
|
|
86
|
+
1. Checks/starts the dev server
|
|
87
|
+
2. Uses Claude in Chrome to screenshot the rendered section (desktop 1440px + mobile 375px)
|
|
88
|
+
3. Fetches Figma screenshot via `get_screenshot`
|
|
89
|
+
4. Compares visually and reports: layout, spacing, typography, colors, images, responsive
|
|
90
|
+
5. Checks browser console for errors
|
|
91
|
+
6. Produces a visual diff report (CRITICAL / MINOR / SUGGESTION / MOBILE-SPECIFIC)
|
|
92
|
+
|
|
93
|
+
See full command in `.cursor/commands/compare-section.md`.
|
|
94
|
+
See visual-compare agent in `.cursor/agents/visual-compare.md`.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Scaffold a new theme folder with all required files and structure
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /create-theme
|
|
7
|
+
|
|
8
|
+
Scaffold a new theme from this theme's existing files.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
```
|
|
12
|
+
/create-theme <theme_name>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Step 1 — Validate
|
|
18
|
+
- If `` already exists → STOP and warn the user, do not overwrite
|
|
19
|
+
- If theme_name is blank → ask the user to provide a name
|
|
20
|
+
|
|
21
|
+
## Step 2 — Find Reference Theme
|
|
22
|
+
- Use this theme's current layouts, snippets, settings, and config as the copy template
|
|
23
|
+
- Do not look outside this theme directory for other themes
|
|
24
|
+
|
|
25
|
+
## Step 3 — Create Folder Structure
|
|
26
|
+
Run terminal commands to create:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
assets/
|
|
31
|
+
i18n/
|
|
32
|
+
en.json ← copy from reference theme, keep structure, clear values
|
|
33
|
+
en.schema.json ← copy from reference theme, keep structure, clear values
|
|
34
|
+
layouts/
|
|
35
|
+
theme.liquid ← copy from reference theme as-is
|
|
36
|
+
accounts.liquid ← copy from reference theme as-is
|
|
37
|
+
sitemap.liquid ← copy from reference theme as-is
|
|
38
|
+
sections/ ← empty folder
|
|
39
|
+
blocks/ ← empty folder (reusable theme blocks)
|
|
40
|
+
snippets/ ← copy all snippets from reference theme as-is
|
|
41
|
+
(icons, search-bar, header-sidebar, etc. are shared infrastructure)
|
|
42
|
+
pages/
|
|
43
|
+
404.json
|
|
44
|
+
blog.json
|
|
45
|
+
cart.json
|
|
46
|
+
categories.json
|
|
47
|
+
checkout.json
|
|
48
|
+
collection.json
|
|
49
|
+
index.json
|
|
50
|
+
orders.json
|
|
51
|
+
page.json
|
|
52
|
+
payment.json
|
|
53
|
+
product.json
|
|
54
|
+
sitemap.json
|
|
55
|
+
settings/
|
|
56
|
+
schema.json ← copy from reference theme as-is
|
|
57
|
+
theme.json ← copy from reference theme as-is
|
|
58
|
+
favicon.ico
|
|
59
|
+
package.json ← copy from reference theme, update name field to <theme_name>
|
|
60
|
+
postcss.config.js ← copy from reference theme as-is
|
|
61
|
+
project.json ← copy from reference theme, update name field to <theme_name>
|
|
62
|
+
tailwind.config.js ← copy from reference theme as-is
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Step 4 — Note About Tokens
|
|
66
|
+
Do NOT create figma-tokens.md. Tokens are read directly from:
|
|
67
|
+
```
|
|
68
|
+
figma-variables.json
|
|
69
|
+
```
|
|
70
|
+
This file is exported by the designer from Figma and placed here manually.
|
|
71
|
+
Remind the developer: ask your designer for figma-variables.json before running /build-section.
|
|
72
|
+
|
|
73
|
+
## Step 5 — Confirm
|
|
74
|
+
Report back:
|
|
75
|
+
- ✅ Theme folder created at ``
|
|
76
|
+
- ✅ Snippets copied from this theme's existing `snippets/`
|
|
77
|
+
- ⚠️ Ask designer for `figma-variables.json` → place at `figma-variables.json` → run `/extract-tokens` to verify
|
|
78
|
+
- ⚠️ Sections folder is empty — use `/audit-page` to plan each page before building
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: CSS rules — applies to all themes
|
|
3
|
+
globs: ["assets/*.css", "sections/*.liquid"]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CSS Rules — b2bizmart Theme
|
|
7
|
+
|
|
8
|
+
## Approach
|
|
9
|
+
Use **Tailwind utility classes** for layout/spacing + **CSS custom properties** for theming/colors.
|
|
10
|
+
Never hardcode color hex values inline — always use CSS variables.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## CSS Custom Properties (Theme Tokens)
|
|
15
|
+
```css
|
|
16
|
+
var(--color-primary) /* primary brand color */
|
|
17
|
+
var(--color-on-primary) /* text color on primary background */
|
|
18
|
+
var(--color-heading) /* heading/icon color */
|
|
19
|
+
var(--color-background) /* page/card background */
|
|
20
|
+
var(--color-border) /* border color */
|
|
21
|
+
var(--color-header-bg) /* header bar background */
|
|
22
|
+
var(--section-padding-x) /* horizontal section padding, default 16px */
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Correct Pattern — Color
|
|
28
|
+
```html
|
|
29
|
+
<!-- ✅ Correct -->
|
|
30
|
+
<div style="color: var(--color-heading); background-color: var(--color-background);">
|
|
31
|
+
|
|
32
|
+
<!-- ❌ Wrong — never hardcode colors inline -->
|
|
33
|
+
<div style="color: #1a1a1a; background-color: #ffffff;">
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Correct Pattern — Spacing
|
|
39
|
+
```html
|
|
40
|
+
<!-- ✅ Use Tailwind for spacing -->
|
|
41
|
+
<div class="flex items-center gap-4 px-4 py-3">
|
|
42
|
+
|
|
43
|
+
<!-- ✅ Use CSS var for section-level padding -->
|
|
44
|
+
<div style="padding-left: var(--section-padding-x, 16px); padding-right: var(--section-padding-x, 16px);">
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Container Pattern
|
|
50
|
+
```html
|
|
51
|
+
<div class="max-w-container-theme mx-auto">
|
|
52
|
+
```
|
|
53
|
+
Use `max-w-container-theme` for page-width constrained containers.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Responsive Patterns
|
|
58
|
+
```html
|
|
59
|
+
<!-- Mobile first, show on desktop -->
|
|
60
|
+
<div class="hidden md:block">...</div>
|
|
61
|
+
<div class="hidden md:flex items-center">...</div>
|
|
62
|
+
|
|
63
|
+
<!-- Visible on mobile only -->
|
|
64
|
+
<div class="md:hidden">...</div>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Dynamic CSS via Liquid Style Block
|
|
70
|
+
```liquid
|
|
71
|
+
{% style %}
|
|
72
|
+
#section-{{ section.id }} .header-logo {
|
|
73
|
+
height: {{ section.settings.logo_width }}px;
|
|
74
|
+
}
|
|
75
|
+
#section-{{ section.id }} {
|
|
76
|
+
padding-top: {{ section.settings.padding_top }}px;
|
|
77
|
+
padding-bottom: {{ section.settings.padding_bottom }}px;
|
|
78
|
+
}
|
|
79
|
+
{% endstyle %}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Tailwind in Sections
|
|
85
|
+
- Only use Tailwind's core utility classes (no custom plugins assumed)
|
|
86
|
+
- Tailwind config is at `tailwind.config.js`
|
|
87
|
+
- PostCSS config is at `postcss.config.js`
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Rules
|
|
92
|
+
- ❌ NEVER hardcode hex colors in inline styles — use `var(--color-*)` tokens
|
|
93
|
+
- ❌ NEVER use `!important` unless absolutely necessary
|
|
94
|
+
- ✅ Use Tailwind for layout, flexbox, grid, spacing, typography sizing
|
|
95
|
+
- ✅ Use CSS variables for all color and brand theming
|
|
96
|
+
- ✅ For section-specific overrides, always scope with `#section-{{ section.id }}`
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Figma MCP Variable Resolution
|
|
101
|
+
When values come from **Figma MCP** output: for every `var(--variable-name, fallback)`, look up the variable name (path split by `/`) in `figma-variables.json`. If the path exists and has `$value`, use that value (theme/mode, e.g. B2BIZMART); otherwise use the fallback. Then convert the **resolved** value using the table below. See `.cursor/rules/figma-mcp-resolution.mdc`.
|
|
102
|
+
|
|
103
|
+
## Figma Value → Tailwind / CSS Variable Map
|
|
104
|
+
When reading Figma output (after resolving variables from figma-variables.json when using MCP), convert resolved values using this table. Never output raw px or hex inline.
|
|
105
|
+
|
|
106
|
+
### Typography → Tailwind
|
|
107
|
+
| Figma px | Tailwind | Use for |
|
|
108
|
+
|----------|----------|---------|
|
|
109
|
+
| 12px | `text-xs` | Labels, captions |
|
|
110
|
+
| 14px | `text-sm` | Secondary text |
|
|
111
|
+
| 16px | `text-base` | Body text |
|
|
112
|
+
| 18px | `text-lg` | Large body |
|
|
113
|
+
| 20px | `text-xl` | Small headings |
|
|
114
|
+
| 24px | `text-2xl` | Sub-headings |
|
|
115
|
+
| 30px | `text-3xl` | Section headings |
|
|
116
|
+
| 36px | `text-4xl` | Page headings |
|
|
117
|
+
| 48px | `text-5xl` | Hero headings |
|
|
118
|
+
| 60px | `text-6xl` | Display headings |
|
|
119
|
+
| 72px+ | `text-7xl` | Giant display |
|
|
120
|
+
|
|
121
|
+
Font weight: 400=`font-normal`, 500=`font-medium`, 600=`font-semibold`, 700=`font-bold`, 800=`font-extrabold`
|
|
122
|
+
|
|
123
|
+
### Spacing → Tailwind (1 unit = 4px)
|
|
124
|
+
4px=`gap-1/p-1`, 8px=`gap-2/p-2`, 12px=`gap-3/p-3`, 16px=`gap-4/p-4`,
|
|
125
|
+
20px=`gap-5/p-5`, 24px=`gap-6/p-6`, 32px=`gap-8/p-8`, 40px=`gap-10/p-10`,
|
|
126
|
+
48px=`gap-12/p-12`, 64px=`gap-16/p-16`, 80px=`gap-20/p-20`
|
|
127
|
+
|
|
128
|
+
### Border Radius → Tailwind
|
|
129
|
+
2px=`rounded-sm`, 4px=`rounded`, 6px=`rounded-md`, 8px=`rounded-lg`,
|
|
130
|
+
12px=`rounded-xl`, 16px=`rounded-2xl`, 24px=`rounded-3xl`, 9999px=`rounded-full`
|
|
131
|
+
|
|
132
|
+
### When a Value is Not in This Map
|
|
133
|
+
1. If the value came from Figma MCP, ensure you resolved it via `figma-variables.json` first (use `$value` if present).
|
|
134
|
+
2. Check `figma-variables.json` in the current theme folder for other mappings.
|
|
135
|
+
3. Use Tailwind arbitrary value: `text-[22px]` or `gap-[18px]`
|
|
136
|
+
4. Add a comment: `{{-- ⚠️ unmapped token: 22px --}}`
|
|
137
|
+
5. Report it in build output so it can be added to the token map if needed.
|