@hostinger/mcp 3.2.2 → 3.3.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 (65) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/gemini-extension.json +1 -1
  3. package/package.json +1 -1
  4. package/server.json +2 -2
  5. package/skills/headless/SKILL.md +245 -36
  6. package/skills/headless/connect/SKILL.md +98 -0
  7. package/skills/headless/{entry → connect}/bootstrap.mjs +8 -3
  8. package/skills/headless/connect/tools/antigravity.md +54 -0
  9. package/skills/headless/connect/tools/claude-code.md +46 -0
  10. package/skills/headless/connect/tools/codex.md +48 -0
  11. package/skills/headless/connect/tools/cursor.md +109 -0
  12. package/skills/headless/connect/tools/devin.md +50 -0
  13. package/skills/headless/connect/tools/vscode.md +57 -0
  14. package/skills/headless/report.schema.json +149 -0
  15. package/skills/headless/run-log.mjs +662 -0
  16. package/skills/headless/steps/01-check-state/SKILL.md +209 -0
  17. package/skills/headless/steps/02-refine/SKILL.md +273 -0
  18. package/skills/headless/steps/03-provision/SKILL.md +117 -0
  19. package/skills/headless/steps/03-provision/ecommerce/SKILL.md +142 -0
  20. package/skills/headless/steps/03-provision/webapp/SKILL.md +154 -0
  21. package/skills/headless/steps/03-provision/wordpress/SKILL.md +249 -0
  22. package/skills/headless/steps/04-content-model/SKILL.md +228 -0
  23. package/skills/headless/steps/04-content-model/ecommerce/SKILL.md +75 -0
  24. package/skills/headless/steps/04-content-model/wordpress/SKILL.md +223 -0
  25. package/skills/headless/steps/04-content-model/wordpress/woocommerce.md +153 -0
  26. package/skills/headless/steps/05-design/SKILL.md +464 -0
  27. package/skills/headless/steps/05-design/logo-kit.mjs +201 -0
  28. package/skills/headless/steps/06-frontend/SKILL.md +160 -0
  29. package/skills/headless/steps/07-validate/SKILL.md +56 -0
  30. package/skills/headless/steps/08-deploy/SKILL.md +179 -0
  31. package/skills/headless/steps/09-done/SKILL.md +157 -0
  32. package/src/core/skills.js +171 -24
  33. package/src/core/skills.ts +171 -24
  34. package/src/servers/agency-hosting.js +1 -1
  35. package/src/servers/agency-hosting.ts +1 -1
  36. package/src/servers/agent-readiness.js +1 -1
  37. package/src/servers/agent-readiness.ts +1 -1
  38. package/src/servers/all.js +1 -1
  39. package/src/servers/all.ts +1 -1
  40. package/src/servers/billing.js +1 -1
  41. package/src/servers/billing.ts +1 -1
  42. package/src/servers/dns.js +1 -1
  43. package/src/servers/dns.ts +1 -1
  44. package/src/servers/domains.js +1 -1
  45. package/src/servers/domains.ts +1 -1
  46. package/src/servers/ecommerce.js +1 -1
  47. package/src/servers/ecommerce.ts +1 -1
  48. package/src/servers/horizons.js +1 -1
  49. package/src/servers/horizons.ts +1 -1
  50. package/src/servers/hosting.js +1 -1
  51. package/src/servers/hosting.ts +1 -1
  52. package/src/servers/mail.js +1 -1
  53. package/src/servers/mail.ts +1 -1
  54. package/src/servers/reach.js +1 -1
  55. package/src/servers/reach.ts +1 -1
  56. package/src/servers/vps.js +1 -1
  57. package/src/servers/vps.ts +1 -1
  58. package/src/servers/wordpress.js +1 -1
  59. package/src/servers/wordpress.ts +1 -1
  60. package/skills/headless/entry/skill.md +0 -79
  61. package/skills/headless/references/DATABASE.md +0 -49
  62. package/skills/headless/references/DEPLOYMENT.md +0 -34
  63. package/skills/headless/references/SETUP.md +0 -35
  64. package/skills/headless/references/STORE.md +0 -52
  65. package/skills/headless/references/WORDPRESS.md +0 -51
