@srobroek/pi-design 0.12.2 → 0.14.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 (81) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +51 -14
  3. package/_kit/prereqs.json +2 -2
  4. package/agents/ui-implementer.md +2 -2
  5. package/agents/ui-ux-specialist.md +3 -2
  6. package/extensions/design.js +10 -3
  7. package/formulas/design-surface.formula.toml +2 -2
  8. package/formulas/design-system.formula.toml +2 -2
  9. package/formulas/mol-design-iterate.formula.toml +2 -2
  10. package/package.json +1 -1
  11. package/skills/design-guide/SKILL.md +4 -2
  12. package/skills/design-prototype/SKILL.md +9 -0
  13. package/skills/design-prototype/references/upstream.md +3 -0
  14. package/skills/design-upstream-preflight/SKILL.md +31 -5
  15. package/skills/impeccable/LICENSE +191 -0
  16. package/skills/impeccable/LICENSE-platform-design-skills +21 -0
  17. package/skills/impeccable/NOTICE +87 -0
  18. package/skills/impeccable/REUSE.toml +26 -0
  19. package/skills/impeccable/SKILL.md +95 -0
  20. package/skills/impeccable/reference/adapt.md +318 -0
  21. package/skills/impeccable/reference/adapt.native.md +58 -0
  22. package/skills/impeccable/reference/android.md +46 -0
  23. package/skills/impeccable/reference/animate.md +108 -0
  24. package/skills/impeccable/reference/audit.md +159 -0
  25. package/skills/impeccable/reference/audit.native.md +152 -0
  26. package/skills/impeccable/reference/bolder.md +33 -0
  27. package/skills/impeccable/reference/clarify.md +94 -0
  28. package/skills/impeccable/reference/colorize.md +86 -0
  29. package/skills/impeccable/reference/component-review.md +65 -0
  30. package/skills/impeccable/reference/craft-floor.md +46 -0
  31. package/skills/impeccable/reference/craft.md +5 -0
  32. package/skills/impeccable/reference/critique-rubric.md +496 -0
  33. package/skills/impeccable/reference/critique.md +331 -0
  34. package/skills/impeccable/reference/degraded/asset-producer.md +44 -0
  35. package/skills/impeccable/reference/degraded/documenter.md +24 -0
  36. package/skills/impeccable/reference/degraded/finish-reviewer.md +38 -0
  37. package/skills/impeccable/reference/degraded/manual-edit-applier.md +93 -0
  38. package/skills/impeccable/reference/degraded/motion-reviewer.md +29 -0
  39. package/skills/impeccable/reference/delight.md +70 -0
  40. package/skills/impeccable/reference/distill.md +111 -0
  41. package/skills/impeccable/reference/doctor.md +60 -0
  42. package/skills/impeccable/reference/document.md +418 -0
  43. package/skills/impeccable/reference/extract.md +69 -0
  44. package/skills/impeccable/reference/foundations.md +46 -0
  45. package/skills/impeccable/reference/generate.md +103 -0
  46. package/skills/impeccable/reference/harden.md +362 -0
  47. package/skills/impeccable/reference/hooks.md +33 -0
  48. package/skills/impeccable/reference/init.md +133 -0
  49. package/skills/impeccable/reference/ios.md +51 -0
  50. package/skills/impeccable/reference/layout.md +86 -0
  51. package/skills/impeccable/reference/live-setup.md +106 -0
  52. package/skills/impeccable/reference/live.md +345 -0
  53. package/skills/impeccable/reference/mode-operate.md +21 -0
  54. package/skills/impeccable/reference/mode-persuade.md +19 -0
  55. package/skills/impeccable/reference/mode-read.md +21 -0
  56. package/skills/impeccable/reference/new-work-comp.md +26 -0
  57. package/skills/impeccable/reference/new-work-world.md +22 -0
  58. package/skills/impeccable/reference/new-work.md +125 -0
  59. package/skills/impeccable/reference/onboard.md +235 -0
  60. package/skills/impeccable/reference/operate.md +61 -0
  61. package/skills/impeccable/reference/optimize.md +257 -0
  62. package/skills/impeccable/reference/overdrive.md +127 -0
  63. package/skills/impeccable/reference/polish.md +107 -0
  64. package/skills/impeccable/reference/quieter.md +99 -0
  65. package/skills/impeccable/reference/region-map.md +28 -0
  66. package/skills/impeccable/reference/routing.md +26 -0
  67. package/skills/impeccable/reference/shape.md +59 -0
  68. package/skills/impeccable/reference/typeset.md +98 -0
  69. package/skills/impeccable/reference/visualize.md +49 -0
  70. package/skills/impeccable/scripts/VERSION +1 -0
  71. package/skills/impeccable/scripts/command-metadata.json +98 -0
  72. package/skills/impeccable/scripts/data/font-index-failures.json +121 -0
  73. package/skills/impeccable/scripts/data/font-index.json +1 -0
  74. package/skills/impeccable/scripts/engine-checksums.txt +9 -0
  75. package/skills/impeccable/scripts/impeccable +349 -0
  76. package/skills/impeccable/scripts/impeccable.cmd +371 -0
  77. package/skills/impeccable/scripts/live-browser-dom.js +320 -0
  78. package/skills/impeccable/scripts/live-browser-ignores.js +246 -0
  79. package/skills/impeccable/scripts/live-browser-session.js +183 -0
  80. package/skills/impeccable/scripts/live-browser.js +13925 -0
  81. package/skills/impeccable/scripts/modern-screenshot.umd.js +14 -0
