@wix/agent-skills 1.8.0 → 1.9.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 (37) hide show
  1. package/package.json +1 -1
  2. package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +2 -1
  3. package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +14 -0
  4. package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +11 -6
  5. package/skills/wix-app/references/editor-react-component/REACT-PATTERNS.md +3 -17
  6. package/skills/wix-app/references/editor-react-component/SSR.md +119 -0
  7. package/skills/wix-design-system/SKILL.md +1 -1
  8. package/skills/wix-headless/references/BUILD-astro.md +5 -7
  9. package/skills/wix-headless/references/SETUP.md +1 -1
  10. package/skills/wix-headless/references/astro/bookings/COMPONENTS.md +41 -333
  11. package/skills/wix-headless/references/astro/bookings/SERVICES_PAGES.md +58 -428
  12. package/skills/wix-headless/references/astro/designer/INSTRUCTIONS.md +4 -7
  13. package/skills/wix-headless/references/astro/templates/bookings/AvailabilityCalendar.tsx +158 -143
  14. package/skills/wix-headless/references/astro/templates/bookings/BookingForm.tsx +104 -162
  15. package/skills/wix-headless/references/astro/templates/bookings/ServiceBookingFlow.tsx +17 -13
  16. package/skills/wix-headless/references/astro/templates/bookings/booking-confirmation.astro +16 -78
  17. package/skills/wix-headless/references/astro/templates/bookings/bookingDriver.ts +245 -0
  18. package/skills/wix-headless/references/astro/templates/bookings/components-bookings.css +122 -179
  19. package/skills/wix-headless/references/astro/templates/bookings/services/[slug].astro +61 -9
  20. package/skills/wix-headless/references/astro/templates/bookings/services/index.astro +10 -2
  21. package/skills/wix-headless/references/bookings/FLOW.md +185 -0
  22. package/skills/wix-headless/references/bookings/INSTRUCTIONS.md +60 -76
  23. package/skills/wix-headless/references/custom/bookings/WIRING.md +123 -65
  24. package/skills/wix-headless/references/verticals/bookings.md +6 -8
  25. package/skills/wix-manage/SKILL.md +12 -0
  26. package/skills/wix-manage/references/app-installation/install-wix-apps.md +3 -27
  27. package/skills/wix-manage/references/bookings/create-appointment-service.md +266 -0
  28. package/skills/wix-manage/references/bookings/create-booking-service-from-prompt.md +37 -0
  29. package/skills/wix-manage/references/bookings/create-class-service.md +245 -0
  30. package/skills/wix-manage/references/bookings/create-course-service.md +249 -0
  31. package/skills/wix-manage/references/cms/cms-data-items-crud.md +2 -1
  32. package/skills/wix-manage/references/cms/cms-schema-management.md +1 -1
  33. package/skills/wix-manage/references/stores/create-product-from-image.md +154 -2
  34. package/skills/wix-headless/references/astro/templates/bookings/ManageBooking.tsx +0 -84
  35. package/skills/wix-headless/references/astro/templates/bookings/api/confirm-booking.ts +0 -34
  36. package/skills/wix-headless/references/astro/templates/bookings/api/waitlist.ts +0 -74
  37. package/skills/wix-headless/references/astro/templates/bookings/manage-booking.astro +0 -76
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/agent-skills",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "Wix Skills for AI coding agents — versioned npm distribution of the wix/skills content.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -72,7 +72,8 @@ Topic-focused references (rules + patterns + common mistakes in one place):
72
72
  - [`editor-react-component/DIRECTIONALITY.md`](editor-react-component/DIRECTIONALITY.md) — RTL/LTR rules and patterns
73
73
  - [`editor-react-component/PROPS-VS-CSS.md`](editor-react-component/PROPS-VS-CSS.md) — What should be a React prop vs CSS
74
74
  - [`editor-react-component/COMPONENT-API.md`](editor-react-component/COMPONENT-API.md) — Props structure, elementProps, data types, file splitting, containers, array props
75
- - [`editor-react-component/REACT-PATTERNS.md`](editor-react-component/REACT-PATTERNS.md) — SSR-safe patterns, CSS rules, remaining common mistakes
75
+ - [`editor-react-component/SSR.md`](editor-react-component/SSR.md) — Server-side rendering rules (mandatory)
76
+ - [`editor-react-component/REACT-PATTERNS.md`](editor-react-component/REACT-PATTERNS.md) — CSS rules, remaining common mistakes
76
77
 
