@sayknow-cli/coding-agent 0.7.17 → 0.7.20

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 (39) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/types/decisions/prompt-triage.d.ts +7 -1
  3. package/dist/types/defaults/skc-ui-skills.d.ts +1 -1
  4. package/dist/types/hooks/ui-skill-keywords.d.ts +4 -3
  5. package/dist/types/modes/controllers/ssh-command-controller.d.ts +5 -0
  6. package/dist/types/sdk/host/control/operations.d.ts +2 -0
  7. package/dist/types/sdk/host/external-permissions.d.ts +47 -0
  8. package/dist/types/session/client-bridge.d.ts +1 -0
  9. package/dist/types/tui/file-list.d.ts +0 -3
  10. package/dist/types/tui/status-line.d.ts +9 -0
  11. package/package.json +9 -8
  12. package/src/decisions/prompt-triage.ts +11 -3
  13. package/src/defaults/skc/ui-skills/LICENSE.motionsites +30 -0
  14. package/src/defaults/skc/ui-skills/LICENSE.pbakaus +191 -0
  15. package/src/defaults/skc/ui-skills/NOTICE.md +22 -1
  16. package/src/defaults/skc/ui-skills/impeccable/SKILL.md +2719 -0
  17. package/src/defaults/skc/ui-skills/motionsites-web-builder/SKILL.md +697 -0
  18. package/src/defaults/skc-ui-skills.ts +10 -0
  19. package/src/hooks/ui-skill-keywords.ts +27 -6
  20. package/src/modes/acp/acp-event-mapper.ts +143 -5
  21. package/src/modes/components/ttsr-notification.ts +7 -4
  22. package/src/modes/controllers/ssh-command-controller.ts +20 -9
  23. package/src/modes/controllers/todo-command-controller.ts +13 -7
  24. package/src/modes/utils/tools-markdown.ts +12 -5
  25. package/src/prompts/agents/executor.md +1 -1
  26. package/src/prompts/system/subagent-system-prompt.md +1 -0
  27. package/src/prompts/system/system-prompt.md +7 -1
  28. package/src/prompts/tools/ask.md +5 -4
  29. package/src/sdk/host/control/operations.ts +2 -0
  30. package/src/sdk/host/external-permissions.ts +330 -0
  31. package/src/session/agent-session.ts +7 -1
  32. package/src/session/client-bridge.ts +1 -1
  33. package/src/skc-runtime/state-renderer.ts +41 -25
  34. package/src/skill-state/workflow-mutation-guard.ts +18 -8
  35. package/src/tools/gh-renderer.ts +44 -25
  36. package/src/tools/ssh.ts +2 -1
  37. package/src/tui/code-cell.ts +16 -2
  38. package/src/tui/file-list.ts +14 -3
  39. package/src/tui/status-line.ts +145 -4
