@wix/agent-skills 1.6.0 → 1.8.0

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 (195) hide show
  1. package/README.md +5 -9
  2. package/package.json +1 -1
  3. package/skills/wix-app/SKILL.md +51 -42
  4. package/skills/wix-app/references/BACKEND_EVENT.md +10 -65
  5. package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +101 -406
  6. package/skills/wix-app/references/DASHBOARD_MENU_PLUGIN.md +14 -111
  7. package/skills/wix-app/references/DASHBOARD_MODAL.md +56 -205
  8. package/skills/wix-app/references/DASHBOARD_PAGE.md +19 -98
  9. package/skills/wix-app/references/DASHBOARD_PLUGIN.md +6 -108
  10. package/skills/wix-app/references/DATA_COLLECTION.md +113 -198
  11. package/skills/wix-app/references/EMBEDDED_SCRIPT.md +41 -268
  12. package/skills/wix-app/references/EXTENSION_REGISTRATION.md +27 -76
  13. package/skills/wix-app/references/SERVICE_PLUGIN.md +35 -188
  14. package/skills/wix-app/references/SITE_PLUGIN.md +8 -92
  15. package/skills/wix-app/references/STORES_VERSIONING.md +1 -0
  16. package/skills/wix-app/references/backend-event/COMMON-EVENTS.md +0 -44
  17. package/skills/wix-app/references/custom-element-widget/SETTINGS_PANEL.md +19 -330
  18. package/skills/wix-app/references/dashboard-menu-plugin/bookings-slots.md +0 -12
  19. package/skills/wix-app/references/dashboard-menu-plugin/ecommerce-slots.md +7 -0
  20. package/skills/wix-app/references/dashboard-menu-plugin/restaurants-slots.md +0 -12
  21. package/skills/wix-app/references/dashboard-plugin/SLOTS.md +3 -15
  22. package/skills/wix-app/references/service-plugin/ADDITIONAL-FEES.md +2 -18
  23. package/skills/wix-app/references/service-plugin/BOOKINGS-STAFF-SORTING.md +2 -42
  24. package/skills/wix-app/references/service-plugin/DISCOUNT-TRIGGERS.md +1 -11
  25. package/skills/wix-app/references/service-plugin/GIFT-CARDS.md +1 -11
  26. package/skills/wix-app/references/service-plugin/PAYMENT-SETTINGS.md +2 -40
  27. package/skills/wix-app/references/service-plugin/SHIPPING-RATES.md +2 -19
  28. package/skills/wix-app/references/service-plugin/VALIDATIONS.md +2 -18
  29. package/skills/wix-app/references/site-plugin/SLOTS.md +17 -68
  30. package/skills/wix-design-system/SKILL.md +4 -0
  31. package/skills/wix-headless/SKILL.md +131 -386
  32. package/skills/wix-headless/references/BUILD-astro.md +246 -0
  33. package/skills/wix-headless/references/BUILD-own-build.md +167 -0
  34. package/skills/wix-headless/references/BUILD.md +105 -0
  35. package/skills/wix-headless/references/DESIGN_SYSTEM.md +175 -0
  36. package/skills/wix-headless/references/DISCOVERY-connect.md +55 -0
  37. package/skills/wix-headless/references/DISCOVERY-create.md +238 -0
  38. package/skills/wix-headless/references/DISCOVERY.md +50 -306
  39. package/skills/wix-headless/references/PLAN-connect.md +19 -0
  40. package/skills/wix-headless/references/PLAN-create.md +17 -0
  41. package/skills/wix-headless/references/PLAN.md +92 -0
  42. package/skills/wix-headless/references/SEED.md +214 -0
  43. package/skills/wix-headless/references/SETUP.md +73 -248
  44. package/skills/wix-headless/references/{blog → astro/blog}/BLOG_PAGES.md +6 -5
  45. package/skills/wix-headless/references/{blog → astro/blog}/BLOG_SETUP.md +2 -2
  46. package/skills/wix-headless/references/astro/bookings/COMPONENTS.md +337 -0
  47. package/skills/wix-headless/references/astro/bookings/SERVICES_PAGES.md +428 -0
  48. package/skills/wix-headless/references/astro/cms/CMS_FOUNDATIONS.md +214 -0
  49. package/skills/wix-headless/references/{cms → astro/cms}/FAQ_KNOWLEDGE_BASE.md +14 -12
  50. package/skills/wix-headless/references/{cms → astro/cms}/PORTFOLIO.md +15 -16
  51. package/skills/wix-headless/references/{cms → astro/cms}/RESOURCE_LIBRARY.md +13 -15
  52. package/skills/wix-headless/references/{cms → astro/cms}/TEAM_DIRECTORY.md +11 -11
  53. package/skills/wix-headless/references/astro/designer/INSTRUCTIONS.md +354 -0
  54. package/skills/wix-headless/references/{ecom → astro/ecom}/CART_PAGES.md +8 -9
  55. package/skills/wix-headless/references/{ecom → astro/ecom}/CART_WIRING.md +6 -6
  56. package/skills/wix-headless/references/{ecom → astro/ecom}/COMPONENTS_CSS.md +6 -6
  57. package/skills/wix-headless/references/{forms → astro/forms}/CONTACT_FORM.md +18 -32
  58. package/skills/wix-headless/references/{gift-cards → astro/gift-cards}/COMPONENTS.md +3 -3
  59. package/skills/wix-headless/references/{gift-cards → astro/gift-cards}/PAGES.md +2 -2
  60. package/skills/wix-headless/references/{stores → astro/stores}/BACK_IN_STOCK.md +7 -7
  61. package/skills/wix-headless/references/{stores → astro/stores}/CATEGORY_PAGES.md +12 -13
  62. package/skills/wix-headless/references/{stores → astro/stores}/COMPONENTS_CSS.md +7 -7
  63. package/skills/wix-headless/references/{stores → astro/stores}/HOME_AND_NAV.md +11 -9
  64. package/skills/wix-headless/references/{stores → astro/stores}/PRODUCT_PAGES.md +11 -9
  65. package/skills/wix-headless/references/{stores → astro/stores}/SHARED_WIRING.md +8 -7
  66. package/skills/wix-headless/references/astro/templates/Footer.astro +27 -0
  67. package/skills/wix-headless/references/astro/templates/Layout.astro +132 -0
  68. package/skills/wix-headless/references/astro/templates/Navigation.astro +38 -0
  69. package/skills/wix-headless/references/astro/templates/astro.config.mjs +41 -0
  70. package/skills/wix-headless/references/astro/templates/bookings/AvailabilityCalendar.tsx +218 -0
  71. package/skills/wix-headless/references/astro/templates/bookings/BookingForm.tsx +194 -0
  72. package/skills/wix-headless/references/astro/templates/bookings/ManageBooking.tsx +84 -0
  73. package/skills/wix-headless/references/astro/templates/bookings/SeoTags.astro +25 -0
  74. package/skills/wix-headless/references/astro/templates/bookings/ServiceBookingFlow.tsx +50 -0
  75. package/skills/wix-headless/references/astro/templates/bookings/ServiceCard.astro +45 -0
  76. package/skills/wix-headless/references/astro/templates/bookings/api/confirm-booking.ts +34 -0
  77. package/skills/wix-headless/references/astro/templates/bookings/api/waitlist.ts +74 -0
  78. package/skills/wix-headless/references/astro/templates/bookings/booking-confirmation.astro +111 -0
  79. package/skills/wix-headless/references/astro/templates/bookings/components-bookings.css +413 -0
  80. package/skills/wix-headless/references/astro/templates/bookings/manage-booking.astro +76 -0
  81. package/skills/wix-headless/references/astro/templates/bookings/services/[slug].astro +81 -0
  82. package/skills/wix-headless/references/astro/templates/bookings/services/index.astro +65 -0
  83. package/skills/wix-headless/references/astro/templates/ecom/components-ecom.css +302 -0
  84. package/skills/wix-headless/references/astro/templates/global.css +286 -0
  85. package/skills/wix-headless/references/astro/templates/index.astro +56 -0
  86. package/skills/wix-headless/{templates → references/astro/templates}/stores/back-in-stock.ts +1 -1
  87. package/skills/wix-headless/{templates → references/astro/templates}/stores/components-stores.css +138 -33
  88. package/skills/wix-headless/references/blog/BLOG_CONTENT.md +28 -19
  89. package/skills/wix-headless/references/blog/INSTRUCTIONS.md +6 -6
  90. package/skills/wix-headless/references/bookings/INSTRUCTIONS.md +106 -0
  91. package/skills/wix-headless/references/bookings/SERVICES_DATA.md +295 -0
  92. package/skills/wix-headless/references/cms/CMS_FOUNDATIONS.md +35 -232
  93. package/skills/wix-headless/references/cms/INSTRUCTIONS.md +39 -8
  94. package/skills/wix-headless/references/commands/known-apps.json +2 -1
  95. package/skills/wix-headless/references/custom/CONNECTION_PLAN.md +142 -0
  96. package/skills/wix-headless/references/custom/INSTRUCTIONS.md +88 -0
  97. package/skills/wix-headless/references/custom/blog/WIRING.md +52 -0
  98. package/skills/wix-headless/references/custom/bookings/WIRING.md +88 -0
  99. package/skills/wix-headless/references/custom/cms/WIRING.md +97 -0
  100. package/skills/wix-headless/references/custom/ecom/WIRING.md +67 -0
  101. package/skills/wix-headless/references/custom/forms/WIRING.md +101 -0
  102. package/skills/wix-headless/references/custom/stores/WIRING.md +80 -0
  103. package/skills/wix-headless/references/ecom/INSTRUCTIONS.md +12 -12
  104. package/skills/wix-headless/references/forms/INSTRUCTIONS.md +6 -6
  105. package/skills/wix-headless/references/gift-cards/INSTRUCTIONS.md +13 -13
  106. package/skills/wix-headless/references/images/INSTRUCTIONS.md +58 -60
  107. package/skills/wix-headless/references/seed-recipes.md +49 -0
  108. package/skills/wix-headless/references/shared/AGENTS_MD.md +47 -0
  109. package/skills/wix-headless/references/shared/AUTHENTICATION.md +108 -0
  110. package/skills/wix-headless/references/shared/BUILD_NOISE.md +2 -2
  111. package/skills/wix-headless/references/shared/DESIGN_MD.md +85 -0
  112. package/skills/wix-headless/references/shared/DOCS_SEARCH.md +41 -0
  113. package/skills/wix-headless/references/shared/IMAGE_GENERATION.md +40 -39
  114. package/skills/wix-headless/references/shared/IMPLEMENTER.md +92 -41
  115. package/skills/wix-headless/references/shared/PRODUCTION_SHARP_EDGES.md +3 -3
  116. package/skills/wix-headless/references/shared/RETURN_CONTRACT.md +32 -312
  117. package/skills/wix-headless/references/shared/STYLING.md +48 -21
  118. package/skills/wix-headless/references/stores/INSTRUCTIONS.md +59 -29
  119. package/skills/wix-headless/references/stores/PRODUCT_CATALOG_DATA.md +31 -28
  120. package/skills/wix-headless/references/verticals/_schema.json +31 -117
  121. package/skills/wix-headless/references/verticals/_schema.md +60 -150
  122. package/skills/wix-headless/references/verticals/blog.md +5 -99
  123. package/skills/wix-headless/references/verticals/bookings.md +41 -0
  124. package/skills/wix-headless/references/verticals/cms.md +9 -100
  125. package/skills/wix-headless/references/verticals/ecom.md +6 -77
  126. package/skills/wix-headless/references/verticals/forms.md +5 -85
  127. package/skills/wix-headless/references/verticals/gift-cards.md +6 -103
  128. package/skills/wix-headless/references/verticals/stores.md +10 -144
  129. package/skills/wix-headless/scripts/check-manifest.mjs +148 -11
  130. package/skills/wix-headless/scripts/compose.mjs +540 -0
  131. package/skills/wix-headless/scripts/emit-design-tokens.mjs +136 -53
  132. package/skills/wix-headless/scripts/flatten.sh +61 -0
  133. package/skills/wix-headless/scripts/generate-images.mjs +242 -0
  134. package/skills/wix-headless/scripts/patch-decorative-slots.mjs +67 -43
  135. package/skills/wix-headless/scripts/plan-entity-image-waves.mjs +3 -3
  136. package/skills/wix-headless/scripts/scaffold.sh +113 -27
  137. package/skills/wix-headless/scripts/seed-utilities.sh +50 -12
  138. package/skills/wix-headless/scripts/write-decorative-json.mjs +62 -0
  139. package/skills/wix-manage/SKILL.md +4 -8
  140. package/skills/wix-manage/references/blog/how-to-create-blog-posts.md +2 -0
  141. package/skills/wix-manage/references/cms/cms-data-items-crud.md +4 -0
  142. package/skills/wix-manage/references/cms/cms-references-and-relationships.md +2 -0
  143. package/skills/wix-manage/references/cms/cms-schema-management.md +4 -0
  144. package/skills/wix-manage/references/domains/domain-search-and-purchase.md +10 -7
  145. package/skills/wix-manage/references/ecommerce/api-shipping.md +443 -0
  146. package/skills/wix-manage/references/ecommerce/flow-add-free-shipping.md +5 -6
  147. package/skills/wix-manage/references/ecommerce/flow-fix-coverage-gaps.md +4 -5
  148. package/skills/wix-manage/references/ecommerce/flow-optimize-shipping-rates.md +4 -5
  149. package/skills/wix-manage/references/ecommerce/goal-increase-aov.md +1 -1
  150. package/skills/wix-manage/references/ecommerce/goal-reduce-cart-abandonment.md +1 -2
  151. package/skills/wix-manage/references/ecommerce/guardrail-shipping-health.md +2 -2
  152. package/skills/wix-manage/references/ecommerce/recipe-apply-shipping-recommendations.md +4 -5
  153. package/skills/wix-manage/references/ecommerce/recommend-ecommerce-strategy.md +7 -7
  154. package/skills/wix-manage/references/ecommerce/setup-discount-rules.md +209 -72
  155. package/skills/wix-manage/references/ecommerce/setup-store-pickup-location.md +9 -10
  156. package/skills/wix-manage/references/ecommerce/skill-graph.md +4 -4
  157. package/skills/wix-manage/references/forms/create-form.md +50 -0
  158. package/skills/wix-manage/references/stores/bulk-create-products-with-options.md +2 -0
  159. package/skills/wix-manage/references/stores/create-product-from-image.md +91 -38
  160. package/skills/wix-manage/references/stores/setup-online-store-catalog-v3.md +2 -0
  161. package/skills/wix-app/references/custom-element-widget/default-thumbnail.png +0 -0
  162. package/skills/wix-app/references/data-collection/extension-template.ts +0 -107
  163. package/skills/wix-headless/references/ORCHESTRATION.md +0 -269
  164. package/skills/wix-headless/references/commands/install-app.md +0 -42
  165. package/skills/wix-headless/references/commands/mcp-bootstrap.md +0 -28
  166. package/skills/wix-headless/references/designer/INSTRUCTIONS.md +0 -828
  167. package/skills/wix-headless/references/shared/MCP_PREFIX.md +0 -105
  168. package/skills/wix-headless/scripts/copy-utility-templates.mjs +0 -153
  169. package/skills/wix-headless/scripts/finalize-run-json.mjs +0 -141
  170. package/skills/wix-headless/scripts/init-site-json.mjs +0 -63
  171. package/skills/wix-headless/scripts/preview.sh +0 -45
  172. package/skills/wix-headless/scripts/release.sh +0 -73
  173. package/skills/wix-headless/templates/ecom/components-ecom.css +0 -215
  174. package/skills/wix-manage/references/events/list-events.md +0 -203
  175. /package/skills/wix-headless/{templates → references/astro/templates}/ecom/CartBadge.tsx +0 -0
  176. /package/skills/wix-headless/{templates → references/astro/templates}/ecom/CartView.tsx +0 -0
  177. /package/skills/wix-headless/{templates → references/astro/templates}/ecom/cart.astro +0 -0
  178. /package/skills/wix-headless/{templates → references/astro/templates}/ecom/discounts.ts +0 -0
  179. /package/skills/wix-headless/{templates → references/astro/templates}/ecom/thank-you.astro +0 -0
  180. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/GiftCardPurchase.tsx +0 -0
  181. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/_home-teaser-snippet.astro +0 -0
  182. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/_nav-snippet.astro +0 -0
  183. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/components-gift-cards.css +0 -0
  184. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/gift-cards.astro +0 -0
  185. /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/gift-cards.ts +0 -0
  186. /package/skills/wix-headless/{templates → references/astro/templates}/stores/AddToCartButton.tsx +0 -0
  187. /package/skills/wix-headless/{templates → references/astro/templates}/stores/BackInStockForm.tsx +0 -0
  188. /package/skills/wix-headless/{templates → references/astro/templates}/stores/CategoryRail.astro +0 -0
  189. /package/skills/wix-headless/{templates → references/astro/templates}/stores/ProductCard.astro +0 -0
  190. /package/skills/wix-headless/{templates → references/astro/templates}/stores/ProductPurchase.tsx +0 -0
  191. /package/skills/wix-headless/{templates → references/astro/templates}/stores/SeoTags.astro +0 -0
  192. /package/skills/wix-headless/{templates → references/astro/templates}/stores/categories.ts +0 -0
  193. /package/skills/wix-headless/{templates → references/astro/templates}/stores/category/[slug].astro +0 -0
  194. /package/skills/wix-headless/{templates → references/astro/templates}/stores/products/[slug].astro +0 -0
  195. /package/skills/wix-headless/{templates → references/astro/templates}/stores/products/index.astro +0 -0