77
78
  ## CSS guidelines
78
79
 
@@ -13,6 +13,20 @@ Rules and patterns for ARIA accessibility support in Editor React components.
13
13
  - The `A11y` type includes: `ariaLabel`, `ariaDescribedBy`, `ariaLabelledBy`, `role`, `ariaHidden`, `ariaLive`, and all other ARIA attributes.
14
14
  - Users provide ARIA values through the `a11y` prop: `<Component a11y={{ ariaLabel: "..." }} />`
15
15
 
16
+ ### Stable IDs for Element Relationships
17
+
18
+ ARIA relationships (`aria-controls`, `aria-labelledby`, `aria-describedby`) and `htmlFor` need element ids. Generate them with `useStableId` from `@wix/react-component-utils` — passing the `id` prop as the override — never `Math.random()`, a manual counter, or a bare `React.useId()` (those break SSR/hydration). See [`SSR.md`](SSR.md) for the full rule.
19
+
20
+ ```tsx
21
+ import { useStableId } from '@wix/react-component-utils';
22
+
23
+ const rootId = useStableId(id);
24
+ const panelId = `${rootId}-panel`;
25
+
26
+ <button aria-controls={panelId}>{label}</button>
27
+ <div id={panelId} role="tabpanel">{content}</div>
28
+ ```
29
+
16
30
  ### ARIA Label Rules
17
31
 
18
32
  ARIA labels are user-facing content and must NEVER be hardcoded as string literals in JSX.
@@ -8,7 +8,8 @@ This guide defines rules and guidance on **how to implement** production-quality
8
8
  - [`DIRECTIONALITY.md`](DIRECTIONALITY.md) — RTL/LTR rules and patterns
9
9
  - [`PROPS-VS-CSS.md`](PROPS-VS-CSS.md) — What should be a React prop vs CSS
10
10
  - [`COMPONENT-API.md`](COMPONENT-API.md) — Props structure, elementProps, data types, file splitting, containers, array props
11
- - [`REACT-PATTERNS.md`](REACT-PATTERNS.md) — SSR-safe patterns, CSS rules, common mistakes
11
+ - [`SSR.md`](SSR.md) — Server-side rendering rules (mandatory)
12
+ - [`REACT-PATTERNS.md`](REACT-PATTERNS.md) — CSS rules, common mistakes
12
13
 
13
14
  ## React 18 features are not supported
14
15
 
@@ -42,6 +43,10 @@ Direction support is mandatory — see [`DIRECTIONALITY.md`](DIRECTIONALITY.md).
42
43
 
43
44
  See [`ACCESSIBILITY.md`](ACCESSIBILITY.md) for full rules and patterns.
44
45
 
46
+ ### SSR Safety
47
+
48
+ Components are server-rendered, then hydrated — they MUST render correctly, completely, and identically on the server. See [`SSR.md`](SSR.md) for full rules and patterns.
49
+
45
50
  ### TypeScript
46
51
 
47
52
  - All components must be fully typed
@@ -67,11 +72,11 @@ All components MUST follow these patterns:
67
72
 
68
73
  **1. SSR-Safe Implementation**
69
74
 
70
- - NO browser APIs at module scope (window, document, navigator, etc.)
71
- - Guard browser APIs with typeof checks or useEffect
72
- - All browser-dependent logic must run client-side only
75
+ - NO browser APIs at module scope or during render (window, document, navigator, etc.) — guard inside `useEffect`
76
+ - First render must be complete and deterministic; effects are client-only enhancement
77
+ - Internal ids via `useStableId`; NO `useLayoutEffect`
73
78
 
74
- See [`REACT-PATTERNS.md`](REACT-PATTERNS.md) §1.1 for code examples.
79
+ See [`SSR.md`](SSR.md) for full rules and code examples.
75
80
 
76
81
  **2. Clean Code**
77
82
 