@@ -0,0 +1,2719 @@
1
+ ---
2
+ name: impeccable
3
+ description: "Use when the user wants to design, redesign, shape, critique, audit, polish, simplify, harden, animate, or otherwise improve a frontend interface: websites, landing pages, dashboards, product UI, components, forms, settings, onboarding, empty states, and native iOS or Android screens. Handles UX review, hierarchy, layout, typography, color, motion, UX copy, accessibility, responsive behavior, edge cases, and capturing or documenting design systems (DESIGN.md, tokens). Also for making bland UI bolder, loud UI quieter, or ambitious visual effects. Not for backend-only or non-UI tasks."
4
+ version: 4.8.1
5
+ license: Apache 2.0
6
+ allowed-tools:
7
+ - Bash(npx impeccable *)
8
+ - Bash(.pi/skills/impeccable/scripts/impeccable *)
9
+ ---
10
+ ## SKC invocation
11
+
12
+ SKC loads this skill automatically for matching frontend UI/UX work.
13
+ Do not wait for a follow-up question. Apply the craft rules immediately
14
+ and keep going on the user's actual task.
15
+
16
+ This skill's companion reference files are appended inline at the end of
17
+ this document. Read them there; they are not separate files on disk.
18
+
19
+ ## SKC: how this bundled copy runs
20
+
21
+ ### Order and precedence
22
+
23
+ `stageshow` stays the design center and loads first. This skill adds Impeccable's steering vocabulary on top: the refine passes (`polish`, `bolder`, `quieter`, `distill`, `clarify`, `colorize`, `typeset`, `layout`, `harden`, `adapt`) and the evaluation passes (`critique`, `audit`). Where the two disagree on framing, hierarchy or motion, `stageshow` decides; interaction timing follows `emil-design-eng`. A pinned brief still wins over both, as "The brief wins" below says.
24
+
25
+ ### The engine is not bundled
26
+
27
+ The `scripts/impeccable` launcher and the native engine binary it downloads on first run are not shipped with SKC. Therefore:
28
+
29
+ - Skip Setup step 1. Do not run the launcher and do not send the "Context loading did not run" message; go straight to the **Launcher unavailable** path: read an existing `PRODUCT.md` and `DESIGN.md` without inventing missing context, then follow Setup steps 2-3.
30
+ - Every `.pi/skills/impeccable/scripts/impeccable <verb>` command below (`detect`, `critique-storage`, `live-server`, `live-inject`, `pin`, `hooks`, `doctor`) is unavailable. Skip that command and keep the manual part of the step. Snapshot persistence and trends are skipped.
31
+ - In `critique`, the detector counts as missing: gather Assessment B's browser evidence with the session's browser or screenshot tool when it has one, and open the report with the degraded banner `critique` requires.
32
+ - Live mode is unavailable, so ignore the "When invoked from live mode" parameter contracts.
33
+ - Do not install the Impeccable CLI (`npx impeccable ...`) or fetch the engine unasked. If the user explicitly asks for the detector, upstream's route is `npx impeccable detect <files or URL>`.
34
+
35
+ ### What is bundled and what replaces the rest
36
+
37
+ The bundled references are appended inline at the end of this document: read `reference/<name>.md` as the `## Appendix: <name>.md` section. Bundled: `craft-floor`, `mode-operate`, `mode-persuade`, `mode-read`, `operate`, `critique`, `audit`, `polish`, `bolder`, `quieter`, `distill`, `clarify`, `colorize`, `typeset`, `layout`, `harden`, `adapt`.
38
+
39
+ | Upstream reference (not bundled) | Use instead |
40
+ | --- | --- |
41
+ | `new-work.md`, `craft.md`, `shape.md`, `init.md` (new surface or replacement visual world) | `stageshow`, then this skill's refine passes |
42
+ | `animate.md`, `delight.md` | `animate`, `find-animation-opportunities` |
43
+ | `ios.md`, `android.md`, `audit.native.md`, `adapt.native.md` | `appllama-app-design-skill` for native app screens, `mobile-native` for a web app on a phone |
44
+ | `live.md`, `live-setup.md`, `generate.md` | `prototype` |
45
+ | `routing.md`, `document.md`, `extract.md`, `onboard.md`, `optimize.md`, `overdrive.md`, `visualize.md`, `component-review.md`, `region-map.md`, `hooks.md`, `doctor.md` | Not available. Do the work with the bundled references, and if the user names one of these commands, say once that it is not bundled. |
46
+
47
+ With no specific command, treat the request as general design work (the Routing "Otherwise" rule); there is no command menu to present.
48
+
49
+
50
+ This skill gives you the tools and permission to make design that earns the name out-of-distribution craft. Work as an award-winning design director would: production-grade code, a clear POV, a deep grasp of what the client and its users need, and exceptional craft.
51
+
52
+ Core principles:
53
+ - Finish the job. No hedging, no shortcuts: the deliverable is complete, except assets the user must provide.
54
+ - Scale ambition to the surface's mode (see Modes). Persuade and Experience get full commitment: bold, distinct work with a point of view. On Operate and Read, ambition shows as precision and restraint, and patterns the visitor already knows earn their place.
55
+ - Verify by looking at the rendered result at the sizes it ships at, and batch the checks: fix what one look shows before looking again, rather than screenshotting after every tweak.
56
+
57
+ ## Setup
58
+
59
+ 1. Run `<skill-base-dir>/scripts/impeccable context` once per session, where `<skill-base-dir>` is the directory that contains this SKILL.md (the skill folder, not a plugin root two levels above it); keep cwd at the user's project. That base directory resolves every `.pi/skills/impeccable/scripts/impeccable <verb>` command in this skill and its references, and `.pi/skills/impeccable/scripts` is the fallback only when the runtime reports no base directory. On a Windows shell without `sh`, call `.pi/skills/impeccable/scripts/impeccable.cmd` instead. The launcher runs a self-contained binary that ships next to it or is downloaded once on first run; no Node or other runtime is required. Pass a named source file or route as `--target <path>`. It loads PRODUCT.md, DESIGN.md, the matching surface brief, and native-platform guidance when applicable; follow its directives and do not rerun it.
60
+ 2. Load the request's playbook: its Commands-table reference for an explicit/implied sub-command, or [reference/new-work.md](reference/new-work.md) for a new surface or replacement visual world. Inspect target and incumbent visual truth before editing. When the app cannot run, start with committed visual-regression goldens or screenshot fixtures; verify target and freshness against current tokens, CSS, components, or assets, resolve conflicts, and compare theme/variant captures.
61
+ 3. After resolving analysis and direction, read [reference/craft-floor.md](#appendix-craft-floor-md) immediately before any UI edit, including small refinements. It carries the quality floor, the absolute bans, and the reflexes no detector catches. Do not load it for planning-only work.
62
+
63
+ **Launcher unavailable:** On refusal or failure, send a separate message **before the next tool call**: “Context loading did not run; I’ll read the existing project context directly.” Then read existing PRODUCT.md and DESIGN.md without inventing missing context, follow applicable steps 2–3, including reading [reference/craft-floor.md](#appendix-craft-floor-md) immediately before any UI edit, and continue through permitted tools. This applies to planning and editing; launcher failure alone does not block either.
64
+
65
+ ## How to design
66
+
67
+ - **The brief wins.** Honor pinned aesthetics, eras, materials, fonts, and palettes even when they conflict with a saturated-pattern warning. Redirecting a clear brief toward your taste is failure.
68
+ - **Refinement preserves; redesign replaces.** Refinement keeps the incumbent identity, behavior, copy, and everything outside scope. Ask before replacing factual copy or adding claims. Redesign keeps product truth, content, function, native affordances, and constraints, but treats the old look as evidence and anti-reference; choose a replacement world in new-work and replace DESIGN.md. Never split the difference into polish on the discarded look.
69
+ - **Loaded symbols stay out of the decoration.** A subject's world does not license emblems tied to militarism, supremacy, or hate movements as motifs, badges, or ornament, such as the Rising Sun flag's rays, the Confederate battle flag, or Nazi-era insignia and their stylised variants; reach for that world's neutral forms instead. Content that documents such a symbol as fact stays as it is.
70
+ - **Visual authority is evidence, not a filename.** Missing DESIGN.md alone does not make a project greenfield; new-work decides whether to preserve, expand, or replace the incumbent world.
71
+
72
+ ## Modes
73
+
74
+ The mode names what the visitor's success looks like on this surface.
75
+
76
+ - **Persuade:** the visitor decides and acts; design is the product. Landing pages, marketing, campaigns, pricing. Earn attention and action. Ship real imagery when the brief needs it; follow the committed world, not category habit.
77
+ - **Operate:** the visitor completes a task. App UI, dashboards, editors, admin, settings, tools. Scanability, consistency, native expectations, and the real usage scene outrank expression. Brand lives in precise details.
78
+ - **Read:** the visitor understands something. Docs, articles, guides, help, changelogs. Structure for comprehension, then make the reading experience worth staying in.
79
+ - **Experience:** the visitor is inside the work itself. Portfolios, galleries, showcases. Let the artifact lead from the first viewport; the interface recedes.
80
+
81
+ Choose the mode from the requested surface, not the product, and persist it only in that surface brief. A tool's landing page is still Persuade; a fashion house's documentation is still Read; a docs index is Read, not Persuade. See [new-work.md](reference/new-work.md) for new surfaces and [operate.md](#appendix-operate-md) for deeper Operate/Read guidance.
82
+
83
+ ## Commands
84
+
85
+ | Command | Category | Description | Reference |
86
+ |---|---|---|---|
87
+ | `craft [feature]` | Build | Deprecated alias for an ordinary new-work request | [reference/craft.md](reference/craft.md) |
88
+ | `shape [feature]` | Build | Plan UX/UI before writing code | [reference/shape.md](reference/shape.md) |
89
+ | `init` | Build | Capture durable product context in PRODUCT.md | [reference/init.md](reference/init.md) |
90
+ | `document` | Build | Generate DESIGN.md from existing project code | [reference/document.md](reference/document.md) |
91
+ | `extract [target]` | Build | Pull reusable tokens and components into design system | [reference/extract.md](reference/extract.md) |
92
+ | `critique [target]` | Evaluate | UX design review with heuristic scoring | [reference/critique.md](#appendix-critique-md) |
93
+ | `audit [target]` | Evaluate | Technical quality checks (a11y, perf, responsive) | [reference/audit.md](#appendix-audit-md) · native: [reference/audit.native.md](reference/audit.native.md) |
94
+ | `polish [target]` | Refine | Final quality pass before shipping | [reference/polish.md](#appendix-polish-md) |
95
+ | `bolder [target]` | Refine | Amplify safe or bland designs | [reference/bolder.md](#appendix-bolder-md) |
96
+ | `quieter [target]` | Refine | Tone down aggressive or overstimulating designs | [reference/quieter.md](#appendix-quieter-md) |
97
+ | `distill [target]` | Refine | Strip to essence, remove complexity | [reference/distill.md](#appendix-distill-md) |
98
+ | `harden [target]` | Refine | Production-ready: errors, i18n, edge cases | [reference/harden.md](#appendix-harden-md) |
99
+ | `onboard [target]` | Refine | Design first-run flows, empty states, activation | [reference/onboard.md](reference/onboard.md) |
100
+ | `animate [target]` | Enhance | Add purposeful animations and motion | [reference/animate.md](reference/animate.md) |
101
+ | `colorize [target]` | Enhance | Add strategic color to monochromatic UIs | [reference/colorize.md](#appendix-colorize-md) |
102
+ | `typeset [target]` | Enhance | Improve typography hierarchy and fonts | [reference/typeset.md](#appendix-typeset-md) |
103
+ | `layout [target]` | Enhance | Fix spacing, rhythm, and visual hierarchy | [reference/layout.md](#appendix-layout-md) |
104
+ | `delight [target]` | Enhance | Add personality and memorable touches | [reference/delight.md](reference/delight.md) |
105
+ | `overdrive [target]` | Enhance | Push past conventional limits | [reference/overdrive.md](reference/overdrive.md) |
106
+ | `clarify [target]` | Fix | Improve UX copy, labels, and error messages | [reference/clarify.md](#appendix-clarify-md) |
107
+ | `adapt [target]` | Fix | Adapt for different devices and screen sizes | [reference/adapt.md](#appendix-adapt-md) · native: [reference/adapt.native.md](reference/adapt.native.md) |
108
+ | `optimize [target]` | Fix | Diagnose and fix UI performance | [reference/optimize.md](reference/optimize.md) |
109
+ | `live` | Iterate | Visual variant mode: pick elements in the browser, iterate on alternatives | [reference/live.md](reference/live.md) |
110
+ | `generate [n] [action] [element]` | Iterate | Variants, versions, or alternatives of a named element to choose from in the live browser; no manual picking | [reference/generate.md](reference/generate.md) |
111
+
112
+ Routing:
113
+
114
+ - **No argument:** read [routing.md](reference/routing.md) and present its context-aware menu; never auto-run a command.
115
+ - **Explicit or clearly implied request to run a command:** load its reference (native variant on native platforms) and follow it. Ask once if two commands fit.
116
+ - **Workflow or command-selection question:** read [Workflow questions](reference/routing.md#workflow-questions).
117
+ - **Otherwise:** treat the request as general design work. Missing PRODUCT.md routes a new surface or replacement world through init, then new-work; a narrow refinement of existing code proceeds on the incumbent implementation as `impeccable context` directs, offering init afterward rather than blocking on it.
118
+ - `teach` aliases `init`. `craft` is a deprecated alias for ordinary new-work and adds nothing. `shape` owns task discovery, then enters new-work only for visual-world and surface-concept decisions.
119
+
120
+ After init writes PRODUCT.md, resume without rerunning `impeccable context`; init loads the native platform reference itself when the platform it recorded is `ios`, `android`, or `adaptive`.
121
+
122
+ **Pin / Unpin:** `.pi/skills/impeccable/scripts/impeccable pin <pin|unpin> <command>` creates or removes a standalone `/<command>` shortcut. Report the script's result concisely; relay stderr verbatim on error.
123
+
124
+ **Hooks:** `/impeccable hooks <on|off|status|ignore-rule|ignore-file|ignore-value|reset>` manages the design detector hook for this project (auto-runs the detector after UI file edits and surfaces findings). Load [reference/hooks.md](reference/hooks.md) when the user invokes it with any argument.
125
+
126
+ **Doctor:** `/impeccable doctor` reports and repairs drift between this project's Impeccable artifacts (PRODUCT.md, DESIGN.md and its sidecar, config, surface briefs, the hook) and what this version reads. Load [reference/doctor.md](reference/doctor.md) when the user invokes it, or when they ask what is out of date, stale, or needs refreshing. A `CONTEXT_STALE` directive in Setup's output is the cheap subset of the same report; act on it there per its own instructions rather than running doctor unasked.
127
+
128
+ **Never repair drift as a side effect of a design task.** A `CONTEXT_STALE` finding is reported, not acted on, unless the user asks. The one exception is a finding marked `auto`, which the next write to that file performs anyway.
129
+
130
+ ---
131
+
132
+ ## Appendix: adapt.md
133
+
134
+ > **Additional context needed**: target platforms/devices and usage contexts.
135
+
136
+ Adapt an existing design to a different context: another screen size, device, platform, or use case. The trap is treating adaptation as scaling. The job is rethinking the experience for the new context.
137
+
138
+ **Web only** (mobile web included). Native platforms (`ios` / `android` / `adaptive`) route to [adapt.native.md](adapt.native.md) instead; if the project is native, switch to it now.
139
+
140
+ ---
141
+
142
+ ## Assess Adaptation Challenge
143
+
144
+ Understand what needs adaptation and why:
145
+
146
+ 1. **Identify the source context**:
147
+ - What was it designed for originally? (Desktop web? Mobile app?)
148
+ - What assumptions were made? (Large screen? Mouse input? Fast connection?)
149
+ - What works well in current context?
150
+
151
+ 2. **Understand target context**:
152
+ - **Device**: Mobile, tablet, desktop, TV, watch, print?
153
+ - **Input method**: Touch, mouse, keyboard, voice, gamepad?
154
+ - **Screen constraints**: Size, resolution, orientation?
155
+ - **Connection**: Fast wifi, slow 3G, offline?
156
+ - **Usage context**: On-the-go vs desk, quick glance vs focused reading?
157
+ - **User expectations**: What do users expect on this platform?
158
+
159
+ 3. **Identify adaptation challenges**:
160
+ - What won't fit? (Content, navigation, features)
161
+ - What won't work? (Hover states on touch, tiny touch targets)
162
+ - What's inappropriate? (Desktop patterns on mobile, mobile patterns on desktop)
163
+
164
+ Adaptation is rethinking the experience for the new context, not scaling pixels.
165
+
166
+ ## Plan Adaptation Strategy
167
+
168
+ Create context-appropriate strategy:
169
+
170
+ ### Mobile Adaptation (Desktop → Mobile)
171
+
172
+ **Layout Strategy**:
173
+ - Single column instead of multi-column
174
+ - Vertical stacking instead of side-by-side
175
+ - Full-width components instead of fixed widths
176
+ - Bottom navigation instead of top/side navigation
177
+
178
+ **Interaction Strategy**:
179
+ - Touch targets 44x44px minimum (not hover-dependent)
180
+ - Swipe gestures where appropriate (lists, carousels)
181
+ - Bottom sheets instead of dropdowns
182
+ - Thumbs-first design (controls within thumb reach)
183
+ - Larger tap areas with more spacing
184
+
185
+ **Content Strategy**:
186
+ - Progressive disclosure (don't show everything at once)
187
+ - Prioritize primary content (secondary content in tabs/accordions)
188
+ - Shorter text (more concise)
189
+ - Larger text (16px minimum)
190
+
191
+ **Navigation Strategy**:
192
+ - Hamburger menu or bottom navigation
193
+ - Reduce navigation complexity
194
+ - Sticky headers for context
195
+ - Back button in navigation flow
196
+
197
+ ### Tablet Adaptation (Hybrid Approach)
198
+
199
+ **Layout Strategy**:
200
+ - Two-column layouts (not single or three-column)
201
+ - Side panels for secondary content
202
+ - Master-detail views (list + detail)
203
+ - Adaptive based on orientation (portrait vs landscape)
204
+
205
+ **Interaction Strategy**:
206
+ - Support both touch and pointer
207
+ - Touch targets 44x44px but allow denser layouts than phone
208
+ - Side navigation drawers
209
+ - Multi-column forms where appropriate
210
+
211
+ ### Desktop Adaptation (Mobile → Desktop)
212
+
213
+ **Layout Strategy**:
214
+ - Multi-column layouts (use horizontal space)
215
+ - Side navigation always visible
216
+ - Multiple information panels simultaneously
217
+ - Fixed widths with max-width constraints (don't stretch to 4K)
218
+
219
+ **Interaction Strategy**:
220
+ - Hover states for additional information
221
+ - Keyboard shortcuts
222
+ - Right-click context menus
223
+ - Drag and drop where helpful
224
+ - Multi-select with Shift/Cmd
225
+
226
+ **Content Strategy**:
227
+ - Show more information upfront (less progressive disclosure)
228
+ - Data tables with many columns
229
+ - Richer visualizations
230
+ - More detailed descriptions
231
+
232
+ ### Print Adaptation (Screen → Print)
233
+
234
+ **Layout Strategy**:
235
+ - Page breaks at logical points
236
+ - Remove navigation, footer, interactive elements
237
+ - Black and white (or limited color)
238
+ - Proper margins for binding
239
+
240
+ **Content Strategy**:
241
+ - Expand shortened content (show full URLs, hidden sections)
242
+ - Add page numbers, headers, footers
243
+ - Include metadata (print date, page title)
244
+ - Convert charts to print-friendly versions
245
+
246
+ ### Email Adaptation (Web → Email)
247
+
248
+ **Layout Strategy**:
249
+ - Narrow width (600px max)
250
+ - Single column only
251
+ - Inline CSS (no external stylesheets)
252
+ - Table-based layouts (for email client compatibility)
253
+
254
+ **Interaction Strategy**:
255
+ - Large, obvious CTAs (buttons not text links)
256
+ - No hover states (not reliable)
257
+ - Deep links to web app for complex interactions
258
+
259
+ ## Implement Adaptations
260
+
261
+ Apply changes systematically:
262
+
263
+ ### Responsive Breakpoints
264
+
265
+ Choose appropriate breakpoints:
266
+ - Mobile: 320px-767px
267
+ - Tablet: 768px-1023px
268
+ - Desktop: 1024px+
269
+ - Or content-driven breakpoints (where design breaks)
270
+
271
+ ### Layout Adaptation Techniques
272
+
273
+ - **CSS Grid/Flexbox**: Reflow layouts automatically
274
+ - **Container Queries**: Adapt based on container, not viewport
275
+ - **`clamp()`**: Fluid sizing between min and max
276
+ - **Media queries**: Different styles for different contexts
277
+ - **Display properties**: Show/hide elements per context
278
+
279
+ ### Touch Adaptation
280
+
281
+ - Increase touch target sizes (44x44px minimum)
282
+ - Add more spacing between interactive elements
283
+ - Remove hover-dependent interactions
284
+ - Add touch feedback (ripples, highlights)
285
+ - Consider thumb zones (easier to reach bottom than top)
286
+
287
+ ### Content Adaptation
288
+
289
+ - Use `display: none` sparingly (still downloads)
290
+ - Progressive enhancement (core content first, enhancements on larger screens)
291
+ - Lazy loading for off-screen content
292
+ - Responsive images (`srcset`, `picture` element)
293
+
294
+ ### Navigation Adaptation
295
+
296
+ - Transform complex nav to hamburger/drawer on mobile
297
+ - Bottom nav bar for mobile apps
298
+ - Persistent side navigation on desktop
299
+ - Breadcrumbs on smaller screens for context
300
+
301
+ Test on real devices. DevTools emulation is a useful first pass but misses real touch, performance, and browser chrome.
302
+
303
+ **Avoid**:
304
+ - Hide core functionality on mobile (if it matters, make it work)
305
+ - Assume desktop = powerful device (consider accessibility, older machines)
306
+ - Use different information architecture across contexts (confusing)
307
+ - Break user expectations for platform (mobile users expect mobile patterns)
308
+ - Forget landscape orientation on mobile/tablet
309
+ - Use generic breakpoints blindly (use content-driven breakpoints)
310
+ - Ignore touch on desktop (many desktop devices have touch)
311
+
312
+ ## Verify Adaptations
313
+
314
+ Test thoroughly across contexts:
315
+
316
+ - **Real devices**: Test on actual phones, tablets, desktops
317
+ - **Different orientations**: Portrait and landscape
318
+ - **Different browsers**: Safari, Chrome, Firefox, Edge
319
+ - **Different OS**: iOS, Android, Windows, macOS
320
+ - **Different input methods**: Touch, mouse, keyboard
321
+ - **Edge cases**: Very small screens (320px), very large screens (4K)
322
+ - **Slow connections**: Test on throttled network
323
+
324
+ **Custom controls** (sliders, drag surfaces, scrollable control strips): a before/after slider can pass every width check above and still refuse to drag on iOS, so exercise each one in scope in the same batched round as the checks above:
325
+
326
+ - **Primary gesture**: Tap it and confirm it responds as designed, then drag it with the target input method; the drag must complete, not just start
327
+ - **Scroll across it**: A swipe along the page's scroll axis across the control scrolls the page or container without activating it; a drag that starts on the control along its axis moves the control, not the page. Neither failure throws an error, so try both
328
+ - **Evidence**: Say what produced the evidence: an emulated viewport, synthesized touch input through a browser tool, which engine ran it (Chromium is not Safari), or a physical device. Screenshots and resized viewports verify layout, never a gesture. Name what stayed untested and move on; unreachable hardware is a reported gap, not a blocker
329
+
330
+ When the adaptation feels native to each context, hand off to `/impeccable polish` for the final pass.
331
+
332
+ ---
333
+
334
+ ## Reference Material
335
+
336
+ The sections below were previously `responsive-design.md` and live inline now so the adapt flow has its deep responsive reference in one place.
337
+
338
+ ### Responsive Design
339
+
340
+ #### Mobile-First: Write It Right
341
+
342
+ Start with base styles for mobile, use `min-width` queries to layer complexity. Desktop-first (`max-width`) means mobile loads unnecessary styles first.
343
+
344
+ #### Breakpoints: Content-Driven
345
+
346
+ Don't chase device sizes; let content tell you where to break. Start narrow, stretch until design breaks, add breakpoint there. Three breakpoints usually suffice (640, 768, 1024px). Use `clamp()` for fluid values without breakpoints.
347
+
348
+ #### Detect Input Method, Not Just Screen Size
349
+
350
+ **Screen size doesn't tell you input method.** A laptop with touchscreen, a tablet with keyboard. Use pointer and hover queries:
351
+
352
+ ```css
353
+ /* Fine pointer (mouse, trackpad) */
354
+ @media (pointer: fine) {
355
+ .button { padding: 8px 16px; }
356
+ }
357
+
358
+ /* Coarse pointer (touch, stylus) */
359
+ @media (pointer: coarse) {
360
+ .button { padding: 12px 20px; } /* Larger touch target */
361
+ }
362
+
363
+ /* Device supports hover */
364
+ @media (hover: hover) {
365
+ .card:hover { transform: translateY(-2px); }
366
+ }
367
+
368
+ /* Device doesn't support hover (touch) */
369
+ @media (hover: none) {
370
+ .card { /* No hover state - use active instead */ }
371
+ }
372
+ ```
373
+
374
+ **Critical**: Don't rely on hover for functionality. Touch users can't hover.
375
+
376
+ #### Safe Areas: Handle the Notch
377
+
378
+ Modern phones have notches, rounded corners, and home indicators. Use `env()`:
379
+
380
+ ```css
381
+ body {
382
+ padding-top: env(safe-area-inset-top);
383
+ padding-bottom: env(safe-area-inset-bottom);
384
+ padding-left: env(safe-area-inset-left);
385
+ padding-right: env(safe-area-inset-right);
386
+ }
387
+
388
+ /* With fallback */
389
+ .footer {
390
+ padding-bottom: max(1rem, env(safe-area-inset-bottom));
391
+ }
392
+ ```
393
+
394
+ **Enable viewport-fit** in your meta tag:
395
+ ```html
396
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
397
+ ```
398
+
399
+ #### Responsive Images: Get It Right
400
+
401
+ ##### srcset with Width Descriptors
402
+
403
+ ```html
404
+ <img
405
+ src="hero-800.jpg"
406
+ srcset="
407
+ hero-400.jpg 400w,
408
+ hero-800.jpg 800w,
409
+ hero-1200.jpg 1200w
410
+ "
411
+ sizes="(max-width: 768px) 100vw, 50vw"
412
+ alt="Hero image"
413
+ >
414
+ ```
415
+
416
+ **How it works**:
417
+ - `srcset` lists available images with their actual widths (`w` descriptors)
418
+ - `sizes` tells the browser how wide the image will display
419
+ - Browser picks the best file based on viewport width AND device pixel ratio
420
+
421
+ ##### Picture Element for Art Direction
422
+
423
+ When you need different crops/compositions (not just resolutions):
424
+
425
+ ```html
426
+ <picture>
427
+ <source media="(min-width: 768px)" srcset="wide.jpg">
428
+ <source media="(max-width: 767px)" srcset="tall.jpg">
429
+ <img src="fallback.jpg" alt="...">
430
+ </picture>
431
+ ```
432
+
433
+ #### Layout Adaptation Patterns
434
+
435
+ **Navigation**: Three stages: hamburger + drawer on mobile, horizontal compact on tablet, full with labels on desktop. **Tables**: Transform to cards on mobile using `display: block` and `data-label` attributes. **Progressive disclosure**: Use `<details>/<summary>` for content that can collapse on mobile.
436
+
437
+ #### Testing: Don't Trust DevTools Alone
438
+
439
+ DevTools device emulation is useful for layout but misses:
440
+
441
+ - Actual touch interactions
442
+ - Real CPU/memory constraints
443
+ - Network latency patterns
444
+ - Font rendering differences
445
+ - Browser chrome/keyboard appearances
446
+
447
+ **Test on at least**: One real iPhone, one real Android, a tablet if relevant. Cheap Android phones reveal performance issues you'll never see on simulators.
448
+
449
+ ---
450
+
451
+ **Avoid**: Desktop-first design. Device detection instead of feature detection. Separate mobile/desktop codebases. Ignoring tablet and landscape. Assuming all mobile devices are powerful.
452
+
453
+ ---
454
+
455
+ ## Appendix: audit.md
456
+
457
+ Run systematic **technical** quality checks and generate a comprehensive report. Don't fix issues; document them for other commands to address.
458
+
459
+ This is a code-level audit, not a design critique. Check what's measurable and verifiable in the implementation.
460
+
461
+ **Web only.** Native platforms (`ios` / `android` / `adaptive`) route to [audit.native.md](audit.native.md) instead; if the project is native, switch to it now.
462
+
463
+ ## Diagnostic Scan
464
+
465
+ Run comprehensive checks across 5 dimensions. Score each dimension 0-4 using the criteria below.
466
+
467
+ ### 1. Accessibility (A11y)
468
+
469
+ **Check for**:
470
+ - **Contrast issues**: Text contrast ratios < 4.5:1, or < 3:1 for large text (or 7:1 for AAA)
471
+ - **Motion sensitivity**: `prefers-reduced-motion` needs an intentional alternative that preserves state change and hierarchy; flag a global `0.01ms` kill that destroys useful feedback, flashing above threshold, and motion that blocks focus, reading, or task completion
472
+ - **Missing ARIA**: Interactive elements without proper roles, labels, or states
473
+ - **Keyboard navigation**: Missing focus indicators, illogical tab order, keyboard traps
474
+ - **Semantic HTML**: Improper heading hierarchy, missing landmarks, divs instead of buttons
475
+ - **Alt text**: Missing or poor image descriptions
476
+ - **Form issues**: Inputs without labels, poor error messaging, missing required indicators
477
+
478
+ **Score 0-4**: 0=Inaccessible (fails WCAG A), 1=Major gaps (few ARIA labels, no keyboard nav), 2=Partial (some a11y effort, significant gaps), 3=Good (WCAG AA mostly met, minor gaps), 4=Excellent (WCAG AA fully met, approaches AAA)
479
+
480
+ ### 2. Performance
481
+
482
+ **Check for**:
483
+ - **Layout thrashing**: Reading/writing layout properties in loops
484
+ - **Expensive animations**: Casual layout-property animation, unbounded blur/filter/shadow effects, or effects that visibly drop frames
485
+ - **Missing optimization**: Images without lazy loading, unoptimized assets
486
+ - **will-change overuse**: `will-change` applied broadly or left on at rest (it is a targeted hint for known expensive animations, not a baseline requirement)
487
+ - **Bundle size**: Unnecessary imports, unused dependencies
488
+ - **Render performance**: Unnecessary re-renders, missing memoization
489
+
490
+ **Score 0-4**: 0=Severe issues (layout thrash, unoptimized everything), 1=Major problems (no lazy loading, expensive animations), 2=Partial (some optimization, gaps remain), 3=Good (mostly optimized, minor improvements possible), 4=Excellent (fast, lean, well-optimized)
491
+
492
+ ### 3. Theming
493
+
494
+ **Check for**:
495
+ - **Hard-coded colors**: Colors not using design tokens
496
+ - **Broken dark mode**: Missing dark mode variants, poor contrast in dark theme
497
+ - **Inconsistent tokens**: Using wrong tokens, mixing token types
498
+ - **Theme switching issues**: Values that don't update on theme change
499
+
500
+ **Score 0-4**: 0=No theming (hard-coded everything), 1=Minimal tokens (mostly hard-coded), 2=Partial (tokens exist but inconsistently used), 3=Good (tokens used, minor hard-coded values), 4=Excellent (full token system, dark mode works perfectly)
501
+
502
+ ### 4. Responsive Design
503
+
504
+ **Check for**:
505
+ - **Fixed widths**: Hard-coded widths that break on mobile
506
+ - **Touch targets**: Interactive elements < 44x44px. WCAG AA (SC 2.5.8) requires at least 24x24 CSS px unless an exception applies: spacing, an equivalent control, inline text, user-agent styling, or an essential size. Spacing passes when a 24 CSS px circle centered on the target's bounding box overlaps no other target and no other undersized target's circle
507
+ - **Broken touch interaction**: Custom sliders, drag surfaces, and scrollable control strips whose primary gesture fails under touch, that swallow page scroll or lose the drag to it, or that stay stuck after an interrupted gesture. Code tells: mouse-only handlers, no `touch-action` on a pointer-event drag surface, drag state that nothing clears on cancel, lost capture, or blur. Exercise the gesture when a browser tool can synthesize touch (a rendered viewport proves layout, not the gesture), then say what produced the evidence (emulated viewport, synthesized touch, which engine, physical device) and what stayed untested
508
+ - **Horizontal scroll**: Content overflow on narrow viewports
509
+ - **Text scaling**: Layouts that break when text size increases
510
+ - **Missing breakpoints**: No mobile/tablet variants
511
+
512
+ **Score 0-4**: 0=Desktop-only (breaks on mobile), 1=Major issues (some breakpoints, many failures), 2=Partial (works on mobile, rough edges), 3=Good (responsive, minor touch target or overflow issues), 4=Excellent (fluid, all viewports, proper touch targets, gestures work under touch)
513
+
514
+ ### 5. Implementation Integrity (CRITICAL)
515
+
516
+ Run the bundled detector and verify each finding in context. Look for repeated implementation shortcuts, design-system drift, misleading or decorative content, and structure that is interchangeable with an unrelated product. Keep deterministic findings separate from visual judgment and call out false positives.
517
+
518
+ **Desktop apps** (Electron, NW.js, CEF, WebView2): launch the app with a local DevTools port (`--remote-debugging-port=9222`, or `WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=--remote-debugging-port=9222` for WebView2; keep it on 127.0.0.1, never exposed), seed the state to audit, keep the window on screen (a hidden one skips the pixel contrast reads), then run `.pi/skills/impeccable/scripts/impeccable detect --cdp 9222 --target <part of the page URL or title> --json`. It returns the same JSON as a URL scan and leaves the window as found. Take screenshots through the harness's CDP tooling, and leave the window as you found it too. Tauri on macOS (WKWebView) and on Linux (WebKitGTK) expose no CDP: scan the source and say the rendered check did not run.
519
+
520
+ **Score 0-4**: 0=systemic drift, 1=major repeated failures, 2=several verified issues, 3=minor isolated issues, 4=coherent and intentional
521
+
522
+ ## Generate Report
523
+
524
+ ### Audit Health Score
525
+
526
+ | # | Dimension | Score | Key Finding |
527
+ |---|-----------|-------|-------------|
528
+ | 1 | Accessibility | ? | [most critical a11y issue or "--"] |
529
+ | 2 | Performance | ? | |
530
+ | 3 | Theming | ? | |
531
+ | 4 | Responsive Design | ? | |
532
+ | 5 | Implementation Integrity | ? | |
533
+ | **Total** | | **??/20** | **[Rating band]** |
534
+
535
+ **Rating bands**: 18-20 Excellent (minor polish), 14-17 Good (address weak dimensions), 10-13 Acceptable (significant work needed), 6-9 Poor (major overhaul), 0-5 Critical (fundamental issues)
536
+
537
+ ### Implementation Integrity Verdict
538
+ **Start here.** Pass/fail: does the implementation express a coherent product-specific system? Cite verified evidence and detector findings.
539
+
540
+ ### Executive Summary
541
+ - Audit Health Score: **??/20** ([rating band])
542
+ - Total issues found (count by severity: P0/P1/P2/P3)
543
+ - Top 3-5 critical issues
544
+ - Recommended next steps
545
+
546
+ ### Detailed Findings by Severity
547
+
548
+ Tag every issue with **P0-P3 severity**:
549
+ - **P0 Blocking**: Prevents task completion. Fix immediately
550
+ - **P1 Major**: Significant difficulty or WCAG AA violation. Fix before release
551
+ - **P2 Minor**: Annoyance, workaround exists. Fix in next pass
552
+ - **P3 Polish**: Nice-to-fix, no real user impact. Fix if time permits
553
+
554
+ For each issue, document:
555
+ - **[P?] Issue name**
556
+ - **Location**: Component, file, line
557
+ - **Category**: Accessibility / Performance / Theming / Responsive / Implementation Integrity
558
+ - **Impact**: How it affects users
559
+ - **WCAG/Standard**: Which standard it violates (if applicable)
560
+ - **Recommendation**: How to fix it
561
+ - **Suggested command**: Which command to use (prefer: /impeccable adapt, /impeccable animate, /impeccable audit, /impeccable bolder, /impeccable clarify, /impeccable colorize, /impeccable critique, /impeccable delight, /impeccable distill, /impeccable document, /impeccable harden, /impeccable layout, /impeccable onboard, /impeccable optimize, /impeccable overdrive, /impeccable polish, /impeccable quieter, /impeccable shape, /impeccable typeset)
562
+
563
+ ### Patterns & Systemic Issues
564
+
565
+ Identify recurring problems that indicate systemic gaps rather than one-off mistakes:
566
+ - "Hard-coded colors appear in 15+ components, should use design tokens"
567
+ - "Touch targets consistently too small (<44px) throughout mobile experience"
568
+
569
+ ### Positive Findings
570
+
571
+ Note what's working well: good practices to maintain and replicate.
572
+
573
+ ## Recommended Actions
574
+
575
+ List recommended commands in priority order (P0 first, then P1, then P2):
576
+
577
+ 1. **[P?] `/command-name`**: Brief description (specific context from audit findings)
578
+ 2. **[P?] `/command-name`**: Brief description (specific context)
579
+
580
+ **Rules**: Only recommend commands from: /impeccable adapt, /impeccable animate, /impeccable audit, /impeccable bolder, /impeccable clarify, /impeccable colorize, /impeccable critique, /impeccable delight, /impeccable distill, /impeccable document, /impeccable harden, /impeccable layout, /impeccable onboard, /impeccable optimize, /impeccable overdrive, /impeccable polish, /impeccable quieter, /impeccable shape, /impeccable typeset. Map findings to the most appropriate command. End with `/impeccable polish` as the final step if any fixes were recommended.
581
+
582
+ After presenting the summary, tell the user:
583
+
584
+ > You can ask me to run these one at a time, all at once, or in any order you prefer.
585
+ >
586
+ > Re-run `/impeccable audit` after fixes to see your score improve.
587
+
588
+ Keep P3s few: a long tail of minor issues buries the ones that matter.
589
+
590
+ **Avoid**:
591
+ - Report issues without explaining impact (why does this matter?)
592
+ - Provide generic recommendations (be specific and actionable)
593
+ - Skip positive findings (celebrate what works)
594
+ - Forget to prioritize (everything can't be P0)
595
+ - Report false positives without verification
596
+
597
+ ---
598
+
599
+ ## Appendix: bolder.md
600
+
601
+ > **Additional context needed**: which section is the target, and what must stay untouched.
602
+
603
+ An open direction round owns the word first: "bolder" said while a direction decision is on the table is the Bolder hand register steer, a fresh deal of foreign forms (see new-work.md), not this command. This command refines a surface whose world already shipped.
604
+
605
+ "Bolder" is an amplification request, and almost always it is scoped to something that already exists. The surrounding page, its system, and its conventions are the given. Your job is to raise one part to the conviction the rest already implies, without rebuilding anything the brief did not name. The reflex answer, reaching for more effects, is the opposite of bold; reject it first.
606
+
607
+ ## Scope is sovereign
608
+
609
+ "Everything else stays" is a literal instruction. Touch only the named target. Do not restyle its neighbors, do not migrate the page to a new idea, do not add colors, fonts, radii, shadows, or system primitives the surface does not already own. If the existing system genuinely cannot express the direction, do not expand it on your own. Ask the user directly to clarify what you cannot infer. Name the exact addition and the job it would do.
610
+
611
+ ## Why it reads flat
612
+
613
+ A section usually reads flat for reasons its neighbors have already solved. Look at what the rest of the page does that this section does not: the display type at full strength, the structural devices that carry meaning, the signature motif, the density and pacing. A flat section is typically one that quietly opts out of the system's own strongest moves. The most reliable bolder pass brings the target up to the expressive level its neighbors already reach, in the system's own vocabulary rather than a new one.
614
+
615
+ ## The amplification
616
+
617
+ - **Amplify what the system already owns.** Reuse its motif and its type scale at full strength, turned up for this section rather than invented for it. The bolder version should look more like the same brand, not less.
618
+ - **Keep content true.** Existing claims are part of the scope: preserve them unless the user supplies replacements. If real evidence is essential to the direction but absent, ask for it.
619
+ - **Commit, then clarify.** Half-measures read as noise. Make the one decisive move completely, then quiet everything around it so the move is legible. If every element got louder, the section got flatter.
620
+ - **Give it its own rhythm.** The target should read as a peak in the scroll, a shift in density or pace from what surrounds it, not simply more of the same.
621
+
622
+ ## The skeleton test
623
+
624
+ Strip the copy out of your planned section and study the bare structure. Does the skeleton still say what this section is and why it matters, through hierarchy and the system's devices alone? If it only works once the words return, the boldness is in the text size, not the design. A placeholder for an image or artifact names a job, an anchor and a piece of evidence, not a cue to drop in a decorative photo; fill that job with whatever the subject actually has.
625
+
626
+ ## Before you finish
627
+
628
+ - Everything outside the named target is unchanged.
629
+ - No new color, font, or system primitive appeared without being asked for.
630
+ - The conventions the section carried, including anything that drives an action, still work the same way.
631
+ - The section is unmistakably the same brand, only more sure of itself.
632
+
633
+ When the target holds its own without pulling the page apart, hand off to `/impeccable polish` for the final pass.
634
+
635
+ ---
636
+
637
+ ## Appendix: clarify.md
638
+
639
+ > **Additional context needed**: audience knowledge and emotional state.
640
+
641
+ Rewrite unclear interface text so users understand what happened, what matters, and what to do next. Preserve factual meaning, product terminology, and brand voice.
642
+
643
+ ## Audit the language
644
+
645
+ Read the entire interaction path, not isolated strings. Identify:
646
+
647
+ - ambiguous nouns, verbs, and actions;
648
+ - internal jargon or assumed knowledge;
649
+ - vague labels, outcomes, and system states;
650
+ - missing consequences, recovery, or timing;
651
+ - inconsistent terminology and capitalization;
652
+ - redundant headings, intros, helper text, and confirmations;
653
+ - text that breaks at realistic widths or in translation;
654
+ - tone that ignores stress, risk, success, or urgency.
655
+
656
+ Infer audience and task from product context and surrounding UI. Ask before changing factual claims, legal meaning, or a term that may be domain-specific.
657
+
658
+ ## Set the message hierarchy
659
+
660
+ For each state, decide:
661
+
662
+ 1. the one fact the user needs now;
663
+ 2. the action available next;
664
+ 3. supporting context that changes the decision;
665
+ 4. the appropriate tone for this moment.
666
+
667
+ Say each idea once. If the heading already explains the state, the introduction should add new information or disappear.
668
+
669
+ ## Rewrite by function
670
+
671
+ ### Actions and navigation
672
+
673
+ Use a specific verb and object when the outcome is not already obvious. Labels should describe what will happen, not the gesture used to trigger it. Keep the same noun and verb for the same concept throughout the product.
674
+
675
+ For destructive actions, name the object and consequence. Prefer undo over confirmation when recovery is safe. When confirmation is necessary, name the action on both the message and button instead of using `Yes`, `No`, `OK`, or `Submit`.
676
+
677
+ ### Forms
678
+
679
+ Use persistent labels; placeholders are examples, not labels. Put format and eligibility requirements before submission. Explain why information is requested only when it is not obvious. Required and optional treatment should be consistent.
680
+
681
+ Validation says what needs attention and how to correct it without blaming the user. Keep related instructions near the field and announce errors accessibly.
682
+
683
+ ### Errors and permissions
684
+
685
+ An actionable error answers:
686
+
687
+ 1. what failed;
688
+ 2. why, when known and useful;
689
+ 3. how to recover or what alternative remains.
690
+
691
+ Do not expose internal codes as the primary message. Do not promise a cause or resolution the system cannot know. Treat privacy, payment, deletion, access loss, and blocked work seriously; warmth is welcome, jokes are not.
692
+
693
+ ### Loading, empty, and success states
694
+
695
+ Loading text names the real operation and sets an honest expectation when the wait is meaningful. Show determinate progress when available; never invent progress.
696
+
697
+ An empty state distinguishes first use, no results, filters, permissions, and failure. Explain the state and provide the next useful action.
698
+
699
+ Success confirms the completed outcome and mentions the next consequence only when it changes what the user should do. Routine success should be brief.
700
+
701
+ ### Help and instructional text
702
+
703
+ Helper text answers an implicit question instead of restating the control. Use progressive disclosure for uncommon detail. Link text must make sense out of context; icon-only controls need accessible names.
704
+
705
+ ## Voice, accessibility, and localization
706
+
707
+ Voice stays consistent; tone adapts to the moment. Use plain language without flattening terminology the audience genuinely knows.
708
+
709
+ - Write complete translatable messages rather than concatenated fragments.
710
+ - Keep variables and numbers structured so translators can reorder them.
711
+ - Allow expansion instead of abbreviating prematurely.
712
+ - Make alt text convey the image's information; use empty alt for decoration.
713
+ - Keep screen-reader names aligned with visible labels and outcomes.
714
+ - Do not rely on punctuation, color, or iconography to carry the message alone.
715
+
716
+ Maintain a short terminology glossary when inconsistency spans the product. Do not vary words for literary effect in an interface.
717
+
718
+ ## Verify
719
+
720
+ Read the flow in context and test:
721
+
722
+ - comprehension without hidden product knowledge;
723
+ - actionability at errors, empty states, and decision points;
724
+ - factual accuracy and consistent terminology;
725
+ - scanability at target widths and 200% zoom;
726
+ - long names, localization expansion, pluralization, and dynamic values;
727
+ - accessible names and announced state changes;
728
+ - tone appropriate to consequence and emotional context.
729
+
730
+ The final copy is as short as it can be without removing meaning or recovery.
731
+
732
+ When the language reads cleanly, hand off to `/impeccable polish` for the final pass.
733
+
734
+ ---
735
+
736
+ ## Appendix: colorize.md
737
+
738
+ > **Additional context needed**: existing brand colors.
739
+
740
+ Introduce color as hierarchy, meaning, and atmosphere. Preserve confirmed brand and semantic conventions; do not replace a visual world under the guise of colorizing it.
741
+
742
+ ---
743
+
744
+ ## Visitor mode
745
+
746
+ - **Persuade + Experience:** color may carry the voice and own large regions when the selected world calls for it.
747
+ - **Operate + Read:** color primarily encodes action, selection, status, wayfinding, and reading hierarchy. Rarity gives an accent force.
748
+
749
+ ## Audit before choosing
750
+
751
+ Read DESIGN.md, tokens, assets, current themes, and representative states. Identify:
752
+
753
+ - which colors are confirmed brand commitments;
754
+ - current surface, text, action, and semantic roles;
755
+ - places where grayscale obscures hierarchy or state;
756
+ - contrast failures and color-only communication;
757
+ - light/dark or data-visualization requirements;
758
+ - whether the task asks for more color or a new identity.
759
+
760
+ If a new identity is required, use [new-work.md](new-work.md). Ask only when a binding brand decision cannot be inferred.
761
+
762
+ ## Choose a strategy
763
+
764
+ Name the intended emotional temperature, dominant relationship, contrast range, and color dosage before editing. The strategy may be restrained or immersive; it must follow the brief and selected world rather than a fixed percentage rule.
765
+
766
+ Build roles, not a bag of swatches:
767
+
768
+ - canvas and elevated surfaces;
769
+ - primary and secondary text;
770
+ - action, focus, and selection;
771
+ - borders and separators;
772
+ - success, warning, error, and information;
773
+ - data categories or scales when needed.
774
+
775
+ Use the project's existing color space. For a new web palette, prefer OKLCH because lightness and chroma can be adjusted predictably. Choose hue from product meaning and visual direction, never from a default category association.
776
+
777
+ ## Apply at system scale
778
+
779
+ - Let the strongest color own a deliberate region or role instead of scattering tiny accents.
780
+ - Keep the primary action easy to find; do not spend its color on decoration.
781
+ - Tint neutrals only when the brand hue genuinely creates cohesion. Neutral gray is valid when it serves the world.
782
+ - On colored surfaces, derive secondary text from the foreground or surface hue rather than using washed-out generic gray.
783
+ - Keep semantic meanings consistent, but respect platform and domain conventions instead of assuming fixed hues.
784
+ - For data, use distinct lightness, chroma, shape, label, or pattern so color is not the only code.
785
+ - In dark mode, design surface elevation and contrast explicitly; do not invert the light theme mechanically.
786
+ - Define primitive values and semantic tokens when the project has a token system. Theme changes should normally remap semantic roles.
787
+
788
+ Decoration without a relationship to hierarchy, state, content, or the visual world is not a color strategy.
789
+
790
+ ## Contrast and perception
791
+
792
+ Verify computed foreground/background pairs:
793
+
794
+ | Content | WCAG AA minimum |
795
+ |---|---|
796
+ | body text | 4.5:1 |
797
+ | large text | 3:1 |
798
+ | controls, icons, focus indicators | 3:1 |
799
+
800
+ Do not rely on eyesight alone. Check interactive states, overlays, text on images, disabled content, and both themes. Simulate common vision deficiencies. Information conveyed by color also needs text, shape, iconography, or position.
801
+
802
+ When deriving OKLCH ramps, vary lightness and reduce chroma near white and black. Do not keep high chroma at extreme lightness merely to make the math uniform. Prefer explicit colors over chains of translucent overlays when alpha would make contrast context-dependent.
803
+
804
+ ## Verify
805
+
806
+ - Every color has a stable role or a world-specific atmospheric purpose.
807
+ - Attention lands on the intended action, content, or state.
808
+ - The palette works across quiet, dense, interactive, error, and empty states.
809
+ - Light and dark themes are each composed, not mechanically inverted.
810
+ - Contrast and non-color cues pass in all relevant states.
811
+ - The result is recognizably this product, not a generic “colorful” treatment.
812
+
813
+ When the palette earns its place, hand off to `/impeccable polish` for the final pass.
814
+
815
+ ## Live-mode signature params
816
+
817
+ When invoked from live mode, every variant declares a `color-amount` parameter. Author CSS against `var(--p-color-amount, 0.5)` so the user can move from neutral to the variant's full color strategy without regeneration.
818
+
819
+ ```json
820
+ {"id":"color-amount","kind":"range","min":0,"max":1,"step":0.05,"default":0.5,"label":"Color amount"}
821
+ ```
822
+
823
+ Add at most two variant-specific parameters, such as palette, temperature, or tint behavior. Follow [live.md](live.md)'s parameter contract.
824
+
825
+ ---
826
+
827
+ ## Appendix: craft-floor.md
828
+
829
+ # Craft floor
830
+
831
+ Load this after the direction is settled, and build without announcing the checklist. A pinned brief or the committed visual world overrides anything here except a line marked as a ban; your own habit does not. When the design hook is active it already enforces the mechanical checks below as you edit: act on its findings instead of re-auditing each rule.
832
+
833
+ ## Verify
834
+
835
+ Each of these is a check on the built result, not an intention. Run them together in each batched look at the render, not as separate screenshot trips; the checks share one render.
836
+
837
+ - **Contrast:** body and placeholder text ≥4.5:1, large text ≥3:1. On colored surfaces tint secondary text from that hue or the foreground; never gray.
838
+ - **Depth:** shadows carry an offset and a soft blur. A zero-offset colored halo is decoration.
839
+ - **Spacing:** tight groups, generous separation, more space above a heading than below it. Read the computed values.
840
+ - **Type:** body measure 65–75ch, display max 6rem, tracking floor -0.04em, balanced headings, obvious scale and weight steps. Run the real copy at every breakpoint and fix what overflows.
841
+ - **Motion:** one authored moment, not scattered effects and not one identical entrance on every section. Exponential ease-out from an already-visible default. Reach past transform and opacity: blur, backdrop-filter, clip-path, mask, and shadow belong to the palette when they stay smooth.
842
+ - **States:** hover, disabled, loading, error, empty. Plus real content, working controls, responsive composition, keyboard focus.
843
+ - **Browser surfaces:** the parts you did not draw still carry the design. Text selection, the caret, custom scrollbars, focus rings, underline offset, and the numerals in tabular data all ship with browser defaults that belong to no design system. Theme them from the palette. This is the cheapest signal that a page was built rather than assembled, and the one models skip most reliably.
844
+ - **Copy:** the product's own language. Controls name their action; errors name the problem and the recovery.
845
+ - **Coverage:** every brief requirement present and findable within seconds.
846
+
847
+ ## Refuse
848
+
849
+ These are the category's defaults, not bans: the brief's own words can earn any of them. Reaching for one when the axis is free means you were not deciding; recognizing that means rewriting the element, not softening it.
850
+
851
+ Page scaffolds:
852
+
853
+ - Same-size cards of icon plus heading plus text as the page structure. Cards are the lazy container; nested cards are always wrong.
854
+ - The hero-metric template: big number, small label, supporting stats, accent.
855
+ - A kicker or eyebrow above a heading. This one is a ban, not a default: no brief earns it back. The heading carries its own weight; delete the label and let the heading speak.
856
+ - Section numbers (01 / 02 / 03) unless the sequence itself carries information the reader needs.
857
+ - A modal for a task that needs neither interruption nor protected focus.
858
+
859
+ Surface habits:
860
+
861
+ - Gradient text. Emphasis comes from weight or size.
862
+ - Glass and blur as decoration rather than as a specific effect.
863
+ - A colored `border-left` or `border-right` above 1px on cards, list items, callouts, or alerts.
864
+ - Hard offset shadows (`box-shadow: 4px 4px 0`) outside a world that is actually neobrutalist. The zero-blur block shadow is a costume, not a depth system; a world that did not choose it never earns it as a default.
865
+ - Sparklines, progress rings, and soft-shadowed rounded rectangles standing in for content.
866
+ - Monospace as a costume for "technical" rather than for code, data, or measurement.
867
+ - A system display face (Impact, Arial Black, the platform sans) as the display voice of an own-world page. Source and self-host a face whose character matches the approved lettering; the closest installed font is a failure, not a fallback.
868
+ - Unicode glyphs or emoji standing in for an icon system. Icons are drawn, from a real library or authored SVG, in one consistent stroke and weight.
869
+ - Geometric masks standing in for organic contours. A circle, polygon, or radial-gradient cutout approximating a photographic subject's edge is the cheap version of the effect and reads worse than omitting it. Derive an alpha matte from the actual image, or produce a cut-out asset.
870
+ - Light or dark picked by category. Pick it from the use scene: who, where, under what ambient light.
871
+
872
+ The floor holds the mechanics; it never picks the direction. With every check green, spend the page on the committed world, and when torn between refined and committed, commit.
873
+
874
+ ---
875
+
876
+ ## Appendix: critique.md
877
+
878
+ ### Purpose
879
+
880
+ Resolve one stable target, run two independent assessments, synthesize a design critique, persist a snapshot, and ask the user what to improve next. The chat response is the primary deliverable; the snapshot is an archive of that run.
881
+
882
+ ### Hard Invariants
883
+
884
+ - Assessment A (design review) and Assessment B (detector/browser evidence) are both required, except on a native platform (see Assessment Orchestration).
885
+ - Assessment A and B MUST run as two isolated sub-agents whenever a sub-agent/Task tool is exposed. Running them inline in this context is "possible" but is NOT permitted; it is a degraded run. Inline is allowed ONLY when no sub-agent tool exists (or the user declined, on harnesses that ask). Native platforms run A alone (see Assessment Orchestration).
886
+ - If you degrade for any reason, the report's first line MUST be a banner: `⚠️ DEGRADED: single-context (<reason>)`. A silent degraded critique is a failed critique.
887
+ - Assessment A must finish before detector findings enter the parent synthesis context. Detector output is deterministic, but it still anchors judgment.
888
+ - A skipped detector is a failed critique run unless `impeccable detect` is missing or crashes after a real attempt, or the platform is native (see Assessment Orchestration).
889
+ - Viewable targets require browser inspection when available.
890
+ - Any local server started only for critique visualization must run in the background, have a recorded stop method, and be stopped before final reporting unless the user asks to keep it.
891
+ - Do not claim a user-visible overlay exists unless script injection succeeded and the detector ran in the page.
892
+ - The question is the LAST thing in the response. Write the entire report out first, then ask; nothing follows the question. Prose emitted after a structured question is withheld until the user answers it, so a report written after the question reads as if the critique never ran.
893
+ - A run that ends with neither the targeted questions nor a literal `Questions skipped: <reason>` line is an incomplete run. The report is not the finish; the close is.
894
+
895
+ ### Setup
896
+
897
+ 1. **Resolve the target** to a concrete file path or URL. Prefer a source path over a dev-server URL when both identify the same surface; ports drift, paths do not.
898
+ - "the homepage" -> `site/pages/index.astro` or `index.html`
899
+ - "the settings modal" -> the primary component file
900
+ - "this page" -> the current URL or source file
901
+ 2. **Confirm the target slugs cleanly**:
902
+ ```bash
903
+ .pi/skills/impeccable/scripts/impeccable critique-storage slug "<resolved-path-or-url>"
904
+ ```
905
+ Every later command also accepts the resolved target directly and derives the same slug internally; never hand-write a slug. If this exits non-zero, skip persistence and trend for this run, but continue the critique.
906
+ 3. **Read `.impeccable/critique/ignore.md`** if it exists. Drop matching findings silently; it is the only prior-run input critique consumes.
907
+
908
+ ### Assessment Orchestration
909
+
910
+ **Native platforms** (`ios` / `android` / `adaptive`): Assessment B does not apply, because `impeccable detect` and the browser overlay read only web markup. Run Assessment A alone in this context and skip both sub-agent gates below, the Codex permission question included: with no B there is nothing to isolate A from, so this is the complete native method and carries no degraded banner. Do not run `impeccable detect` on native source; its empty result reads as clean.
911
+
912
+ Delegate Assessment A and Assessment B to separate sub-agents. They must not see each other's output. Do not show findings to the user until synthesis.
913
+
914
+ Sub-agent gate (all harnesses):
915
+ - Unless a harness-specific gate below overrides this, spawn A and B as two isolated, parallel sub-agents whenever a sub-agent/Task tool is exposed. This is the default and is mandatory; do not run them inline because it is faster.
916
+ - Desktop apps (see **Desktop apps** under Assessment B) are the one exception to parallel: both sub-agents would drive the app's single window at once. Seed the window, spawn A, wait until it has finished and put the window back, then spawn B. They are still two isolated sub-agents, so this is not the degraded path.
917
+ - "Unavailable" means exactly one thing: no sub-agent/Task tool is exposed in this session (or, on harnesses that ask, the user declined). It does not mean inconvenient.
918
+ - If and only if sub-agents are unavailable, fall back sequentially: finish and record Assessment A, then run Assessment B, then synthesize, and emit the degraded banner.
919
+ - Whichever path you take, declare it in the report header (see Report header provenance). Skipping sub-agents without the banner is the most common failure of this command.
920
+
921
+ If browser automation is available, each assessment creates its own new tab. Never reuse an existing tab, even if it is already at the right URL. Desktop apps are the exception (see **Desktop apps** under Assessment B).
922
+
923
+ ### Assessment A: Design Review
924
+
925
+ Read relevant source files and visually inspect the live page when browser automation is available. Think like a design director.
926
+
927
+ Evaluate:
928
+ - **Design specificity**: Is the composition, interaction, and visual language grounded in this product, or could an unrelated product use it unchanged? Make this judgment before seeing detector output.
929
+ - **Holistic design**: hierarchy, IA, emotional fit, discoverability, composition, typography, color, accessibility, states, copy, and edge cases.
930
+ - **Cognitive load**: consult the [Cognitive Load Assessment](#cognitive-load-assessment) section below; report checklist failures and decision points with >4 visible options.
931
+ - **Emotional journey**: peak-end rule, emotional valleys, reassurance at high-stakes moments.
932
+ - **Nielsen heuristics**: consult the [Heuristics Scoring Guide](#heuristics-scoring-guide) section below; score all 10 heuristics 0-4, marking any heuristic the mode-applicability rule allows as `n/a` instead of forcing a number.
933
+
934
+ Return: design-specificity verdict, heuristic scores, cognitive load, emotional journey, 2-3 strengths, 3-5 priority issues, persona red flags, minor observations, and provocative questions.
935
+
936
+ ### Assessment B: Detector + Browser Evidence
937
+
938
+ Run the bundled detector and browser visualization evidence. On web, Assessment B is mandatory and must remain isolated from Assessment A until both are complete.
939
+
940
+ CLI scan:
941
+ ```bash
942
+ .pi/skills/impeccable/scripts/impeccable detect --json [target]
943
+ ```
944
+
945
+ - Pass markup files/directories as `[target]`; do not pass CSS-only files.
946
+ - For URLs, skip CLI scan and use browser visualization.
947
+ - For very large trees (500+ scannable files), narrow scope or ask.
948
+ - Exit code 0 = clean; 2 = findings.
949
+ - If the detector entrypoint is missing or fails to load, report deterministic scan unavailable and continue with browser/manual review.
950
+
951
+ Browser visualization is required for a viewable target when browser automation is available. Use a localhost dev/static URL for local files; avoid `file://` unless the available browser explicitly supports this workflow. Overlay flow:
952
+
953
+ 1. Create a fresh tab and navigate. Prefer the harness's native/browser-canvas screenshot path before hand-rolling a Playwright/Puppeteer script; only fall back to a custom script when no native browser tool is exposed.
954
+ 2. Preflight mutable injection by setting `document.title` and appending a `<script>` tag. Read-only evaluate APIs do not count.
955
+ 3. If mutation is unavailable, skip live server, browser presentation, and injection; report fallback signal.
956
+ 4. If mutation is available, start `.pi/skills/impeccable/scripts/impeccable live-server --background`, present the browser if supported, label `[Human]`, scroll top, inject `http://localhost:PORT/detect.js`, wait 2-3 seconds, read `impeccable` console messages, then run `.pi/skills/impeccable/scripts/impeccable live-server stop --keep-inject`. The overlay went in through the browser, so the project's HTML has no script tag to strip; a bare `stop` also runs `live-inject --remove` against the project's entry file, an edit a read-only critique should not make.
957
+ 5. For multi-view targets, inject on 3-5 representative pages.
958
+
959
+ **Desktop apps** (Electron, NW.js, CEF, WebView2): there is no URL to open, so Assessment B attaches to the running app instead.
960
+
961
+ 1. Launch the app with a local DevTools port: `--remote-debugging-port=9222` (Electron, NW.js, CEF), or `WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=--remote-debugging-port=9222` for WebView2. Keep the port on 127.0.0.1 and never expose it beyond this machine; prefer a test profile and test data.
962
+ 2. Seed the state under review (route, open panel, theme, data). The scan reads the window as it stands. Keep the window on screen: a minimized or hidden window scans without the pixel contrast reads.
963
+ 3. Run `.pi/skills/impeccable/scripts/impeccable detect --cdp 9222 --target <part of the page URL or title> --json`. It returns the same JSON as a URL scan and leaves the page as found. With several pages open it fails and lists them; rerun with a `--target` that names one.
964
+ 4. Take screenshots through the harness's CDP tooling (`Page.captureScreenshot` on the same target). Skip the live-server overlay: there is no `[Human]` tab.
965
+
966
+ The app has one window, so the assessments take turns in it instead of opening tabs (A, then B; see the sub-agent gate), and each must leave it as found: put back any route, scroll, theme, or panel it changed. Tauri on macOS (WKWebView) and on Linux (WebKitGTK) expose no CDP: run Assessment A and the source scan only, and say so in Run Notes.
967
+
968
+ Return: CLI findings JSON/counts, browser console findings if applicable, false positives, and skipped/failed browser steps with concrete reasons.
969
+
970
+ After Assessment B returns usable CLI findings, reuse them. Do not rerun `impeccable detect` in the parent unless Assessment B failed, was truncated, or omitted count, rule names, or file locations.
971
+
972
+ ### Generate Combined Critique Report
973
+
974
+ Synthesize both assessments into a single report. Do not simply concatenate. Weave the findings together, noting where the LLM review and detector agree, where the detector caught issues the LLM missed, and where detector findings are false positives.
975
+
976
+ The chat response is the primary user-facing deliverable. Present the full structured critique below in chat; do not replace it with a summary and a link. The persisted snapshot is an archive of that run.
977
+
978
+ Structure your feedback as a design director would:
979
+
980
+ #### Report header provenance
981
+
982
+ The report's first line MUST declare how the assessments were run, so a degraded run is never silent:
983
+ - Dual-agent: `Method: dual-agent (A: <agent-id> · B: <agent-id>)`
984
+ - Degraded: `⚠️ DEGRADED: single-context (<reason, e.g. no sub-agent tool exposed>)`
985
+ - Native: `Method: design review only (detector not applicable, native platform)`
986
+
987
+ #### Design Health Score
988
+ > *Consult the [Heuristics Scoring Guide](#heuristics-scoring-guide) section below.*
989
+
990
+ Present the Nielsen's 10 heuristics scores as a table:
991
+
992
+ | # | Heuristic | Score | Key Issue |
993
+ |---|-----------|-------|-----------|
994
+ | 1 | Visibility of System Status | ? | [specific finding or "n/a" if solid] |
995
+ | 2 | Match System / Real World | ? | |
996
+ | 3 | User Control and Freedom | ? | |
997
+ | 4 | Consistency and Standards | ? | |
998
+ | 5 | Error Prevention | ? | |
999
+ | 6 | Recognition Rather Than Recall | ? | |
1000
+ | 7 | Flexibility and Efficiency | ? | |
1001
+ | 8 | Aesthetic and Minimalist Design | ? | |
1002
+ | 9 | Error Recovery | ? | |
1003
+ | 10 | Help and Documentation | ? | |
1004
+ | **Total** | | **??/[applicable max]** | **[Rating band]** |
1005
+
1006
+ The applicable maximum is 4 times the number of heuristics you actually scored: **/40** when all ten apply, **/32** when two are `n/a`. Never print `/40` over a partial set.
1007
+
1008
+ Be honest with scores. A 4 means genuinely excellent. Most real interfaces score 20-32 out of 40.
1009
+
1010
+ **Mode applicability**: heuristics 7 (Flexibility and Efficiency) and 10 (Help and Documentation) may be scored `n/a` on Persuade and Experience surfaces (landing pages, campaigns, portfolios, bodies of work), as may any other heuristic that genuinely cannot apply to the surface under review. Write `n/a` in the Score cell with a one-line reason, and renormalize the total to the applicable maximum (e.g. **24/32** when two heuristics are n/a) so the rating band stays proportional. The persisted snapshot must record the applicable maximum and which heuristics were scored n/a.
1011
+
1012
+ #### Design Specificity Verdict
1013
+
1014
+ **Start here.** Does the result feel authored for this product, or category-interchangeable?
1015
+
1016
+ **LLM assessment**: Your unanchored evaluation of design specificity. Cover overall coherence, structural sameness, category-interchangeable choices, and missed opportunities for product character.
1017
+
1018
+ **Deterministic scan**: Summarize what the automated detector found, with counts and file locations. Note any additional issues the detector caught that you missed, and flag any false positives. On a native platform, write `not applicable (native platform)` instead.
1019
+
1020
+ **Visual overlays** (if injection succeeded): Tell the user that overlays are now visible in the **[Human]** tab in their browser, highlighting the detected issues. Summarize what the console output reported. If browser visualization was attempted but injection failed, say that no reliable user-visible overlay is available and report the fallback signal instead.
1021
+
1022
+ #### Overall Impression
1023
+ A brief gut reaction: what works, what doesn't, and the single biggest opportunity.
1024
+
1025
+ #### What's Working
1026
+ Highlight 2-3 things done well. Be specific about why they work.
1027
+
1028
+ #### Priority Issues
1029
+ The 3-5 most impactful design problems, ordered by importance.
1030
+
1031
+ For each issue, tag with **P0-P3 severity** (see [Issue Severity below](#issue-severity-p0p3) for definitions):
1032
+ - **[P?] What**: Name the problem clearly
1033
+ - **Why it matters**: How this hurts users or undermines goals
1034
+ - **Fix**: What to do about it (be concrete)
1035
+ - **Suggested command**: Which command could address this (from: /impeccable adapt, /impeccable animate, /impeccable audit, /impeccable bolder, /impeccable clarify, /impeccable colorize, /impeccable critique, /impeccable delight, /impeccable distill, /impeccable document, /impeccable harden, /impeccable layout, /impeccable onboard, /impeccable optimize, /impeccable overdrive, /impeccable polish, /impeccable quieter, /impeccable shape, /impeccable typeset)
1036
+
1037
+ #### Persona Red Flags
1038
+ > *Consult the [Personas reference](#persona-based-design-testing) below.*
1039
+
1040
+ Auto-select 2-3 personas most relevant to this interface type (use the selection table in the reference). If `AGENTS.md` contains a `## Design Context` section from `impeccable init`, also generate 1-2 project-specific personas from the audience/brand info.
1041
+
1042
+ For each selected persona, walk through the primary user action and list specific red flags found:
1043
+
1044
+ **Alex (Power User)**: No keyboard shortcuts detected. Form requires 8 clicks for primary action. Forced modal onboarding. High abandonment risk.
1045
+
1046
+ **Jordan (First-Timer)**: Icon-only nav in sidebar. Technical jargon in error messages ("404 Not Found"). No visible help. Will abandon at step 2.
1047
+
1048
+ Be specific. Name the exact elements and interactions that fail each persona. Don't write generic persona descriptions; write what broke for them.
1049
+
1050
+ #### Minor Observations
1051
+ Quick notes on smaller issues worth addressing.
1052
+
1053
+ #### Questions to Consider
1054
+ Provocative questions that might unlock better solutions:
1055
+ - "What if the primary action were more prominent?"
1056
+ - "Does this need to feel this complex?"
1057
+ - "What would a confident version of this look like?"
1058
+
1059
+ **Remember**:
1060
+ - Be direct. Vague feedback wastes everyone's time.
1061
+ - Be specific. "The submit button," not "some elements."
1062
+ - Say what's wrong AND why it matters to users.
1063
+ - Give concrete suggestions. Cut "consider exploring..." entirely.
1064
+ - Prioritize ruthlessly. If everything is important, nothing is.
1065
+ - Don't soften criticism. Developers need honest feedback to ship great design.
1066
+
1067
+ ### Deliver the Report
1068
+
1069
+ Write the full report into the chat response now, before any persistence work. This is the deliverable; everything below it is bookkeeping.
1070
+
1071
+ Do this first because the alternative is the most common way this command fails: the report gets composed once, straight into the persistence heredoc, and the run ends with a perfect archive nobody has read. Composing it into a file is not delivering it. If the report exists only in `.impeccable/critique/`, the run produced nothing.
1072
+
1073
+ Persistence is not the end of the run. After it, the response continues with the trend line and the close.
1074
+
1075
+ ### Persist the Snapshot
1076
+
1077
+ Once the report above is finalized, write it to `.impeccable/critique/` so the user can refer back, and so `/impeccable polish` can pick up the priority issues without a copy-paste.
1078
+
1079
+ Skip this step if the Setup slug was null (vague or root-level target).
1080
+
1081
+ 1. **Write the body to a temp file** so you can pipe it to the helper. Use the full critique report (heuristic table, design-specificity verdict, priority issues, persona red flags, minor observations, and questions), but stop before the "Ask the User" / "Recommended Actions" sections that come later.
1082
+
1083
+ This is a copy of the report you already delivered above, for later commands to read. It is not delivery. If you find yourself composing the report for the first time inside this heredoc, you have skipped Deliver the Report; go back and send it.
1084
+
1085
+ 2. **Pass the structured metadata** through `IMPECCABLE_CRITIQUE_META` (JSON), then run the write command:
1086
+ ```bash
1087
+ IMPECCABLE_CRITIQUE_META='{"target":"<user phrasing>","total_score":<n>,"max_score":<n>,"na_heuristics":"<comma-separated numbers, or empty>","p0_count":<n>,"p1_count":<n>}' \
1088
+ .pi/skills/impeccable/scripts/impeccable critique-storage write "<resolved target>" <body-file>
1089
+ ```
1090
+ `max_score` is the applicable maximum from the heuristic table (40 when every heuristic applied), so a later run can tell a renormalized total from a full one. For a local file target, the helper also records an exact content fingerprint so polish can distinguish the assessed bytes from later edits without relying on Git state or timestamps. The helper prints the absolute path it wrote. Leave that file on disk. Polish closes it; this run does not.
1091
+
1092
+ 3. **Delete the temp body file** after the write attempt completes, whether the write succeeded or failed. If deletion fails, mention `temp-file cleanup failed: <reason>` briefly in the final output, but do not block the critique.
1093
+
1094
+ 4. **Read the trend** for context:
1095
+ ```bash
1096
+ .pi/skills/impeccable/scripts/impeccable critique-storage trend "<resolved target>" 5
1097
+ ```
1098
+ This returns a JSON array of the last 5 frontmatter entries (including the one you just wrote).
1099
+
1100
+ 5. **Append a single line to the user-visible output**, after the report and before the questions:
1101
+
1102
+ > **Trend for `<slug>` (last 5 runs): 24 → 28 → 32 → 29 → 32 (out of 40)**
1103
+ > Wrote `.impeccable/critique/<filename>`.
1104
+
1105
+ Read `max_score` on each trend entry. When every entry shares one maximum, state it once as above. When they differ, print each score with its own denominator (`24/32 → 30/40`) and note that the runs scored different heuristic sets, so the line is not a like-for-like comparison. Treat a missing `max_score` on an older entry as 40.
1106
+
1107
+ If this is the first run for the slug, the trend is just one score; say so: "First run for this target, no trend yet."
1108
+
1109
+ 6. **Close the run.** Go to Ask the User below and emit the questions, or the `Questions skipped: <reason>` line when the count allows it. The run is not complete until you do. Persistence is bookkeeping and cleanup is not an ending; stopping here leaves the user with a report and no way forward, and leaves `/impeccable polish` with no priorities to inherit.
1110
+
1111
+ This is fire-and-forget. Do not show the user the helper's JSON output; only the human-readable trend line and the written path. Failures here should not block the rest of the flow; print the error and move on.
1112
+
1113
+ ### Ask the User
1114
+
1115
+ **After presenting findings**, use targeted questions based on what was actually found. Ask the user directly to clarify what you cannot infer. These answers will shape the action plan.
1116
+
1117
+ Ask in the same message that carries the report, with the report written out first and the question last. Do not split the two across turns: a turn that ends on the report is a turn that ends, and the questions never arrive. Order within the message is what matters, because prose emitted after a structured question is withheld until the user answers.
1118
+
1119
+ Ask questions along these lines (adapt to the specific findings; do not ask generic questions):
1120
+
1121
+ 1. **Priority direction**: Based on the issues found, ask which category matters most to the user right now. For example: "I found problems with visual hierarchy, color usage, and information overload. Which area should we tackle first?" Offer the top 2-3 issue categories as options.
1122
+
1123
+ 2. **Design intent**: If the critique found a tonal mismatch, ask whether it was intentional. For example: "The interface feels clinical and corporate. Is that the intended tone, or should it feel warmer/bolder/more playful?" Offer 2-3 tonal directions as options based on what would fix the issues found.
1124
+
1125
+ 3. **Scope**: Ask how much the user wants to take on. For example: "I found N issues. Want to address everything, or focus on the top 3?" Offer scope options like "Top 3 only", "All issues", "Critical issues only".
1126
+
1127
+ 4. **Constraints** (optional; only ask if relevant): If the findings touch many areas, ask if anything is off-limits. For example: "Should any sections stay as-is?" This prevents the plan from touching things the user considers done.
1128
+
1129
+ **Rules for questions**:
1130
+ - Every question must reference specific findings from the report. Never ask generic "who is your audience?" questions.
1131
+ - Keep it to 2-4 questions maximum. Respect the user's time.
1132
+ - Offer concrete options, not open-ended prompts.
1133
+ - Skipping is allowed only when the report listed **fewer than 3 Priority Issues**. Count them; do not judge the findings "straightforward" by feel. At 3 or more, the questions are required.
1134
+
1135
+ **Final-question gate.** The user-visible response must either include the targeted questions or carry the literal line `Questions skipped: <reason>` naming the count that permitted the skip. Each question must include 2-3 concrete answer options tied to the actual critique findings. Do not end with only open-ended questions, and do not end with neither: stopping after the report, having asked nothing and printed no skip line, is the most common way this command fails.
1136
+
1137
+ ### Recommended Actions
1138
+
1139
+ **After receiving the user's answers**, present a prioritized action summary reflecting the user's priorities and scope from Ask the User.
1140
+
1141
+ #### Action Summary
1142
+
1143
+ List recommended commands in priority order, based on the user's answers:
1144
+
1145
+ 1. **`/command-name`**: Brief description of what to fix (specific context from critique findings)
1146
+ 2. **`/command-name`**: Brief description (specific context)
1147
+ ...
1148
+
1149
+ **Rules for recommendations**:
1150
+ - Only recommend commands from: /impeccable adapt, /impeccable animate, /impeccable audit, /impeccable bolder, /impeccable clarify, /impeccable colorize, /impeccable critique, /impeccable delight, /impeccable distill, /impeccable document, /impeccable harden, /impeccable layout, /impeccable onboard, /impeccable optimize, /impeccable overdrive, /impeccable polish, /impeccable quieter, /impeccable shape, /impeccable typeset
1151
+ - Order by the user's stated priorities first, then by impact
1152
+ - Each item's description should carry enough context that the command knows what to focus on
1153
+ - Map each Priority Issue to the appropriate command
1154
+ - Skip commands that would address zero issues
1155
+ - If the user chose a limited scope, only include items within that scope
1156
+ - If the user marked areas as off-limits, exclude commands that would touch those areas
1157
+ - End with `/impeccable polish` as the final step if any fixes were recommended
1158
+
1159
+ After presenting the summary, tell the user:
1160
+
1161
+ > You can ask me to run these one at a time, all at once, or in any order you prefer.
1162
+ >
1163
+ > Re-run `/impeccable critique` after fixes to see your score improve.
1164
+
1165
+ ---
1166
+
1167
+ ## Reference Material
1168
+
1169
+ The sections below were previously separate reference files (`cognitive-load.md`, `heuristics-scoring.md`, `personas.md`). They live inline now so the critique flow has all its deep context in one place.
1170
+
1171
+ ### Cognitive Load Assessment
1172
+
1173
+ Cognitive load is the total mental effort required to use an interface. Overloaded users make mistakes, get frustrated, and leave. This reference helps identify and fix cognitive overload.
1174
+
1175
+ ---
1176
+
1177
+ #### Three Types of Cognitive Load
1178
+
1179
+ ##### Intrinsic Load: The Task Itself
1180
+ Complexity inherent to what the user is trying to do. You can't eliminate this, but you can structure it.
1181
+
1182
+ **Manage it by**:
1183
+ - Breaking complex tasks into discrete steps
1184
+ - Providing scaffolding (templates, defaults, examples)
1185
+ - Progressive disclosure: show what's needed now, hide the rest
1186
+ - Grouping related decisions together
1187
+
1188
+ ##### Extraneous Load: Bad Design
1189
+ Mental effort caused by poor design choices. **Eliminate this ruthlessly.** It's pure waste.
1190
+
1191
+ **Common sources**:
1192
+ - Confusing navigation that requires mental mapping
1193
+ - Unclear labels that force users to guess meaning
1194
+ - Visual clutter competing for attention
1195
+ - Inconsistent patterns that prevent learning
1196
+ - Unnecessary steps between user intent and result
1197
+
1198
+ ##### Germane Load: Learning Effort
1199
+ Mental effort spent building understanding. This is *good* cognitive load; it leads to mastery.
1200
+
1201
+ **Support it by**:
1202
+ - Progressive disclosure that reveals complexity gradually
1203
+ - Consistent patterns that reward learning
1204
+ - Feedback that confirms correct understanding
1205
+ - Onboarding that teaches through action, not walls of text
1206
+
1207
+ ---
1208
+
1209
+ #### Cognitive Load Checklist
1210
+
1211
+ Evaluate the interface against these 8 items:
1212
+
1213
+ - [ ] **Single focus**: Can the user complete their primary task without distraction from competing elements?
1214
+ - [ ] **Chunking**: Is information presented in digestible groups (≤4 items per group)?
1215
+ - [ ] **Grouping**: Are related items visually grouped together (proximity, borders, shared background)?
1216
+ - [ ] **Visual hierarchy**: Is it immediately clear what's most important on the screen?
1217
+ - [ ] **One thing at a time**: Can the user focus on a single decision before moving to the next?
1218
+ - [ ] **Minimal choices**: Are decisions simplified (≤4 visible options at any decision point)?
1219
+ - [ ] **Working memory**: Does the user need to remember information from a previous screen to act on the current one?
1220
+ - [ ] **Progressive disclosure**: Is complexity revealed only when the user needs it?
1221
+
1222
+ **Scoring**: Count the failed items. 0–1 failures = low cognitive load (good). 2–3 = moderate (address soon). 4+ = high cognitive load (critical fix needed).
1223
+
1224
+ ---
1225
+
1226
+ #### The Working Memory Rule
1227
+
1228
+ **Humans can hold ≤4 items in working memory at once** (Miller's Law revised by Cowan, 2001).
1229
+
1230
+ At any decision point, count the number of distinct options, actions, or pieces of information a user must simultaneously consider:
1231
+ - **≤4 items**: Within working memory limits, manageable
1232
+ - **5–7 items**: Pushing the boundary; consider grouping or progressive disclosure
1233
+ - **8+ items**: Overloaded; users will skip, misclick, or abandon
1234
+
1235
+ **Practical applications**:
1236
+ - Action buttons: 1 primary, 1–2 secondary, group the rest in a menu
1237
+ - Navigation menus: ≤5 top-level items (group the rest under clear categories)
1238
+ - Long-form articles: one reading path; gather related links into a single block at the end instead of scattering them mid-flow
1239
+ - Documentation sidebars: ≤4 sibling choices visible per level before grouping kicks in
1240
+ - Portfolio and gallery indexes: one decision per screen (which piece to open), not filter, sort, and tag controls all at once
1241
+
1242
+ ---
1243
+
1244
+ #### Common Cognitive Load Violations
1245
+
1246
+ ##### 1. The Wall of Options
1247
+ **Problem**: Presenting 10+ choices at once with no hierarchy.
1248
+ **Fix**: Group into categories, highlight recommended, use progressive disclosure.
1249
+
1250
+ ##### 2. The Memory Bridge
1251
+ **Problem**: User must remember info from step 1 to complete step 3.
1252
+ **Fix**: Keep relevant context visible, or repeat it where it's needed.
1253
+
1254
+ ##### 3. The Hidden Navigation
1255
+ **Problem**: User must build a mental map of where things are.
1256
+ **Fix**: Always show current location (breadcrumbs, active states, progress indicators).
1257
+
1258
+ ##### 4. The Jargon Barrier
1259
+ **Problem**: Technical or domain language forces translation effort.
1260
+ **Fix**: Use plain language. If domain terms are unavoidable, define them inline.
1261
+
1262
+ ##### 5. The Visual Noise Floor
1263
+ **Problem**: Every element has the same visual weight; nothing stands out.
1264
+ **Fix**: Establish clear hierarchy: one primary element, 2–3 secondary, everything else muted.
1265
+
1266
+ ##### 6. The Inconsistent Pattern
1267
+ **Problem**: Similar actions work differently in different places.
1268
+ **Fix**: Standardize interaction patterns. Same type of action = same type of UI.
1269
+
1270
+ ##### 7. The Multi-Task Demand
1271
+ **Problem**: Interface requires processing multiple simultaneous inputs (reading + deciding + navigating).
1272
+ **Fix**: Sequence the steps. Let the user do one thing at a time.
1273
+
1274
+ ##### 8. The Context Switch
1275
+ **Problem**: User must jump between screens/tabs/modals to gather info for a single decision.
1276
+ **Fix**: Co-locate the information needed for each decision. Reduce back-and-forth.
1277
+
1278
+ ---
1279
+
1280
+ ### Heuristics Scoring Guide
1281
+
1282
+ Score each of Nielsen's 10 Usability Heuristics on a 0–4 scale. Be honest: a 4 means genuinely excellent, not "good enough."
1283
+
1284
+ #### Nielsen's 10 Heuristics
1285
+
1286
+ ##### 1. Visibility of System Status
1287
+
1288
+ Keep users informed about what's happening through timely, appropriate feedback.
1289
+
1290
+ **Check for**:
1291
+ - Loading indicators during async operations
1292
+ - Confirmation of user actions (save, submit, delete)
1293
+ - Progress indicators for multi-step processes
1294
+ - Current location in navigation (breadcrumbs, active states)
1295
+ - Form validation feedback (inline, not just on submit)
1296
+
1297
+ **Scoring**:
1298
+ | Score | Criteria |
1299
+ |-------|----------|
1300
+ | 0 | No feedback; user is guessing what happened |
1301
+ | 1 | Rare feedback; most actions produce no visible response |
1302
+ | 2 | Partial; some states communicated, major gaps remain |
1303
+ | 3 | Good; most operations give clear feedback, minor gaps |
1304
+ | 4 | Excellent; every action confirms, progress is always visible |
1305
+
1306
+ ##### 2. Match Between System and Real World
1307
+
1308
+ Speak the user's language. Follow real-world conventions. Information appears in natural, logical order.
1309
+
1310
+ **Check for**:
1311
+ - Familiar terminology (no unexplained jargon)
1312
+ - Logical information order matching user expectations
1313
+ - Recognizable icons and metaphors
1314
+ - Domain-appropriate language for the target audience
1315
+ - Natural reading flow (left-to-right, top-to-bottom priority)
1316
+
1317
+ **Scoring**:
1318
+ | Score | Criteria |
1319
+ |-------|----------|
1320
+ | 0 | Pure tech jargon, alien to users |
1321
+ | 1 | Mostly confusing; requires domain expertise to navigate |
1322
+ | 2 | Mixed; some plain language, some jargon leaks through |
1323
+ | 3 | Mostly natural; occasional term needs context |
1324
+ | 4 | Speaks the user's language fluently throughout |
1325
+
1326
+ ##### 3. User Control and Freedom
1327
+
1328
+ Users need a clear "emergency exit" from unwanted states without extended dialogue.
1329
+
1330
+ **Check for**:
1331
+ - Undo/redo functionality
1332
+ - Cancel buttons on forms and modals
1333
+ - Clear navigation back to safety (home, previous)
1334
+ - Easy way to clear filters, search, selections
1335
+ - Escape from long or multi-step processes
1336
+
1337
+ **Scoring**:
1338
+ | Score | Criteria |
1339
+ |-------|----------|
1340
+ | 0 | Users get trapped; no way out without refreshing |
1341
+ | 1 | Difficult exits; must find obscure paths to escape |
1342
+ | 2 | Some exits; main flows have escape, edge cases don't |
1343
+ | 3 | Good control; users can exit and undo most actions |
1344
+ | 4 | Full control; undo, cancel, back, and escape everywhere |
1345
+
1346
+ ##### 4. Consistency and Standards
1347
+
1348
+ Users shouldn't wonder whether different words, situations, or actions mean the same thing.
1349
+
1350
+ **Check for**:
1351
+ - Consistent terminology throughout the interface
1352
+ - Same actions produce same results everywhere
1353
+ - Platform conventions followed (standard UI patterns)
1354
+ - Visual consistency (colors, typography, spacing, components)
1355
+ - Consistent interaction patterns (same gesture = same behavior)
1356
+
1357
+ **Scoring**:
1358
+ | Score | Criteria |
1359
+ |-------|----------|
1360
+ | 0 | Inconsistent everywhere; feels like different products stitched together |
1361
+ | 1 | Many inconsistencies; similar things look/behave differently |
1362
+ | 2 | Partially consistent; main flows match, details diverge |
1363
+ | 3 | Mostly consistent; occasional deviation, nothing confusing |
1364
+ | 4 | Fully consistent; cohesive system, predictable behavior |
1365
+
1366
+ ##### 5. Error Prevention
1367
+
1368
+ Better than good error messages is a design that prevents problems in the first place.
1369
+
1370
+ **Check for**:
1371
+ - Confirmation before destructive actions (delete, overwrite)
1372
+ - Constraints preventing invalid input (date pickers, dropdowns)
1373
+ - Smart defaults that reduce errors
1374
+ - Clear labels that prevent misunderstanding
1375
+ - Autosave and draft recovery
1376
+
1377
+ **Scoring**:
1378
+ | Score | Criteria |
1379
+ |-------|----------|
1380
+ | 0 | Errors easy to make; no guardrails anywhere |
1381
+ | 1 | Few safeguards; some inputs validated, most aren't |
1382
+ | 2 | Partial prevention; common errors caught, edge cases slip |
1383
+ | 3 | Good prevention; most error paths blocked proactively |
1384
+ | 4 | Excellent; errors nearly impossible through smart constraints |
1385
+
1386
+ ##### 6. Recognition Rather Than Recall
1387
+
1388
+ Minimize memory load. Make objects, actions, and options visible or easily retrievable.
1389
+
1390
+ **Check for**:
1391
+ - Visible options (not buried in hidden menus)
1392
+ - Contextual help when needed (tooltips, inline hints)
1393
+ - Recent items and history
1394
+ - Autocomplete and suggestions
1395
+ - Labels on icons (not icon-only navigation)
1396
+
1397
+ **Scoring**:
1398
+ | Score | Criteria |
1399
+ |-------|----------|
1400
+ | 0 | Heavy memorization; users must remember paths and commands |
1401
+ | 1 | Mostly recall; many hidden features, few visible cues |
1402
+ | 2 | Some aids; main actions visible, secondary features hidden |
1403
+ | 3 | Good recognition; most things discoverable, few memory demands |
1404
+ | 4 | Everything discoverable; users never need to memorize |
1405
+
1406
+ ##### 7. Flexibility and Efficiency of Use
1407
+
1408
+ Accelerators, invisible to novices, speed up expert interaction.
1409
+
1410
+ **Check for**:
1411
+ - Keyboard shortcuts for common actions
1412
+ - Customizable interface elements
1413
+ - Recent items and favorites
1414
+ - Bulk/batch actions
1415
+ - Power user features that don't complicate the basics
1416
+
1417
+ **Scoring**:
1418
+ | Score | Criteria |
1419
+ |-------|----------|
1420
+ | 0 | One rigid path; no shortcuts or alternatives |
1421
+ | 1 | Limited flexibility; few alternatives to the main path |
1422
+ | 2 | Some shortcuts; basic keyboard support, limited bulk actions |
1423
+ | 3 | Good accelerators; keyboard nav, some customization |
1424
+ | 4 | Highly flexible; multiple paths, power features, customizable |
1425
+
1426
+ ##### 8. Aesthetic and Minimalist Design
1427
+
1428
+ Interfaces should not contain irrelevant or rarely needed information. Every element should serve a purpose.
1429
+
1430
+ **Check for**:
1431
+ - Only necessary information visible at each step
1432
+ - Clear visual hierarchy directing attention
1433
+ - Purposeful use of color and emphasis
1434
+ - No decorative clutter competing for attention
1435
+ - Focused, uncluttered layouts
1436
+
1437
+ **Scoring**:
1438
+ | Score | Criteria |
1439
+ |-------|----------|
1440
+ | 0 | Overwhelming; everything competes for attention equally |
1441
+ | 1 | Cluttered; too much noise, hard to find what matters |
1442
+ | 2 | Some clutter; main content clear, periphery noisy |
1443
+ | 3 | Mostly clean; focused design, minor visual noise |
1444
+ | 4 | Perfectly minimal; every element earns its pixel |
1445
+
1446
+ ##### 9. Help Users Recognize, Diagnose, and Recover from Errors
1447
+
1448
+ Error messages should use plain language, precisely indicate the problem, and constructively suggest a solution.
1449
+
1450
+ **Check for**:
1451
+ - Plain language error messages (no error codes for users)
1452
+ - Specific problem identification ("Email is missing @" not "Invalid input")
1453
+ - Actionable recovery suggestions
1454
+ - Errors displayed near the source of the problem
1455
+ - Non-blocking error handling (don't wipe the form)
1456
+
1457
+ **Scoring**:
1458
+ | Score | Criteria |
1459
+ |-------|----------|
1460
+ | 0 | Cryptic errors; codes, jargon, or no message at all |
1461
+ | 1 | Vague errors; "Something went wrong" with no guidance |
1462
+ | 2 | Clear but unhelpful; names the problem but not the fix |
1463
+ | 3 | Clear with suggestions; identifies problem and offers next steps |
1464
+ | 4 | Perfect recovery; pinpoints issue, suggests fix, preserves user work |
1465
+
1466
+ ##### 10. Help and Documentation
1467
+
1468
+ Even if the system is usable without docs, help should be easy to find, task-focused, and concise.
1469
+
1470
+ **Check for**:
1471
+ - Searchable help or documentation
1472
+ - Contextual help (tooltips, inline hints, guided tours)
1473
+ - Task-focused organization (not feature-organized)
1474
+ - Concise, scannable content
1475
+ - Easy access without leaving current context
1476
+
1477
+ **Scoring**:
1478
+ | Score | Criteria |
1479
+ |-------|----------|
1480
+ | 0 | No help available anywhere |
1481
+ | 1 | Help exists but hard to find or irrelevant |
1482
+ | 2 | Basic help; FAQ or docs exist, not contextual |
1483
+ | 3 | Good documentation; searchable, mostly task-focused |
1484
+ | 4 | Excellent contextual help; right info at the right moment |
1485
+
1486
+ ---
1487
+
1488
+ #### Score Summary
1489
+
1490
+ **Total possible**: 40 points (10 heuristics × 4 max)
1491
+
1492
+ | Score Range | Rating | What It Means |
1493
+ |-------------|--------|---------------|
1494
+ | 36–40 | Excellent | Minor polish only; ship it |
1495
+ | 28–35 | Good | Address weak areas, solid foundation |
1496
+ | 20–27 | Acceptable | Significant improvements needed before users are happy |
1497
+ | 12–19 | Poor | Major UX overhaul required; core experience broken |
1498
+ | 0–11 | Critical | Redesign needed; unusable in current state |
1499
+
1500
+ When heuristics were scored `n/a`, the maximum is lower than 40; read the band off the percentage instead of the raw number (90%+ Excellent, 70%+ Good, 50%+ Acceptable, 30%+ Poor, below that Critical). 24/32 is 75%, so Good.
1501
+
1502
+ ---
1503
+
1504
+ #### Issue Severity (P0–P3)
1505
+
1506
+ Tag each individual issue found during scoring with a priority level:
1507
+
1508
+ | Priority | Name | Description | Action |
1509
+ |----------|------|-------------|--------|
1510
+ | **P0** | Blocking | Prevents task completion entirely | Fix immediately; this is a showstopper |
1511
+ | **P1** | Major | Causes significant difficulty or confusion | Fix before release |
1512
+ | **P2** | Minor | Annoyance, but workaround exists | Fix in next pass |
1513
+ | **P3** | Polish | Nice-to-fix, no real user impact | Fix if time permits |
1514
+
1515
+ **Tip**: If you're unsure between two levels, ask: "Would a user contact support about this?" If yes, it's at least P1.
1516
+
1517
+ ---
1518
+
1519
+ ### Persona-Based Design Testing
1520
+
1521
+ Test the interface through the eyes of 5 distinct user archetypes. Each persona exposes different failure modes that a single "design director" perspective would miss.
1522
+
1523
+ **How to use**: Select 2–3 personas most relevant to the interface being critiqued. Walk through the primary user action as each persona. Report specific red flags, not generic concerns.
1524
+
1525
+ ---
1526
+
1527
+ #### 1. Impatient Power User: "Alex"
1528
+
1529
+ **Profile**: Expert with similar products. Expects efficiency, hates hand-holding. Will find shortcuts or leave.
1530
+
1531
+ **Behaviors**:
1532
+ - Skips all onboarding and instructions
1533
+ - Looks for keyboard shortcuts immediately
1534
+ - Tries to bulk-select, batch-edit, and automate
1535
+ - Gets frustrated by required steps that feel unnecessary
1536
+ - Abandons if anything feels slow or patronizing
1537
+
1538
+ **Test Questions**:
1539
+ - Can Alex complete the core task in under 60 seconds?
1540
+ - Are there keyboard shortcuts for common actions?
1541
+ - Can onboarding be skipped entirely?
1542
+ - Do modals have keyboard dismiss (Esc)?
1543
+ - Is there a "power user" path (shortcuts, bulk actions)?
1544
+
1545
+ **Red Flags** (report these specifically):
1546
+ - Forced tutorials or unskippable onboarding
1547
+ - No keyboard navigation for primary actions
1548
+ - Slow animations that can't be skipped
1549
+ - One-item-at-a-time workflows where batch would be natural
1550
+ - Redundant confirmation steps for low-risk actions
1551
+
1552
+ ---
1553
+
1554
+ #### 2. Confused First-Timer: "Jordan"
1555
+
1556
+ **Profile**: Never used this type of product. Needs guidance at every step. Will abandon rather than figure it out.
1557
+
1558
+ **Behaviors**:
1559
+ - Reads all instructions carefully
1560
+ - Hesitates before clicking anything unfamiliar
1561
+ - Looks for help or support constantly
1562
+ - Misunderstands jargon and abbreviations
1563
+ - Takes the most literal interpretation of any label
1564
+
1565
+ **Test Questions**:
1566
+ - Is the first action obviously clear within 5 seconds?
1567
+ - Are all icons labeled with text?
1568
+ - Is there contextual help at decision points?
1569
+ - Does terminology assume prior knowledge?
1570
+ - Is there a clear "back" or "undo" at every step?
1571
+
1572
+ **Red Flags** (report these specifically):
1573
+ - Icon-only navigation with no labels
1574
+ - Technical jargon without explanation
1575
+ - No visible help option or guidance
1576
+ - Ambiguous next steps after completing an action
1577
+ - No confirmation that an action succeeded
1578
+
1579
+ ---
1580
+
1581
+ #### 3. Accessibility-Dependent User: "Sam"
1582
+
1583
+ **Profile**: Uses screen reader (VoiceOver/NVDA), keyboard-only navigation. May have low vision, motor impairment, or cognitive differences.
1584
+
1585
+ **Behaviors**:
1586
+ - Tabs through the interface linearly
1587
+ - Relies on ARIA labels and heading structure
1588
+ - Cannot see hover states or visual-only indicators
1589
+ - Needs adequate color contrast (4.5:1 minimum)
1590
+ - May use browser zoom up to 200%
1591
+
1592
+ **Test Questions**:
1593
+ - Can the entire primary flow be completed keyboard-only?
1594
+ - Are all interactive elements focusable with visible focus indicators?
1595
+ - Do images have meaningful alt text?
1596
+ - Is color contrast WCAG AA compliant (4.5:1 for text)?
1597
+ - Does the screen reader announce state changes (loading, success, errors)?
1598
+
1599
+ **Red Flags** (report these specifically):
1600
+ - Click-only interactions with no keyboard alternative
1601
+ - Missing or invisible focus indicators
1602
+ - Meaning conveyed by color alone (red = error, green = success)
1603
+ - Unlabeled form fields or buttons
1604
+ - Time-limited actions without extension option
1605
+ - Custom components that break screen reader flow
1606
+
1607
+ ---
1608
+
1609
+ #### 4. Deliberate Stress Tester: "Riley"
1610
+
1611
+ **Profile**: Methodical user who pushes interfaces beyond the happy path. Tests edge cases, tries unexpected inputs, and probes for gaps in the experience.
1612
+
1613
+ **Behaviors**:
1614
+ - Tests edge cases intentionally (empty states, long strings, special characters)
1615
+ - Submits forms with unexpected data (emoji, RTL text, very long values)
1616
+ - Tries to break workflows by navigating backwards, refreshing mid-flow, or opening in multiple tabs
1617
+ - Looks for inconsistencies between what the UI promises and what actually happens
1618
+ - Documents problems methodically
1619
+
1620
+ **Test Questions**:
1621
+ - What happens at the edges (0 items, 1000 items, very long text)?
1622
+ - Do error states recover gracefully or leave the UI in a broken state?
1623
+ - What happens on refresh mid-workflow? Is state preserved?
1624
+ - Are there features that appear to work but produce broken results?
1625
+ - How does the UI handle unexpected input (emoji, special chars, paste from Excel)?
1626
+
1627
+ **Red Flags** (report these specifically):
1628
+ - Features that appear to work but silently fail or produce wrong results
1629
+ - Error handling that exposes technical details or leaves UI in a broken state
1630
+ - Empty states that show nothing useful ("No results" with no guidance)
1631
+ - Workflows that lose user data on refresh or navigation
1632
+ - Inconsistent behavior between similar interactions in different parts of the UI
1633
+
1634
+ ---
1635
+
1636
+ #### 5. Distracted Mobile User: "Casey"
1637
+
1638
+ **Profile**: Using phone one-handed on the go. Frequently interrupted. Possibly on a slow connection.
1639
+
1640
+ **Behaviors**:
1641
+ - Uses thumb only; prefers bottom-of-screen actions
1642
+ - Gets interrupted mid-flow and returns later
1643
+ - Switches between apps frequently
1644
+ - Has limited attention span and low patience
1645
+ - Types as little as possible, prefers taps and selections
1646
+
1647
+ **Test Questions**:
1648
+ - Are primary actions in the thumb zone (bottom half of screen)?
1649
+ - Is state preserved if the user leaves and returns?
1650
+ - Does it work on slow connections (3G)?
1651
+ - Can forms use autocomplete and smart defaults?
1652
+ - Are touch targets at least 44×44pt?
1653
+
1654
+ **Red Flags** (report these specifically):
1655
+ - Important actions positioned at the top of the screen (unreachable by thumb)
1656
+ - No state persistence; progress lost on tab switch or interruption
1657
+ - Large text inputs required where selection would work
1658
+ - Heavy assets loading on every page (no lazy loading)
1659
+ - Tiny tap targets or targets too close together
1660
+
1661
+ ---
1662
+
1663
+ #### Selecting Personas
1664
+
1665
+ Choose personas based on the interface type:
1666
+
1667
+ | Interface Type | Primary Personas | Why |
1668
+ |---------------|-----------------|-----|
1669
+ | Landing page / marketing | Jordan, Riley, Casey | First impressions, trust, mobile |
1670
+ | Dashboard / admin | Alex, Sam | Power users, accessibility |
1671
+ | E-commerce / checkout | Casey, Riley, Jordan | Mobile, edge cases, clarity |
1672
+ | Onboarding flow | Jordan, Casey | Confusion, interruption |
1673
+ | Data-heavy / analytics | Alex, Sam | Efficiency, keyboard nav |
1674
+ | Form-heavy / wizard | Jordan, Sam, Casey | Clarity, accessibility, mobile |
1675
+
1676
+ ---
1677
+
1678
+ #### Project-Specific Personas
1679
+
1680
+ If `AGENTS.md` contains a `## Design Context` section (generated by `impeccable init`), derive 1–2 additional personas from the audience and brand information:
1681
+
1682
+ 1. Read the target audience description
1683
+ 2. Identify the primary user archetype not covered by the 5 predefined personas
1684
+ 3. Create a persona following this template:
1685
+
1686
+ ```
1687
+ ##### [Role]: "[Name]"
1688
+
1689
+ **Profile**: [2-3 key characteristics derived from Design Context]
1690
+
1691
+ **Behaviors**: [3-4 specific behaviors based on the described audience]
1692
+
1693
+ **Red Flags**: [3-4 things that would alienate this specific user type]
1694
+ ```
1695
+
1696
+ Only generate project-specific personas when real Design Context data is available. Don't invent audience details; use the 5 predefined personas when no context exists.
1697
+
1698
+ ---
1699
+
1700
+ ## Appendix: distill.md
1701
+
1702
+ Strip a design to its essence. Remove anything that doesn't earn its place: redundant elements, repeated information, decorative noise, cosmetic complexity.
1703
+
1704
+
1705
+ ---
1706
+
1707
+ ## Assess Current State
1708
+
1709
+ Analyze what makes the design feel complex or cluttered:
1710
+
1711
+ 1. **Identify complexity sources**:
1712
+ - **Too many elements**: Competing buttons, redundant information, visual clutter
1713
+ - **Excessive variation**: Too many colors, fonts, sizes, styles without purpose
1714
+ - **Information overload**: Everything visible at once, no progressive disclosure
1715
+ - **Visual noise**: Unnecessary borders, shadows, backgrounds, decorations
1716
+ - **Confusing hierarchy**: Unclear what matters most
1717
+ - **Feature creep**: Too many options, actions, or paths forward
1718
+
1719
+ 2. **Find the essence**:
1720
+ - What's the primary user goal? (There should be ONE)
1721
+ - What's actually necessary vs nice-to-have?
1722
+ - What can be removed, hidden, or combined?
1723
+ - What's the 20% that delivers 80% of value?
1724
+
1725
+ If any of these are unclear from the codebase, do not guess. Ask the user directly to clarify what you cannot infer.
1726
+
1727
+ Simplicity is not about removing features. It's about removing obstacles between users and their goals. Every element should justify its existence.
1728
+
1729
+ ## Plan Simplification
1730
+
1731
+ Create a ruthless editing strategy:
1732
+
1733
+ - **Core purpose**: What's the ONE thing this should accomplish?
1734
+ - **Essential elements**: What's truly necessary to achieve that purpose?
1735
+ - **Progressive disclosure**: What can be hidden until needed?
1736
+ - **Consolidation opportunities**: What can be combined or integrated?
1737
+
1738
+ Expect to say no to good ideas to make room for great execution.
1739
+
1740
+ ## Simplify the Design
1741
+
1742
+ Systematically remove complexity across these dimensions:
1743
+
1744
+ ### Information Architecture
1745
+ - **Reduce scope**: Remove secondary actions, redundant information
1746
+ - **Progressive disclosure**: Hide complexity behind clear entry points (accordions, modals, step-through flows)
1747
+ - **Combine related actions**: Merge similar buttons, consolidate forms, group related content
1748
+ - **Clear hierarchy**: ONE primary action, few secondary actions, everything else tertiary or hidden
1749
+ - **Remove redundancy**: If it's said elsewhere, don't repeat it here
1750
+
1751
+ ### Visual Simplification
1752
+ - **Reduce color palette**: Use 1-2 colors plus neutrals, not 5-7 colors
1753
+ - **Limit typography**: One font family, 3-4 sizes maximum, 2-3 weights
1754
+ - **Remove decorations**: Eliminate borders, shadows, backgrounds that don't serve hierarchy or function
1755
+ - **Flatten structure**: Reduce nesting, remove unnecessary containers; never nest cards inside cards
1756
+ - **Remove unnecessary cards**: Cards aren't needed for basic layout; use spacing and alignment instead
1757
+ - **Consistent spacing**: Use one spacing scale, remove arbitrary gaps
1758
+
1759
+ ### Layout Simplification
1760
+ - **Linear flow**: Replace complex grids with simple vertical flow where possible
1761
+ - **Remove sidebars**: Move secondary content inline or hide it
1762
+ - **Full-width**: Use available space generously instead of complex multi-column layouts
1763
+ - **Consistent alignment**: Pick left or center, stick with it
1764
+ - **Generous white space**: Let content breathe, don't pack everything tight
1765
+
1766
+ ### Interaction Simplification
1767
+ - **Reduce choices**: Fewer buttons, fewer options, clearer path forward (paradox of choice is real)
1768
+ - **Smart defaults**: Make common choices automatic, only ask when necessary
1769
+ - **Inline actions**: Replace modal flows with inline editing where possible
1770
+ - **Remove steps**: Can the flow lose a step?
1771
+ - **Clear next action**: ONE obvious next action, not five competing ones
1772
+
1773
+ ### Content Simplification
1774
+ - **Shorter copy**: Cut filler, not meaning
1775
+ - **Active voice**: "Save changes" not "Changes will be saved"
1776
+ - **Remove jargon**: Plain language always wins
1777
+ - **Scannable structure**: Short paragraphs, bullet points, clear headings
1778
+ - **Essential information only**: Remove marketing fluff, hedging
1779
+ - **Remove redundant copy**: No headers restating intros, no repeated explanations, say it once
1780
+
1781
+ ### Code Simplification
1782
+ - **Remove unused code**: Dead CSS, unused components, orphaned files
1783
+ - **Flatten component trees**: Reduce nesting depth
1784
+ - **Consolidate styles**: Merge similar styles, use utilities consistently
1785
+ - **Reduce variants**: Does that component need 12 variations, or can 3 cover 90% of cases?
1786
+
1787
+ **Avoid**:
1788
+ - Remove necessary functionality (simplicity ≠ feature-less)
1789
+ - Sacrifice accessibility for simplicity (clear labels and ARIA still required)
1790
+ - Make things so simple they're unclear (mystery ≠ minimalism)
1791
+ - Remove information users need to make decisions
1792
+ - Eliminate hierarchy completely (some things should stand out)
1793
+ - Oversimplify complex domains (match complexity to actual task complexity)
1794
+
1795
+ ## Verify Simplification
1796
+
1797
+ Ensure simplification improves usability:
1798
+
1799
+ - **Faster task completion**: Can users accomplish goals more quickly?
1800
+ - **Reduced cognitive load**: Is it easier to understand what to do?
1801
+ - **Still complete**: Are all necessary features still accessible?
1802
+ - **Clearer hierarchy**: Is it obvious what matters most?
1803
+ - **Better performance**: Does simpler design load faster?
1804
+
1805
+ ## Document Removed Complexity
1806
+
1807
+ If you removed features or options:
1808
+ - Document why they were removed
1809
+ - Consider if they need alternative access points
1810
+ - Note any user feedback to monitor
1811
+
1812
+ When the cuts feel right, hand off to `/impeccable polish` for the final pass. As Antoine de Saint-Exupéry put it: "Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away."
1813
+
1814
+ ---
1815
+
1816
+ ## Appendix: harden.md
1817
+
1818
+ 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.
1819
+
1820
+ ## Assess Hardening Needs
1821
+
1822
+ Identify weaknesses and edge cases:
1823
+
1824
+ 1. **Test with extreme inputs**:
1825
+ - Very long text (names, descriptions, titles)
1826
+ - Very short text (empty, single character)
1827
+ - Special characters (emoji, RTL text, accents)
1828
+ - Large numbers (millions, billions)
1829
+ - Many items (1000+ list items, 50+ options)
1830
+ - No data (empty states)
1831
+
1832
+ 2. **Test error scenarios**:
1833
+ - Network failures (offline, slow, timeout)
1834
+ - API errors (400, 401, 403, 404, 500)
1835
+ - Validation errors
1836
+ - Permission errors
1837
+ - Rate limiting
1838
+ - Concurrent operations
1839
+
1840
+ 3. **Test internationalization**:
1841
+ - Long translations (German is often 30% longer than English)
1842
+ - RTL languages (Arabic, Hebrew)
1843
+ - Character sets (Chinese, Japanese, Korean, emoji)
1844
+ - Date/time formats
1845
+ - Number formats (1,000 vs 1.000)
1846
+ - Currency symbols
1847
+
1848
+ Designs that only work with perfect data aren't production-ready.
1849
+
1850
+ ## Hardening Dimensions
1851
+
1852
+ Systematically improve resilience:
1853
+
1854
+ ### Text Overflow & Wrapping
1855
+
1856
+ **Long text handling**:
1857
+ ```css
1858
+ /* Single line with ellipsis */
1859
+ .truncate {
1860
+ overflow: hidden;
1861
+ text-overflow: ellipsis;
1862
+ white-space: nowrap;
1863
+ }
1864
+
1865
+ /* Multi-line with clamp */
1866
+ .line-clamp {
1867
+ display: -webkit-box;
1868
+ -webkit-line-clamp: 3;
1869
+ -webkit-box-orient: vertical;
1870
+ overflow: hidden;
1871
+ }
1872
+
1873
+ /* Allow wrapping */
1874
+ .wrap {
1875
+ word-wrap: break-word;
1876
+ overflow-wrap: break-word;
1877
+ hyphens: auto;
1878
+ }
1879
+ ```
1880
+
1881
+ **Flex/Grid overflow**:
1882
+ ```css
1883
+ /* Prevent flex items from overflowing */
1884
+ .flex-item {
1885
+ min-width: 0; /* Allow shrinking below content size */
1886
+ overflow: hidden;
1887
+ }
1888
+
1889
+ /* Prevent grid items from overflowing */
1890
+ .grid-item {
1891
+ min-width: 0;
1892
+ min-height: 0;
1893
+ }
1894
+ ```
1895
+
1896
+ **Responsive text sizing**:
1897
+ - Use `clamp()` for fluid typography
1898
+ - 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)
1899
+ - Test text scaling (zoom to 200%)
1900
+ - Ensure containers expand with text
1901
+
1902
+ ### Internationalization (i18n)
1903
+
1904
+ **Text expansion**:
1905
+ - Add 30-40% space budget for translations
1906
+ - Use flexbox/grid that adapts to content
1907
+ - Test with longest language (usually German)
1908
+ - Avoid fixed widths on text containers
1909
+
1910
+ ```jsx
1911
+ // ❌ Bad: Assumes short English text
1912
+ <button className="w-24">Submit</button>
1913
+
1914
+ // ✅ Good: Adapts to content
1915
+ <button className="px-4 py-2">Submit</button>
1916
+ ```
1917
+
1918
+ **RTL (Right-to-Left) support**:
1919
+ ```css
1920
+ /* Use logical properties */
1921
+ margin-inline-start: 1rem; /* Not margin-left */
1922
+ padding-inline: 1rem; /* Not padding-left/right */
1923
+ border-inline-end: 1px solid; /* Not border-right */
1924
+
1925
+ /* Or use dir attribute */
1926
+ [dir="rtl"] .arrow { transform: scaleX(-1); }
1927
+ ```
1928
+
1929
+ **Arabic-script specifics** (Arabic, Persian, Urdu, Pashto, Kurdish):
1930
+ - 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.
1931
+ - 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.
1932
+ - 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.
1933
+
1934
+ ```javascript
1935
+ // ✅ Locale-aware digit formatting
1936
+ new Intl.NumberFormat('fa-IR').format(1234); // ۱٬۲۳۴
1937
+ new Intl.NumberFormat('ar-SA').format(1234); // ١٬٢٣٤
1938
+ ```
1939
+
1940
+ - 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.
1941
+
1942
+ ```javascript
1943
+ // ✅ Locale-appropriate calendar
1944
+ new Intl.DateTimeFormat('fa-IR').format(new Date());
1945
+ new Intl.DateTimeFormat('ar-SA-u-ca-islamic').format(new Date());
1946
+ ```
1947
+
1948
+ **Character set support**:
1949
+ - Use UTF-8 encoding everywhere
1950
+ - Test with Chinese/Japanese/Korean (CJK) characters
1951
+ - Test with emoji (they can be 2-4 bytes)
1952
+ - Handle different scripts (Latin, Cyrillic, Arabic, etc.)
1953
+
1954
+ **Date/Time formatting**:
1955
+ ```javascript
1956
+ // ✅ Use Intl API for proper formatting
1957
+ new Intl.DateTimeFormat('en-US').format(date); // 1/15/2024
1958
+ new Intl.DateTimeFormat('de-DE').format(date); // 15.1.2024
1959
+
1960
+ new Intl.NumberFormat('en-US', {
1961
+ style: 'currency',
1962
+ currency: 'USD'
1963
+ }).format(1234.56); // $1,234.56
1964
+ ```
1965
+
1966
+ **Pluralization**:
1967
+ ```javascript
1968
+ // ❌ Bad: Assumes English pluralization
1969
+ `${count} item${count !== 1 ? 's' : ''}`
1970
+
1971
+ // ✅ Good: Use proper i18n library
1972
+ t('items', { count }) // Handles complex plural rules
1973
+ ```
1974
+
1975
+ ### Error Handling
1976
+
1977
+ **Network errors**:
1978
+ - Show clear error messages
1979
+ - Provide retry button
1980
+ - Explain what happened
1981
+ - Offer offline mode (if applicable)
1982
+ - Handle timeout scenarios
1983
+
1984
+ ```jsx
1985
+ // Error states with recovery
1986
+ {error && (
1987
+ <ErrorMessage>
1988
+ <p>Failed to load data. {error.message}</p>
1989
+ <button onClick={retry}>Try again</button>
1990
+ </ErrorMessage>
1991
+ )}
1992
+ ```
1993
+
1994
+ **Form validation errors**:
1995
+ - Inline errors near fields
1996
+ - Clear, specific messages
1997
+ - Suggest corrections
1998
+ - Don't block submission unnecessarily
1999
+ - Preserve user input on error
2000
+
2001
+ **API errors**:
2002
+ - Handle each status code appropriately
2003
+ - 400: Show validation errors
2004
+ - 401: Redirect to login
2005
+ - 403: Show permission error
2006
+ - 404: Show not found state
2007
+ - 429: Show rate limit message
2008
+ - 500: Show generic error, offer support
2009
+
2010
+ **Graceful degradation**:
2011
+ - Core functionality works without JavaScript
2012
+ - Images have alt text
2013
+ - Progressive enhancement
2014
+ - Fallbacks for unsupported features
2015
+
2016
+ ### Edge Cases & Boundary Conditions
2017
+
2018
+ **Empty states**:
2019
+ - No items in list
2020
+ - No search results
2021
+ - No notifications
2022
+ - No data to display
2023
+ - Provide clear next action
2024
+
2025
+ **Loading states**:
2026
+ - Initial load
2027
+ - Pagination load
2028
+ - Refresh
2029
+ - Show what's loading ("Loading your projects...")
2030
+ - Time estimates for long operations
2031
+
2032
+ **Large datasets**:
2033
+ - Pagination or virtual scrolling
2034
+ - Search/filter capabilities
2035
+ - Performance optimization
2036
+ - Don't load all 10,000 items at once
2037
+
2038
+ **Concurrent operations**:
2039
+ - Prevent double-submission (disable button while loading)
2040
+ - Handle race conditions
2041
+ - Optimistic updates with rollback
2042
+ - Conflict resolution
2043
+
2044
+ **Interrupted gestures** (custom sliders, drag surfaces, scrollable control strips):
2045
+ - A second finger or pointer lands mid-drag: the first drag keeps its pointer or ends cleanly, never jumps to the new one
2046
+ - 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
2047
+ - After each of these, the next tap or drag works without a reload
2048
+
2049
+ **Permission states**:
2050
+ - No permission to view
2051
+ - No permission to edit
2052
+ - Read-only mode
2053
+ - Clear explanation of why
2054
+
2055
+ **Browser compatibility**:
2056
+ - Polyfills for modern features
2057
+ - Fallbacks for unsupported CSS
2058
+ - Feature detection (not browser detection)
2059
+ - Test in target browsers
2060
+
2061
+ ### Input Validation & Sanitization
2062
+
2063
+ **Client-side validation**:
2064
+ - Required fields
2065
+ - Format validation (email, phone, URL)
2066
+ - Length limits
2067
+ - Pattern matching
2068
+ - Custom validation rules
2069
+
2070
+ **Server-side validation** (always):
2071
+ - Never trust client-side only
2072
+ - Validate and sanitize all inputs
2073
+ - Protect against injection attacks
2074
+ - Rate limiting
2075
+
2076
+ **Constraint handling**:
2077
+ ```html
2078
+ <!-- Set clear constraints -->
2079
+ <input
2080
+ type="text"
2081
+ maxlength="100"
2082
+ pattern="[A-Za-z0-9]+"
2083
+ required
2084
+ aria-describedby="username-hint"
2085
+ />
2086
+ <small id="username-hint">
2087
+ Letters and numbers only, up to 100 characters
2088
+ </small>
2089
+ ```
2090
+
2091
+ ### Accessibility Resilience
2092
+
2093
+ **Keyboard navigation**:
2094
+ - All functionality accessible via keyboard
2095
+ - Logical tab order
2096
+ - Focus management in modals
2097
+ - Skip links for long content
2098
+
2099
+ **Screen reader support**:
2100
+ - Proper ARIA labels
2101
+ - Announce dynamic changes (live regions)
2102
+ - Descriptive alt text
2103
+ - Semantic HTML
2104
+
2105
+ **High contrast mode**:
2106
+ - Test in Windows high contrast mode
2107
+ - Don't rely only on color
2108
+ - Provide alternative visual cues
2109
+
2110
+ ### Performance Resilience
2111
+
2112
+ **Slow connections**:
2113
+ - Progressive image loading
2114
+ - Skeleton screens
2115
+ - Optimistic UI updates
2116
+ - Offline support (service workers)
2117
+
2118
+ **Memory leaks**:
2119
+ - Clean up event listeners
2120
+ - Cancel subscriptions
2121
+ - Clear timers/intervals
2122
+ - Abort pending requests on unmount
2123
+
2124
+ **Throttling & Debouncing**:
2125
+ ```javascript
2126
+ // Debounce search input
2127
+ const debouncedSearch = debounce(handleSearch, 300);
2128
+
2129
+ // Throttle scroll handler
2130
+ const throttledScroll = throttle(handleScroll, 100);
2131
+ ```
2132
+
2133
+ ## Testing Strategies
2134
+
2135
+ **Manual testing**:
2136
+ - Test with extreme data (very long, very short, empty)
2137
+ - Test in different languages
2138
+ - Test offline
2139
+ - Test slow connection (throttle to 3G)
2140
+ - Test with screen reader
2141
+ - Test keyboard-only navigation
2142
+ - Test on old browsers
2143
+
2144
+ **Automated testing**:
2145
+ - Unit tests for edge cases
2146
+ - Integration tests for error scenarios
2147
+ - E2E tests for critical paths
2148
+ - A behavioral regression for each confirmed gesture fix, when the project's test runner can drive input
2149
+ - Visual regression tests
2150
+ - Accessibility tests (axe, WAVE)
2151
+
2152
+ **Avoid**:
2153
+ - Assume perfect input (validate everything)
2154
+ - Ignore internationalization (design for global)
2155
+ - Leave error messages generic ("Error occurred")
2156
+ - Forget offline scenarios
2157
+ - Trust client-side validation alone
2158
+ - Use fixed widths for text
2159
+ - Assume English-length text
2160
+ - Block entire interface when one component errors
2161
+
2162
+ ## Verify Hardening
2163
+
2164
+ Test thoroughly with edge cases:
2165
+
2166
+ - **Long text**: Try names with 100+ characters
2167
+ - **Emoji**: Use emoji in all text fields
2168
+ - **RTL**: Test with Arabic or Hebrew
2169
+ - **CJK**: Test with Chinese/Japanese/Korean
2170
+ - **Network issues**: Disable internet, throttle connection
2171
+ - **Large datasets**: Test with 1000+ items
2172
+ - **Concurrent actions**: Click submit 10 times rapidly
2173
+ - **Interrupted gestures**: Add a second finger mid-drag, scroll across the control, release outside it, switch windows mid-drag; then drag again
2174
+ - **Errors**: Force API errors, test all error states
2175
+ - **Empty**: Remove all data, test empty states
2176
+
2177
+ For gestures, say what produced the evidence (emulated viewport, synthesized touch, which engine, physical device) and name what stayed untested.
2178
+
2179
+ When edge cases are covered, hand off to `/impeccable polish` for the final pass.
2180
+
2181
+ ---
2182
+
2183
+ ## Appendix: layout.md
2184
+
2185
+ Layout turns product priority into reading order, grouping, rhythm, and usable space. Diagnose the structural problem before moving boxes.
2186
+
2187
+ ---
2188
+
2189
+ ## Visitor mode
2190
+
2191
+ - **Persuade + Experience:** composition may be asymmetric, fluid, or intentionally disruptive when the selected world earns it.
2192
+ - **Operate + Read:** predictable structure, stable density, and navigable linearity are affordances.
2193
+ - **Native:** follow [ios.md](ios.md) or [android.md](android.md) for navigation, insets, adaptation, and touch targets.
2194
+
2195
+ Preserve the established visual world. A layout command changes structure inside it; identity replacement belongs to [new-work.md](new-work.md).
2196
+
2197
+ ## Two isolated assessments
2198
+
2199
+ When a sub-agent tool is available and permitted, run these independently; otherwise run them yourself in this order.
2200
+
2201
+ 1. **Layout assessment:** inspect representative states and viewports. Answer every question below with rendered or source evidence:
2202
+ - **Reading order:** Apply the squint test. With detail blurred, can you still identify the primary element, the secondary element, and the major groups in order?
2203
+ - **Grouping:** Are related items close and distinct groups separated, or are containers compensating for weak proximity?
2204
+ - **Rhythm:** Do tight and generous intervals create a deliberate cadence, or is one spacing value repeated until everything has equal weight?
2205
+ - **Structure:** Does the topology match the content and task? Are repeated cards, columns, or sections genuinely equivalent, or merely a framework default?
2206
+ - **Density:** Does the amount of information per region fit use frequency, decision complexity, and visitor mode?
2207
+ - **Adaptation:** At narrow, intermediate, wide, zoomed, and localized states, what reorders, collapses, wraps, scrolls, or remains fixed? Does DOM and focus order still agree with the visual order?
2208
+ - **Extremes:** Do long content, empty states, overlays, sticky elements, safe areas, and small touch targets expose structural failures?
2209
+ 2. **Mechanical scan:** run:
2210
+
2211
+ ```bash
2212
+ .pi/skills/impeccable/scripts/impeccable detect --json --scope layout [target files or dirs]
2213
+ ```
2214
+
2215
+ Also inspect arbitrary spacing, overflow, stacking, and container behavior the detector cannot resolve. Keep mechanical evidence out of the first assessment, then synthesize both passes before editing. A clean scan cannot prove hierarchy or rhythm.
2216
+
2217
+ ## Set the spatial thesis
2218
+
2219
+ Before editing, name:
2220
+
2221
+ - the primary reading or task path;
2222
+ - what belongs together and what must separate;
2223
+ - which element leads and which supports;
2224
+ - the intended density and spacing rhythm;
2225
+ - how the structure changes across containers, viewports, input modes, and content extremes.
2226
+
2227
+ Choose the simplest structural model that expresses those relationships. Use layout primitives according to the relationships they control, and name reusable spacing and container roles semantically.
2228
+
2229
+ ## Apply
2230
+
2231
+ - Group by meaning. Use proximity before adding containers or decoration.
2232
+ - Create rhythm through deliberate contrast between tight and generous intervals.
2233
+ - Use a documented spacing scale rather than one-off values. A 4-unit base usually provides the useful middle steps that an 8-only scale misses.
2234
+ - Let hierarchy follow product priority, not framework defaults.
2235
+ - Keep distinct content visually distinct without turning every group into an isolated component.
2236
+ - Make responsive behavior structural: reorder, collapse, reflow, or reveal based on what remains important.
2237
+ - Prefer container-aware components when the same component appears in different contexts.
2238
+ - Use `gap` for sibling rhythm when it expresses the relationship more directly than child margins.
2239
+ - Keep touch targets usable even when their visible marks are small.
2240
+ - Use depth only when it clarifies state or hierarchy.
2241
+ - Make optical corrections only after inspecting the rendered result.
2242
+
2243
+ Variation is not a goal by itself. Repetition should support recognition; break it only when content or priority changes.
2244
+
2245
+ ## Verify
2246
+
2247
+ - The squint test still reveals the primary, secondary, and major groups in order.
2248
+ - The reading and task path remains clear at every supported size.
2249
+ - Related content groups naturally; unrelated content does not blur together.
2250
+ - Tight and generous spacing create intentional rhythm instead of monotonous repetition.
2251
+ - Density matches use frequency and content complexity.
2252
+ - Long text, empty states, localization, zoom, and dynamic content do not break the structure.
2253
+ - Keyboard, touch, and assistive-technology order agree with the visual order.
2254
+ - The final mechanical scan has no unexplained findings.
2255
+
2256
+ Answer each item with rendered or source evidence, then rerun the scan. Do not substitute a bare “yes” for verification.
2257
+
2258
+ When the structure holds, hand off to `/impeccable polish`.
2259
+
2260
+ ## Live-mode signature params
2261
+
2262
+ Every variant declares a coarse `density` parameter and authors spacing against `var(--p-density, 1)`.
2263
+
2264
+ ```json
2265
+ {"id":"density","kind":"range","min":0.6,"max":1.4,"step":0.05,"default":1,"label":"Density"}
2266
+ ```
2267
+
2268
+ Add one structural parameter only when the topology genuinely branches. Follow [live.md](live.md)'s parameter contract.
2269
+
2270
+ ---
2271
+
2272
+ ## Appendix: mode-operate.md
2273
+
2274
+ # Operate
2275
+
2276
+ `impeccable concept-seed --mode operate` prints the two sections below as its MODE RULES block. On an Operate surface the visitor came to get a job done, so the page is first a working product of its category and the world serves it.
2277
+
2278
+ ## Directions
2279
+
2280
+ Someone who uses tools like this one should know where everything is before they notice the world. The world lends four things and only these: type, palette, density, and one signature move. It never supplies the layout, the navigation model, or the controls. Colour is part of the world's contribution, and it does real jobs: a committed palette for the shell (a coloured rail or header, a tinted ground), state colours, data series, selection, and the signature move. A grey screen with one accent colour is the category default without the category's polish, not restraint.
2281
+
2282
+ Read every candidate, the assigned direction, and every challenger through that limit before you fuse or judge it. A world taken from a tool or instrument the audience operates (a terminal, a scope, a control panel, a cockpit) or from a fictional interface comes back as a costume of that tool on a working screen: take from it only what transfers as type, palette, density, and a signature move, or replace it from your list. When a catalog world's source is itself an interface language, the same limit holds: it lends type, density, palette, and one signature move, while navigation and controls stay the standard ones for the platform, web components on the web and native controls in an app.
2283
+
2284
+ Write each direction's first viewport as the product's shell first: the navigation, the work areas and what each is for, the data the visitor reads first and its states, and then where the signature move lives. Expression may never obscure the task, state, or familiar affordance. Name the signature move concretely, so the comp and the build can find it: service health drawn as a transit map, a schedule set in a timetable's column rhythm. A direction whose world shows up only as a colour scheme has not found its move yet. When you weigh fused challengers, product clarity includes reading as a working product of this category.
2285
+
2286
+ ## Comps
2287
+
2288
+ The comp is the product screen, in the direction's committed palette: its shell and navigation with a distinct area for each job and, where there is data, filters over what they scope and charts and tables with clear states. The world enters only through type, palette, density, and the one signature move; it never supplies the page's organisation, so a working screen never reads as a newspaper, a poster, or any other artifact of the world. Every control is a standard one the visitor already knows how to use, a web component on the web and the platform's native control in an app: buttons, tabs, inputs, selects, filters, tables with sortable headers, navigation that reads as navigation. Never a costume of the world's own interface: a terminal's function-key bar or command prompt, an instrument's bezel, ruled ledger paper standing in for a table. A comp an engineer could not build from the platform's standard components is a picture of the tool, not the tool. The finish bar is the best product in the category: an aligned grid, consistent spacing, a real type scale, and clear hierarchy. The signature move adds to a screen that is already that clean; it never stands in for it.
2289
+
2290
+ Prompt with the screen's real content: the product name, realistic data with plausible values and units, real labels, and one state worth seeing (an alert, a degraded service, an empty filter result), never placeholder tiles. State colours (red for critical, amber for degraded) sit on top of the world's palette only where they carry meaning, and a headline number that moves over time shows its recent history, with the onset marked when something changed.
2291
+
2292
+ Comps two and three vary the product's organisation, never its world coverage: the navigation model (side rail, top bar, command-first), how the work areas divide the screen, which data leads, the density, and where the signature move sits. Each must be recognisably different from the first at thumbnail size; a variant only its prompt can tell apart adds no choice. A variant that adds world material, texture, or ornament goes further in the wrong direction; on a working screen, more world is a costume.
2293
+
2294
+ Self-check every render: with the name covered, does it read as a product of its category, could the visitor do the task from it, and is it at least as clean as the category standard and more distinctive than it? If it reads as an artifact of the world first, regenerate with the shell and the work areas named region by region and the world held to its four contributions.
2295
+
2296
+ ---
2297
+
2298
+ ## Appendix: mode-persuade.md
2299
+
2300
+ # Persuade and Experience
2301
+
2302
+ `impeccable concept-seed --mode persuade` (or `experience`) prints the two sections below as its MODE RULES block. On these surfaces the design is what the visitor judges, so the world may own and structure the page.
2303
+
2304
+ ## Directions
2305
+
2306
+ When a catalog world's source is itself an interface language, the surface may carry its native grammar across navigation, content, controls, and states, within the platform conventions a native app keeps.
2307
+
2308
+ For **Persuade**, the opening must make the offer intelligible and desirable, expose a clear action, and demonstrate something only this product can prove. The action is the one the category's visitors came to take, in its working form: an airline's route-and-dates search, a clinic's open appointment slots, a store's add to cart. A decorative link pointing at it elsewhere does not count. Conversion lives inside the form's own vocabulary: a hook that lands in one line, a visible primary action, a legible reading order. A committed form that hides the offer or the action has not finished translating. For **Experience**, the work itself leads from the first viewport.
2309
+
2310
+ ## Comps
2311
+
2312
+ The world may be the carrier of the page, never a picture of it: a facade, a shutter or a book can be what the page is built on, while a viewport painted whole as a facade, a book cover or a travel poster, with no working parts in it, is a picture of the world, not its website. Material coverage is wanted: the world's material is the ground and the major surfaces, its type sets the headlines, and a world reduced to an accent on a neutral template is the category default with a sticker on it. Coverage is not performance: how many regions act out the concept is limited by the depth rule in visualize.md, and the rest stay in the world's material without performing it. Both ends erase the direction: the painted poster, and the generic product page (a headline over subcopy and a button, a row of equal cards below). The dealt composition sets the skeleton, and the compositions you write for comps two and three answer to the same test: a split hero (copy on one side, the product on the other, a badge row under it) or a centred headline over a row of cards is the template whatever world paints it.
2313
+
2314
+ The world carries the page's parts and never absorbs them, so wherever it puts one, the page still works as a page: navigation set into a facade reads as links, copy on a shutter as set text a visitor reads, an action on a door plaque as plainly clickable, text reads against whatever sits behind it, the sections keep a steady vertical rhythm, the primary action is unmistakable, and the section below starts as a section rather than more painting. Fix a poster by making its parts work where the world put them, never by moving them into a standard layout on the world's colour: a cover that becomes copy beside a device on marigold has lost the cover.
2315
+
2316
+ When the world is an object, the page is that one object seen once, at one scale and from one point of view, and the object keeps its real form: a book opens to two pages on one gutter, never a third panel, and a spine that carries the navigation belongs to the book on the page, never a second book beside it. More content goes on the object's own surfaces or on the next spread below, never on extra copies or impossible folds.
2317
+
2318
+ Comps two and three each go further than the first, never cleaner: a bolder use of the same world, where the world's material carries more of the page's structure (still one dominant move, per the depth rule), a larger or stranger focal move, or a composition the category would not attempt.
2319
+
2320
+ ---
2321
+
2322
+ ## Appendix: mode-read.md
2323
+
2324
+ # Read
2325
+
2326
+ `impeccable concept-seed --mode read` prints the two sections below as its MODE RULES block. On a Read surface the visitor came to understand something, so the page is first a document of its kind, framed by the world.
2327
+
2328
+ ## Directions
2329
+
2330
+ The reader's question leads, and comprehension and wayfinding stay intact at every step. Documentation reads as documentation, a guide as a guide, an article as an article, a changelog as a changelog. The world owns the frame and serves the column. The frame is the masthead, the navigation rail, the ground, the title and section openers, and the way code, tables, and callouts are set: there the world's palette, type, and signature move commit fully, so the page could belong to no other product. The reading column inside it stays calm: a reading face, real contrast, a real measure, nothing performing behind the text. The world never supplies the reading order or replaces the navigation with something a reader has to learn. Documentation still reads as documentation, a guide as a guide, an article as an article.
2331
+
2332
+ Candidates from the world's own publishing traditions transfer best: reference books, type specimens, timetables, field guides, technical manuals, scholarly apparatus, a newspaper's wayfinding. A tool, instrument, or fictional interface from the audience's world comes back as a costume on a page meant for reading: take from it only what transfers as type, palette, density, and a signature move, or replace it from your list. When a catalog world's source is itself an interface language, the same limit holds: it lends type, density, palette, and one signature move, while navigation and controls stay the standard ones for the platform.
2333
+
2334
+ Write each direction's first viewport as the document's shell first: the navigation and where the reader stands in it, the title and the opening that answers or frames the reader's question, the reading column, and the way forward (contents, section headings, next and previous). Then name where the world owns the frame and where the signature move lives: a masthead, a coloured rail, a running head, a margin system, a numbering scheme, a way of setting code or tables. When you weigh fused challengers, product clarity includes how fast a reader finds and understands the answer.
2335
+
2336
+ ## Comps
2337
+
2338
+ The comp is the document as the reader meets it: a frame the world owns, in the direction's committed palette and type, around a calm reading column at a real measure (on the web about 60 to 75 characters with body text near 16px; in a native app, the platform's body text style and its readable width), with headings in a clear hierarchy and the wayfinding that carries the reader through. Body text is set in a reading face with real contrast against its ground; a monospace face is for code, parameters, and small labels, never the running text or the headings by default. Code, tables, notes, and figures sit in the standard forms readers already know, set in the world's type and palette. The signature move is one system used where it earns its place, never a frame repeated around every element. The world never supplies the page's reading order, so a document never reads as a poster, a magazine cover, or a book photographed open.
2339
+
2340
+ Prompt with the real material: the actual title, a real opening paragraph, real section names, and one example of the hardest content the surface holds (a code sample, a reference table, a diagram), never filler text.
2341
+
2342
+ Comps two and three vary the reading structure and how the frame carries the world, never the column: the navigation model (sidebar tree, top tabs, inline contents), the column and margin system, how densely the reference material sits, and where the signature move appears. Each must be recognisably different from the first at thumbnail size; a variant only its prompt can tell apart adds no choice. A variant that pushes world material into the reading column makes reading harder and goes the wrong way.
2343
+
2344
+ Self-check every render: can a reader tell where they are and where to go next, and read the body comfortably? Then cover the name: could this be any other product's documentation? If so, the frame has not taken the world; push the masthead, rail, ground, and openers further into it. If the render reads as an artifact of the world before it reads as a document, the world has reached the column; pull it back to the frame.
2345
+
2346
+ ---
2347
+
2348
+ ## Appendix: operate.md
2349
+
2350
+ # Operate mode depth (and Read notes)
2351
+
2352
+ When design SERVES the product: app UIs, admin dashboards, settings panels, data tables, tools, authenticated surfaces, anything where the user is in a task. The essentials live in SKILL.md's modes and [craft-floor.md](#appendix-craft-floor-md); this file is extended depth, written for Operate surfaces. Read surfaces (docs, guides, long-form) take SKILL.md's Read mode plus this file's typography and consistency rules; their prose measure and navigation matter more than component density.
2353
+
2354
+ ## The product slop test
2355
+
2356
+ Familiarity is often a feature here. The test is whether a category-fluent user can trust the interface immediately or must pause at every subtly-off component.
2357
+
2358
+ Product UI's failure mode isn't flatness, it's strangeness without purpose: over-decorated buttons, mismatched form controls, gratuitous motion, display fonts where labels should be, invented affordances for standard tasks. The bar is earned familiarity. The tool should disappear into the task.
2359
+
2360
+ ## Typography
2361
+
2362
+ - **One family is often right.** Product UIs don't need display/body pairing. A well-tuned sans carries headings, buttons, labels, body, data.
2363
+ - **Fixed rem scale, not fluid.** Clamp-sized headings don't serve product UI. Users view at consistent DPI, and a fluid h1 that shrinks in a sidebar looks worse, not better.
2364
+ - **Tighter scale ratio.** 1.125–1.2 between steps is typical. More type elements here than on brand surfaces; exaggerated contrast creates noise.
2365
+ - **Line length still applies for prose** (65–75ch). Data and compact UI can run denser; tables at 120ch+ are fine.
2366
+
2367
+ ## Color
2368
+
2369
+ Product defaults to Restrained. A single surface can earn Committed (a dashboard where one category color carries a report, an onboarding flow with a drenched welcome screen), but Restrained is the floor.
2370
+
2371
+ - State-rich semantic vocabulary: hover, focus, active, disabled, selected, loading, error, warning, success, info. Standardize these.
2372
+ - Accent color used for primary actions, current selection, and state indicators only, not decoration.
2373
+ - A second neutral layer for sidebars, toolbars, and panels (slightly cooler or warmer than the content surface).
2374
+
2375
+ ## Layout
2376
+
2377
+ - Responsive behavior is structural (collapse sidebar, responsive table, breakpoint-driven columns), not fluid typography.
2378
+
2379
+ ## Components
2380
+
2381
+ Every interactive component has: default, hover, focus, active, disabled, loading, error. Don't ship with half of these.
2382
+
2383
+ - Skeleton states for loading, not spinners in the middle of content.
2384
+ - Empty states that teach the interface, not "nothing here."
2385
+ - Consistent affordances across the surface. Same button shape. Same form-control vocabulary. Same icon style.
2386
+ - Overlays escape their container. An absolutely positioned dropdown inside an `overflow: hidden` or `overflow: auto` ancestor gets clipped; reach for `<dialog>`, the popover API, `position: fixed`, or a portal.
2387
+
2388
+ ## Motion
2389
+
2390
+ - 150–250 ms on most transitions. Users are in flow; don't make them wait for choreography.
2391
+ - Motion conveys state, not decoration. State change, feedback, loading, reveal: nothing else.
2392
+ - No orchestrated page-load sequences. Product loads into a task; users don't want to watch it load.
2393
+
2394
+ ## Product constraints
2395
+
2396
+ - Decorative motion that doesn't convey state.
2397
+ - Inconsistent component vocabulary across screens. If the "save" button looks different in two places, one is wrong.
2398
+ - Display fonts in UI labels, buttons, data.
2399
+ - Reinventing standard affordances for flavor (custom scrollbars, weird form controls, non-standard modals).
2400
+ - Heavy color or full-saturation accents on inactive states.
2401
+ - Modal as first thought. Modals are usually laziness. Exhaust inline / progressive alternatives first.
2402
+
2403
+ ## Product permissions
2404
+
2405
+ Product can afford things brand surfaces can't.
2406
+
2407
+ - System fonts and familiar sans defaults.
2408
+ - Standard navigation patterns: top bar + side nav, breadcrumbs, tabs, command palettes.
2409
+ - Density. Tables with many rows, panels with many labels, dense information when users need it.
2410
+ - Consistency over surprise. The same visual vocabulary screen to screen is a virtue; delight is saved for moments, not pages.
2411
+
2412
+ ---
2413
+
2414
+ ## Appendix: polish.md
2415
+
2416
+ > **Additional context needed**: quality bar and shipping constraints.
2417
+
2418
+ Polish is refinement, never concealed redesign. Preserve the incumbent visual world, content, behavior, and everything outside scope. If the concept itself is wrong, say so and recommend redesign or `bolder` instead of smuggling in a replacement.
2419
+
2420
+ A detector result is defect evidence, not proof of quality. Inspect the rendered experience and real interaction path.
2421
+
2422
+ ## 1. Establish the system
2423
+
2424
+ Read DESIGN.md and representative tokens, shared components, patterns, and neighboring flows. If no formal system exists, use coherent project conventions.
2425
+
2426
+ Classify each drift before fixing it:
2427
+
2428
+ - **missing token:** the system needs a reusable value;
2429
+ - **one-off implementation:** an existing shared component or pattern should replace it;
2430
+ - **conceptual mismatch:** the flow, information architecture, or hierarchy differs from comparable product areas;
2431
+ - **local defect:** the implementation is simply incomplete or inconsistent.
2432
+
2433
+ Fix the cause at the narrowest correct level. Ask when a binding system principle cannot be inferred.
2434
+
2435
+ ## 2. Gather the evidence
2436
+
2437
+ Use the feature yourself at the surface's representative sizes: desktop and mobile on the web; on a native platform (`ios` / `android` / `adaptive`), the shipped device classes on the simulator, emulator, or hardware, captured per the platform reference's Verifying the build section. Determine:
2438
+
2439
+ - whether the path is functionally complete;
2440
+ - the intended quality bar and time available;
2441
+ - known constraints or deliberately unfinished work;
2442
+ - the states, content lengths, roles, and input methods users will actually encounter.
2443
+
2444
+ If a prior critique exists, use it as one input:
2445
+
2446
+ ```bash
2447
+ .pi/skills/impeccable/scripts/impeccable critique-storage latest "<resolved target>" --json
2448
+ ```
2449
+
2450
+ Exit 0 returns JSON with the latest snapshot's `body` and an exact `snapshot_file` identity. Retain `snapshot_file` until the end of the pass. For a local file target, the helper compares the file's exact current content fingerprint with the fingerprint captured by critique. Unchanged staged, unstaged, or untracked content remains current; any byte change, deletion, or replacement with a non-file closes the backlog it identified while preserving its trend history and exits 2. A URL target has no local fingerprint and remains current until explicitly closed. When current, incorporate relevant P0/P1 findings from `body` and name the snapshot read. Exit 2 means none exists or the target changed. Perform an independent pass either way.
2451
+
2452
+ ## 3. Triage
2453
+
2454
+ Separate functional defects from cosmetic ones and fix in this order:
2455
+
2456
+ 1. broken or blocked tasks, data loss, misleading state, and inaccessible paths;
2457
+ 2. missing loading, empty, error, success, disabled, and permission states;
2458
+ 3. flow, hierarchy, responsive, and design-system drift;
2459
+ 4. visual and motion inconsistencies;
2460
+ 5. code and asset cleanup.
2461
+
2462
+ Do not perfect one corner while leaving the rest below the same quality bar.
2463
+
2464
+ ## 4. Polish the whole path
2465
+
2466
+ ### Flow and hierarchy
2467
+
2468
+ - Match neighboring mental models, terminology, disclosure, routing, save behavior, and optimistic or pessimistic patterns.
2469
+ - Make the primary task and current state obvious without flattening every element to equal weight.
2470
+ - Ensure arrival, transition, empty, and recovery paths connect instead of behaving as isolated screens.
2471
+
2472
+ ### Layout and type
2473
+
2474
+ - Align to the project's grid and spacing scale; fix optical as well as mathematical alignment.
2475
+ - Group related content tightly and separate distinct groups generously.
2476
+ - Keep same-role typography consistent; test measure, wrapping, localization expansion, zoom, and font loading.
2477
+ - Verify every supported viewport rather than correcting only the current screenshot.
2478
+
2479
+ ### Color, imagery, and icons
2480
+
2481
+ - Use semantic tokens and stable color meanings across themes.
2482
+ - Verify text, control, and focus contrast in every state.
2483
+ - Keep icon families, stroke/weight, sizing, and optical alignment coherent.
2484
+ - Prevent image layout shift; use correct aspect ratios, responsive sources, and useful alt text.
2485
+
2486
+ ### Interaction and state
2487
+
2488
+ - Every control needs appropriate default, hover, focus, active, disabled, loading, error, and success behavior.
2489
+ - Preserve visible keyboard focus, logical tab order, labels, and platform-appropriate touch targets.
2490
+ - Keep motion coherent, interruptible, and performant. Do not add animation merely to make polish visible.
2491
+ - Validate long, missing, localized, offline, slow, and permission-limited content where the product can encounter it.
2492
+
2493
+ ### Content and code
2494
+
2495
+ - Keep terminology, capitalization, punctuation, and factual copy consistent. Ask before changing claims.
2496
+ - Remove debug output, dead code, unused imports, obsolete styles, and polish-created duplication.
2497
+ - Replace custom implementations with shared components where the system owns the pattern.
2498
+ - Promote genuinely reusable values to tokens; do not create a system abstraction for one local exception.
2499
+
2500
+ ## 5. Verify and finish
2501
+
2502
+ Walk the complete path again with mouse, keyboard, and touch where applicable. Check:
2503
+
2504
+ - mobile, intermediate, and wide layouts on the web; phone and tablet size classes in both supported orientations on native;
2505
+ - loading, empty, error, success, disabled, long-content, and missing-content states;
2506
+ - zoom, contrast, focus, semantics, and screen-reader names;
2507
+ - console errors, layout shift, interaction latency, and image loading everywhere; supported browsers on the web; supported OS versions, runtime warnings, and dropped frames on native;
2508
+ - agreement with DESIGN.md, neighboring features, and the user's scope.
2509
+
2510
+ Follow the quality guidance supplied by `impeccable context` and hooks, then run any other relevant QA commands. Context requests a manual scan only when no automatic detector is active; never add another detector pass. Fix real defects and document only narrow intentional exceptions. A clean scan does not replace visual judgment.
2511
+
2512
+ Finish with a source diff: remove accidental churn, orphaned code, redundant values, and temporary artifacts. Ship only when the feature is functionally complete and consistently finished across the path.
2513
+
2514
+ When this pass clears every Priority Issue it took from a snapshot, close that snapshot:
2515
+
2516
+ ```bash
2517
+ .pi/skills/impeccable/scripts/impeccable critique-storage close "<resolved target>" "<snapshot_file returned by latest>"
2518
+ ```
2519
+
2520
+ This closes only the snapshot this pass actually processed; if a newer critique landed meanwhile, its backlog stays live. Do not close when no snapshot was read, when `snapshot_file` was not retained, or when Priority Issues remain.
2521
+
2522
+ ---
2523
+
2524
+ ## Appendix: quieter.md
2525
+
2526
+ Quiet design is harder than bold design. Subtlety needs precision. Reduce visual intensity in designs that are too loud, aggressive, or overstimulating without losing personality or making the result generic.
2527
+
2528
+ ---
2529
+
2530
+ ## Visitor mode
2531
+
2532
+ Persuade + Experience: "quieter" means more restrained palette, more whitespace, more typographic air. Drama is reduced, not eliminated; the POV stays intact.
2533
+
2534
+ Operate + Read: "quieter" means reducing visual noise. Fewer background accents, flatter cards, less color, less motion. The tool should disappear more completely into the task.
2535
+
2536
+ ---
2537
+
2538
+ ## Assess Current State
2539
+
2540
+ Analyze what makes the design feel too intense:
2541
+
2542
+ 1. **Identify intensity sources**:
2543
+ - **Color saturation**: Overly bright or saturated colors
2544
+ - **Contrast extremes**: Too much high-contrast juxtaposition
2545
+ - **Visual weight**: Too many bold, heavy elements competing
2546
+ - **Animation excess**: Too much motion or overly dramatic effects
2547
+ - **Complexity**: Too many visual elements, patterns, or decorations
2548
+ - **Scale**: Everything is large and loud with no hierarchy
2549
+
2550
+ 2. **Understand the context**:
2551
+ - What's the purpose? (Marketing vs tool vs reading experience)
2552
+ - Who's the audience? (Some contexts need energy)
2553
+ - What's working? (Don't throw away good ideas)
2554
+ - What's the core message? (Preserve what matters)
2555
+
2556
+ If any of these are unclear from the codebase, do not guess. Ask the user directly to clarify what you cannot infer.
2557
+
2558
+ "Quieter" means refined and easier on the eyes, not generic. Generic quiet looks like gray text on white, one sans at a uniform weight, and a grid of identical cards; restraint still needs a point of view.
2559
+
2560
+ ## Plan Refinement
2561
+
2562
+ Create a strategy to reduce intensity while maintaining impact:
2563
+
2564
+ - **Color approach**: Desaturate or shift to more restrained tones?
2565
+ - **Hierarchy approach**: Which elements should stay bold (very few), which should recede?
2566
+ - **Simplification approach**: What can be removed entirely?
2567
+ - **Sophistication approach**: How can we signal quality through restraint?
2568
+
2569
+ Subtlety requires precision. Quiet without intent collapses to generic.
2570
+
2571
+ ## Refine the Design
2572
+
2573
+ Systematically reduce intensity across these dimensions:
2574
+
2575
+ ### Color Refinement
2576
+ - **Reduce saturation**: Shift from fully saturated to 70-85% saturation
2577
+ - **Soften palette**: Replace bright colors with muted tones
2578
+ - **Reduce color variety**: Use fewer colors more thoughtfully
2579
+ - **Neutral dominance**: Let neutrals do more work, use color as accent (10% rule)
2580
+ - **Gentler contrasts**: High contrast only where it matters most
2581
+ - **Tinted grays**: Use warm or cool tinted grays instead of pure gray. Adds depth without loudness
2582
+ - **Never gray on color**: If you have gray text on a colored background, use a darker shade of that color or transparency instead
2583
+
2584
+ ### Visual Weight Reduction
2585
+ - **Typography**: Reduce font weights (900 → 600, 700 → 500), decrease sizes where appropriate
2586
+ - **Hierarchy through subtlety**: Use weight, size, and space instead of color and boldness
2587
+ - **White space**: Increase breathing room, reduce density
2588
+ - **Borders & lines**: Reduce thickness, decrease opacity, or remove entirely
2589
+
2590
+ ### Simplification
2591
+ - **Remove decorative elements**: Gradients, shadows, patterns, textures that don't serve purpose
2592
+ - **Simplify shapes**: Reduce border radius extremes, simplify custom shapes
2593
+ - **Reduce layering**: Flatten visual hierarchy where possible
2594
+ - **Clean up effects**: Reduce or remove blur effects, glows, multiple shadows
2595
+
2596
+ ### Motion Reduction
2597
+ - **Reduce animation intensity**: Shorter distances (10-20px instead of 40px), gentler easing
2598
+ - **Remove decorative animations**: Keep functional motion, remove flourishes
2599
+ - **Subtle micro-interactions**: Replace dramatic effects with gentle feedback
2600
+ - **Refined easing**: Use ease-out-quart for smooth, understated motion. Never bounce or elastic
2601
+ - **Remove animations entirely** if they're not serving a clear purpose
2602
+
2603
+ ### Composition Refinement
2604
+ - **Reduce scale jumps**: Smaller contrast between sizes creates calmer feeling
2605
+ - **Align to grid**: Bring rogue elements back into systematic alignment
2606
+ - **Even out spacing**: Replace extreme spacing variations with consistent rhythm
2607
+
2608
+ **Avoid**:
2609
+ - Make everything the same size/weight (hierarchy still matters)
2610
+ - Remove all color (quiet ≠ grayscale)
2611
+ - Eliminate all personality (maintain character through refinement)
2612
+ - Sacrifice usability for aesthetics (functional elements still need clear affordances)
2613
+ - Make everything small and light (some anchors needed)
2614
+
2615
+ ## Verify Quality
2616
+
2617
+ Ensure refinement maintains quality:
2618
+
2619
+ - **Still functional**: Can users still accomplish tasks easily?
2620
+ - **Still distinctive**: Does it have character, or is it generic now?
2621
+ - **Better reading**: Is text easier to read for extended periods?
2622
+ - **Restrained, not absent**: Does the POV survive the cuts?
2623
+
2624
+ When the result feels right, hand off to `/impeccable polish` for the final pass.
2625
+
2626
+ ---
2627
+
2628
+ ## Appendix: typeset.md
2629
+
2630
+ Typography carries information, hierarchy, and voice. Improve it inside the established visual world; do not replace the identity unless the user asked to.
2631
+
2632
+ ---
2633
+
2634
+ ## Visitor mode
2635
+
2636
+ - **Persuade + Experience:** display type may carry the voice. Use decisive contrast and responsive scale when the composition benefits.
2637
+ - **Operate + Read:** stability, scanability, and measure come first. A single well-tuned family and fixed role scale are often right.
2638
+ - **Native:** follow [ios.md](ios.md) or [android.md](android.md), including platform scaling and accessibility behavior.
2639
+
2640
+ If typography replacement would create a new identity, route through [new-work.md](new-work.md) and update DESIGN.md. Otherwise preserve confirmed families and improve their use.
2641
+
2642
+ ## Two isolated assessments
2643
+
2644
+ When a sub-agent tool is available and permitted, run these independently; otherwise run them yourself in this order. Do not let detector findings anchor the design assessment.
2645
+
2646
+ 1. **Typographic assessment:** inspect representative pages and styles. Answer every question below with a file, selector, or computed value:
2647
+ - **Authority and fit:** Which faces, weights, and roles are established? Do they fit the product and selected world, or are they unexamined defaults? Is every family necessary?
2648
+ - **Hierarchy:** Can heading, body, label, metadata, and data roles be distinguished at a glance? Are adjacent sizes or weights too close to carry different jobs?
2649
+ - **Scale and consistency:** Is there a deliberate role scale, or a collection of arbitrary values? Do repeated roles stay identical across screens and states?
2650
+ - **Reading:** Does body copy stay within a comfortable 45–75 character measure? Are line height, paragraph rhythm, contrast, and tracking tuned to the actual face, width, language, and surface?
2651
+ - **Stress:** What happens with long headings, localization expansion, zoom, narrow containers, missing weights, and font fallback?
2652
+ - **Delivery:** Are only used assets loaded? Do fallback metrics, loading strategy, and variable-font settings avoid invisible text and disruptive reflow?
2653
+ 2. **Mechanical scan:** run:
2654
+
2655
+ ```bash
2656
+ .pi/skills/impeccable/scripts/impeccable detect --json --scope type [target files or dirs]
2657
+ ```
2658
+
2659
+ Also inspect dynamic or arbitrary font values the detector cannot interpret. Synthesize both assessments before editing, noting what each caught alone. A clean scan is a floor, not proof of good typography.
2660
+
2661
+ ## Set the system
2662
+
2663
+ Before editing, state:
2664
+
2665
+ - the roles the interface needs;
2666
+ - the intended contrast between those roles;
2667
+ - the reading measure and density;
2668
+ - which existing faces and weights are authoritative;
2669
+ - any performance, localization, or accessibility constraints.
2670
+
2671
+ Use the fewest roles and families that make the hierarchy unmistakable. Combine size, weight, space, and tone deliberately instead of asking size alone to do all the work. Role names and tokens should describe purpose rather than values.
2672
+
2673
+ ## Apply
2674
+
2675
+ - Keep body copy comfortably readable and zoomable. Use 1rem / 16px as the ordinary web body floor unless a dense role, platform convention, or user setting justifies otherwise.
2676
+ - Keep prose in the 45–75ch range. Tune line height inversely with measure: wider lines generally need more leading.
2677
+ - Compensate light text on dark surfaces on all three perceptual axes: slightly more line height, a touch more tracking, and one step more weight when the face needs it.
2678
+ - Tune line height to the face, width, language, and contrast, not a universal ratio.
2679
+ - Keep repeated roles consistent across screens and states.
2680
+ - Use numeric, tabular, code, and label features when their content benefits.
2681
+ - Load only used font assets and weights. Provide metric-compatible fallbacks and avoid blocking text.
2682
+ - Let marketing display type respond to available space when useful; keep dense product and reading surfaces spatially predictable.
2683
+ - Preserve browser zoom, user font settings, Dynamic Type, and platform text scaling.
2684
+ - Use paragraph spacing or first-line indentation as the primary paragraph rhythm; combining both usually double-marks the boundary.
2685
+
2686
+ Do not make type decorative at the expense of comprehension, or introduce a second family without a clear role it alone can perform.
2687
+
2688
+ ## Line breaks
2689
+
2690
+ After Matthew Butterick's *Practical Typography*, paraphrased; where his numbers differ from these, these stand.
2691
+
2692
+ - Set `text-wrap: balance` on headings and short centered blocks, and `text-wrap: pretty` on body copy. Both are progressive: a browser that ignores them keeps its default wrap.
2693
+ - `pretty` pulls a word down beside a lone last word. It does not fill the last line, and a two-word tail is fine.
2694
+ - In a column too narrow for either to help, edit the copy or widen the column.
2695
+ - Break a heading by hand only between phrases, and check the break at every width the heading renders at. A hard break that lands mid-line on a phone is worse than the default wrap.
2696
+ - An uneven break can carry meaning: a headline that lands on one word for weight, a poster line, a pull quote. Make it deliberate with a hard break or a wrap set on that element, and keep it rare. The detector's `straggler` and `unbalanced-heading` findings are advisory for this reason; say which breaks are intended.
2697
+
2698
+ ## Verify
2699
+
2700
+ - Primary, secondary, body, and metadata roles are recognizable without reading the copy.
2701
+ - Long text remains comfortable across relevant widths and languages.
2702
+ - The typography belongs to the product and its established world.
2703
+ - Loading does not create disruptive reflow or invisible text.
2704
+ - Zoom, text scaling, focus, contrast, and reduced viewport paths remain usable.
2705
+ - The final mechanical scan has no unexplained findings.
2706
+
2707
+ Answer each item with rendered or source evidence, then rerun the scan. Do not substitute a bare “yes” for verification.
2708
+
2709
+ When the hierarchy holds, hand off to `/impeccable polish`.
2710
+
2711
+ ## Live-mode signature params
2712
+
2713
+ Every variant declares a coarse `scale` parameter and authors its type ramp against `var(--p-scale, 1)`.
2714
+
2715
+ ```json
2716
+ {"id":"scale","kind":"range","min":0.85,"max":1.3,"step":0.05,"default":1,"label":"Scale"}
2717
+ ```
2718
+
2719
+ Add at most one pairing or weight parameter when it represents a real system choice. Follow [live.md](live.md)'s parameter contract.