@@ -13,7 +13,7 @@ Use this reference when a Wix Headless run touches production release, SEO-contr
13
13
  - `temporary system error`
14
14
  - `try again shortly`
15
15
 
16
- The bundled `scripts/release.sh` retries these known transient release failures. Do not retry build failures; TypeScript, Astro, missing import, and missing module failures are code issues that must be fixed before another release attempt.
16
+ The conductor's release step (the shared release tail, `BUILD.md` § "Shared release tail" — `BUILD-astro.md` § "Build & Release" for astro, `BUILD-own-build.md` § "Release" for no-build frameworks) retries these known transient release failures serially — up to 3× with `attempt * 5`s backoff. Do not retry build failures; TypeScript, Astro, missing import, and missing module failures are code issues that must be fixed before another release attempt.
17
17
 
18
18
  For batch releases across many projects, prefer releasing failed sites one by one after the current deployment state settles. Parallel release is useful for throughput, but retry serially when Wix reports state-machine errors.
19
19
 
@@ -63,7 +63,7 @@ PUT https://www.wixapis.com/promote-seo-robots-server/v2/llms
63
63
  }
64
64
  ```
65
65
 
66
- Do not use `default: true` for custom `llms.txt`; in observed runs it caused `/llms.txt` to return `404`.
66
+ Do not use `default: true` for custom `llms.txt` — setting `default: true` returns `404` for custom `llms.txt` content.
67
67
 
68
68
  Wix may mutate `llms.txt` content by:
69
69
 
@@ -94,4 +94,4 @@ For production checks, verify the final rendered HTML and edge-controlled files
94
94
  - For `llms.txt`: fetch `/llms.txt` after the REST update and account for Wix-injected sections.
95
95
  - For custom domains: check both the Wix-hosted URL and custom domain when available, because domain propagation and redirects can differ.
96
96
 
97
- Do not construct URLs by editing the release URL from memory. Use the exact release URL printed by the CLI or the configured custom domain.
97
+ Do not construct URLs by editing the release URL from memory. Use the exact release URL printed by the CLI or the configured custom domain.
@@ -1,18 +1,24 @@
1
1
  # Agent Return Contract
2
2
 
3
- Replaces the sidecar-file coordination model (`.wix/logs/*.md`) with **in-memory structured returns**. Every agent returns a JSON block at the end of its completion message; the skill parses these returns directly from session context.
3
+ Coordination between agents uses **in-memory structured returns**, not sidecar files (`.wix/logs/*.md`, `.wix/seed-returns/*.json`, `.wix/image-urls.md`). Every agent returns a JSON block at the end of its completion message; the skill parses these returns directly from session context.
4
4
 
5
- At end of run, the skill writes ONE file (`.wix/run.json`) aggregating every return. This is the only observability artifact on the project side.
5
+ The orchestrator consumes each return directly from context; nothing is aggregated to disk. The one end-of-run file is the project-root `AGENTS.md` (see `references/shared/AGENTS_MD.md`) — content about the site, not telemetry.
6
6
 
7
- ## Why this replaces sidecars
7
+ This document is the **universal envelope** every agent shares: the rules, the JSON skeleton, status semantics, and the generic failure shape. **The phase-specific `data` shape you must emit does NOT live here — it lives in your own role doc** (the one your scope already reads). See the index at the bottom.
8
8
 
9
- Sidecar files were designed assuming agents are independent processes without shared memory. But subagents run as child model calls under the parent skill's context — they can return structured data directly. Writing/reading markdown files between them adds:
9
+ ## The JSON return is your sole output channel
10
+
11
+ Subagents MUST NOT write coordination files (`.wix/seed-returns/<pack>.json`, `.wix/image-urls.md`, `.wix/logs/*.md`, etc.). The orchestrator parses your fenced JSON block from the message body and either acts on the data directly or pipes it to a deterministic helper script via stdin (e.g. `emit-design-tokens.mjs`, `patch-decorative-slots.mjs`). Any data the orchestrator needs from you belongs under `data` in the return block — files in `.wix/` that aren't build-consumed (CSS, .d.ts) or external-system-owned (`wix.config.json`) are not part of the contract.
12
+
13
+ ## Why structured returns, not files
14
+
15
+ Writing markdown files between agents assumes they're independent processes without shared memory. But subagents run as child model calls under the parent skill's context — they can return structured data directly. File-based coordination adds:
10
16
 
11
17
  - ~10s per sidecar write (file I/O + narration)
12
18
  - ~5s per sidecar read from the parent (another tool call)
13
19
  - Coordination complexity (timing, status-line parsing, retry logic)
14
20
 
15
- Prior runs spent **~1–2 minutes total** on sidecar ceremony. Eliminating that buys back meaningful critical-path time.
21
+ That overhead is pure critical-path cost with no benefit here.
16
22
 
17
23
  ## The contract
18
24
 
@@ -24,10 +30,10 @@ Every subagent's final message ends with a fenced JSON block (language tag: `jso
24
30
  ```json
25
31
  {
26
32
  "status": "complete" | "partial" | "failed",
27
- "phase": "<phase identifier — pack.seed / pack.components / pack.pages[*].name / design-system / image-phase-1-decorative / image-phase-2-entity>",
33
+ "phase": "<phase identifier — see your role doc's Returns section for the exact value>",
28
34
  "scope": "<scope string from the agent's prompt>",
29
35
  "summary": "<one-line description of what was done>",
30
- "data": { ... phase-specific structured data ... },
36
+ "data": { ... phase-specific structured data — shape defined in your role doc ... },
31
37
  "files": ["list", "of", "files", "written", "or", "modified"],
32
38
  "errors": [],
33
39
  "notes": "<optional — anything the parent skill should know>"
@@ -39,28 +45,11 @@ The JSON block MUST be the **last** content in the message. The parent skill par
39
45
 
40
46
  ### Timing is NOT the agent's responsibility
41
47
 
42
- Prior versions of this contract asked agents to include `started` / `ended` ISO-8601 timestamps. **Remove those fields.** Agents fabricate placeholder timestamps (`T00:00:00Z` / `T00:05:00Z`) roughly 60% of the time, which makes `run.json` useless for perf comparison.
43
-
44
- **Authoritative timing source is the runtime `duration_ms`** captured by the parent skill from task-notifications when the subagent completes. The orchestrator MUST prefer `duration_ms` over any agent-reported timing. If an older agent still emits `started`/`ended`, the orchestrator ignores them.
45
-
46
- For Bash calls made by the skill itself (scaffold, env-pull, npm-install, app-install), wrap in `date -u` captures:
47
-
48
- ```bash
49
- STARTED_AT=$(date -u +%Y-%m-%dT%H:%M:%SZ)
50
- # ... run the command ...
51
- ENDED_AT=$(date -u +%Y-%m-%dT%H:%M:%SZ)
52
- # compute seconds and append to run.json
53
- ```
48
+ Agents don't self-report timing or status — the return is just `data`. Emit no `started`/`ended` timestamps; any wall-clock measurement is the harness's job, taken from the session trace.
54
49
 
55
- No LLM-generated timestamps anywhere in the observability pipeline.
50
+ ### No trailing prose after the fenced JSON
56
51
 
57
- ### Observed failure mode — narrative ending instead of fenced JSON
58
-
59
- Agents sometimes end with prose like:
60
-
61
- > *"All three files are correctly written. Let me verify the key requirements… Everything looks good."*
62
-
63
- …with no fenced JSON block at the end. The parent skill then has to reconstruct `data.products` etc. from narrative text — fragile, and when Phase 4 relies on pre-seeded data from Phase 1 Seed returns (see `SKILL.md` Step 7), a missing JSON block means Phase 4 agents don't get their pre-seeded data inline and fall back to re-querying MCP, costing 5–15s each.
52
+ The fenced JSON block must be the **last** content in the message. A trailing sentence — or no block at all — means the parent skill has to reconstruct `data.products` etc. from narrative text. That's fragile, and when a later phase relies on pre-seeded data from earlier returns, a missing block means downstream agents don't get their data inline and fall back to re-querying the REST API, costing 5–15s each.
64
53
 
65
54
  **Correct pattern — end with the fenced block, no trailing prose:**
66
55
 
@@ -92,14 +81,6 @@ All files written. Contract classes referenced: productCard, productGrid, option
92
81
  All three files are correctly written. Let me verify the key requirements are met before returning.
93
82
  ~~~
94
83
 
95
- ~~~markdown
96
- ❌ WRONG — no JSON block at all
97
-
98
- All three files are correctly written. The ProductPurchase island uses contract classes
99
- throughout, AddToCartButton wires to @wix/ecom, and CartView handles the two-step
100
- checkout redirect. Build should pass.
101
- ~~~
102
-
103
84
  The parent skill looks for the **last** fenced JSON block in the message. A trailing sentence means it's no longer the last content; scanning falls back to heuristics. Just stop writing after the closing ` ``` `.
104
85
 
105
86
  ## Status semantics
@@ -110,200 +91,6 @@ The parent skill looks for the **last** fenced JSON block in the message. A trai
110
91
  | `partial` | Some work done, some failed — `errors` explains | Decide per-case: retry, work around, or fail the run |
111
92
  | `failed` | Nothing usable produced — `errors` explains | Retry with corrective prompt or fail the run |
112
93
 
113
- ## Phase-specific `data` shapes
114
-
115
- The skill uses `data` to carry information forward to later phases. Each phase has a known shape.
116
-
117
- ### Phase 1: stores seed
118
-
119
- ```json
120
- {
121
- "status": "complete",
122
- "phase": "stores-seed",
123
- "scope": "seed",
124
- "summary": "Deleted 12 default products; created 3 on-brand products with variants",
125
- "data": {
126
- "products": [
127
- {
128
- "id": "2d1bce83-...",
129
- "name": "Tero Dining Table",
130
- "slug": "tero-dining-table",
131
- "variantId": "ffc1caa2-...",
132
- "price": 2890,
133
- "inventory": 12,
134
- "sku": "TAB-TERO-OAK"
135
- }
136
- ],
137
- "deletedCount": 12,
138
- "createdCount": 3
139
- },
140
- "files": [],
141
- "errors": []
142
- }
143
- ```
144
-
145
- Phase 4 agents consume `data.products[*].slug` and `data.products[*].variantId` to wire live SDK queries.
146
-
147
- ### Phase 1: CMS seed
148
-
149
- ```json
150
- {
151
- "status": "complete",
152
- "phase": "cms-seed",
153
- "scope": "seed",
154
- "data": {
155
- "collections": [
156
- {
157
- "name": "about-content",
158
- "itemIds": ["665f3363-..."],
159
- "fields": ["heading", "body", "image"]
160
- },
161
- {
162
- "name": "faq",
163
- "itemIds": ["abc", "def", "ghi", "jkl", "mno", "pqr"],
164
- "fields": ["question", "answer", "sortOrder"]
165
- }
166
- ]
167
- }
168
- }
169
- ```
170
-
171
- Phase 4 CMS page agents reference these collection names; the image agent attaches entity images to CMS items by ID.
172
-
173
- ### Phase 2: shared wiring
174
-
175
- ```json
176
- {
177
- "status": "complete",
178
- "phase": "stores-components",
179
- "scope": "components",
180
- "summary": "Wrote React islands + utils; wired analytics; contract classes referenced: 7",
181
- "data": {
182
- "islands": ["ProductPurchase.tsx", "CartView.tsx", "AddToCartButton.tsx", "CartBadge.tsx"],
183
- "utils": ["wix-image.ts", "analytics.ts"],
184
- "astroComponents": ["SeoTags.astro"]
185
- },
186
- "files": [
187
- "src/utils/wix-image.ts",
188
- "src/utils/analytics.ts",
189
- "src/components/SeoTags.astro",
190
- "src/components/AddToCartButton.tsx",
191
- "src/components/CartBadge.tsx",
192
- "src/components/ProductPurchase.tsx",
193
- "src/components/CartView.tsx"
194
- ]
195
- }
196
- ```
197
-
198
- ### Phase 2: page rewrites
199
-
200
- ```json
201
- {
202
- "status": "complete",
203
- "phase": "stores-pages-products",
204
- "scope": "pages-products",
205
- "data": {
206
- "pagesWired": 2,
207
- "wixMetadataExported": true,
208
- "seoTagsMounted": true,
209
- "analyticsEvents": ["AddProductImpression", "ClickProduct", "ViewContent"]
210
- },
211
- "files": [
212
- "src/pages/products/index.astro",
213
- "src/pages/products/[slug].astro",
214
- "src/components/ProductCard.astro"
215
- ]
216
- }
217
- ```
218
-
219
- ### Designer foundation
220
-
221
- ```json
222
- {
223
- "status": "complete",
224
- "phase": "design-system",
225
- "data": {
226
- "contractKeys": 19,
227
- "cssLines": 247,
228
- "fonts": ["Cormorant Garamond", "DM Sans"],
229
- "palette": {"cream": "#FFF8F0", "charcoal": "#1A1A1A", "roseGold": "#B76E79"}
230
- },
231
- "files": [
232
- "src/styles/global.css",
233
- "src/layouts/Layout.astro",
234
- "src/components/Navigation.astro",
235
- "src/components/Footer.astro",
236
- ".wix/design-tokens.css"
237
- ]
238
- }
239
- ```
240
-
241
- ### Designer page groups
242
-
243
- ```json
244
- {
245
- "status": "complete",
246
- "phase": "designer-store-pages",
247
- "data": {
248
- "pagesDesigned": ["/products", "/products/[slug]", "/cart", "/thank-you"],
249
- "placeholderDataUsed": true,
250
- "contractClassesHonored": 11
251
- },
252
- "files": [
253
- "src/pages/products/index.astro",
254
- "src/pages/products/[slug].astro",
255
- "src/pages/cart.astro",
256
- "src/pages/thank-you.astro",
257
- "src/components/ProductCard.astro",
258
- "src/components/ProductPurchase.astro",
259
- "src/components/CartView.astro"
260
- ]
261
- }
262
- ```
263
-
264
- ### Images (split into two image phases, dispatched separately)
265
-
266
- The image agent runs in two scopes dispatched by the parent in different steps. Each emits its own return block.
267
-
268
- **`image-phase-1-decorative` — dispatched in Step 3 (no dependencies):**
269
-
270
- ```json
271
- {
272
- "status": "complete",
273
- "phase": "image-phase-1-decorative",
274
- "scope": "image-phase-1-decorative",
275
- "summary": "Generated 3 decorative images; uploaded to Wix Media; wrote .wix/image-urls.md",
276
- "data": {
277
- "decorativeCount": 3,
278
- "purposes": ["hero", "about", "background"],
279
- "model": "google:4@2",
280
- "totalCredits": 0.297
281
- },
282
- "files": [".wix/image-urls.md"],
283
- "errors": []
284
- }
285
- ```
286
-
287
- **`image-phase-2-entity` — dispatched in Step 7 (Phase 1 Seed return data inline in prompt):**
288
-
289
- ```json
290
- {
291
- "status": "complete",
292
- "phase": "image-phase-2-entity",
293
- "scope": "image-phase-2-entity",
294
- "summary": "Generated + attached images for 6 products and 1 CMS item",
295
- "data": {
296
- "entityCount": { "products": 6, "cmsAboutContent": 1, "blogPosts": 0 },
297
- "model": "google:4@2",
298
- "totalCredits": 0.693
299
- },
300
- "files": [],
301
- "errors": []
302
- }
303
- ```
304
-
305
- (Image agent writes to Wix Media via MCP, not to project files — Image Phase 2 `files` is empty.)
306
-
307
94
  ## Failure returns
308
95
 
309
96
  On `failed` or `partial`, `errors` is populated and `data` may still contain partial results:
@@ -326,98 +113,31 @@ On `failed` or `partial`, `errors` is populated and `data` may still contain par
326
113
 
327
114
  Severity levels: `warning` (keep running), `error` (parent should retry), `fatal` (parent must stop).
328
115
 
329
- ## Final `.wix/run.json` (written once by the skill at end of run)
330
-
331
- The skill aggregates every agent return into one file.
332
-
333
- **Timing is required** — the `run` object MUST include `started`, `ended`, and `totalSeconds`, and every entry in `phases` MUST include `seconds`. All timing values are captured by the parent skill (from runtime `duration_ms` for subagents, from `date -u` wraps for its own Bash calls) — agents do not self-report. If timing is missing for any phase, record `seconds: null` + `errors: [{code: "MISSING_TIMING"}]` and investigate what broke capture. See `skills/wix-headless/SKILL.md` § "Timing — required in run.json" for the capture protocol.
334
-
335
- Example:
336
-
337
- ```json
338
- {
339
- "version": "1.0",
340
- "run": {
341
- "started": "2026-01-15T09:16:14Z",
342
- "ended": "2026-01-15T09:28:03Z",
343
- "totalSeconds": 709,
344
- "brand": "Acme Coffee",
345
- "prompt": "I want to sell tables online",
346
- "verticals": ["stores", "cms"],
347
- "packs": ["stores", "cms"]
348
- },
349
- "outcome": {
350
- "build": "success",
351
- "previewUrl": "https://goj5lj-tabula-...-alexp775.wix-host.com",
352
- "dashboardUrl": "https://manage.wix.com/dashboard/<siteId>"
353
- },
354
- "phases": [
355
- { "phase": "scaffold", "status": "complete", "seconds": 45 },
356
- { "phase": "app-install-stores", "status": "complete", "seconds": 6 },
357
- { "phase": "env-pull", "status": "complete", "seconds": 4 },
358
- { "phase": "npm-install", "status": "complete", "seconds": 42, "packageCount": 725 },
359
- { "phase": "stores-seed", "status": "complete", "seconds": 112, "data": { ... } },
360
- { "phase": "cms-seed", "status": "complete", "seconds": 98, "data": { ... } },
361
- { "phase": "stores-components", "status": "complete", "seconds": 134, "data": { ... } },
362
- { "phase": "design-system", "status": "complete", "seconds": 165, "data": { ... } },
363
- { "phase": "designer-home", "status": "complete", "seconds": 287, "data": { ... } },
364
- { "phase": "designer-static", "status": "complete", "seconds": 265, "data": { ... } },
365
- { "phase": "designer-store-pages", "status": "complete", "seconds": 298, "data": { ... } },
366
- { "phase": "stores-pages-products", "status": "complete", "seconds": 89, "data": { ... } },
367
- { "phase": "stores-pages-cart-checkout", "status": "complete", "seconds": 67, "data": { ... } },
368
- { "phase": "stores-pages-home-and-nav", "status": "complete", "seconds": 54, "data": { ... } },
369
- { "phase": "pages", "status": "complete", "seconds": 78, "data": { ... } },
370
- { "phase": "image-phase-1-decorative", "status": "complete", "seconds": 112, "data": { "decorativeCount": 3, ... } },
371
- { "phase": "image-phase-2-entity", "status": "complete", "seconds": 287, "data": { "entityCount": { "products": 6, "cmsAboutContent": 1 }, ... } },
372
- { "phase": "build", "status": "complete", "seconds": 9 },
373
- { "phase": "preview", "status": "complete", "seconds": 21 }
374
- ],
375
- "notes": []
376
- }
377
- ```
378
-
379
- Observations post-run (including this doc's example):
380
- - Total serial wall time ≈ max parallel paths, not sum of seconds
381
- - `data` blocks preserve what each agent returned — recoverable without re-reading agent transcripts
382
- - `files` lists omitted from aggregate; query individual phase `data` if needed
383
-
384
- ## Common failure modes
385
-
386
- Agents should check their output for these before returning `complete`:
387
-
388
- ### Astro/React
389
-
390
- | Failure | How to detect | Fix |
391
- |---------|---------------|-----|
392
- | HTML-style comments in `.astro` frontmatter | `grep '<!--' *.astro frontmatter` | Use `//` or `/* */` — frontmatter is TypeScript |
393
- | Missing `wixMetadata` on `/products/[slug]` | Check exports | Add the metadata export — required for Wix platform indexing |
394
- | `import { products }` instead of `productsV3` | `grep 'from "@wix/stores"' -- import line` | V1 silently returns 0 on V3 catalogs |
395
- | Missing `variantId` in cart operations | Check `catalogReference.options` | Always include — single-variant products have one |
396
- | React island using default Tailwind color class | `grep 'bg-blue-\|bg-green-\|text-red-\|bg-gray-' *.tsx` | Use brand `@theme` utilities (`bg-bark`, `text-cream`) or contract class names |
397
-
398
- ### MCP
116
+ ## Where your phase-specific `data` shape lives
399
117
 
400
- | Failure | How to detect | Fix |
401
- |---------|---------------|-----|
402
- | `UNSUPPORTED_FORM_NAMESPACE` after app install | Error on first MCP call post-install | Wait 10s, retry up to 3x (namespace propagation) |
403
- | `CallWixSiteAPI` with stringified `body` | Tool rejects the call shape | Load the tool schema via your runtime's tool-discovery primitive, then pass `body` as a real object |
404
- | Tool-not-found on Wix MCP call | Tool name without the session's prefix | Use `<prefix>ToolName`; see `MCP_PREFIX.md` recovery |
118
+ The envelope above is universal. The exact `data` shape — plus the known `error.code` values and required `files` — lives in **your role doc**, the one your scope already reads. Do not look for them here; read your own doc. This keeps each shape single-sourced (no drift) and means you never load shapes for phases you don't emit.
405
119
 
406
- ### Build
120
+ | Your agent / scope | `phase` value(s) | Shape lives in |
121
+ |---|---|---|
122
+ | Seed — stores | `stores-seed` | `references/stores/INSTRUCTIONS.md` § Seed return |
123
+ | Seed — CMS | `cms-seed` | `references/cms/INSTRUCTIONS.md` § Seed return |
124
+ | Seed — other verticals | `<pack>-seed` | per-vertical `INSTRUCTIONS.md` (same generic shape as stores) |
125
+ | Components | `<pack>-components` | `references/shared/IMPLEMENTER.md` § Return contract |
126
+ | Pages | `<pack>-pages[-<group>]` | `references/shared/IMPLEMENTER.md` § Return contract |
127
+ | Design System Designer | `design-system` | `references/DESIGN_SYSTEM.md` § What you write and return |
128
+ | Design System Composer (`scripts/compose.mjs`, not a subagent — manifest printed to stdout) | `compose` | `scripts/compose.mjs` header (the manifest shape) |
129
+ | Page Designer | `designer-<scope>` | `references/astro/designer/INSTRUCTIONS.md` (per-scope) |
130
+ | Images | `image-phase-1-decorative`, `image-phase-2-entity` | `references/images/INSTRUCTIONS.md` § Return Contract |
407
131
 
408
- | Failure | How to detect | Fix |
409
- |---------|---------------|-----|
410
- | `Legacy HTML single-line comments` | `npx @wix/cli build` stderr | See Astro/React row 1 above — Phase 2 agent emitted HTML comments |
411
- | `Missing environment variable WIX_CLIENT_ID` | Build stderr | Run `npx @wix/cli env pull` then retry |
412
- | `Cannot find module '@wix/…'` | Build stderr | npm install didn't include that package; check pack's `packages` list |
132
+ The **orchestrator** is the one audience that needs every shape — it parses each return directly; there is no aggregated file. This table is its index.
413
133
 
414
134
  ## Notes for agent authors
415
135
 
416
- When writing a new agent, include a **Returns** section in its `INSTRUCTIONS.md` that lists:
136
+ When writing a new agent, put a **Returns** section in its role doc (`INSTRUCTIONS.md` or equivalent) listing:
417
137
 
418
138
  1. The `phase` identifier this agent emits
419
139
  2. The exact `data` shape for successful returns
420
140
  3. Known `error.code` values
421
141
  4. Required `files` entries
422
142
 
423
- Agents should produce the JSON return block deterministically — don't let creative prose overrun the fenced block. Parent skill parsing assumes the JSON is well-formed and complete.
143
+ Then add a row to the index table above so the orchestrator can find it. Do **not** copy the shape back into this file — one source per shape. Produce the JSON return block deterministically; don't let creative prose overrun the fenced block. Parent skill parsing assumes the JSON is well-formed and complete and is the **last** content in the message.
@@ -1,12 +1,14 @@
1
1
  # Styling — Three Categories, One Default
2
2
 
3
- Every visual decision in a generated site falls into one of three categories. Each has a single owner and a single home. This file is the canonical reference; designer `INSTRUCTIONS.md` and `IMPLEMENTER.md` link here.
3
+ Every visual decision in a generated site falls into one of three categories. Each has a single owner and a single home. This file is the canonical reference; `DESIGN_SYSTEM.md` (Designer), `scripts/compose.mjs` (Composer — deterministic script, self-documenting), `astro/designer/INSTRUCTIONS.md` (Phase 4 page designers), and `IMPLEMENTER.md` link here.
4
+
5
+ > **Design-system ownership (the design-vs-application split).** The **Designer** (`DESIGN_SYSTEM.md`) owns the token *values* and their *completeness* — a coherent, complete brand visual authored as a **DESIGN.md** (`data.design`; format spec in `shared/DESIGN_MD.md`). The **Composer** (`scripts/compose.mjs`; self-documenting) owns the *application* — it writes the `@theme` block in `global.css` from those values (mapping each semantic role to a `--var` name) and guarantees the required-token contract below resolves. Component and page authors still compose those tokens as Tailwind utilities at their call sites. So: Designer picks "paper = `#FAF6EF`"; Composer writes `--color-paper: #FAF6EF` into `@theme`; a page writes `class="bg-paper"`.
4
6
 