@@ -162,6 +167,6 @@ See [`PROPS-VS-CSS.md`](PROPS-VS-CSS.md) and [`COMPONENT-API.md`](COMPONENT-API.
162
167
 
163
168
  **Phase 1: Analysis** — Parse information, map component structure (see Part 0)
164
169
 
165
- **Phase 2: Component File** — Apply all §1.1 mandatory features and §1.2 implementation standards
170
+ **Phase 2: Component File** — Apply all §1.1 mandatory features and §1.2 implementation standards; verify SSR safety against [`SSR.md`](SSR.md)
166
171
 
167
172
  **Phase 3: Styles** — Apply Part 2 SCSS rules
@@ -6,23 +6,7 @@ Code patterns and common mistakes for Editor React components.
6
6
 
7
7
  ## 1.1 SSR-Safe Implementation
8
8
 
9
- Avoid browser-only APIs at module scope or during render; use them inside `useEffect` with `typeof window !== 'undefined'`.
10
-
11
- **❌ Wrong:**
12
-
13
- ```typescript
14
- const userAgent = window.navigator.userAgent;
15
- ```
16
-
17
- **✅ Correct:**
18
-
19
- ```typescript
20
- useEffect(() => {
21
- if (typeof window !== "undefined") {
22
- const userAgent = window.navigator.userAgent;
23
- }
24
- }, []);
25
- ```
9
+ Components are server-rendered then hydrated. See [`SSR.md`](SSR.md) for the full rules and code examples (browser globals, complete first render, deterministic output, `useStableId`, no `useLayoutEffect`).
26
10
 
27
11
  ## 1.2 Element Visibility (Platform-Managed)
28
12
 
@@ -102,6 +86,8 @@ different — they go through a JS-toggled modifier class; see
102
86
 
103
87
  ## 3.2 Browser APIs at module scope
104
88
 
89
+ See [`SSR.md`](SSR.md) for the full SSR rules.
90
+
105
91
  **❌ Wrong:**
106
92
 
107
93
  ```typescript
@@ -0,0 +1,119 @@
1
+ # Server-Side Rendering (SSR)
2
+
3
+ Rules and patterns for SSR-safe Editor React components.
4
+
5
+ Editor React components are server-rendered and then hydrated on the client — every component MUST render correctly, completely, and identically on the server. SSR safety is mandatory for every component.
6
+
7
+ ---
8
+
9
+ ## Rules
10
+
11
+ ### No browser globals at module scope or during render
12
+
13
+ `window`, `document`, `navigator`, `localStorage`, `sessionStorage`, `matchMedia`, `IntersectionObserver`, `ResizeObserver`, and other DOM/BOM APIs do not exist on the server. Never touch them at module scope or in the render body. Access them only inside `useEffect`, optionally guarded with `typeof window !== 'undefined'`.
14
+
15
+ **❌ Wrong:**
16
+
17
+ ```typescript
18
+ const userAgent = window.navigator.userAgent;
19
+ ```
20
+
21
+ **✅ Correct:**
22
+
23
+ ```typescript
24
+ useEffect(() => {
25
+ if (typeof window !== "undefined") {
26
+ const userAgent = window.navigator.userAgent;
27
+ }
28
+ }, []);
29
+ ```
30
+
31
+ ### First render must be complete
32
+
33
+ Render all parts unconditionally — never gate structural elements behind effect-set state. Initialize `useState` to a valid, server-renderable default so the first (server) render already shows the final structure. Element visibility is platform-managed; see [`PROPS-VS-CSS.md`](PROPS-VS-CSS.md) and [`REACT-PATTERNS.md`](REACT-PATTERNS.md) §1.2.
34
+
35
+ **❌ Wrong — content only appears after an effect runs (missing on the server):**
36
+
37
+ ```tsx
38
+ const [items, setItems] = useState<Array<Item>>([]);
39
+ useEffect(() => {
40
+ setItems(buildItems(props));
41
+ }, [props]);
42
+ return <ul>{items.map(/* ... */)}</ul>; // empty on the server
43
+ ```
44
+
45
+ **✅ Correct — derive during render so it exists on the first pass:**
46
+
47
+ ```tsx
48
+ const items = buildItems(props);
49
+ return <ul>{items.map(/* ... */)}</ul>;
50
+ ```
51
+
52
+ ### Deterministic render
53
+
54
+ The same props MUST produce the same markup on the server and the client. No `Math.random()`, `Date.now()`, `new Date()`, or locale/timezone-dependent output during render — these differ across environments and break hydration.
55
+
56
+ **❌ Wrong:**
57
+
58
+ ```tsx
59
+ <span>{new Date().toLocaleString()}</span>
60
+ ```
61
+
62
+ **✅ Correct — derive from props, or compute in an effect:**
63
+
64
+ ```tsx
65
+ <span>{formatDate(props.timestamp)}</span>
66
+ ```
67
+
68
+ ### Stable IDs via `useStableId`
69
+
70
+ When a component needs an internal id (ARIA wiring such as `aria-controls` / `aria-labelledby`, or `htmlFor`), generate it with `useStableId` from `@wix/react-component-utils`. Never use `Math.random()`, a manual counter, or a bare `React.useId()` — those break hydration or are not available across runtimes. Pass the component's `id` prop as the override so a caller-supplied id wins, then derive child ids from the result.
71
+
72
+ **✅ Correct:**
73
+
74
+ ```tsx
75
+ import { useStableId } from '@wix/react-component-utils';
76
+
77
+ const rootId = useStableId(id);
78
+ const panelId = `${rootId}-panel`;
79
+
80
+ <button aria-controls={panelId}>{label}</button>
81
+ <div id={panelId} role="tabpanel">{content}</div>
82
+ ```
83
+
84
+ **❌ Wrong:**
85
+
86
+ ```tsx
87
+ const panelId = `tab-${Math.random()}`; // ❌ differs every render
88
+ const panelId = React.useId(); // ❌ use the useStableId util instead
89
+ ```
90
+
91
+ ### No `useLayoutEffect`
92
+
93
+ `useLayoutEffect` does nothing on the server and triggers a React warning. Use `useEffect` for client-only work.
94
+
95
+ **❌ Wrong:**
96
+
97
+ ```tsx
98
+ useLayoutEffect(() => { measure(); }, []);
99
+ ```
100
+
101
+ **✅ Correct:**
102
+
103
+ ```tsx
104
+ useEffect(() => { measure(); }, []);
105
+ ```
106
+
107
+ ### Effects are client-only enhancement
108
+
109
+ `useEffect` runs only after hydration, never on the server. Use effects to enhance — not to produce the initial UI. The server-rendered default state must already look correct before any effect runs.
110
+
111
+ ---
112
+
113
+ ## SSR Checklist
114
+
115
+ - [ ] No browser globals at module scope or in the render body — guarded inside `useEffect` only
116
+ - [ ] All parts render unconditionally on the first pass; state initialized to a server-safe default
117
+ - [ ] Render output is deterministic — no `Math.random()` / `Date.now()` / `new Date()` / locale-dependent output during render
118
+ - [ ] Internal ids come from `useStableId(id)`, never random values, counters, or bare `React.useId()`
119
+ - [ ] No `useLayoutEffect`
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: wix-design-system
3
- description: Wix Design System component reference. Use when building UI with @wix/design-system, choosing components, checking props and examples, or writing tests with component testkits. Triggers on "what component", "how do I make", "WDS", "show me props", "testkit", "driver", or component names like Button, Card, Modal, Box, Text.
3
+ description: Wix Design System component reference. Use when building UI with @wix/design-system, choosing components, checking props and examples, or writing tests with component testkits. Triggers on "what component", "how do I make", "WDS", "show me props", "testkit", "driver", or component names like Button, Card, Box, Text.
4
4
  ---
5
5
 
6
6
  # WDS Documentation Navigator
@@ -171,14 +171,12 @@ cp "<SKILL_ROOT>/references/astro/templates/stores/back-in-stock.ts" "src/utils/
171
171
  cp "<SKILL_ROOT>/references/astro/templates/stores/categories.ts" "src/utils/categories.ts"
172
172
  # ecom (loaded)
173
173
  cp "<SKILL_ROOT>/references/astro/templates/ecom/discounts.ts" "src/utils/discounts.ts"
174
- # bookings (loaded) — elevated SSR API endpoints + SeoTags
175
- mkdir -p src/pages/api
176
- cp "<SKILL_ROOT>/references/astro/templates/bookings/api/confirm-booking.ts" "src/pages/api/confirm-booking.ts"
177
- cp "<SKILL_ROOT>/references/astro/templates/bookings/api/waitlist.ts" "src/pages/api/waitlist.ts"
178
- cp "<SKILL_ROOT>/references/astro/templates/bookings/SeoTags.astro" "src/components/SeoTags.astro"
174
+ # bookings (loaded) — the booking SDK module + SeoTags
175
+ cp "<SKILL_ROOT>/references/astro/templates/bookings/bookingDriver.ts" "src/components/bookingDriver.ts"
176
+ cp "<SKILL_ROOT>/references/astro/templates/bookings/SeoTags.astro" "src/components/SeoTags.astro"
179
177
  ```
180
178
 
181
- `categories.ts` is imported by `pages-categories`/`pages-products`/`pages-home-and-nav`; `back-in-stock.ts` by stores components; `discounts.ts` by ecom components + stores product pages; the bookings API endpoints (elevated `confirmBooking` seat-hold + native v1 waitlist register) by `BookingForm.tsx`, and `SeoTags.astro` by `services/[slug].astro`. Static, brand-agnostic SDK wrappers — if not pre-copied, multiple scopes race to author them.
179
+ `categories.ts` is imported by `pages-categories`/`pages-products`/`pages-home-and-nav`; `back-in-stock.ts` by stores components; `discounts.ts` by ecom components + stores product pages; `bookingDriver.ts` (the ecom-Cart-V2 booking sequence — `book()`/`navigateToCheckout()`) by the bookings islands, and `SeoTags.astro` by `services/[slug].astro`. Static, brand-agnostic SDK wrappers — if not pre-copied, multiple scopes race to author them.
182
180
 
183
181
  ### Dispatch the wave — one concurrent batch (private agents) + a serialized shell chain alongside it
184
182
 
@@ -193,7 +191,7 @@ One merged "build" agent per loaded vertical (Instruction file = that vertical's
193
191
  **B · Serialized shell chain — agents that patch `Navigation.astro` / `index.astro`** (read-modify-write a shared file → concurrent dispatch trips the staleness guard `File has been modified since read`, **per-file, not per-marker**). **Launch one, wait for its return, launch the next** — each sees the previous one's insertion. Runs **alongside** batch A, not after it. The shell-patchers (today): **ecom, stores `pages-home-and-nav`, bookings, gift-cards** — exactly the packs with `nav:`/`home:` markers:
194
192
  - **ecom-build** — `components` (CartView, CartBadge) → `pages` (`cart.astro`, `thank-you.astro` private, **+ CartBadge mount in `Navigation.astro` at `<!-- nav:actions -->`**).
195
193
  - **stores-home-and-nav** — patch `index.astro` product grid at `<!-- home:stores -->` + `Navigation.astro` Shop submenu at `<!-- nav:links -->`. Writes no islands; pure shell-patcher.
196
- - **bookings-build** — `components` (ServiceCard, AvailabilityCalendar, BookingForm, ServiceBookingFlow, ManageBooking) → `pages` (`services/index.astro`, `services/[slug].astro`, `booking-confirmation.astro`, `manage-booking.astro` private, **+ Services link in `Navigation.astro` at `<!-- nav:links -->` / services teaser in `index.astro` at `<!-- home:bookings -->`**).
194
+ - **bookings-build** — `components` (AvailabilityCalendar, BookingForm, ServiceBookingFlow islands; `bookingDriver.ts` + `SeoTags.astro` are pre-copied) → `pages` (`services/index.astro`, `services/[slug].astro`, `ServiceCard.astro`, `booking-confirmation.astro` private, **+ Services link in `Navigation.astro` at `<!-- nav:links -->` / services teaser in `index.astro` at `<!-- home:bookings -->`**).
197
195
  - **gift-cards-build** — `components` (probe util, GiftCardPurchase island) → `pages` (gift-cards landing + `Navigation.astro` `<!-- nav:links -->` / `index.astro` `<!-- home:gift-cards -->`).
198
196
 
199
197
  Cross-vertical imports (`stores-home-and-nav` importing `CategoryRail`/`ProductCard`/`utils/categories.ts`) resolve at **build time**, not write time, so they impose no write-ordering between the chain and batch A. The only ordering: (i) shell-patchers serialize against each other (per-file), (ii) everything is on disk before Build.
@@ -96,7 +96,7 @@ npm install --no-fund --no-audit --legacy-peer-deps <package-set> \
96
96
  | | **blog** → `@wix/blog @wix/ricos @astrojs/rss @astrojs/sitemap` |
97
97
  | | **forms** → `@wix/forms` |
98
98
  | | **cms** → `@wix/data @wix/essentials` |
99
- | | **bookings** → `@wix/bookings @wix/essentials` |
99
+ | | **bookings** → `@wix/bookings @wix/essentials @wix/forms @wix/redirects @wix/auto_sdk_ecom_cart-v-2` |
100
100
  | | **gift-cards** → (none — disabled-by-default pack ships no Astro-time imports) |
101
101
 
102
102
  Example (resolved set = stores + ecom + gift-cards + cms):