@@ -0,0 +1,153 @@
1
+ # headless — WooCommerce cookbook (headless store on WordPress)
2
+
3
+ A companion recipe to `SKILL.md` (WordPress content model). Use it whenever the WordPress backend carries
4
+ a **WooCommerce store** (`site.json → woocommerce.enabled: true`) — a brief whose **Suggested backend** is
5
+ `**WordPress + WooCommerce**` (one site: content **and** commerce).
6
+
7
+ **WooCommerce is not a separate backend.** It is the `woocommerce` plugin on a normal headless WordPress
8
+ install at `/cms` (installed in the provision step). This cookbook is the authoritative home for the store
9
+ data layer: how to **seed and CRUD** products, categories and coupons, and how the **storefront** reads
10
+ the cart, coupons and checkout.
11
+
12
+ ---
13
+
14
+ ## 1 — The one rule: drive the store through the per-site WP MCP
15
+
16
+ A **custom plugin cannot be installed into a headless `/cms`** from a coding agent (same limit that
17
+ removed `wp-development.md`). So there is **no seed plugin, no WP-CLI, and no REST consumer key in this
18
+ flow.** Instead, the **per-site WP MCP** (the Hostinger AI Assistant — the same JWT session the WordPress
19
+ content push uses, see `SKILL.md` Step 1) exposes **native WooCommerce abilities**. Seed and manage the
20
+ catalog through them, exactly as posts/pages are created.
21
+
22
+ Relevant abilities (names from `hostinger-ai-discover-abilities`; call `get-ability-info` for each schema
23
+ before use — they mirror the WooCommerce REST v3 shapes):
24
+
25
+ | Area | Abilities |
26
+ |---|---|
27
+ | Products | `wc-products-search` · `wc-products-get` · `wc-products-create` · `wc-products-update` · `wc-products-delete` |
28
+ | Categories / tags / brands | `wc-product-categories-{list,create,update,delete}` · `wc-product-tags-*` · `wc-product-brands-*` |
29
+ | Coupons | `wc-coupons-{search,get,create,update,delete,batch}` |
30
+ | Orders | `wc-orders-{search,get,create,update,delete}` |
31
+ | Reports | `wc-reports-{sales,orders-totals,products-totals,coupons-totals,…}` |
32
+ | Media | `media-upload-from-url` (product images — WordPress keeps its own copy) |
33
+
34
+ All run as the install's admin **inside the MCP session** — no consumer keys, no Basic Auth. This is
35
+ proven: a `wc-products-create` call makes a product that immediately appears on the public Store API.
36
+
37
+ ---
38
+
39
+ ## 2 — The storefront reads the public Store API
40
+
41
+ The **frontend** never touches the per-site MCP or any key. It reads the **public WooCommerce Store API**
42
+ at `site.json → urls.store_api` (`/cms/wp-json/wc/store/v1`) — public, open CORS, no auth for reads.
43
+ Pretty permalinks are on by default on a headless install, so the Store API resolves immediately.
44
+
45
+ | Store API call | Use |
46
+ |---|---|
47
+ | `GET /products?per_page=100` · `GET /products/<id>` · `?slug=<slug>` | catalog + product pages |
48
+ | `GET /products/categories` | category nav |
49
+ | `GET /cart` | current cart (seeds the `Cart-Token`) |
50
+ | `POST /cart/add-item` `{ id, quantity }` · `/cart/update-item` `{ key, quantity }` · `/cart/remove-item` `{ key }` | cart mutations |
51
+ | `POST /cart/apply-coupon` `{ code }` · `/cart/remove-coupon` `{ code }` | coupons on the cart |
52
+ | `POST /checkout` `{ billing_address, shipping_address, payment_method }` | place an order |
53
+
54
+ **Store API auth for writes** (cart/checkout): send the **`Nonce`** header (read it from the `Nonce` /
55
+ `X-WC-Store-API-Nonce` response header of a prior Store API GET and echo it back) **and** the
56
+ **`Cart-Token`** header (a JWT the Store API returns on the first cart response — resend it on every
57
+ cart call so a headless client keeps one cart; persist it in `localStorage`). Reads need neither.
58
+
59
+ **Pricing / minor units.** The Store API returns **integer-string** prices in minor units plus the
60
+ divisor: `prices.price` (e.g. `"1999"`) with `prices.currency_minor_unit` (e.g. `2`) and
61
+ `prices.currency_code`. Display value = `Number(price) / 10 ** currency_minor_unit`. **Pagination:**
62
+ `?page=&per_page=` (max 100), with `X-WP-Total` / `X-WP-TotalPages` headers.
63
+
64
+ ---
65
+
66
+ ## 3 — Seeding the catalog (content-model push)
67
+
68
+ Run after provision installed + activated WooCommerce (`site.json → woocommerce.enabled: true`), inside
69
+ the authenticated per-site WP MCP session (`SKILL.md` Step 1). Seed from the prepared catalog in
70
+ `content-model.md`. **Idempotent by SKU** (products) and **code** (coupons) — list/search first, create
71
+ only if absent, so a re-run never duplicates.
72
+
73
+ 1. **Product categories** — for each category: `wc-product-categories-list` (match by `slug`/`name`,
74
+ reuse the id) else `wc-product-categories-create { name, slug }`. Keep `name → id`.
75
+ 2. **Products** — for each product: `wc-products-search { sku: "<sku>" }`; a hit → reuse its id; empty →
76
+ `wc-products-create`:
77
+ ```json
78
+ { "name": "...", "type": "simple", "sku": "<unique>", "regular_price": "39.99",
79
+ "description": "...", "short_description": "...", "status": "publish",
80
+ "categories": [ { "id": <catId> } ] }
81
+ ```
82
+ - `regular_price` is a **decimal string in major units** (`"39.99"`) on the ability side — the Store
83
+ API re-exposes it as minor units to the storefront.
84
+ - **Variable products:** create the parent (`type: "variable"`) with its attributes, then the
85
+ variations (via the product update / variations ability that discovery lists).
86
+ 3. **Product images** — `media-upload-from-url { url, filename, alt_text, title }` (WordPress downloads
87
+ and stores its own copy; raster, HTTPS, direct file URL — source like the parent `SKILL.md` Unsplash
88
+ flow). Attach the returned media id to the product (`wc-products-update { id, images: [ { id } ] }`).
89
+ Idempotency: skip when the product already has images.
90
+ 4. **Coupons** — for each coupon: `wc-coupons-search { code }`; empty → `wc-coupons-create`:
91
+ ```json
92
+ { "code": "WELCOME10", "discount_type": "percent", "amount": "10" }
93
+ ```
94
+ (`discount_type`: `percent` | `fixed_cart` | `fixed_product`.)
95
+
96
+ Record the SKU → id map, category ids and coupon codes into `content-model.md` under
97
+ `## Created in WooCommerce` so the frontend and any re-run resolve references directly.
98
+
99
+ **Verify over the public Store API (no auth):**
100
+ - `GET {store_api}/products?per_page=100` → count matches the plan; each has `prices` (minor units +
101
+ `currency_minor_unit`) and, where seeded, an image.
102
+ - `GET {store_api}/products/categories` → every planned category present.
103
+ - Coupon: `wc-coupons-search { code }` returns it, or apply it to a throwaway cart and see the total drop.
104
+
105
+ ---
106
+
107
+ ## 4 — Checkout is owner-completed (the one gate)
108
+
109
+ A fresh WooCommerce install has **no payment gateway and no shipping zone enabled**, and **neither is
110
+ reachable from the headless tooling** — there is no payment/shipping MCP ability, and `wp-settings-update`
111
+ only writes standard WordPress settings (it ignores `woocommerce_*` options). So:
112
+
113
+ - **The catalog, product pages, client-side cart and coupon application all work headlessly.**
114
+ - **Checkout (`POST /checkout`) does not work until the owner enables a payment method + a shipping zone
115
+ in wp-admin** (WooCommerce → Settings → Payments / Shipping; reach it via the one-click login in Step 9).
116
+ Cash on Delivery is the zero-config choice once enabled.
117
+ - Treat this exactly like the Hostinger Ecommerce `payment_enabled: false` gate: record
118
+ `woocommerce.payment_enabled: false`, tell the user in one line that checkout needs that one setup step,
119
+ and **never block the build on it**. The frontend renders a graceful disabled-checkout state and does not
120
+ call `/checkout` while `payment_enabled` is `false`. Flip it to `true` only after the owner confirms a
121
+ gateway is live. **Never ask the user for payment credentials.**
122
+
123
+ Store **currency** and **address** (`woocommerce_*` options) likewise aren't settable headlessly — they
124
+ follow the install default; the owner changes them in wp-admin if needed.
125
+
126
+ ---
127
+
128
+ ## 5 — REST API v3 (optional, owner-only — not used by this flow)
129
+
130
+ WooCommerce also exposes the authenticated **REST API v3** at `site.json → urls.wc_rest_api`
131
+ (`/cms/wp-json/wc/v3`) for external/server-side integrations. **This build never uses it** — seeding goes
132
+ through the per-site MCP and the storefront uses the public Store API. Document it for the owner only:
133
+
134
+ - **Auth:** `Authorization: Basic base64("<consumer_key>:<consumer_secret>")`, **HTTPS only**, server-side
135
+ only — **never ship a key to the browser.**
136
+ - **Keys:** the owner generates a key pair in **wp-admin → WooCommerce → Settings → Advanced → REST API**
137
+ (the agent cannot mint one headlessly). Store it in the owner's own environment, not in `site.json` or
138
+ the repo.
139
+ - **Endpoints** (same shapes as the abilities above): `GET/POST/PUT/DELETE /products`, `/products/<id>/variations`,
140
+ `/products/categories`, `/coupons`, `/orders`. Idempotency via `?sku=` / `?code=`. Pagination via
141
+ `?page=&per_page=` + `X-WP-Total`.
142
+
143
+ ---
144
+
145
+ ## 6 — Idempotency & verification checklist
146
+
147
+ - **Idempotency keys:** products → **SKU** (`wc-products-search { sku }`); coupons → **code**
148
+ (`wc-coupons-search { code }`); categories → **slug/name**; images → skip when the product already has
149
+ `images`.
150
+ - **Verify over the public Store API** (no auth) — products count + prices + categories, and a coupon via
151
+ a cart apply. Record the id/SKU map into `content-model.md`.
152
+ - **Checkout** is verified only when `payment_enabled` is `true`; while `false`, confirming the catalog +
153
+ cart over the Store API is the whole job.
@@ -0,0 +1,464 @@
1
+ ---
2
+ name: headless-step-design
3
+ description: "Step 5 (design) of the Hostinger Headless flow. Derives three distinct design directions from brief.md (plus any reference sites and brand assets), lets the user pick one in a single question, checks the chosen one against the 8-point grid and WCAG 2.2 AA, designs the logo as outlined SVG (wordmark, icon mark, favicon), then writes design.md — tokens, type, logo, components, per-page composition, accessibility and imagery — as the contract the frontend implements (the framework/stack is chosen later by the frontend step). Prepare work: runs during the provision wait and never touches the backend."
4
+ ---
5
+
6
+ # headless-step-design
7
+
8
+ Turn the brief into a look the user has chosen, and write it down so the frontend can't drift from
9
+ it. **One question, three options, one spec.** The output is **files** (`design.md` plus the logo),
10
+ not a conversation: the frontend step implements `design.md`, not the chat.
11
+
12
+ **In:** `brief.md` (required), `content-model.md` (if it exists yet), reference sites and assets the
13
+ user gave. **Out:** `~/.hostinger/<domain>/design.md` and the logo files in
14
+ `~/.hostinger/<domain>/brand/`.
15
+
16
+ > ## ⚠️ Build mode: "Bring your own frontend"? This step defers to the user
17
+ > Read `brief.md` → **Build mode** first. When it is **Bring your own frontend**, the user drives the
18
+ > design — **do not generate three directions or write a prescriptive `design.md` over their project.**
19
+ > The frontend already exists (or the user vibe-codes it with you); your job is to follow *their*
20
+ > direction, not impose one. Skip Steps 1–7 below: either write nothing, or capture only what the user
21
+ > explicitly asks for (a short note of their stated colours/vibe) so the frontend step has it. The logo
22
+ > and token work here apply only when **Build mode is "Agent designs and builds"**. (This mirrors the
23
+ > frontend step's existing "existing app the user brought" handling, now generalised to any backend.)
24
+
25
+ This is **prepare work**: it runs while provision settles (see *Background provision & the instance
26
+ barrier* in the top-level `SKILL.md`). Nothing here calls the Hostinger connector or the backend.
27
+
28
+ **Keep it short.** Refine already asked about tone and look; don't ask again. The step asks the user
29
+ **one** question: either the keep/change question (Step 1) or the three directions (Step 4), never
30
+ both. "You decide" is a valid answer.
31
+
32
+ **Talk like a person, not a designer.** Everything the user reads describes how the site will
33
+ **look and feel**: colours by name ("hot pink, butter yellow"), lettering by feel ("big chunky
34
+ rounded headlines"), and the details they'll notice ("photos tilted like stickers on a scrapbook").
35
+ No hex codes, font names, or design jargon (palette, accent, tokens, shape language, contrast).
36
+
37
+ **Two hard rules apply to every direction, however loud or quiet it is:**
38
+
39
+ - **The 8-point grid.** Every spacing, sizing and layout value is a multiple of 8 px (details in
40
+ 5.2).
41
+ - **WCAG 2.2 Level AA.** Colour, focus, motion, target size and reflow are decided here, so the
42
+ frontend can't build them wrong (details in 5.1 and 5.3).
43
+
44
+ These rules are for you, not the user. **Never mention them**: no grid, contrast, WCAG or
45
+ accessibility talk in anything the user reads, and no "all options follow…" reassurances. The user
46
+ judges the look in the preview; the rules just make sure it works.
47
+
48
+ ---
49
+
50
+ ## Step 1 — Read the workspace, then the resume check
51
+
52
+ Read `brief.md`, `state.json`, and `content-model.md` if it exists.
53
+
54
+ - **`design.md` already exists and this is not a redesign** → don't overwrite it. Describe the
55
+ current look in two or three plain sentences and ask: *keep it, or change something?* That is this
56
+ step's one question.
57
+ - **Keep** → leave the file alone and go straight to the `state.json` update at the end of Step 7.
58
+ - **Change** → edit only what they asked for, re-run the 5.x checks on what changed, then save.
59
+ - **The site is already deployed** (`deploy.json` exists, or `state.json` has `deployed_at`) and the
60
+ user asked for a different look → this is a **redesign**. Tell them plainly: their content stays
61
+ as it is, only the look changes, and they'll see a preview before it goes live. Then run Steps 2–7
62
+ as normal. The current `design.md` becomes one more signal in Step 2, so carry over what the user
63
+ wants to keep and move away from the rest.
64
+
65
+ ## Step 2 — Collect the signals
66
+
67
+ Before inventing anything, gather what already constrains the design:
68
+
69
+ | Signal | Where | How it constrains |
70
+ |---|---|---|
71
+ | Tone, purpose, audience | `brief.md` → *Tone*, *Purpose*, *Audience* | Sets the mood all three directions must fit |
72
+ | Brand assets | `brief.md` → *Assets* | Logo, brand colours and fonts are **fixed** in every direction. Never recolour a supplied logo; Step 6 uses it instead of designing one |
73
+ | Pages and entities | `content-model.md` → *Navigation*, *Pages*, *Articles*; if it doesn't exist yet, `brief.md` → *Pages* | Drives the component inventory and page composition |
74
+ | Reference sites | URLs in the brief or the conversation | Cues to borrow (see below) |
75
+ | Images already sourced | `content-model.md` → the image lines under *Articles* (skip if none yet) | Glance at a few at small size; keep accents from clashing with their dominant colours |
76
+ | Current design (redesign only) | existing `design.md` | What to keep, what to move away from |
77
+
78
+ **Reference sites.** Open each one in a real browser if you have one. Static fetches are often
79
+ blocked or rate-limited; without a browser, fetch the HTML and its linked CSS instead. If neither
80
+ works, say so in one line and continue from the brief alone. Pull **cues**:
81
+
82
+ - **Fonts:** the computed `font-family` of `h1`/`h2` and of body `p`.
83
+ - **Colours:** background colours weighted by painted area (element width × height), the top 5–8.
84
+ Skip transparent and semi-transparent backgrounds and overlays (cookie banners, modals, chat
85
+ widgets). Text colours come from headings, paragraphs and links.
86
+ - **Feel:** look at the first screen and one further down (screenshots shown to you, not saved in
87
+ the workspace) and note what creates the feel: type weight, colour blocking, shapes, density.
88
+
89
+ **Borrow cues, never assets.** Don't use its logo, copy, images or exact layout. **The brief wins**
90
+ over the live site when they disagree (the user's words are what they want). Note the mismatch in
91
+ the direction.
92
+
93
+ **Brand colours that fail contrast** are still fixed, but only in roles where they pass. A pale brand
94
+ yellow can be a background band or a large decorative shape, never body text. Say so in the
95
+ direction.
96
+
97
+ ## Step 3 — Derive three directions
98
+
99
+ Write three directions that **all fit the brief** but are **genuinely different**. Vary at least two
100
+ of: palette (temperature, saturation, light vs. dark), type personality (geometric, grotesk, serif,
101
+ display), and shape language (sharp vs. round, flat vs. outlined, airy vs. dense). Three shades of
102
+ one idea is not a choice. Neither is a wildcard that ignores the brief.
103
+
104
+ Order them: **A is the recommendation**, the closest reading of the brief and references. B and C
105
+ push in different directions.
106
+
107
+ Each direction carries exactly this:
108
+
109
+ - **Name** — 2–3 evocative words ("Sticker-book maximal", "Quiet gallery").
110
+ - **Mood** — one line on how the site feels.
111
+ - **Palette** — 5–7 hex colours with roles (base, text, primary accent, secondary accents, surface).
112
+ These are the core colours the user sees; Step 5 may add derived shades (link, muted, error,
113
+ focus) as tokens.
114
+ - **Type** — a display font and a body font, both self-hostable through `@fontsource`.
115
+ - **Shape language** — corners, borders, shadows and density in one phrase ("chunky 3 px ink
116
+ outlines, hard 8 px offset shadows, tilted cards").
117
+ - **Signature element** — the one memorable move (a scrolling marquee, stickers, oversized numerals,
118
+ a duotone photo treatment). If it moves on its own, it gets a pause control (5.3).
119
+ - **Logo idea** — one line on how the name becomes a logo, using a move from Step 6 ("letters
120
+ bounce in different colours and the O is a smiley").
121
+
122
+ **Only offer what can pass.** Before asking, run two quick gates on **all three**:
123
+
124
+ 1. **Contrast gate.** Every colour that will carry text (base, surfaces, and any accent used as a
125
+ text block) has a palette text colour reaching **4.5:1** on it. Two text colours are fine (dark on
126
+ light blocks, light on dark ones). Accents that only ever hold large text need 3:1.
127
+ 2. **Font gate.** Each font resolves on npm, and the display font also has a static `@fontsource`
128
+ package, because the logo is built from it (5.4).
129
+
130
+ A direction that fails either gate gets adjusted, not offered as-is. Don't offer a look that only
131
+ works by breaking the rules, such as body text on a neon accent or a marquee that can't be stopped.
132
+ Loud is fine; inaccessible is not.
133
+
134
+ **Avoid the template look** unless the brief asks for neutral: Inter or Roboto everywhere, a
135
+ blue-to-purple gradient hero, centred hero with three feature cards, grey cards on white. Every
136
+ direction should look like *this* site, not a starter theme.
137
+
138
+ ## Step 4 — Ask once
139
+
140
+ Ask **one** question, with A marked as the recommendation. With a structured question UI (multiple
141
+ choice plus an "other" field), each option's **label** is the direction's name and its
142
+ **description** is one or two plain sentences, under ~160 characters. Without one, write each
143
+ option as one line in the same shape.
144
+
145
+ The description says what the site would feel like, the main colours by name, what the lettering
146
+ is like, the logo idea, and the one detail they'll remember. Hex codes and font names stay in your
147
+ notes.
148
+
149
+ > **Sticker-book maximal** — Loud and playful, like a scrapbook: candy pink, butter yellow and lilac,
150
+ > chunky headlines, tilted sticker photos and a bouncy logo with a smiley O.
151
+
152
+ > **Midnight disco** — A dark, glowing night-out feel: deep purple with neon pink, yellow and
153
+ > turquoise, heavy rounded headlines and a logo like a neon sign.
154
+
155
+ Then:
156
+
157
+ - **Pick** → use it as written.
158
+ - **"You decide" / skipped** → use A, and tell them in one line which look you went with.
159
+ - **A mix** ("A's colours with C's fonts") → merge them. Don't ask again.
160
+ - **Something else** → build a direction from what they said, run Step 5, and use it. Don't send
161
+ three new options.
162
+
163
+ Don't ask about anything else in this step.
164
+
165
+ ## Step 5 — Check the chosen direction
166
+
167
+ Fix any problem found here by adjusting the direction, not by asking the user. Don't report these
168
+ checks or their fixes; the user sees the result in the preview.
169
+
170
+ ### 5.1 Contrast — WCAG 2.2 SC 1.4.3 and 1.4.11
171
+
172
+ **Which pairs count:** walk the component inventory you're about to write (Components table). For
173
+ each component, list every foreground/background combination in every state: default, hover,
174
+ focus, active, error. Include text on coloured bands (footer links on dark, marquee text, chips),
175
+ placeholder text and photo credits. Compute the WCAG contrast ratio for each:
176
+
177
+ | Kind | Examples | Minimum |
178
+ |---|---|---|
179
+ | Body text | paragraphs, links, footer text, input text, placeholder text, captions | **4.5:1** |
180
+ | Large text | ≥ 24 px regular, or ≥ 18.66 px (14 pt) bold | **3:1** |
181
+ | Non-text | input and button boundaries (when the outline is the only edge), focus indicator against each adjacent colour, icons that carry meaning, chip outlines | **3:1** |
182
+
183
+ A pair that fails gets a darker or lighter shade of the **same hue**; never drop a brand colour. A
184
+ new shade becomes a token (for example `--color-link` or `--color-muted`). Disabled controls and
185
+ pure decoration are exempt, but say which elements those are. **Text on photos** needs a scrim or
186
+ solid backing that gets the text to 4.5:1 against the lightest part of the image. If you can't
187
+ guarantee that, don't put text on photos. Record every pair and its ratio in `design.md`.
188
+
189
+ ```js
190
+ // node -e: relative luminance + contrast ratio, hex in → ratio out
191
+ const L = h => { const c = h.match(/\w\w/g).map(x => parseInt(x, 16) / 255)
192
+ .map(v => v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4);
193
+ return 0.2126 * c[0] + 0.7152 * c[1] + 0.0722 * c[2]; };
194
+ const ratio = (a, b) => { const [x, y] = [L(a), L(b)].sort((m, n) => n - m); return (x + 0.05) / (y + 0.05); };
195
+ ```
196
+
197
+ ### 5.2 The 8-point grid
198
+
199
+ Values are checked in px at the default 16 px root (`0.5rem` = 8 px).
200
+
201
+ | What | Rule |
202
+ |---|---|
203
+ | Spacing (padding, margin, gap) | Multiples of 8: `8 16 24 32 48 64 96 128`. **4 px** is the only half-step, and only inside small components (chip padding, icon-to-label gap) |
204
+ | Component sizes | Heights and fixed widths are multiples of 8. Buttons, nav items and inputs are **48 px** tall minimum |
205
+ | Radii | `8 16 24 32`, or `999px` for pills. 4 px only on elements under 32 px tall |
206
+ | Line heights | Fixed-size text: multiples of 8 (16/24, 18/32, 24/32), or of 4 for text ≤ 14 px (12/16, 14/20). Fluid headings (`clamp()` sizes) use a unitless line-height (1.0–1.2) and are exempt, because their line box can't stay on the grid at every size |
207
+ | Fluid spacing | `clamp()` for spacing or sizes uses grid values at both ends. Fluid **font sizes** are exempt |
208
+ | Shadow offsets | 4 or 8 multiples |
209
+ | Layout | Content width, gutters and breakpoints are multiples of 8 (e.g. `1200`, `768`, `1024`, `1280`) |
210
+ | Exempt | Border and outline widths (1–4 px), focus offset, font sizes, the `999px` pill radius, the 4-multiple line heights above, and anything that isn't a length (angles like a `-2deg` tilt, durations, opacity) |
211
+
212
+ Every value in the **Tokens** block must pass this table.
213
+
214
+ ### 5.3 WCAG 2.2 AA — what the design must decide
215
+
216
+ These criteria are settled at design time. Write each answer into the **Accessibility** section of
217
+ `design.md`.
218
+
219
+ | Criterion | The design must specify |
220
+ |---|---|
221
+ | 1.4.1 Use of colour | Links in running text are underlined, not colour-only. States (active nav, selected, error) also change shape, weight or an icon, not only colour |
222
+ | 1.4.4 Resize text | Font sizes in `rem`; nothing breaks at 200 % zoom |
223
+ | 1.4.10 Reflow | Works at **320 CSS px** wide with no horizontal scroll. Every component has a stated ≤ 320 px behaviour; decorative pieces never widen the page |
224
+ | 1.4.12 Text spacing | No fixed-height boxes around text, so nothing clips when a user overrides spacing (line-height 1.5, paragraph spacing 2×, letter-spacing 0.12 em, word-spacing 0.16 em). Fixed line-height tokens are fine; clipping is not |
225
+ | 2.2.2 Pause, Stop, Hide | Anything that moves on its own for more than 5 s (marquee, carousel, animated sticker) has a **visible pause control**, and doesn't move at all under `prefers-reduced-motion`. Hover-to-pause alone doesn't count |
226
+ | 2.3.1 Three flashes | Nothing flashes more than 3 times a second |
227
+ | 2.4.7 Focus visible | One focus style (e.g. 3 px outline, 2 px offset) whose colour reaches 3:1 against **every** surface it can appear on. Name a second colour for surfaces where the first fails |
228
+ | 2.4.11 Focus not obscured *(new in 2.2)* | Sticky headers, cookie bars and chat bubbles never cover the focused element. Either the header isn't sticky, or `scroll-padding-top: var(--header-h)` |
229
+ | 2.5.8 Target size *(new in 2.2)* | Interactive targets ≥ 24 × 24 px with spacing. On this grid: **48 px** for buttons, nav and inputs, ≥ 24 px for inline icon buttons |
230
+ | 3.2.6 Consistent help *(new in 2.2)* | The contact or help link sits in the same place on every page (e.g. last nav item and footer) |
231
+ | 3.3.2 Labels | Every form field has a visible label; placeholders are never the only label |
232
+ | 1.1.1 Text alternatives | Content images get alt text describing what they show; purely decorative images and shapes get empty alt or `aria-hidden` |
233
+
234
+ ### 5.4 Fonts resolve
235
+
236
+ For each family, prefer the variable package and fall back to the static one:
237
+ `npm view @fontsource-variable/<slug> version`, then `npm view @fontsource/<slug> version`. One must
238
+ answer with a version. If neither does, swap to the closest family that does. Record the exact
239
+ package names. The **display** family must also resolve as a static package
240
+ (`npm view @fontsource/<slug> version`): the static packages ship `.woff` files the logo kit can
241
+ read; the variable ones ship only `.woff2`.
242
+
243
+ ## Step 6 — Design the logo
244
+
245
+ **The user supplied a logo** → copy it into `brand/` unchanged, note it in the **Logo** section, and
246
+ skip the rest of this step. Never redraw or recolour it.
247
+
248
+ Otherwise, turn the name into a **designed** logo: shaped, coloured and composed. Typing the name in
249
+ the display font with an emoji or symbol next to it doesn't count. Build the **logo idea** from the
250
+ chosen direction with one or two of these moves:
251
+
252
+ | Move | What it is | Suits |
253
+ |---|---|---|
254
+ | **Letter swap** | One letter becomes a simple shape tied to the subject: O → smiley, sun, loaf, plate, eye; I → candle, pencil, brush; A → roof, tent. Swap **one character** only, even if the letter appears twice, and the word must still read | Playful, friendly brands |
255
+ | **Bounce** | Letters tilt ±3–6° and bob off the baseline, each in a palette colour, with an ink outline and hard shadow | Loud, maximal directions |
256
+ | **Stack** | The name split over 2–3 lines on coloured tiles, or set as a tight block | Long names, bold directions |
257
+ | **Tag** | The main word large; a short second word on a pill, ribbon or tab | Two-part names ("Dopamine Den") |
258
+ | **Seal** | The name around a ring, with a monogram or symbol in the middle | A secondary mark (footer, hero sticker, social avatar), never the header logo |
259
+ | **Typographic contrast** | Weight, style or case contrast between words (a light italic word next to a heavy upright one), custom tight spacing, one shared stroke or cut between letters | Quiet, refined, editorial directions |
260
+
261
+ No emoji, clip-art, gradients, or details that vanish at small sizes. Colours come only from the
262
+ palette (base and surface colours count).
263
+
264
+ ### Build it with the logo kit
265
+
266
+ The kit (`logo-kit.mjs`, next to this file) does the error-prone parts: it outlines letters into
267
+ vector paths, sets text on a circle, draws the outline-and-shadow treatment, measures, and validates
268
+ the output. You write the composition. Copy the kit into `brand/` so the build is self-contained
269
+ and a redesign can re-run it:
270
+
271
+ ```bash
272
+ mkdir -p ~/.hostinger/<domain>/brand && cd ~/.hostinger/<domain>/brand
273
+ cp <the folder this SKILL.md is in>/logo-kit.mjs .
274
+ npm init -y >/dev/null && npm i opentype.js @fontsource/<display-slug>
275
+ ```
276
+
277
+ Write `brand/logo-build.mjs`, import from `./logo-kit.mjs`, and always run it from `brand/`
278
+ (packages resolve from the working directory):
279
+
280
+ | Kit function | Use |
281
+ |---|---|
282
+ | `loadFont(slug, weight, style)` | Loads a static `@fontsource` weight across all its subsets (`latin`, `latin-ext`, …), so accented letters like Ė or Ł resolve; `style` is `'normal'` or `'italic'`. Throws if that weight or style isn't in the package, so pick another |
283
+ | `layout(font, text, size)` | Kerned glyph positions, total width, `capHeight`, `xHeight`; place letters one by one for bounce or swap. Throws if a character isn't in the font |
284
+ | `glyphPath(glyph, x, baselineY, size)` / `textPath(font, text, x, baselineY, size)` | Outlined path data for one letter or a whole word. For typographic contrast, load two weights or styles and set each word with `textPath` |
285
+ | `pathBox(font, text, x, baselineY, size)` | Tight box around a word's outlines; size the viewBox from it plus room for outlines, shadows and tilt |
286
+ | `arcText(font, text, { cx, cy, r, size })` | Letters around a circle, for seals |
287
+ | `sticker(d, { fill, ink, strokeWidth, shadow, shadowColor, transform })` | Ink outline + hard offset shadow, for outlined directions. On dark backgrounds give the outline and shadow a palette colour that shows (`shadowColor` defaults to `ink`) |
288
+ | `svgDoc({ width, height, title, body })` | Root SVG with `role="img"` and a `<title>` |
289
+ | `check(svg)` | Throws on `NaN`, live `<text>`, a missing title or viewBox. Run it on every file before writing |
290
+
291
+ Never call opentype's `path.toPathData()` directly; the kit's serializer exists because opentype.js
292
+ 2.0 writes `NaN` into some paths, and browsers silently stop drawing at the first `NaN`.
293
+
294
+ ### Deliver four files
295
+
296
+ | File | What | Must read clearly at |
297
+ |---|---|---|
298
+ | `brand/logo.svg` | The primary, mostly horizontal logo for the header | Its header display heights (desktop and small screens) |
299
+ | `brand/logo-mark.svg` | A square icon from the same idea (initial, monogram or the swapped symbol) on a solid rounded tile (corner radius ≈ ¼ of the side) in a palette colour | 32 px |
300
+ | `brand/favicon.svg` | The simplest form of the mark: same tile, no shadow, no thin details, outlines thickened if it has any | 16 px, on both light and dark browser tab bars |
301
+ | `brand/logo-build.mjs` | The script that built them, with `package.json`, kept so a redesign can adjust it | — |
302
+
303
+ Add `brand/logo-seal.svg` only if the direction uses a seal as a secondary mark. Delete
304
+ `brand/node_modules` when you're done; a redesign runs `npm i` in `brand/` first.
305
+
306
+ **Check the sizes.** Display heights are multiples of 8, with one for desktop and one for small
307
+ screens (they may be equal). Work them out from the viewBox:
308
+
309
+ - **Letter size:** letter height on screen = letter height ÷ viewBox height × display height, and it
310
+ must be ≥ 16 px. Use `xHeight` when the logo is mostly lowercase and `capHeight` when it's mostly
311
+ capitals; for mixed fonts, take the smaller word. A two-line lockup usually needs 64 px.
312
+ - **Headroom:** `pathBox` covers the letters, not what you add. Leave room above for accents (Ė, Ž, Å sit above cap height) and below for descenders, plus whatever bounce, tilt, outline and shadow add, so nothing touches the viewBox edge.
313
+ - **Width:** width on screen = viewBox width ÷ viewBox height × display height. At the small-screen
314
+ height it must be **≤ 192 px**, which leaves room for the menu button in a 320 px header. If it
315
+ doesn't fit, lower the small-screen height (letters still ≥ 16 px), simplify the logo, or show
316
+ `logo-mark.svg` with the name beside it on small screens.
317
+ - **Look at it.** If you have a browser, render the files at both header heights, 32 px and 16 px,
318
+ the favicon on a light and a dark background, and fix anything that reads wrong. Without a
319
+ browser, rely on the numbers and list "logo not visually checked" under gaps in the final report.
320
+
321
+ The logo is exempt from text-contrast minimums, but the header link around it needs `alt` = the site
322
+ name and a target of at least 24 px.
323
+
324
+ Don't show the logo to the user in this step; they see it in the preview.
325
+
326
+ ## Step 7 — Write `design.md` and hand off
327
+
328
+ Write `design.md` from the template below. Fill every section. The **Tokens** block is copied
329
+ verbatim into the frontend's global stylesheet, so it must be valid CSS. Every colour, font, type
330
+ size, line height, space, radius and shadow used elsewhere in the file must exist in it as a token.
331
+ The template's token list is the **minimum**: add what the design needs (`--color-error`,
332
+ `--color-on-accent`, `--leading-h3`…) under the same naming scheme.
333
+ **Breakpoints are the one exception**: CSS custom properties don't work inside `@media`, so they are
334
+ listed in *Grid, shape & motion* as plain px values.
335
+
336
+ Then update `state.json`: set `"stage": "frontend"` (also for a redesign: restyle, then validate and
337
+ deploy) and `updated_at` to the current UTC time (ISO 8601). Don't touch `provision`, `run` or
338
+ `history` (`run-log.mjs` owns those), or add other keys.
339
+
340
+ If content prepare hasn't sourced images yet, it now follows `design.md` → **Imagery** (see
341
+ `04-content-model/SKILL.md`).
342
+
343
+ ## `design.md` template
344
+
345
+ ````markdown
346
+ # Design — <domain>
347
+
348
+ > Direction **<name>**, selected on <YYYY-MM-DD> from three options (others offered: <B name>,
349
+ > <C name>). <"Picked by the user." | "User said 'you decide'; recommendation A used." |
350
+ > "Merged by the user: <what>.">
351
+
352
+ ## Direction
353
+ <2–3 sentences: the mood, what it borrows from the references (and any brief/reference mismatch),
354
+ the signature element.>
355
+
356
+ ## Stack
357
+ **<chosen by the frontend step>** — design doesn't decide the stack. The frontend step (06) picks and
358
+ confirms the framework (default Next.js SSR; ecommerce must be SSR) and records it in
359
+ `state.json → frontend`. Leave this as a placeholder for the frontend step to fill in.
360
+
361
+ ## Tokens
362
+ ```css
363
+ :root {
364
+ /* colour — semantic names, never "--pink-2" */
365
+ --color-base: #…; --color-text: #…; --color-surface: #…; --color-muted: #…;
366
+ --color-primary: #…; --color-accent-1: #…; --color-accent-2: #…; --color-link: #…;
367
+ --color-focus: #…; --color-focus-alt: #…; /* for surfaces where --color-focus is < 3:1 */
368
+ /* type */
369
+ --font-display: '<Family> Variable', <fallback stack>;
370
+ --font-body: '<Family> Variable', <fallback stack>;
371
+ --text-body: …rem; --leading-body: …rem; /* 8-multiple in px */
372
+ --text-small: …rem; --leading-small: …rem; /* 4-multiple in px */
373
+ --text-h1: clamp(…rem, …, …rem); --text-h2: clamp(…); --text-h3: …rem;
374
+ --leading-display: 1.05; /* unitless; fluid headings are grid-exempt */
375
+ /* 8-point grid */
376
+ --space-half: 4px; --space-1: 8px; --space-2: 16px; --space-3: 24px; --space-4: 32px;
377
+ --space-6: 48px; --space-8: 64px; --space-12: 96px; --space-16: 128px;
378
+ --target-min: 48px;
379
+ /* shape */
380
+ --radius-sm: 8px; --radius-card: …; --radius-pill: 999px;
381
+ --border: …; --shadow: …; --shadow-hover: …;
382
+ --focus-ring: 3px solid var(--color-focus); --focus-offset: 2px;
383
+ /* layout */
384
+ --content-max: …px; /* multiple of 8 */
385
+ --header-h: …px; /* header band height, multiple of 8; scroll-padding-top uses it if sticky */
386
+ --logo-h: …px; /* header logo height on desktop, multiple of 8 */
387
+ --logo-h-sm: …px; /* on small screens; logo ≤ 192 px wide at this height */
388
+ }
389
+ ```
390
+
391
+ ## Palette roles
392
+ | Token | Hex | Used for |
393
+ |---|---|---|
394
+
395
+ ## Contrast
396
+ | Foreground | Background | Kind (body text / large text / non-text) | Ratio | Needs | Passes |
397
+ |---|---|---|---|---|---|
398
+
399
+ ## Type
400
+ - **Display:** <family> (`@fontsource-variable/<slug>@<version>`), weights …, tracking …; sizes `--text-h1…h3`, `--leading-display`
401
+ - **Body:** <family> (`@fontsource-variable/<slug>@<version>`); `--text-body` / `--leading-body`, measure ≤ 68ch
402
+
403
+ ## Logo
404
+ - **Concept:** <the move(s), and what any swapped letter or symbol stands for | "Supplied by the user">
405
+ - **Built from:** `@fontsource/<display-slug>@<version>`, weight(s)/style(s) …
406
+ - **Files:** `brand/logo.svg` (header, `--logo-h` desktop / `--logo-h-sm` small screens),
407
+ `brand/logo-mark.svg`, `brand/favicon.svg`<, `brand/logo-seal.svg`>; source `brand/logo-build.mjs`
408
+ - **Measured:** letters … px tall at `--logo-h-sm`; width … px at `--logo-h-sm`
409
+ - **Use:** the frontend copies `brand/*.svg` into `public/`. Header: `<a href="/"><img src="/logo.svg"
410
+ alt="<Site name>" style="height: var(--logo-h)"></a>` (switch to `--logo-h-sm` on small screens).
411
+ Favicon: `<link rel="icon" href="/favicon.svg" type="image/svg+xml">`
412
+ - **Don't:** recolour, stretch, add effects, or retype the logo as live text.
413
+
414
+ ## Grid, shape & motion
415
+ <section padding desktop/mobile (space tokens), gutters, breakpoints in px (multiples of 8), borders,
416
+ radii, shadows, hover behaviour, every animation and its pause control, and "no motion under
417
+ prefers-reduced-motion".>
418
+
419
+ ## Accessibility (WCAG 2.2 AA)
420
+ - **Focus:** <style; which colour on which surface>
421
+ - **Targets:** <48 px controls; inline exceptions>
422
+ - **Links & states:** <underline rule; how active/error states differ beyond colour>
423
+ - **Motion:** <what moves, where its pause control is>
424
+ - **Sticky elements:** <none | header uses --header-h + scroll-padding-top>
425
+ - **Help:** <where the contact link sits on every page>
426
+ - **Text on images:** <none | scrim spec and resulting ratio>
427
+ - **Reflow:** <anything special at 320 px>
428
+ - **Exempt from contrast:** <disabled controls / decorative shapes, named>
429
+
430
+ ## Components
431
+ | Component | Renders (from content model) | Look | ≤ 320 px |
432
+ |---|---|---|---|
433
+ | Header + nav | Navigation items | … | … |
434
+ | Post card | Article: image, category, title, excerpt | … | … |
435
+ | … | | | |
436
+
437
+ ## Page composition
438
+ - **<Page>** — <sections top to bottom, each naming its component and band colour>
439
+ - …
440
+
441
+ ## Imagery
442
+ <subjects, mood and colour fit for photos; search keywords; treatment (frame, crop ratio, radius,
443
+ duotone…); alt text written from what the photo shows.>
444
+
445
+ ## Don'ts
446
+ - <3–6 site-specific rules, e.g. "no grey cards", "never put body text on the primary accent">
447
+ ````
448
+
449
+ ## Invariants
450
+
451
+ - **One question.** Refine owns discovery; this step only chooses among directions (or keeps the
452
+ existing one).
453
+ - **8-point grid, always.** No spacing, size, radius or breakpoint off the grid except the listed
454
+ exemptions.
455
+ - **WCAG 2.2 AA is the floor.** No direction is offered, chosen or written that fails it. Brand
456
+ colours keep their hue but only appear in roles where they pass.
457
+ - **Brand assets are fixed.** A supplied logo, colour or font appears in every direction, unchanged.
458
+ - **A logo is designed, not typed.** Outlined SVG paths built with the logo kit, never live text,
459
+ emoji or clip-art, and always readable at its smallest use.
460
+ - **Self-hosted fonts only** (`@fontsource`). No Google Fonts or other font CDN links in the output.
461
+ - **The tokens block is the only source of values** (breakpoints excepted). Components and pages
462
+ reference tokens, never raw hex codes, pixel values or font names.
463
+ - **No backend calls.** Design never waits on provision and never writes to the instance.
464
+ - **Never overwrite an existing `design.md` silently.** Keep or change, as in Step 1.