5
7
  ## The three categories
6
8
 
7
9
  | Category | Lives in | Owned by | Use for |
8
10
  |---|---|---|---|
9
- | **Tokens (composed as utilities)** | `@theme` block in `src/styles/global.css`, mirrored to `.wix/site.json.designTokens`, `.wix/design-tokens.css`, `.wix/site.d.ts` | Designer (Phase 2) | All color, spacing, typography scale, radii, aspect ratios, shadows, transitions. Pages compose tokens at call sites as Tailwind utilities — `class="py-4xl bg-sand aspect-[16/5]"`. |
11
+ | **Tokens (composed as utilities)** | the canonical `DESIGN.md` + its projections: the `@theme` block in `src/styles/global.css` (written by `scripts/compose.mjs`), plus `.wix/design-tokens.css` and `.wix/site.d.ts` (written by `scripts/emit-design-tokens.mjs`) — all from Designer's `DESIGN.md` | Designer picks values (Phase 2); `compose.mjs` writes `@theme` | All color, spacing, typography scale, radii, aspect ratios, shadows, transitions. Pages compose tokens at call sites as Tailwind utilities — `class="py-4xl bg-sand aspect-[16/5]"`. |
10
12
  | **Global semantic classes** | `src/styles/global.css` (outside `@theme`) and `src/styles/components-<pack>.css` | Designer + Phase 3 component agents | Compound multi-element patterns, interactive states (`:hover`, `:focus`, `:disabled`), and JS/React DOM query targets. |
