@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
package/README.md CHANGED
@@ -0,0 +1,61 @@
1
+ # Zoho Commerce CLI
2
+
3
+ A command-line tool for developing and building themes for Zoho Commerce stores.
4
+
5
+ ## Installation
6
+
7
+ Global installs (`npm i -g`) are not recommended. Prefer `npx` so you always run the package version resolved for the current project:
8
+
9
+ ```bash
10
+ # From a theme (or monorepo) that depends on the CLI:
11
+ npx @zohofinance/commerce <command>
12
+
13
+ # Or install as a local dependency, then use npx / yarn scripts:
14
+ npm install @zohofinance/commerce
15
+ npx @zohofinance/commerce <command>
16
+ ```
17
+
18
+ ## Commands
19
+
20
+ ### `theme init [theme-name]`
21
+
22
+ Scaffolds a new theme project. If `theme-name` is omitted, you will be prompted to enter one.
23
+
24
+ ```bash
25
+ npx @zohofinance/commerce theme init <theme-name>
26
+ ```
27
+
28
+ Creates a new folder with the theme template and includes AI helper files (`.claude/` and `.cursor/`) for editor integrations.
29
+
30
+ ---
31
+
32
+ ### `theme dev`
33
+
34
+ Starts a local development server with live reload.
35
+
36
+ ```bash
37
+ npx @zohofinance/commerce theme dev
38
+ ```
39
+
40
+ **Options**
41
+
42
+ | Flag | Description |
43
+ |------|-------------|
44
+ | `--port <value>` | Port for the local preview server |
45
+ | `--open` | Open the theme preview in your default browser |
46
+ | `--livereload-off` | Disable live reload |
47
+ | `--storeUrl <value>` | Preview the theme with live store data |
48
+
49
+ ---
50
+
51
+ ### `theme build`
52
+
53
+ Builds the theme into a distributable package.
54
+
55
+ ```bash
56
+ npx @zohofinance/commerce theme build
57
+ ```
58
+
59
+ ## Docs
60
+
61
+ [Zoho Commerce Theme Development](https://www.zoho.com/commerce/developer/themes/introduction/)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohofinance/commerce",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "main": "ts-dist/index.js",
5
5
  "bin": {
6
6
  "zcommerce": "ts-dist/index.js"
@@ -16,7 +16,7 @@
16
16
  "test": "node -e \"console.log('No tests configured')\""
17
17
  },
18
18
  "publishConfig": {
19
- "registry": "https://registry.npmjs.org"
19
+ "registry": "https://registry.npmjs.com"
20
20
  },
21
21
  "type": "module",
22
22
  "dependencies": {
@@ -0,0 +1,6 @@
1
+ # Claude Code Instructions
2
+
3
+ Add your Claude Code skills and settings here for theme development.
4
+
5
+ - `skills/` — skill markdown files loaded by Claude Code
6
+ - `settings.json` — Claude Code project settings
@@ -0,0 +1,242 @@
1
+ ---
2
+ name: zcommerce-section-from-design
3
+ description: Use when the user asks to build a NEW ZCommerce Liquid section that should match a provided Figma frame, screenshot, or live URL — and they want production-quality output (visual accuracy, accessibility, performance). Triggers on phrases like "build this section from Figma", "make a section like this screenshot", "clone this URL's hero", "section that matches the design". Do NOT use for bug fixes (use zcommerce-theme-builder's `fix-section`), redesigns of an existing section (`redesign-section`), theme-wide setting changes (`add-theme-setting`), or full multi-page theme generation (`build-theme`). This skill orchestrates intake + verification; section authoring itself is delegated to `zcommerce-theme-builder`.
4
+ ---
5
+
6
+ ## Preconditions (check before starting)
7
+
8
+ - **CLI is installed.** `npx @zohofinance/commerce --version` must work from inside the theme folder. If not, run `npm install @zohofinance/commerce` inside the theme directory, then retry.
9
+ - **Dev server can start.** Run `yarn run dev --storeUrl=<your store url>` once to confirm. If the project hasn't been bootstrapped, run `yarn install` first.
10
+ - **Claude in Chrome is connected** for gate 1 and gate 3 (the section-scoped axe path). Check via `mcp__Claude_in_Chrome__list_connected_browsers` — if none, ask the user to connect one. Without it, fall back to CLI-driven verification (`npx @zohofinance/commerce theme build`) which is slower but works.
11
+ - **Figma MCP is authenticated** if the input is Figma. Two servers exist (Dev-Mode and the plugin's OAuth path) — see `inputs/figma.md`.
12
+ - **Scratchpad path.** All intake artefacts and reports go under `.claude/scratchpad/<section_name>/` inside the theme repo (gitignored). This is the canonical location — every reference to "`<scratchpad>`" in the docs resolves here. Create it on first use.
13
+
14
+
15
+
16
+ # ZCommerce Section From Design
17
+
18
+ **Read first:**
19
+ 1. `CLAUDE.md` at the repo root — global project rules.
20
+ 2. `.claude/skills/zcommerce-theme-builder/SKILL.md` — section authoring mechanics, schema syntax, file anatomy, all CLI commands. This skill **does not** re-derive those rules.
21
+ 3. This theme's `sections/` folder — pick an existing section with similar purpose to copy Liquid logic from.
22
+
23
+ This skill is the orchestration layer. It takes a design input, normalizes it into a Design Spec Table, hands off to `zcommerce-theme-builder` to build, then runs a four-gate verification pipeline and iterates until all gates pass (or the user accepts a tolerated deviation).
24
+
25
+ ---
26
+
27
+ ## 1. When to use
28
+
29
+ Trigger when the user provides **any** of these and asks for a section, page block, or component:
30
+ - A **Figma** selection (via Figma MCP) or shared frame URL.
31
+ - A **screenshot** image (uploaded file, paste, or path).
32
+ - A **live website URL** ("build this like xyz.com's hero").
33
+ - Any combination of the above (e.g. "screenshot + reference site").
34
+
35
+ Do **not** trigger for: theme-wide settings changes (use `add-theme-setting`), bug fixes on existing sections (use `fix-section`), or full multi-page theme generation (this skill is section-scoped).
36
+
37
+ ---
38
+
39
+ ## 2. The pipeline (always five stages)
40
+
41
+ ```
42
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
43
+ │ 1. Intake & │ → │ 2. Normalize │ → │ 3. Reference │ → │ 4. Build │ → │ 5. Verify │
44
+ │ Input Type │ │ Spec Table │ │ Selection │ │ (delegated) │ │ 4 gates │
45
+ └──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘
46
+ │
47
+ fail → 6. Iterate ↑
48
+ pass → done
49
+ ```
50
+
51
+ Every stage has a dedicated reference file. Read the relevant one before executing the stage.
52
+
53
+ | Stage | What it produces | Reference doc |
54
+ |------|------------------|---------------|
55
+ | 1. Intake | Raw input + recorded source type | `inputs/figma.md` · `inputs/screenshot.md` · `inputs/url.md` |
56
+ | 2. Normalize | Unified **Design Spec Table** (the build contract) | `spec-table.md` |
57
+ | 3. Reference | Pick a reference section in this theme; decide whether to reuse existing web components | this theme's `sections/` · existing snippets / web components |
58
+ | 4. Build | A `.liquid` section file in `sections/` | (delegated) `zcommerce-theme-builder` → `build-section` |
59
+ | 5. Verify | A Verification Report covering 4 gates | `verification/visual-diff.md` · `verification/tokens.md` · `verification/accessibility.md` · `verification/performance.md` |
60
+
61
+ ---
62
+
63
+ ## 3. Stage 1 — Intake
64
+
65
+ ### 3.1 Inputs the user may give
66
+
67
+ | Source | How to access |
68
+ |---|---|
69
+ | Figma frame URL or selection | `mcp__plugin_product-management_figma__*` tools or the Dev-Mode `mcp__32a68a89-...` tools — `get_design_context`, `get_variable_defs`, `get_screenshot`, `get_metadata` |
70
+ | Screenshot file | Read the uploaded image; if absent, ask the user to upload to a known path |
71
+ | Website URL | Claude in Chrome — `navigate`, `get_page_text`, `javascript_tool` for computed styles, `read_page` for DOM. If Claude in Chrome is unavailable, fall back to `mcp__workspace__web_fetch` for HTML only (no JS execution) |
72
+
73
+ ### 3.2 Required questions before proceeding
74
+
75
+ Use `AskUserQuestion` once at the start to collect:
76
+ 1. **Target theme** — this theme directory (confirm the folder name).
77
+ 2. **Section name** (snake-case, used as filename).
78
+ 3. **Page where it will live** (so the page JSON can be updated in stage 4).
79
+ 4. **Both desktop AND mobile inputs?** — if input is Figma, request both frames. If screenshot, ask for both. If URL, the agent will resize the browser to 1440 and 375 itself.
80
+
81
+ ### 3.3 Source-specific intake — see the dedicated docs
82
+
83
+ - Figma → `inputs/figma.md`
84
+ - Screenshot → `inputs/screenshot.md`
85
+ - URL → `inputs/url.md`
86
+
87
+ Stage 1 output goes to `.claude/scratchpad/<section_name>/` (the canonical scratchpad path defined in Preconditions). Add this directory to `.gitignore` if not already. Raw artefacts: `{desktop.png, mobile.png, figma-context.json, computed-styles.json, spec-table.md, ...}`. Verification reuses these.
88
+
89
+ ---
90
+
91
+ ## 4. Stage 2 — Normalize to a Design Spec Table
92
+
93
+ The **Design Spec Table** is the build contract. Every value the implementation must produce is enumerated here in pixels/hex/font-weight terms before any code is written. This is what makes the build a one-pass match instead of a guess-and-compare loop.
94
+
95
+ See `spec-table.md` for the exact column schema and worked examples for all three input types. Hard rule: the table must be filled in before stage 4. If a row cannot be filled (e.g. screenshot is ambiguous about spacing), mark it `?` and ask the user — do not guess.
96
+
97
+ ---
98
+
99
+ ## 5. Stage 3 — Reference selection
100
+
101
+ Two decisions:
102
+
103
+ ### 5.1 Which existing section to copy Liquid logic from
104
+
105
+ Scan this theme's `sections/` for the closest match by purpose (hero, banner, product grid, footer, etc.). If nothing similar exists, use the closest partial match or build schema from the docs — do not look outside this theme for other themes.
106
+
107
+ The rule from `zcommerce-theme-builder`: **logic and schema patterns come from the reference; HTML structure and visual values come from the input.** Never discard working Liquid logic to match a simpler-looking design.
108
+
109
+ ### 5.2 Whether to reuse an existing web component
110
+
111
+ This theme may already ship accessible web components (for example add-to-cart, authentication, cookie bar, custom fields, accordion, input, message bar, quantity counter, search). Prefer those over hand-rolled JS when a matching component already exists. Wire them in via `{% render %}` the same way existing sections do.
112
+
113
+ ---
114
+
115
+ ## 6. Stage 4 — Build (delegated)
116
+
117
+ Hand off to `zcommerce-theme-builder` → `build-section <theme_name> <section_name>`. Pass it:
118
+ - The completed Design Spec Table from stage 2 (file at `.claude/scratchpad/<section_name>/spec-table.md`).
119
+ - The reference section identified in stage 3.
120
+ - Any existing web components to be wired in.
121
+
122
+ **Spec-table handoff is explicit.** `zcommerce-theme-builder`'s `build-section` workflow has its own stage-2 "Extract Detailed Design Spec" step. When called from this skill, that step is **skipped** — the spec table this skill produced is the authoritative one. Tell the delegated workflow: "spec-table.md is pre-populated at `.claude/scratchpad/<section>/spec-table.md`; use it directly, do not re-extract."
123
+
124
+ `zcommerce-theme-builder`'s `build-section` then handles: file anatomy (script/style/liquid/conditional/wrapper/schema order), custom schema syntax, Tailwind/CSS-variable mapping (the `*-theme-*` utility classes from each theme's `tailwind.config.js`), mobile-first responsive layout, self-compare against the spec table. Do not re-derive those rules here.
125
+
126
+ **Note on Tailwind classes.** The spec-table examples use classes like `py-theme-16`, `gap-theme-8`, `rounded-theme-button`. These are defined in each theme's own `tailwind.config.js`. Before passing the spec to the build, **open `tailwind.config.js`** and confirm the classes referenced exist. If a class is missing, either add it to the config (if the underlying CSS variable exists in `theme.json`) or use arbitrary-value Tailwind (`py-[64px]`) as a fallback.
127
+
128
+ After build, also update:
129
+ - `pages/<page_name>.json` — add the new section to the page (use `assemble-page` if the page doesn't exist yet, otherwise edit in place).
130
+ - `i18n/en.json` and `en.schema.json` — add all translation keys referenced in the schema.
131
+
132
+ ---
133
+
134
+ ## 7. Stage 5 — Verify (four gates)
135
+
136
+ A section passes only when all four gates pass within tolerance. Run them **after** the build is in place and the dev server is up.
137
+
138
+ ### Start the dev server (once, kept alive for the whole verification)
139
+
140
+ ```bash
141
+ cd <theme_name>
142
+ yarn run dev --storeUrl=<your store url>
143
+ ```
144
+
145
+ Wait for "compiled" / "ready". The dev server stays running across all four gates and any iteration loops. If the user wrote `--storefronturl` they mean `--storeUrl`. Add `--useMock` only if they explicitly asked for mock data.
146
+
147
+ ### Gate 1 — Visual diff
148
+
149
+ See `verification/visual-diff.md`. Reuses `zcommerce-theme-builder`'s `compare-section --visual` workflow under the hood — that command already orchestrates Claude in Chrome navigation + screenshot + Figma comparison. This skill's gate 1 adds screenshot/URL input handling (compare-section is Figma-only) and ensures the resulting mismatch report categorizes by CRITICAL / MINOR / SUGGESTION using this skill's tolerance defaults (§10).
150
+
151
+ ### Gate 2 — Design-token exact match (Figma only)
152
+
153
+ See `verification/tokens.md`. For every row of the Design Spec Table, assert the generated code uses the right CSS variable / Tailwind class / px value. This catches numeric drift that visual diff misses (e.g. 16px vs 17px). Skipped when input was screenshot or URL — those have no token source of truth.
154
+
155
+ ### Gate 3 — Accessibility (WCAG 2.1 AA via axe-core)
156
+
157
+ See `verification/accessibility.md`. Run axe-core against the section URL — the CLI already integrates axe-core via puppeteer, so the simplest path is to call `npx @zohofinance/commerce theme build` and read the audit output. For section-only checks during iteration, run axe directly in Claude in Chrome via `javascript_tool` injecting axe-core. **Fail the gate on any critical or serious violation.**
158
+
159
+ ### Gate 4 — Performance (Lighthouse)
160
+
161
+ See `verification/performance.md`. Same path — the CLI ships Lighthouse and runs it during `theme build`. For per-section iteration, run Lighthouse directly via puppeteer or just inspect Chrome DevTools metrics. Targets: LCP < 2.5s, CLS < 0.1, TBT < 200ms, performance score ≥ 90 on the section's host page.
162
+
163
+ ### The Verification Report
164
+
165
+ After all four gates run, produce a single report:
166
+
167
+ ```
168
+ SECTION: <theme>/<section_name>
169
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
170
+ INPUT TYPE: figma | screenshot | url
171
+ SOURCE: <link or filename>
172
+ DEVICE: desktop 1440 + mobile 375
173
+
174
+ GATE 1 — VISUAL DIFF
175
+ desktop: 0 critical, 2 minor (gap 16→14px, radius 8→6px)
176
+ mobile: 0 critical, 0 minor
177
+
178
+ GATE 2 — TOKEN MATCH (figma only)
179
+ 17/17 spec rows verified
180
+ FAIL font-size on .hero-h1 expected 48px → found 44px
181
+
182
+ GATE 3 — A11Y (axe-core, WCAG 2.1 AA)
183
+ 0 critical, 0 serious
184
+ 1 moderate: color-contrast 4.3:1 on .badge (target 4.5)
185
+
186
+ GATE 4 — PERFORMANCE (Lighthouse, page = /home)
187
+ Performance 94 · LCP 1.9s · CLS 0.02 · TBT 110ms
188
+
189
+ VERDICT: needs iteration (1 token mismatch, 1 a11y moderate)
190
+ NEXT: fix .hero-h1 font-size, tweak .badge contrast → re-run gates 1-3
191
+ ```
192
+
193
+ ---
194
+
195
+ ## 8. Stage 6 — Iterate
196
+
197
+ Loop on whichever gates failed. Two patterns:
198
+
199
+ - **Token / visual mismatch** → edit the section file; re-run gates 1 and 2 only.
200
+ - **A11y / perf failure** → diagnose in `verification/accessibility.md` / `verification/performance.md`; usually a fix in the `.liquid` or asset JS. Re-run the failing gate plus any visually affected gates.
201
+
202
+ **Iteration counter.** One "iteration" = one full pass through whichever gates failed (not per-gate). Hard stop after **3 iterations** — if still failing, surface the report to the user with the remaining deltas and ask whether to ship as-is, change the spec, or escalate.
203
+
204
+ **Gate-2 precedence.** Gate 2 (token match) is stricter than the tolerance defaults in §10 — it requires *exact* matches per the spec table. When gate 1's tolerance says "within 2px is fine" but gate 2 says "spec says 64px, code has 62px → FAIL", gate 2 wins. Tolerance defaults apply only to visual diff and to user-facing accept/reject decisions, not to token verification.
205
+
206
+ ---
207
+
208
+ ## 9. Parallelism
209
+
210
+ Within a single section build, parallelize where safe:
211
+ - Stage 1 — fetch desktop + mobile inputs concurrently.
212
+ - Stage 5 — gates 1 (visual diff) and 2 (token check) can run in parallel; gates 3 (a11y) and 4 (perf) share a puppeteer browser so run them serially or use the CLI's `theme build` which already sequences them.
213
+
214
+ For multi-section batches, spawn one subagent per section using the `general-purpose` agent type, each running this skill end-to-end. See `zcommerce-theme-builder` § 5 for the parallel agent strategy.
215
+
216
+ ---
217
+
218
+ ## 10. Tolerance defaults
219
+
220
+ | Metric | Auto-pass | Flag minor | Flag critical |
221
+ |---|---|---|---|
222
+ | Spacing / padding | within 2px | 3–8px diff | > 8px diff |
223
+ | Font size | exact | within 2px | > 2px diff |
224
+ | Color | hex equal OR ΔE < 1 | ΔE 1–3 | ΔE > 3 |
225
+ | Border radius | within 2px | 3–6px diff | > 6px diff |
226
+ | LCP | < 2.5s | 2.5–4s | > 4s |
227
+ | CLS | < 0.1 | 0.1–0.25 | > 0.25 |
228
+ | Axe violations | none | moderate / minor | critical / serious |
229
+
230
+ Override these per-section only if the user explicitly says "loose match" or "pixel-perfect required."
231
+
232
+ ---
233
+
234
+ ## 11. Quick-start command
235
+
236
+ ```
237
+ section-from-design <theme_name> <section_name> --input figma:<your figma url> [--page <page_name>]
238
+ section-from-design <theme_name> <section_name> --input screenshot:<path>[,<mobile_path>]
239
+ section-from-design <theme_name> <section_name> --input url:<your website url>
240
+ ```
241
+
242
+ If invoked without flags, the skill asks via `AskUserQuestion` for the missing pieces and proceeds.
@@ -0,0 +1,81 @@
1
+ # Input handler — Figma
2
+
3
+ Triggered when the user provides a Figma frame URL, Figma file key, or has a selection active in the Figma desktop app (Dev-Mode MCP).
4
+
5
+ ## 1. Available Figma tools
6
+
7
+ Two MCP servers may be connected:
8
+
9
+ | Server | Tools | When to use |
10
+ |---|---|---|
11
+ | Dev-Mode MCP (`mcp__32a68a89-...`) | `get_design_context`, `get_screenshot`, `get_variable_defs`, `get_metadata`, `get_code_connect_suggestions`, `search_design_system` | **Preferred** when the user has the Figma desktop app open with a frame selected. Pulls live values from the canvas. |
12
+ | Figma plugin MCP (`mcp__plugin_product-management_figma__*`) | OAuth-based REST API access | Use when only a URL/file-key is available and no selection is active. Requires `authenticate` first. |
13
+
14
+ If neither is connected, ask the user to either open Figma with a selection (for Dev-Mode) or paste a screenshot as a fallback.
15
+
16
+ ## 2. Intake steps
17
+
18
+ Run all of these. The first two can be parallelized.
19
+
20
+ 1. **`get_metadata`** — confirms the frame name, dimensions, and whether you're looking at a single frame vs a page. Reject if the selection is a page-level group (too broad); ask user to drill in.
21
+ 2. **`get_screenshot`** — fetch desktop screenshot at 1× and 2×. Save under `<scratchpad>/intake/<section_name>/figma-desktop.png` and `...-2x.png`.
22
+ 3. **`get_screenshot`** for the mobile variant frame — Figma files conventionally have a separate mobile frame. If the user only shared one frame, ask for the mobile counterpart before continuing.
23
+ 4. **`get_design_context`** — returns the full structured node tree with computed styles per element. Save raw to `<scratchpad>/intake/<section_name>/figma-context.json`. This is the source of truth for the spec table.
24
+ 5. **`get_variable_defs`** — pulls all variable references used in the selection (colors, spacing, radius, type). Save to `<scratchpad>/intake/<section_name>/figma-variables-used.json`.
25
+
26
+ ## 3. Resolve variables against `figma-variables.json`
27
+
28
+ The theme repo has a `figma-variables.json` (W3C-design-tokens format with `$type` / `$value`). After step 4 above, for every variable reference in the design context:
29
+
30
+ 1. Strip the `--` prefix, split on `/`, traverse the JSON.
31
+ 2. If the resolved node has `$value`, use it.
32
+ 3. If not found, log it under "unmapped tokens" — the user may need to add it to `figma-variables.json` before the build can complete.
33
+
34
+ Example: `var(--spacing/4-multiples/4, 16px)` → traverse `spacing > "4 Multiples" > "4"` → `$value: 16`.
35
+
36
+ ## 4. Extract per-element values
37
+
38
+ For every visible element in the frame (containers, text nodes, images, buttons, dividers), record:
39
+
40
+ - `width`, `height` (or `auto` / `fill`)
41
+ - `padding-{top,right,bottom,left}`
42
+ - `margin-*` (only if non-zero; rely on auto-layout gap otherwise)
43
+ - `gap` (for flex/grid containers)
44
+ - `background` — resolved hex or CSS variable name
45
+ - `border` — width, color, style
46
+ - `border-radius` — per-corner if asymmetric
47
+ - `font-family`, `font-size`, `font-weight`, `line-height`, `letter-spacing`, `color`
48
+ - `box-shadow` — full spec
49
+ - `opacity`, `mix-blend-mode` if non-default
50
+ - `display` / `flex-direction` / `justify-content` / `align-items` for containers
51
+
52
+ Feed all of this into the spec table (`../spec-table.md`).
53
+
54
+ ## 5. Handle responsive
55
+
56
+ Always compare desktop and mobile side-by-side. The spec table has a desktop column and a mobile column; if a value is the same, write it in one and leave the other blank.
57
+
58
+ If the Figma file has only desktop and no mobile frame, **stop and ask** — building responsive from desktop alone leads to bad mobile output. Acceptable fallback only with user approval: derive mobile defaults using Tailwind breakpoints (`base` = mobile starting at 375, `md:` = 768+, `lg:` = 1024+).
59
+
60
+ ## 6. Gotchas
61
+
62
+ - Figma "Auto Layout" → CSS flexbox. `gap` is real CSS gap, **not** margin between children.
63
+ - Figma "fill container" → `flex-1` or `w-full`.
64
+ - Figma color tokens that don't appear in `figma-variables.json` are likely from an unimported library — ask the user to either import or hardcode (with their explicit approval).
65
+ - `get_screenshot` may downscale aggressively — for pixel-perfect typography checks, also fetch the 2× version.
66
+ - The Dev-Mode MCP can return *generated code suggestions* via `get_code_connect_suggestions`. Treat those as hints only; never paste them directly — they don't follow ZCommerce's custom schema conventions.
67
+
68
+ ## 7. Output artefacts
69
+
70
+ ```
71
+ <scratchpad>/intake/<section_name>/
72
+ figma-desktop.png
73
+ figma-desktop-2x.png
74
+ figma-mobile.png
75
+ figma-mobile-2x.png
76
+ figma-context.json (raw get_design_context output)
77
+ figma-variables-used.json (raw get_variable_defs output)
78
+ unmapped-tokens.txt (variables referenced but not in figma-variables.json)
79
+ ```
80
+
81
+ Feed all of these into stage 2 (spec table).
@@ -0,0 +1,54 @@
1
+ # Input handler — Screenshot
2
+
3
+ Triggered when the user uploads an image (PNG / JPG / WebP) or pastes a screenshot, with no Figma or URL source.
4
+
5
+ ## 1. Required inputs
6
+
7
+ Use `AskUserQuestion` to collect (only fields not already provided):
8
+
9
+ 1. **Desktop screenshot** — required.
10
+ 2. **Mobile screenshot** — strongly recommended. If absent, ask once whether the user wants to:
11
+ - (a) provide a mobile screenshot, or
12
+ - (b) let the agent derive a sensible mobile layout from defaults (clearly note this in the report — the section's mobile match cannot be verified against an input).
13
+ 3. **Brand colors / typography** — if the screenshot is from an unrelated brand, the user must tell us what colors and fonts to map to. Otherwise we'll extract from the image and may get them wrong.
14
+ 4. **Theme settings to source colors from** — the section should still use `var(--color-*)` variables from `settings/theme.json`. Ask which theme settings the screenshot's brand colors should map to (e.g. "the orange button → `--color-primary`").
15
+
16
+ ## 2. Vision extraction protocol
17
+
18
+ Read the screenshot directly (the Read tool sees PNG/JPG natively). For each visible element, extract approximate values:
19
+
20
+ | Property | Method |
21
+ |---|---|
22
+ | Colors | Eyedropper-style — sample dominant colors. Match to nearest token in `figma-variables.json`. If no match within ΔE 3, propose adding a new variable. |
23
+ | Spacing | Estimate in 4px steps (the project's spacing scale is `Spacing/4 Multiples`). Pad/gap values almost always land on multiples of 4. |
24
+ | Typography | Identify font weight (thin / regular / medium / semibold / bold) and approximate size in 2px steps. Verify the font-family against `assets/` and `theme.json`. |
25
+ | Border radius | Round to nearest of 4, 8, 12, 16, 24, full. |
26
+ | Image aspect ratio | Eyeball + verify against common ratios (1:1, 4:3, 16:9, 3:2). |
27
+ | Shadows | Note presence and rough strength (sm / md / lg). Tailwind shadow utilities are usually close enough. |
28
+
29
+ For everything ambiguous, **mark it `?` in the spec table** — do not guess past the user's tolerance.
30
+
31
+ ## 3. Cross-reference theme tokens
32
+
33
+ Before finalizing the spec, open `figma-variables.json` and `settings/theme.json`. Map every extracted value to an existing variable where possible. This is critical — hardcoded hex values from a screenshot will break the theme's customizer.
34
+
35
+ ## 4. Confirm before building
36
+
37
+ Produce the draft spec table and **ask the user to approve** before stage 4 begins. Screenshot input has more ambiguity than Figma; user review at this point saves an iteration cycle.
38
+
39
+ ## 5. Output artefacts
40
+
41
+ ```
42
+ <scratchpad>/intake/<section_name>/
43
+ screenshot-desktop.png (copied from upload)
44
+ screenshot-mobile.png (copied from upload, if provided)
45
+ vision-notes.md (per-element extraction notes, what was guessed)
46
+ ambiguity-questions.md (questions the user must answer before build)
47
+ ```
48
+
49
+ ## 6. Gotchas
50
+
51
+ - Screenshot DPI matters — a 2× macOS screenshot is twice the pixel dimensions. Ask the user for the source viewport width if dimensions look off.
52
+ - JPEG compression artefacts can shift perceived colors by a few units. Lean on the theme token list when possible rather than extracted hex.
53
+ - If the screenshot was taken at a non-standard browser zoom (e.g. 110%), spacing measurements will be off. Cross-check with any reference URL the user can share.
54
+ - Don't try to extract text content from the screenshot for the schema defaults — ask the user for the copy. OCR'd headlines are almost always slightly wrong.
@@ -0,0 +1,88 @@
1
+ # Input handler — Live website URL
2
+
3
+ Triggered when the user says "build this like xyz.com" or pastes a URL.
4
+
5
+ ## 1. Tooling check
6
+
7
+ This handler needs **Claude in Chrome** (`mcp__Claude_in_Chrome__*`) for computed-style extraction. If only `mcp__workspace__web_fetch` is available, you can only read raw HTML — degrade gracefully and tell the user the fidelity will be lower than Figma or screenshot inputs.
8
+
9
+ If Claude in Chrome is connected but the user hasn't selected a browser, call `list_connected_browsers` then `select_browser`.
10
+
11
+ ## 2. Intake steps
12
+
13
+ 1. **`navigate`** to the URL.
14
+ 2. **`resize_window` 1440 × 900** — desktop viewport.
15
+ 3. **`get_page_text`** — DOM with text content. Save raw.
16
+ 4. **`javascript_tool`** — run a small script to dump computed styles of every visible element in the target section. Example:
17
+
18
+ ```js
19
+ const target = document.querySelector('SELECTOR_FROM_USER');
20
+ const out = [];
21
+ function walk(node, depth = 0) {
22
+ if (node.nodeType !== 1) return;
23
+ const cs = getComputedStyle(node);
24
+ out.push({
25
+ depth,
26
+ tag: node.tagName,
27
+ cls: node.className,
28
+ rect: node.getBoundingClientRect(),
29
+ styles: {
30
+ display: cs.display,
31
+ padding: cs.padding,
32
+ margin: cs.margin,
33
+ gap: cs.gap,
34
+ background: cs.backgroundColor,
35
+ color: cs.color,
36
+ font: cs.font,
37
+ lineHeight: cs.lineHeight,
38
+ borderRadius: cs.borderRadius,
39
+ boxShadow: cs.boxShadow,
40
+ },
41
+ });
42
+ node.childNodes.forEach((c) => walk(c, depth + 1));
43
+ }
44
+ walk(target);
45
+ JSON.stringify(out);
46
+ ```
47
+
48
+ Ask the user for the CSS selector that bounds the target section (e.g. `header.site-header`, `.hero`, `section#products`). If they don't know, navigate them through it: take a screenshot, ask them to point at the bounding element.
49
+ 5. **Screenshot** the section with Claude in Chrome's screenshot capability. Crop to just the target section using the bounding rect from step 4.
50
+ 6. **`resize_window` 375 × 812** — mobile viewport. Repeat steps 4–5 for mobile.
51
+ 7. **`read_console_messages`** + **`read_network_requests`** — capture font loads and any errors. Helps identify the actual font stack vs what's in `font-family`.
52
+
53
+ ## 3. Map computed styles to theme tokens
54
+
55
+ Live sites use raw hex / px values. The output section must use the **target theme's** tokens, not the source site's. For each computed value:
56
+
57
+ 1. Find the nearest token in `figma-variables.json` (ΔE < 3 for colors, exact match for spacing/radius).
58
+ 2. If no nearby token exists, ask the user:
59
+ - "The source uses #FF6B35 — should the target theme adopt this as `--color-primary`, or map it to your existing `--color-primary` (#XYZ)?"
60
+
61
+ Never silently hardcode a value from the source site. The whole point of the theme system is that every color/spacing/font is a customizable token.
62
+
63
+ ## 4. Section selection — be precise
64
+
65
+ Live sites usually have **everything**: nav, hero, footer, modals, popups. Insist the user identifies the **exact** section to clone. Pull the bounding selector and crop to it. Don't try to reconstruct an entire homepage from a URL — that's out of scope (use full-theme builds for that).
66
+
67
+ ## 5. Output artefacts
68
+
69
+ ```
70
+ <scratchpad>/intake/<section_name>/
71
+ url.txt (the source URL)
72
+ selector.txt (the CSS selector used as the bound)
73
+ desktop.png (cropped section, 1440 viewport)
74
+ mobile.png (cropped section, 375 viewport)
75
+ computed-styles-desktop.json
76
+ computed-styles-mobile.json
77
+ dom.html (saved HTML of the section)
78
+ console-errors.txt
79
+ font-requests.txt (from network log — what fonts actually loaded)
80
+ ```
81
+
82
+ ## 6. Gotchas
83
+
84
+ - Computed styles include browser defaults — filter out values that look like UA defaults (e.g. `margin: 0px` everywhere).
85
+ - Some sites use CSS-in-JS / utility frameworks (Tailwind, Bootstrap) — the class names are noise, not signal. Always trust computed styles, never the class strings.
86
+ - Behind-Cloudflare / paywalled sites may not be fetchable. Fall back to asking the user for a screenshot.
87
+ - Dynamic content (lazy-loaded images, animation states) — wait for `networkidle` before snapshotting. If the section has an animation, screenshot at the end-state.
88
+ - Anti-bot challenges may block Chrome — if so, surface the issue and fall back to screenshot input.