@@ -0,0 +1,103 @@
1
+ <!-- Vendored from pbakaus/impeccable skill-v4.12.0 (Apache-2.0) and modified by the design plugin; see NOTICE. Written by scripts/vendor-impeccable.ts; do not edit. -->
2
+
3
+ > **Additional context needed**: only the target element, when the request does not name one that resolves uniquely on the page.
4
+
5
+ Generate is the fast lane into live mode: the user names an element, a direction, and a count in one sentence, and within a minute they are cycling through variants in their browser. One command boots the helper, hands the element to the overlay in the page your harness already shows (it scrolls to it, selects it, and fires the same Go a click fires) and returns the generate event; one edit writes the variants; one call replies and waits for the user's choice, which the helper bakes into source itself. This file owns the lane's plumbing; from the event onward the design work is [live.md](live.md)'s, unchanged, so read it in full now if you have not this session.
6
+
7
+ **Web only.** Live mode's browser overlay has no native equivalent; on `ios` / `android` / `adaptive` projects, decline this command and offer `bolder` or `quieter` on the source instead.
8
+
9
+ The plumbing is where the lane saves time: one command starts the session around the page your harness already shows, one call replies and waits, and nothing here is a browser you have to babysit. The design work is not where it saves time. Setup runs as for any command (`impeccable context`, this reference, craft-floor.md before the edit), and the variants are planned, written, and accepted exactly the way a live session plans, writes, and accepts them.
10
+
11
+ Three prohibitions cover the known ways this command goes wrong:
12
+
13
+ - **Never run init or document, and never ask for PRODUCT.md or DESIGN.md.** When they exist, the start command prints them under `boot` and you use them. When they do not, it says so (`contextMissing`, `contextNote`) and you extract the identity from the event (Step 3). A missing file is never a reason to interview the user inside this command; offer `init` in one line after the session ends.
14
+ - **Never hand-write a variants wrapper or invent a session id.** Only the browser mints session ids (8 hex characters, at Go). A missing event is fixed by rerunning Step 2, never with a direct source edit.
15
+ - **Do not act on hook findings while live markers are in the file**, and do not restyle variants to appease them; the accept verifies the file once the variant is permanent.
16
+
17
+ ## Step 1: Parse the request
18
+
19
+ Three parts, all from the user's sentence:
20
+
21
+ - **A number in the request**: that is the count. **No number**: 3. The protocol caps count at 8.
22
+ - **The direction wording** maps onto the live action vocabulary; never invent a new action value:
23
+ - **bold, bolder, stronger, punchier**: `bolder`
24
+ - **quiet, calmer, softer, toned down**: `quieter`
25
+ - **simpler, minimal, stripped**: `distill`
26
+ - **refined, tightened, polished**: `polish`
27
+ - **font and type words**: `typeset`
28
+ - **color words**: `colorize`
29
+ - **arrangement and spacing words**: `layout`
30
+ - **device and breakpoint words**: `adapt`
31
+ - **motion words**: `animate`
32
+ - **playful words**: `delight`
33
+ - **rule-breaking words**: `overdrive`
34
+ - **Wording that carries intent but no vocabulary word** ("make it feel like a bank", "warmer", "more premium"): `impeccable`, with the user's wording passed as the prompt.
35
+ - **An action fits AND extra intent rides along** ("bolder, but keep it monochrome"): that action, with the rest as the prompt.
36
+ - **The wording names no direction at all** ("better", "improve", "nicer", "different", "fresh", "new", "redesign", "fix", "some options", "ideas", "alternatives", or just "variants" with nothing else): Ask the user directly to clarify what you cannot infer. Ask one question, offering the vocabulary: *"Which direction should the variants take? bolder, quieter, simpler (distill), polished, typography (typeset), color (colorize), layout, motion (animate), playful (delight), or rule-breaking (overdrive)."* Map the answer with this list; an answer that is still open ("surprise me", "you pick") is `impeccable` with the user's original wording as the prompt, and Step 2 starts on that answer.
37
+ - **The element description** ("the pricing cards", "the hero heading"): Step 2 resolves it to a selector.
38
+
39
+ Done when you hold an action from the vocabulary (asked for, when the request named no direction), a count from 1 to 8, and the element description.
40
+
41
+ ## Step 2: Reuse the page, then start
42
+
43
+ **Reuse** the dev server already running and the tab your harness already shows it in; a second server or a second browser window is the failure this step prevents.
44
+
45
+ 1. **Find the dev server**, cheapest source first, and stop at the first hit: the user's message, a browser tab already on the app (Claude Code: an origin in `tabs_context`), a server your harness started (Claude Code: `preview_list`), a terminal that printed its URL. Its origin is your `--dev-url`. **No hit**: leave `--dev-url` off and run the start command with no wait; the boot probes for a running server and its verdict names the move. `browser_needed` carries the `devUrl` it found: open it as in 2, then rerun with `--dev-url <devUrl> --wait-for-browser 60000`. `no_dev_server` means nothing serves the app: start the dev script the way the verdict says (Claude Code: `preview_start`; Cursor: a background terminal; Codex: an exec you yield from), wait for its URL, then rerun with `--dev-url <url>`.
46
+ 2. **Open the page that renders the element in your browser, then start.** The route the request names, else the one `--target` serves; `--dev-url` takes only the origin.
47
+ - **Cursor** (`browser_navigate`) and **Claude Code** (`navigate`, which opens the Browser pane when it is closed and takes the `tabId` from `tabs_context` when a tab is already on that origin): open the URL, then run the start command with `--dev-url <url> --wait-for-browser 60000`. The boot injects the overlay and the page reloads into it while the command waits. Your browser tool is the only opener on these harnesses; the engine ignores `--open` there.
48
+ - **No browser tool** (Codex, others): run the start command with `--open --wait-for-browser 120000`; it opens the system browser, and the longer wait covers the user finding the tab. **`browser_open_failed` back**: tell the user the `url` in one line and rerun with `--wait-for-browser 120000`.
49
+
50
+ ```bash
51
+ <skill-base-dir>/scripts/impeccable live-generate --target src/App.jsx --dev-url http://127.0.0.1:5173/ --selector ".pricing-grid" --action bolder --count 3 --boot --wait-for-browser 60000
52
+ ```
53
+
54
+ Run it in the foreground in Cursor and Claude Code (it returns within the wait); on Codex, in an exec you yield from, the way Step 3 runs the poll.
55
+
56
+ - `--target`: the file that renders the element when the request or the project makes it obvious; skip it otherwise.
57
+ - `--dev-url`: the origin from 1; omit it and the boot probes.
58
+ - `--selector`: a unique class first, then a landmark tag plus class, an id last (every variant mounts a copy of the element, so an id repeats in the DOM). **The request names a repeated component in plural** ("the pricing cards"): target the container that holds the set, so one scoped stylesheet restyles every instance. One read of the source file that renders the element is allowed when the selector is not obvious; `--dry-run` resolves and reports without starting anything when it is not certain.
59
+ - `--boot`: runs the lane's boot (PRODUCT.md and DESIGN.md loaded again for the helper, missing files tolerated, dev URL found, bottom bar hidden for the helper's lifetime) and reuses a helper that is already running. Its result rides along as `boot`.
60
+ - Also available: `--prompt`, `--text` (keep only matches whose visible text contains a snippet), `--index` (1-based pick among matches).
61
+
62
+ Read the output in this order: `boot` (or `boot.contextMissing` with `boot.contextNote`: the page is the source of truth, per the note), then `event`, the generate event for `sessionId`, with the same `_instructions` a user's Go gets. Every verdict carries `_instructions`, and they win over your recollection of this file; the ones whose move is a decision of yours:
63
+
64
+ - **`ambiguous`**: the candidates are listed; target their common container, or rerun with `--text "<visible text>"` or `--index <n>`.
65
+ - **`dev_server_gone`**: the dev server stopped answering while the command waited for the page (on Cursor, a server another chat started dies with that chat). Start it the way the verdict says, then rerun with `--dev-url <url>`.
66
+ - **`no_match`**: the tab is on a route that does not render the element (navigate to the right route, rerun), or the selector is wrong (derive a better one from the source, or add `--text`).
67
+ - **`config_missing` / `config_invalid`** under `bootError`: follow [live-setup.md](live-setup.md) first, then rerun.
68
+ - **`event: null`** with `ok: true`: the event was slower than the wait; run `<skill-base-dir>/scripts/impeccable live-poll` once to collect it, then continue.
69
+
70
+ Done when the output shows `ok: true`, a `sessionId`, and an `event`, reached with at most one server started and one tab opened by you.
71
+
72
+ ## Step 3: Generate
73
+
74
+ The event is a standard `generate` event: the picked element's context, a preflighted scaffold, and `_instructions` naming the action's reference, the planning section, and the exact splice. Handle it exactly per live.md's **Handle generate**, which owns everything from the identity lock to the done reply: read the action's reference and craft-floor.md as it says, plan per section 4 (identity first, then mode, then three different primary axes, then the squint test), declare knobs per section 7, and deliver per section 6 (a complete replacement of the element per variant, the preview CSS plus every variant in one edit at the scaffold's splice). The lane changes nothing about what a variant may be: the moves a live session would make on this element (a promoted tier, a restructured set, a reordered card, a different surface) are open here too. Never screenshot the page; the overlay preview is the review channel until accept.
75
+
76
+ **Reply and wait in one call**, with the file you wrote:
77
+
78
+ ```bash
79
+ <skill-base-dir>/scripts/impeccable live-poll --reply EVENT_ID done --file src/App.jsx --then-poll
80
+ ```
81
+
82
+ This replies done (the browser mounts the variants) and then blocks until the user's choice arrives, so run it the way your harness runs a long wait: **Claude Code** in the foreground with your tool's longest timeout (600000 ms), so you are paused until the choice arrives; **Codex** in a yielded foreground exec; **Cursor** in a background terminal with notify on `"type":"(accept|discard|variant_mount_failed|exit)"`. Never pass a short `--timeout=`. While it runs there is nothing else to do: never sleep and never poll its output on a timer; a harness that backgrounds it wakes you when it returns. `{"type":"timeout"}` means the user has not chosen yet: run `live-poll` again, at most twice (about 30 minutes of waiting in all). After the third timeout, stop polling: tell the user the variants are still live on the page, to Accept or Discard there and then tell you, and end your turn; one `live-poll` collects the queued choice, and Step 4 runs from there. If the edit fails after the browser flipped to GENERATING, `--reply EVENT_ID error "Short reason"` (without `--then-poll`) so the bar resets.
83
+
84
+ Then tell the user, in one line, where their variants are: *"Three [bolder] variants are live on [the pricing cards]: cycle with the floating bar's arrows, adjust the Tune knobs, and Accept the keeper."*
85
+
86
+ Outside the replace path, read the matching live.md section before acting: `scaffold.previewMode: "svelte-component"` (Svelte previews are edited as components, and their accept is mechanical), `mode: "insert"`, `variant_mount_failed`, `steer`, `manual_edit_apply`, and any `fallback: "agent-driven"` wrap error.
87
+
88
+ ## Step 4: Accept and close
89
+
90
+ The call from Step 3 returns the user's choice. **`discard`**: nothing to do. **`accept`**: `_acceptResult.carbonize: true` is the normal case, and the cleanup is live.md's **Required after accept**, unchanged: move the accepted variant's rules into the stylesheet that already owns the element with real selectors, bake the chosen knob values in, unwrap the element and drop every `data-impeccable-*` attribute, delete the inline `<style>` block and both `impeccable-carbonize` markers, then `<skill-base-dir>/scripts/impeccable live-complete --id SESSION_ID` and confirm `phase: "completed"`. (`baked: true` appears only when the accept was run with `--bake`; then the helper already made the variant permanent and no `live-complete` is owed.)
91
+
92
+ Close without being asked, the moment the choice is handled:
93
+
94
+ ```bash
95
+ <skill-base-dir>/scripts/impeccable live-server stop
96
+ ```
97
+
98
+ Stopping removes the injected script and reloads the page once: the user sees the accepted design with no overlay chrome, still served by their dev server. **Never kill or restart the dev server**, including one you started in Step 2.
99
+
100
+ - **The user asks for more variants before you closed**: skip the close, run Step 2 again for the next element (the helper is reused), and close after the last choice.
101
+ - **Interrupted or unsure of the state**: `<skill-base-dir>/scripts/impeccable live-status`, then `live-resume`; the journal under `.impeccable/live/sessions/` is canonical.
102
+
103
+ Done when the helper is stopped and the dev site still answers with the accepted design.
@@ -0,0 +1,362 @@
1
+ Designs that only work with perfect data aren't production-ready. Harden the interface against the inputs, errors, languages, and network conditions that real users will throw at it.
2
+
3
+ ## Assess Hardening Needs
4
+
5
+ Identify weaknesses and edge cases:
6
+
7
+ 1. **Test with extreme inputs**:
8
+ - Very long text (names, descriptions, titles)
9
+ - Very short text (empty, single character)
10
+ - Special characters (emoji, RTL text, accents)
11
+ - Large numbers (millions, billions)
12
+ - Many items (1000+ list items, 50+ options)
13
+ - No data (empty states)
14
+
15
+ 2. **Test error scenarios**:
16
+ - Network failures (offline, slow, timeout)
17
+ - API errors (400, 401, 403, 404, 500)
18
+ - Validation errors
19
+ - Permission errors
20
+ - Rate limiting
21
+ - Concurrent operations
22
+
23
+ 3. **Test internationalization**:
24
+ - Long translations (German is often 30% longer than English)
25
+ - RTL languages (Arabic, Hebrew)
26
+ - Character sets (Chinese, Japanese, Korean, emoji)
27
+ - Date/time formats
28
+ - Number formats (1,000 vs 1.000)
29
+ - Currency symbols
30
+
31
+ Designs that only work with perfect data aren't production-ready.
32
+
33
+ ## Hardening Dimensions
34
+
35
+ Systematically improve resilience:
36
+
37
+ ### Text Overflow & Wrapping
38
+
39
+ **Long text handling**:
40
+ ```css
41
+ /* Single line with ellipsis */
42
+ .truncate {
43
+ overflow: hidden;
44
+ text-overflow: ellipsis;
45
+ white-space: nowrap;
46
+ }
47
+
48
+ /* Multi-line with clamp */
49
+ .line-clamp {
50
+ display: -webkit-box;
51
+ -webkit-line-clamp: 3;
52
+ -webkit-box-orient: vertical;
53
+ overflow: hidden;
54
+ }
55
+
56
+ /* Allow wrapping */
57
+ .wrap {
58
+ word-wrap: break-word;
59
+ overflow-wrap: break-word;
60
+ hyphens: auto;
61
+ }
62
+ ```
63
+
64
+ **Flex/Grid overflow**:
65
+ ```css
66
+ /* Prevent flex items from overflowing */
67
+ .flex-item {
68
+ min-width: 0; /* Allow shrinking below content size */
69
+ overflow: hidden;
70
+ }
71
+
72
+ /* Prevent grid items from overflowing */
73
+ .grid-item {
74
+ min-width: 0;
75
+ min-height: 0;
76
+ }
77
+ ```
78
+
79
+ **Responsive text sizing**:
80
+ - Use `clamp()` for fluid typography
81
+ - Set minimum readable sizes (16px body on mobile, the same floor the typography guidance sets; 14px only for genuinely secondary text. iOS Safari force-zooms focused inputs under 16px, which breaks form layouts)
82
+ - Test text scaling (zoom to 200%)
83
+ - Ensure containers expand with text
84
+
85
+ ### Internationalization (i18n)
86
+
87
+ **Text expansion**:
88
+ - Add 30-40% space budget for translations
89
+ - Use flexbox/grid that adapts to content
90
+ - Test with longest language (usually German)
91
+ - Avoid fixed widths on text containers
92
+
93
+ ```jsx
94
+ // ❌ Bad: Assumes short English text
95
+ <button className="w-24">Submit</button>
96
+
97
+ // ✅ Good: Adapts to content
98
+ <button className="px-4 py-2">Submit</button>
99
+ ```
100
+
101
+ **RTL (Right-to-Left) support**:
102
+ ```css
103
+ /* Use logical properties */
104
+ margin-inline-start: 1rem; /* Not margin-left */
105
+ padding-inline: 1rem; /* Not padding-left/right */
106
+ border-inline-end: 1px solid; /* Not border-right */
107
+
108
+ /* Or use dir attribute */
109
+ [dir="rtl"] .arrow { transform: scaleX(-1); }
110
+ ```
111
+
112
+ **Arabic-script specifics** (Arabic, Persian, Urdu, Pashto, Kurdish):
113
+ - Preserve Zero-Width Non-Joiner (U+200C). Persian and Kurdish use ZWNJ between compound-word parts to break cursive joining while keeping the word together. A filter or sanitizer that strips it changes meaning. Never normalize it away.
114
+ - Handle Yeh and Kaf variants. Persian uses ی (U+06CC) and ک (U+06A9), while Arabic uses ي (U+064A) and ك (U+0643). Preserve the original form in storage. For search and validation, treat the corresponding letters as equivalent so that Arabic-keyboard input matches Persian text. Rejecting one variant locks out users whose keyboard sends the other.
115
+ - Support locale-aware digits. Persian (`fa-IR`) and Arabic locales use Eastern Arabic-Indic numerals (۰-۹ and ٠-٩). Use `Intl.NumberFormat` with the correct locale rather than hardcoding Western digits.
116
+
117
+ ```javascript
118
+ // ✅ Locale-aware digit formatting
119
+ new Intl.NumberFormat('fa-IR').format(1234); // ۱٬۲۳۴
120
+ new Intl.NumberFormat('ar-SA').format(1234); // ١٬٢٣٤
121
+ ```
122
+
123
+ - Respect calendar systems. Persian users expect the Solar Hijri (Jalali) calendar; many Arabic-speaking users expect the Hijri (Islamic) calendar. Use `Intl.DateTimeFormat` with the appropriate locale or calendar parameter.
124
+
125
+ ```javascript
126
+ // ✅ Locale-appropriate calendar
127
+ new Intl.DateTimeFormat('fa-IR').format(new Date());
128
+ new Intl.DateTimeFormat('ar-SA-u-ca-islamic').format(new Date());
129
+ ```
130
+
131
+ **Character set support**:
132
+ - Use UTF-8 encoding everywhere
133
+ - Test with Chinese/Japanese/Korean (CJK) characters
134
+ - Test with emoji (they can be 2-4 bytes)
135
+ - Handle different scripts (Latin, Cyrillic, Arabic, etc.)
136
+
137
+ **Date/Time formatting**:
138
+ ```javascript
139
+ // ✅ Use Intl API for proper formatting
140
+ new Intl.DateTimeFormat('en-US').format(date); // 1/15/2024
141
+ new Intl.DateTimeFormat('de-DE').format(date); // 15.1.2024
142
+
143
+ new Intl.NumberFormat('en-US', {
144
+ style: 'currency',
145
+ currency: 'USD'
146
+ }).format(1234.56); // $1,234.56
147
+ ```
148
+
149
+ **Pluralization**:
150
+ ```javascript
151
+ // ❌ Bad: Assumes English pluralization
152
+ `${count} item${count !== 1 ? 's' : ''}`
153
+
154
+ // ✅ Good: Use proper i18n library
155
+ t('items', { count }) // Handles complex plural rules
156
+ ```
157
+
158
+ ### Error Handling
159
+
160
+ **Network errors**:
161
+ - Show clear error messages
162
+ - Provide retry button
163
+ - Explain what happened
164
+ - Offer offline mode (if applicable)
165
+ - Handle timeout scenarios
166
+
167
+ ```jsx
168
+ // Error states with recovery
169
+ {error && (
170
+ <ErrorMessage>
171
+ <p>Failed to load data. {error.message}</p>
172
+ <button onClick={retry}>Try again</button>
173
+ </ErrorMessage>
174
+ )}
175
+ ```
176
+
177
+ **Form validation errors**:
178
+ - Inline errors near fields
179
+ - Clear, specific messages
180
+ - Suggest corrections
181
+ - Don't block submission unnecessarily
182
+ - Preserve user input on error
183
+
184
+ **API errors**:
185
+ - Handle each status code appropriately
186
+ - 400: Show validation errors
187
+ - 401: Redirect to login
188
+ - 403: Show permission error
189
+ - 404: Show not found state
190
+ - 429: Show rate limit message
191
+ - 500: Show generic error, offer support
192
+
193
+ **Graceful degradation**:
194
+ - Core functionality works without JavaScript
195
+ - Images have alt text
196
+ - Progressive enhancement
197
+ - Fallbacks for unsupported features
198
+
199
+ ### Edge Cases & Boundary Conditions
200
+
201
+ **Empty states**:
202
+ - No items in list
203
+ - No search results
204
+ - No notifications
205
+ - No data to display
206
+ - Provide clear next action
207
+
208
+ **Loading states**:
209
+ - Initial load
210
+ - Pagination load
211
+ - Refresh
212
+ - Show what's loading ("Loading your projects...")
213
+ - Time estimates for long operations
214
+
215
+ **Large datasets**:
216
+ - Pagination or virtual scrolling
217
+ - Search/filter capabilities
218
+ - Performance optimization
219
+ - Don't load all 10,000 items at once
220
+
221
+ **Concurrent operations**:
222
+ - Prevent double-submission (disable button while loading)
223
+ - Handle race conditions
224
+ - Optimistic updates with rollback
225
+ - Conflict resolution
226
+
227
+ **Interrupted gestures** (custom sliders, drag surfaces, scrollable control strips):
228
+ - A second finger or pointer lands mid-drag: the first drag keeps its pointer or ends cleanly, never jumps to the new one
229
+ - The browser cancels the gesture to scroll (`pointercancel`), capture is lost (`lostpointercapture`), the pointer is released outside the control, or the window loses focus (`blur`) mid-drag: clear the dragging state and release capture
230
+ - After each of these, the next tap or drag works without a reload
231
+
232
+ **Permission states**:
233
+ - No permission to view
234
+ - No permission to edit
235
+ - Read-only mode
236
+ - Clear explanation of why
237
+
238
+ **Browser compatibility**:
239
+ - Polyfills for modern features
240
+ - Fallbacks for unsupported CSS
241
+ - Feature detection (not browser detection)
242
+ - Test in target browsers
243
+
244
+ ### Input Validation & Sanitization
245
+
246
+ **Client-side validation**:
247
+ - Required fields
248
+ - Format validation (email, phone, URL)
249
+ - Length limits
250
+ - Pattern matching
251
+ - Custom validation rules
252
+
253
+ **Server-side validation** (always):
254
+ - Never trust client-side only
255
+ - Validate and sanitize all inputs
256
+ - Protect against injection attacks
257
+ - Rate limiting
258
+
259
+ **Constraint handling**:
260
+ ```html
261
+ <!-- Set clear constraints -->
262
+ <input
263
+ type="text"
264
+ maxlength="100"
265
+ pattern="[A-Za-z0-9]+"
266
+ required
267
+ aria-describedby="username-hint"
268
+ />
269
+ <small id="username-hint">
270
+ Letters and numbers only, up to 100 characters
271
+ </small>
272
+ ```
273
+
274
+ ### Accessibility Resilience
275
+
276
+ **Keyboard navigation**:
277
+ - All functionality accessible via keyboard
278
+ - Logical tab order
279
+ - Focus management in modals
280
+ - Skip links for long content
281
+
282
+ **Screen reader support**:
283
+ - Proper ARIA labels
284
+ - Announce dynamic changes (live regions)
285
+ - Descriptive alt text
286
+ - Semantic HTML
287
+
288
+ **High contrast mode**:
289
+ - Test in Windows high contrast mode
290
+ - Don't rely only on color
291
+ - Provide alternative visual cues
292
+
293
+ ### Performance Resilience
294
+
295
+ **Slow connections**:
296
+ - Progressive image loading
297
+ - Skeleton screens
298
+ - Optimistic UI updates
299
+ - Offline support (service workers)
300
+
301
+ **Memory leaks**:
302
+ - Clean up event listeners
303
+ - Cancel subscriptions
304
+ - Clear timers/intervals
305
+ - Abort pending requests on unmount
306
+
307
+ **Throttling & Debouncing**:
308
+ ```javascript
309
+ // Debounce search input
310
+ const debouncedSearch = debounce(handleSearch, 300);
311
+
312
+ // Throttle scroll handler
313
+ const throttledScroll = throttle(handleScroll, 100);
314
+ ```
315
+
316
+ ## Testing Strategies
317
+
318
+ **Manual testing**:
319
+ - Test with extreme data (very long, very short, empty)
320
+ - Test in different languages
321
+ - Test offline
322
+ - Test slow connection (throttle to 3G)
323
+ - Test with screen reader
324
+ - Test keyboard-only navigation
325
+ - Test on old browsers
326
+
327
+ **Automated testing**:
328
+ - Unit tests for edge cases
329
+ - Integration tests for error scenarios
330
+ - E2E tests for critical paths
331
+ - A behavioral regression for each confirmed gesture fix, when the project's test runner can drive input
332
+ - Visual regression tests
333
+ - Accessibility tests (axe, WAVE)
334
+
335
+ **Avoid**:
336
+ - Assume perfect input (validate everything)
337
+ - Ignore internationalization (design for global)
338
+ - Leave error messages generic ("Error occurred")
339
+ - Forget offline scenarios
340
+ - Trust client-side validation alone
341
+ - Use fixed widths for text
342
+ - Assume English-length text
343
+ - Block entire interface when one component errors
344
+
345
+ ## Verify Hardening
346
+
347
+ Test thoroughly with edge cases:
348
+
349
+ - **Long text**: Try names with 100+ characters
350
+ - **Emoji**: Use emoji in all text fields
351
+ - **RTL**: Test with Arabic or Hebrew
352
+ - **CJK**: Test with Chinese/Japanese/Korean
353
+ - **Network issues**: Disable internet, throttle connection
354
+ - **Large datasets**: Test with 1000+ items
355
+ - **Concurrent actions**: Click submit 10 times rapidly
356
+ - **Interrupted gestures**: Add a second finger mid-drag, scroll across the control, release outside it, switch windows mid-drag; then drag again
357
+ - **Errors**: Force API errors, test all error states
358
+ - **Empty**: Remove all data, test empty states
359
+
360
+ For gestures, say what produced the evidence (emulated viewport, synthesized touch, which engine, physical device) and name what stayed untested.
361
+
362
+ When edge cases are covered, hand off to `/impeccable polish` for the final pass.
@@ -0,0 +1,33 @@
1
+ <!-- Vendored from pbakaus/impeccable skill-v4.12.0 (Apache-2.0) and modified by the design plugin; see NOTICE. Written by scripts/vendor-impeccable.ts; do not edit. -->
2
+
3
+ # /impeccable hooks
4
+
5
+ The design plugin does not install impeccable's automatic detector hook on this harness. The
6
+ hook would run this skill's launcher after every UI file edit; the plugin runs the detector on
7
+ request instead.
8
+
9
+ ## Scan route
10
+
11
+ Once the changed UI is finished, run the `design_impeccable_scan` tool on the changed files
12
+ or the served URL, or `<skill-base-dir>/scripts/impeccable detect --json <targets>`. Treat
13
+ its findings as a corroborating signal and confirm each one on the rendered surface.
14
+
15
+ Neither route downloads unasked. The tool runs the impeccable on `PATH`. Without it, on
16
+ OpenCode it uses an engine cached in `~/.impeccable`, or refuses at once and never downloads;
17
+ on pi it asks before npx fetches impeccable, and refuses when the session cannot ask. The
18
+ launcher uses the engine on `PATH` or in `~/.impeccable` and downloads one only with
19
+ `IMPECCABLE_ALLOW_DOWNLOAD=1`.
20
+
21
+ ## Routing
22
+
23
+ The first argument is the action. Defaults to `status`.
24
+
25
+ | Action | What to do |
26
+ |---|---|
27
+ | `status` | Say the design plugin wires no hook here, then run `<skill-base-dir>/scripts/impeccable hooks status` and print its output for the detector ignores. |
28
+ | `on` | Do not run `hooks on` and do not edit harness settings. Say the plugin has no per-edit hook here and name the scan route above. |
29
+ | `off`, `reset` | Run `<skill-base-dir>/scripts/impeccable hooks <action>` and print its output. |
30
+ | `ignore-rule`, `ignore-file`, `ignore-value` | Run `<skill-base-dir>/scripts/impeccable hooks <action> [args...]` and print its output. These edit the detector ignores in `.impeccable/config.json`, which `design_impeccable_scan` and manual `detect` runs read too; add `--local` only when the user asks for a private exception. |
31
+
32
+ When the launcher exits 127, the engine is missing: report it and its install,
33
+ `mise use -g npm:impeccable`, and do not rerun it with `IMPECCABLE_ALLOW_DOWNLOAD=1` unless the user agrees.
@@ -0,0 +1,133 @@
1
+ # Init flow
2
+
3
+ `init` captures durable product truth in PRODUCT.md. It does not invent a visual world and does not write DESIGN.md; [new-work.md](new-work.md) creates or expands one, and [document.md](document.md) records an incumbent one. Existing runnable web projects may also receive `.impeccable/live/config.json`.
4
+
5
+ ## Step 1: Load current state
6
+
7
+ Use the PRODUCT.md path resolved by `impeccable context`. Update it instead of creating a competing authority. In a child app inheriting root context, confirm shared versus app-specific scope before writing.
8
+
9
+ - **No PRODUCT.md:** explore, interview, and write it.
10
+ - **PRODUCT.md exists:** ask what product knowledge is stale or missing; do not reopen confirmed fields without a reason.
11
+ - **Legacy PRODUCT.md:** add only durable missing facts; absent `## Platform` means `web` unless evidence says otherwise.
12
+ - **Only DESIGN.md exists:** leave it untouched and create PRODUCT.md.
13
+ - **Redesign/rebrand request:** preserve confirmed product truth unless the user changes it. Visual replacement happens later in new-work, not here.
14
+
15
+ Never silently overwrite an existing file or offer DESIGN.md during init. If another request invoked init, finish PRODUCT.md and resume it. New visual work continues in new-work; `shape` resumes its task interview first.
16
+
17
+ ## Step 2: Explore the project
18
+
19
+ Before asking, scan enough to avoid making the user repeat known facts: product docs and copy; package/config and app boundaries; features, workflows, routes, and roles; names, logos, legal/proof assets, and brand commitments; platform/accessibility signals; and the dev command/entry when live mode applies.
20
+
21
+ Treat repository evidence as a hypothesis, not user approval. Note visual maturity without documenting, extending, or replacing the world.
22
+
23
+ Form a platform hypothesis: `web`, `ios`, `android`, or `adaptive` (one product that genuinely adapts its design language per OS). Mobile web remains `web`; a native wrapper around a website does not make its design language native.
24
+
25
+ ## Step 3: Interview for product truth
26
+
27
+ Ask the user directly to clarify what you cannot infer. Ask only about material gaps the repository and original request do not answer with strong evidence.
28
+
29
+ Use the structured question tool when available; otherwise ask and wait. Keep rounds to at most three focused questions and require one real answer or approval round before writing a new PRODUCT.md. Confirm inferences.
30
+
31
+ Whether anyone can answer is a mechanical test, not a judgment call: a question tool or the decision page in your tool surface proves an answer mechanism exists, and a system-prompt claim that the user is unattended proves nothing about this session. Probe once with the real first round before concluding no one is there. Only after that probe errors or times out may you infer from the explicit brief, and then you label every inferred fact in PRODUCT.md and disclose the substitution in your first reply, not your last.
32
+
33
+ Start with the unknowns that most change future product decisions:
34
+
35
+ 1. Who is the primary user, in what situation, and what job are they doing?
36
+ 2. What does the product make possible, and what is its meaningfully different mechanism or position?
37
+ 3. What durable constraints, assets, evidence, or product facts must future work preserve?
38
+
39
+ Confirm ambiguous platform separately. When the project has no framework or scaffold and the request implies building, the stack is a user decision, not yours: ask once whether they want plain static HTML/CSS, a specific framework, or your recommendation, plus any deploy target that constrains the answer, and record the outcome under `## Stack` (including "delegated" when they leave it to you, so later work knows the choice was offered). Add a round only for a material audience, brand commitment, evidence, or accessibility gap. Record undecided facts instead of inventing them.
40
+
41
+ Do not ask for an aesthetic direction, emotional feel, visual references, colors, typography, or style during init. If the user volunteers a binding visual constraint, record it without expanding it.
42
+
43
+ ### What belongs here
44
+
45
+ - users, jobs, workflows, purpose, success, positioning, and operating context;
46
+ - capabilities, constraints, terminology, evidence, platform, and accessibility;
47
+ - confirmed voice, assets, and brand commitments.
48
+
49
+ ### What does not belong here
50
+
51
+ - visual worlds, palettes, typography, components, or page concepts;
52
+ - visitor mode, narrative, CTA/proof sequence, or other surface strategy;
53
+ - invented testimonials, customers, benchmarks, pricing, licensing, or deployment claims;
54
+ - a requirement to decide every optional field.
55
+
56
+ ## Step 4: Write PRODUCT.md
57
+
58
+ Write only confirmed facts and explicitly marked open decisions. Omit irrelevant sections rather than filling them with generic prose.
59
+
60
+ ```markdown
61
+ # Product
62
+
63
+ <!-- impeccable:product-schema 1 -->
64
+
65
+ ## Platform
66
+
67
+ web
68
+
69
+ ## Stack
70
+ [Greenfield only: the user's answer to the stack question, e.g. "static HTML/CSS", "Astro", or "delegated: <what you chose and why>". Omit the section when an existing codebase already answers it.]
71
+
72
+ ## Users
73
+ [Primary users, their situation, and job. Add other audiences only when confirmed.]
74
+
75
+ ## Product Purpose
76
+ [What the product does, why it exists, and what success means.]
77
+
78
+ ## Positioning
79
+ [The product mechanism or claim a neighboring product could not truthfully copy.]
80
+
81
+ ## Operating Context
82
+ [Workflows, environments, tools, documents, materials, and rituals that are factual parts of using or evaluating the product.]
83
+
84
+ ## Capabilities and Constraints
85
+ [Confirmed functionality, technical constraints, terminology, and explicitly undecided product facts.]
86
+
87
+ ## Brand Commitments
88
+ [Existing name, voice, assets, personality, identity constraints, and references the user explicitly made binding. Omit when none exist.]
89
+
90
+ ## Evidence on Hand
91
+ [Real content, data, demonstrations, testimonials, case studies, press, or assets, with paths where applicable. State absences that future work must not fabricate.]
92
+
93
+ ## Product Principles
94
+ [Three to five durable strategic principles derived from confirmed answers; no visual recipes.]
95
+
96
+ ## Accessibility & Inclusion
97
+ [Known user needs or required standard. Omit when no product-specific requirement was established.]
98
+ ```
99
+
100
+ Platform is the bare value `web`, `ios`, `android`, or `adaptive`. Preserve useful legacy headings. New files go at `PROJECT_ROOT/PRODUCT.md`; otherwise update the resolved file. Write it before any visual-world or surface-concept work.
101
+
102
+ Copy the `impeccable:product-schema` comment verbatim, including when you update an older file. It records which version of the product record this file follows, so later versions can tell a deliberately short record from one written before a section existed, and never propose an interview the user has already sat through. Update the number only when this reference's template changes it. Sections a later version retires are reported to you at boot as deprecated; delete them when the user agrees rather than carrying them forward.
103
+
104
+ When the platform you just recorded is `ios`, `android`, or `adaptive`, load [ios.md](ios.md), [android.md](android.md), or both before any design work. On a project that had no PRODUCT.md, `impeccable context` could not know the platform and so never loaded them; init is the only place that learns the answer.
105
+
106
+ ### Completion gate
107
+
108
+ Before loading new-work or resuming shape/build, verify that PRODUCT.md exists at the resolved path and contains the confirmed product record. If the file is absent, init is incomplete. Do not substitute interview notes, a planning packet, or later design prose for the file.
109
+
110
+ ## Step 5: Record workflow defaults
111
+
112
+ When image generation is available and no `buildPath` is recorded yet, ask once how new surfaces should be built. Availability means a harness-native image tool or the API fallback that `impeccable context` reports as `IMAGE_GEN_AVAILABLE`, and the first of those leaves no trace in the boot output: `impeccable context` only sees the key, so a silent boot on a harness that generates images is not evidence there is nothing to ask about. This is its own question, never a clause riding inside another one. The stack round asks what to build with; this asks how the building starts, and an answer to the first carries no consent about the second. State the trade in the question the user actually reads, because the two names mean nothing to someone meeting them for the first time: **comp-first** (an image sets the bar before any code; bolder composition, slower, and the build must match the image) or **code-first** (build directly; the ambition is written into the direction contract and audited at the finish; leaner, faster). Say in the same question what the choice covers: landing pages and showcase surfaces. App screens and documents are built code-first either way.
113
+
114
+ Write the answer to `.impeccable/config.json` as `"buildPath": "comp"` or `"buildPath": "code"`, merging with the keys already there. Write only the value the user chose. A recommendation you made is not an answer you received, and a value taken from silence is a standing default nobody set: it then rides every future round in the project, which is the opposite of asking once. When the question goes unanswered, record nothing and say in one line which path this session is taking and that it is not stored. That path is comp-first on a landing page or showcase surface, the default new-work applies wherever image generation exists and nothing is recorded, and code-first on an app screen or document; name it rather than choosing a quieter one, because a silent default invented here is the same failure as a value written without an answer. Unset is a working state, not a gap: the decision page's toggle governs each session, and new-work's one-time offer records the answer the first time the user flips it. The config is the only place this lives. It is a workflow setting, not product truth, so it never joins `## Stack` or any other PRODUCT.md section, where a second copy would outlive the setting and steer rounds nobody could trace back to it.
115
+
116
+ A value already recorded in `.impeccable/config.json` or the gitignored `.impeccable/config.local.json` is a confirmed answer: on a re-run, honor it in silence rather than asking again. This is a default, not a lock: the decision page renders a toggle whose flip binds a single session and is never written back. Without image generation there is no choice to record; code-first is the only path.
117
+
118
+ Then configure live mode when useful: skip native or non-runnable projects and leave existing config untouched. Otherwise follow [live.md](live.md)'s first-time setup. Any CSP source edit still requires its stated consent.
119
+
120
+ ## Step 6: Wrap up or resume
121
+
122
+ Summarize captured and deliberately undecided facts. Do not offer DESIGN.md merely because it is missing.
123
+
124
+ Tell the user once which files to commit: PRODUCT.md, DESIGN.md, `.impeccable/config.json`, `.impeccable/surfaces/`, `.impeccable/design.json`, `.impeccable/live/config.json`, and `.impeccable/critique/ignore.md`. A blanket `.impeccable/` ignore hides them from teammates and other worktrees. The runtime directories (`questions/`, `mocks/`, `review/`, critique snapshots) ignore themselves, and `.impeccable/config.local.json` stays on the developer's machine.
125
+
126
+ Recommend the next action from the actual project state:
127
+
128
+ - Empty or early project: ask naturally for the surface to be built, or use `/impeccable shape <surface>` when the user wants a confirmed brief without implementation. New-work will establish a visual world only when the requested work needs one.
129
+ - Existing coherent interface without DESIGN.md: `/impeccable document` if the user wants the incumbent system recorded independently of a new build.
130
+ - Existing surface needing work: name the most relevant scoped command.
131
+ - Web project ready for visual iteration: `/impeccable live` when configured.
132
+
133
+ If init was invoked by another request, resume without rerunning `impeccable context`; the native reference above is the one thing that run could not have given you, and new-work owns later visual decisions.