11
13
  | **Co-located styles** | `<style>` block at the bottom of the same `.astro` file (or component CSS module for islands) | Page or component author | One-off page decoration: hero stamps, custom dividers, ornamental overlays that won't be reused elsewhere. |
12
14
 
@@ -14,7 +16,7 @@ Every visual decision in a generated site falls into one of three categories. Ea
14
16
 
15
17
  **Tokens-as-utilities is the default.** When you're about to write a class for layout, spacing, typography, alignment, simple background/text color, or aspect ratio, write Tailwind utilities derived from `@theme` instead. The site's design tokens give you `py-4xl`, `gap-sm`, `bg-paper-warm`, `text-ink`, `font-display`, `aspect-[16/5]` etc. Compose them in markup; do not invent semantic classes for these concerns.
16
18
 
17
- The token namespace is the contract. Read `.wix/site.json.designTokens` (or its typed mirror at `.wix/site.d.ts`) at the start of any pages or components scope to know which tokens this run published. If a token you need isn't there, that's a designer-side gap — flag it in your return JSON, don't paper over it with a custom class.
19
+ The token namespace is the contract. The design tokens (the DESIGN.md token vocabulary — `colors`/`typography`/`spacing`/`rounded`/`containers`) live on disk at `.wix/design-tokens.css` (gate-verified present before the build wave) — **read that file at the start of any pages or components scope** to know which tokens this run published. The orchestrator does **not** inline them in your prompt. (`.wix/site.d.ts` is also on disk for the build.) If a token you need isn't in `.wix/design-tokens.css`, that's a designer-side gap — flag it in your return JSON, don't paper over it with a custom class.
18
20
 
19
21
  ## Decision tree
20
22
 
@@ -24,7 +26,7 @@ When you find yourself reaching for a `class="..."` value, ask:
24
26
  2. **Is it a compound multi-element pattern** (e.g., a bordered card with header + body + foot rules), an **interactive state** (`:hover`/`:focus`/`:disabled`/`:hover .child`), or a **JS query target** the DOM is inspected for? → Global semantic class in `global.css` (designer-owned) or `components-<pack>.css` (Phase 3 components agent-owned).
25
27
  3. **Is it a one-off page decoration** that won't be reused on any other route? → Co-located `<style>` block at the bottom of the same `.astro` file. Reference tokens via `var(--color-foo)` from `:root` (auto-loaded by `design-tokens.css`).
26
28
 
27
- If none fit, you're probably trying to do something the tokens don't support yet — talk to the designer (for new runs, return a `MISSING_TOKEN` error; for existing projects, add the token to `@theme` and propagate to `.wix/site.json.designTokens`).
29
+ If none fit, you're probably trying to do something the tokens don't support yet — talk to the designer (for new runs, return a `MISSING_TOKEN` error; for existing projects, add the token to `@theme`).
28
30
 
29
31
  ## What does NOT belong as a global semantic class
30
32
 
@@ -35,10 +37,45 @@ These are layout/spacing/typography concerns that should always be utilities, ne
35
37
  - Aspect ratios (`aspect-[4/5]`, `aspect-square`)
36
38
  - Plain typography choices (`text-display-lg font-display`, `text-mute uppercase tracking-wide`)
37
39
  - Background / foreground color application without state (`bg-paper`, `text-ink-soft`)
38
- - Container widths derived from tokens (`max-w-prose`, `w-full`)
40
+ - Container widths derived from tokens (`max-w-prose`, `w-full`) **only when** the designer declared matching `--container-*` keys in `@theme`
41
+
42
+ ### Prose / reading width (CMS, FAQ, About)
43
+
44
+ Tailwind v4 resolves `max-w-3xl` to `var(--container-3xl)`, **not** `var(--spacing-3xl)`. If the designer published `--spacing-3xl: 5rem` but no `--container-3xl`, FAQ/About columns collapse to ~80px.
45
+
46
+ **Page agents (Phase 4):**
47
+
48
+ - **Do not** use `max-w-2xl`, `max-w-3xl`, etc. unless `global.css` `@theme` documents the matching `--container-*` key (grep `@theme` before choosing).
49
+ - **Prefer** `container-reading` (designer `@utility`), `max-w-6xl` when `--container-6xl` exists, or explicit arbitrary width `max-w-[48rem]`.
50
+ - **Do not** confuse spacing scale with container scale — `py-3xl` uses `--spacing-3xl`; `max-w-3xl` uses `--container-3xl`.
39
51
 
40
52
  If a designer's `global.css` contains rules like `.featured-section { padding-block: var(--spacing-4xl); }` or `.product-card-body { display: flex; flex-direction: column; gap: var(--spacing-xs); }`, those are misplaced — they belong in markup as utilities. Inventing such classes ships broken layouts: every consumer needs the designer to have pre-declared the class, and Tailwind v4 silently drops the references when the rule is missing.
41
53
 
54
+ ## Required tokens — the component-CSS template contract
55
+
56
+ The per-pack `components-<pack>.css` templates at `<SKILL_ROOT>/references/astro/templates/<pack>/components-<pack>.css` reference a fixed set of CSS custom properties via `var(--token)` (never `@apply`). Those templates are copied verbatim into the project by the orchestrator at BUILD-astro.md § Step 4.5, so **the Composer's `@theme` block MUST declare every token below** for the build to pass (the Composer maps the Designer's framework-agnostic spec onto these `--var` names, deriving any required role the Designer omitted). If a token is missing, the rule that references it collapses silently and the corresponding component renders unstyled (or worse, half-styled).
57
+
58
+ | Token | Required? | Fallback in templates | Used by |
59
+ |---|---|---|---|
60
+ | `--color-paper` | **required** | — | every pack — primary background |
61
+ | `--color-paper-warm` | **required** | `var(--color-paper, var(--color-cream))` | stores summary bg, ecom cart-summary bg, gift-cards |
62
+ | `--color-ink` | **required** | — | every pack — primary text + dark fills |
63
+ | `--color-ink-soft` | optional | `var(--color-mute)` | stores option-label, ecom cart-item-option |
64
+ | `--color-mute` | **required** | — | every pack — muted text + remove buttons |
65
+ | `--color-rule` | **required** | — | every pack — borders + dividers |
66
+ | `--color-accent` | **required** | — | every pack — brand emphasis |
67
+ | `--color-cream` | optional | inner fallback in `var(--color-paper-warm, var(--color-paper, var(--color-cream)))` | stores form bg, gift-cards |
68
+ | `--color-error` | optional | `var(--color-accent)` or hardcode | ecom cart-item-unavailable, stores back-in-stock-error |
69
+ | `--font-display` | **required** | — | every pack — headings + labels |
70
+ | `--font-body` | **required** | — | every pack — body text + UI |
71
+ | `--spacing-2xs` … `--spacing-4xl` | **required (full scale)** | — | every template uses `gap: var(--spacing-md)` and similar |
72
+ | `--radius-sm`, `--radius-md` | **required** | — | buttons, inputs, cards |
73
+ | `--radius-lg`, `--radius-xl` | optional | — | stores product-card |
74
+
75
+ The templates do NOT use `@apply` — every rule is `property: var(--token);` directly. This means missing utilities don't fail at build time (the way `@apply gap-sm` would). Missing tokens degrade silently to `var(missing) → unset → initial`. That makes the failure mode "ugly component" not "broken build" — easier to recover from but harder to detect, so verify the full set above is in `@theme` before returning.
76
+
77
+ **Why this contract exists.** The component templates are authored against a stable, brand-agnostic token vocabulary so they don't need to be regenerated per run. Using `@apply` against brand-specific tokens (e.g. `bark`, `cream`, `parchment`) that designers don't publish fails the build with `Cannot apply unknown utility class`. Direct `var()` against the required-token list above avoids that class of failure entirely.
78
+
42
79
  ## What DOES belong in `global.css` (designer-owned)
43
80
 
44
81
  The designer's `global.css` is small — tokens plus a short list of truly cross-cutting patterns. Anything specific to a single vertical's component (a product card, a cart row, a discount callout) does NOT belong here. Those live with the component, in `components-<pack>.css` (Phase 3 components agent-owned) or in a co-located `<style>` block inside the component's `.astro` file.
@@ -54,7 +91,7 @@ That's it. The full list of always-required classes for a site lives in designer
54
91
 
55
92
  ## Component-specific CSS is owned by the component, not the designer
56
93
 
57
- The boundary that previously caused leaks: the designer published partial rules for `.product-card`, `.product-grid`, `.product-card-media`, `.offer-callout`, `.cart-summary`, etc. — all classes used by exactly one vertical's component. The designer doesn't know how those components should be laid out for a particular brand, so the rules ship as stubs and templates quietly add the missing layout in scoped CSS. Result: the same class behaves differently on different pages (e.g. `/products` rendering with `.product-grid { transition: opacity }` and no `display: grid`, while `/category/<slug>` defines a separate scoped `.product-grid` with the actual grid).
94
+ The boundary that causes leaks: if the designer publishes partial rules for `.product-card`, `.product-grid`, `.product-card-media`, `.offer-callout`, `.cart-summary`, etc. — all classes used by exactly one vertical's component — the designer doesn't know how those components should be laid out for a particular brand, so the rules ship as stubs and templates quietly add the missing layout in scoped CSS. The same class then behaves differently on different pages (e.g. `/products` rendering with `.product-grid { transition: opacity }` and no `display: grid`, while `/category/<slug>` defines a separate scoped `.product-grid` with the actual grid).
58
95
 
59
96
  The fix is structural: move component-specific CSS out of `global.css` entirely.
60
97
 
@@ -67,25 +104,15 @@ The fix is structural: move component-specific CSS out of `global.css` entirely.
67
104
 
68
105
  The Phase 3 components agents already write to `components-<pack>.css` (the file is imported by the designer's `Layout.astro` from the start). This change just makes it the *only* place those classes live — no parallel partial rule in `global.css`.
69
106
 
70
- ### Why this is structural
71
-
72
- Tokens + truly cross-cutting patterns (buttons, decorative slots, site shell) are stable across verticals and brands — fine for the designer to own. Component-specific layout and spacing evolves with the component. Putting it next to the component means:
107
+ ### Pre-return checklist for the Composer
73
108
 
74
- - One author per class. No drift.
75
- - Verticals can ship new component variants without round-tripping the designer.
76
- - `overflow: hidden` + `border-radius` traps are caught by the same person who set the radius — no second author who has to *know* the radius value.
77
-
78
- ### Pre-return checklist for the designer
79
-
80
- Before returning the design-system scope, the designer agent runs:
109
+ `compose.mjs` writes `global.css` by substituting the `@theme` palette into a pinned skeleton, so this leak is **structurally prevented** — the skeleton declares no `.product-card`/`.cart-summary`-family rules and the script never adds any. The grep below is a maintainer guard for when the skeleton itself is edited; confirm it declares none of these:
81
110
 
82
111
  ```
83
- grep -r --include="*.astro" --include="*.tsx" -lE "class(\\Name)?=.*(\\.|\\b)(product-card|product-grid|product-card-media|product-card-ribbon|product-card-index|offer-callout|cart-summary|cart-total|cart-empty|checkout-btn)\\b" $SKILL_ROOT/templates/*/
112
+ grep -r --include="*.astro" --include="*.tsx" -lE "class(\\Name)?=.*(\\.|\\b)(product-card|product-grid|product-card-media|product-card-ribbon|product-card-index|offer-callout|cart-summary|cart-total|cart-empty|checkout-btn)\\b" $SKILL_ROOT/references/astro/templates/*/
84
113
  ```
85
114
 
86
- For every class name listed above that the designer's `global.css` declares: if any template references it, the class is component-specific and must NOT be in `global.css`. Move the rule to the appropriate `components-<pack>.css` template (or to a scoped `<style>` block in the component template). Do NOT ship a partial rule in `global.css` that the template "completes" — that's the leak this file is preventing.
87
-
88
- The check is mechanical and bounded — it scans templates, not the live project.
115
+ For any listed class the Composer's `global.css` declares: if a template references it, move the rule to the appropriate `components-<pack>.css` template (or a scoped `<style>` block). Do NOT ship a partial rule in `global.css` that the template "completes".
89
116
 
90
117
  ## Co-located styles — the locality default for one-offs
91
118
 
@@ -114,4 +141,4 @@ No coordination with the designer needed; no entry to forget on the always-requi
114
141
 
115
142
  ## Why this protocol
116
143
 
117
- The bug class this prevents: markup writers (designer's shells, vertical pages agents, committed templates) and the CSS writer (designer's `global.css`) operate in different phases with no handshake. When the markup writer types a class string the CSS writer didn't pre-declare, Tailwind v4 silently drops it and ships a site with broken styling. Tokens-as-utilities collapses that handshake — there's no class to forget, only utilities derived from a token list everyone reads.
144
+ The bug class this prevents: markup writers (designer's shells, vertical pages agents, committed templates) and the CSS writer (designer's `global.css`) operate in different phases with no handshake. When the markup writer types a class string the CSS writer didn't pre-declare, Tailwind v4 silently drops it and ships a site with broken styling. Tokens-as-utilities collapses that handshake — there's no class to forget, only utilities derived from a token list everyone reads.