@blackbelt-technology/frontend-mockup-loop 0.5.4

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.
@@ -0,0 +1,13 @@
1
+ {
2
+ "system": "shadcn",
3
+ "label": "shadcn/ui boolean rubric",
4
+ "checks": [
5
+ { "id": "tokens", "text": "Colors, radii, and spacing trace to shadcn CSS variables (no raw hex/px literals)." },
6
+ { "id": "radius", "text": "Corner rounding uses --radius scale, consistent across cards/buttons/inputs." },
7
+ { "id": "neutral-palette", "text": "Neutral, restrained palette — no default-average purple gradient hero." },
8
+ { "id": "contrast", "text": "Text meets WCAG AA contrast in both light and dark." },
9
+ { "id": "focus-ring", "text": "Interactive elements show a visible --ring focus state." },
10
+ { "id": "hierarchy", "text": "One clear focal point per screen; intentional emphasis." },
11
+ { "id": "spacing-rhythm", "text": "Spacing rhythm from the 4/8px scale, not eyeballed gaps." }
12
+ ]
13
+ }
@@ -0,0 +1,256 @@
1
+ # UX Best Practices — the expert designer's ground truth
2
+
3
+ > **Stance: act as an expert UX designer.** Every design decision in the loop
4
+ > must be **grounded in an externally documented, public-facing design rule**,
5
+ > not invented. When you make a UX call, you should be able to name the rule and
6
+ > cite its public source. "I think it looks better" is not a reason; "Hick's Law
7
+ > — reduce the choices at this decision point (lawsofux.com/hicks-law)" is.
8
+ >
9
+ > **Adapt, don't copy.** Adapt the *principle* from the source to the current
10
+ > product and its selected design system. Prefer freely-licensed public sources
11
+ > (USWDS is CC0; GOV.UK is OGL; Material/Carbon are Apache-2.0). Cite NN/g and
12
+ > Laws of UX with attribution. Never copy proprietary assets/text (Apple HIG,
13
+ > Refactoring UI, Mobbin) — adapt their principles only.
14
+
15
+ This reference is the rule corpus the `frontend-mockup-loop` skill consults. It
16
+ is organized as: (1) source hierarchy, (2) universal laws & heuristics,
17
+ (3) component pattern rules, (4) the expert evaluation protocol, (5) the
18
+ checkable rubric seed, (6) the sources index.
19
+
20
+ ---
21
+
22
+ ## 1. Source hierarchy — what to adapt, in licensing-safe order
23
+
24
+ | Tier | Source | Adapt for | Licence |
25
+ |---|---|---|---|
26
+ | 1 | **USWDS** — patterns-as-recipes + 7 principles | task patterns (forms, addresses, usernames) | **CC0 / public domain** |
27
+ | 1 | **GOV.UK Design System + Service Manual + Style Guide** | task patterns, error summary, plain language | MIT + Open Government Licence |
28
+ | 2 | **NN/g** — 10 Usability Heuristics + pattern articles | the vendor-neutral principles layer | free articles, cite |
29
+ | 2 | **Laws of UX** (lawsofux.com) | cognitive laws → concrete UI rules | free, cite |
30
+ | 2 | **Material Design 3** | adaptive layout, interaction states, content | Apache-2.0 |
31
+ | 2 | **IBM Carbon** | per-component "when to use / when not" | Apache-2.0 |
32
+ | 3 | **Shopify Polaris — Content** | UX writing, error-message wording | free public docs |
33
+ | 3 | **Mailchimp Content Style Guide** | voice vs tone framework | openly published |
34
+ | 4 | **Apple HIG**, Refactoring UI, Smart Interface Design Patterns, Mobbin | principles/inspiration only | proprietary/paid — never copy |
35
+
36
+ **Default rule:** when a project has a selected design system (Material, MUI,
37
+ Fluent, Apple HIG…), that system's documented guidance is the *first* source to
38
+ adapt. The universal laws below fill the gaps the system does not cover.
39
+
40
+ ---
41
+
42
+ ## 2. Universal laws & heuristics
43
+
44
+ ### 2a. Nielsen's 10 Usability Heuristics
45
+ Canonical source: https://www.nngroup.com/articles/ten-usability-heuristics/
46
+
47
+ 1. **Visibility of system status** — every action/state shows timely feedback (loading/success/error).
48
+ 2. **Match between system and real world** — plain language, real-world conventions, logical order.
49
+ 3. **User control & freedom** — a marked exit: undo, cancel, back.
50
+ 4. **Consistency & standards** — same words/actions mean the same thing; follow platform norms.
51
+ 5. **Error prevention** — constrain inputs, sensible defaults, confirm risky actions.
52
+ 6. **Recognition rather than recall** — needed info visible on-screen, not memorized across screens.
53
+ 7. **Flexibility & efficiency** — accelerators for experts (shortcuts, saved views, bulk actions).
54
+ 8. **Aesthetic & minimalist design** — one primary action per screen; cut everything that does not serve the goal.
55
+ 9. **Help users recognize, diagnose, recover from errors** — plain-language errors stating cause + fix, no codes.
56
+ 10. **Help & documentation** — contextual, task-focused help where complex actions occur.
57
+
58
+ ### 2b. Laws of UX (highest-leverage)
59
+ Source: https://lawsofux.com/
60
+
61
+ - **Jakob's Law** — users prefer your site to work like the others they know → follow conventions (logo top-left → home, search top-right).
62
+ - **Fitts's Law** — targets large + close; primary CTA big and reachable (≥44px).
63
+ - **Hick's Law** — decision time grows with choices → limit/group options, progressive disclosure.
64
+ - **Miller's Law** — working memory ~7±2 → chunk long sequences (phone/card numbers, nav).
65
+ - **Tesler's Law** — irreducible complexity must live somewhere → the system absorbs it (smart defaults), not the user.
66
+ - **Postel's Law** — accept liberal input (phone with/without spaces), normalize internally.
67
+ - **Von Restorff (Isolation)** — the different item is remembered → exactly one isolated focal action per view.
68
+ - **Doherty Threshold** — keep interaction < 400ms or show feedback → optimistic UI, skeletons.
69
+ - **Goal-Gradient / Zeigarnik** — show progress, front-loaded, for multi-step flows.
70
+ - **Aesthetic-Usability Effect** — polished UI is perceived as more usable → meet a baseline visual bar (alignment, spacing, type scale).
71
+
72
+ ### 2c. Gestalt principles (grouping)
73
+ - **Proximity** — within-group spacing tighter than between-group spacing.
74
+ - **Similarity** — same-function elements share visual style.
75
+ - **Common region** — related items enclosed in a shared container/border/background.
76
+ - **Continuity** — related items aligned along a grid/baseline.
77
+ - **Figure/ground** — the focal element clearly separated from background (modal + dimmed overlay, elevation).
78
+
79
+ ### 2d. Cognitive load
80
+ Source: https://www.nngroup.com/articles/minimize-cognitive-load/
81
+ - **Eliminate extraneous load** — every on-screen element must serve the current goal (the core UX job).
82
+ - Offload memory to the interface (recognition > recall), chunk (Miller), reuse established patterns (Jakob), defer secondary options (progressive disclosure), keep responses < 400ms (Doherty).
83
+
84
+ ---
85
+
86
+ ## 3. Component pattern rules (each is a checkable do/don't)
87
+
88
+ ### Forms & validation
89
+ Sources: NN/g web-form-design, Baymard inline-validation, GOV.UK.
90
+ - Persistent **label above the field**; never placeholder-as-label (it disappears, breaks recall).
91
+ - **Single-column** layout (exception: short grouped fields like City/State/Zip).
92
+ - Inline-validate **on blur / submit, not per-keystroke**; confirm success.
93
+ - Mark the **minority class** explicitly ("(optional)"); cut optional fields.
94
+ - **Match input type/control to data** (radios ≤3 options; correct mobile keyboard via `type`).
95
+ - State format/requirements **up front**; no Reset/Clear buttons.
96
+ - **CTA = specific verb** ("Create account"), never "Submit"/"OK".
97
+
98
+ ### Navigation & IA
99
+ Sources: NN/g hamburger-menus, breadcrumbs, navigation-cognitive-strain.
100
+ - Desktop primary nav **visible** (not hidden behind a hamburger when space allows).
101
+ - Mobile **tab bar 3–5 core destinations**; overflow → "More".
102
+ - **Breadcrumbs reflect hierarchy, not history**; last node = current page, **unlinked**.
103
+ - Global nav in the **same place every page**; mark the **active/current** item.
104
+ - **Descriptive, literal labels** (information scent) over clever names.
105
+
106
+ ### Error handling & messaging
107
+ Sources: NN/g error-message-guidelines, confirmation-dialog; GOV.UK error-summary.
108
+ - **Prevent first** (constraints, defaults, confirm before irreversible).
109
+ - Plain language (~7–8th-grade), **no raw codes**; say **what went wrong AND how to fix it**.
110
+ - Show errors **inline at the field** + a **top error summary** that links to each failing field (multi-field forms).
111
+ - Convey errors by **more than color** (icon + text + outline); **preserve the user's input**.
112
+ - **Prefer undo over confirm**; confirm only destructive/irreversible actions. Never blame the user.
113
+
114
+ ### Empty states & onboarding
115
+ Sources: NN/g empty-state, progressive-disclosure, onboarding-tutorials; Carbon.
116
+ - Name the **value/outcome**, not the feature; show the **shape of success** (ghost rows).
117
+ - **One** primary CTA (+ at most one escape hatch like "import sample data").
118
+ - **Progressive disclosure**: show the few most important options first.
119
+ - Onboarding **skippable/deferrable**, contextual just-in-time help, not a forced upfront tour.
120
+
121
+ ### Loading & feedback
122
+ Source: NN/g response-times (0.1s / 1s / 10s limits); Doherty Threshold.
123
+ - **< 0.1s** instantaneous → no spinner (avoids flicker).
124
+ - **< 1s** preserves flow; beyond ~1s show a busy indicator.
125
+ - **> 10s** show a **determinate percent-done + cancel**.
126
+ - **Skeletons** for full-page/content layout loads; **spinners** for short blocking actions.
127
+ - **Optimistic UI** for high-confidence quick actions, with rollback on failure.
128
+
129
+ ### Data display
130
+ Source: NN/g data-tables, infinite-scrolling-when.
131
+ - Design the table around the **task** (lookup/compare/scan/act).
132
+ - Treat **density as a feature** (compact/comfortable modes).
133
+ - **Pagination with visible position** for find tasks; **infinite scroll only for exploratory feeds**.
134
+ - Sort + filter + in-page search; **sticky headers**; **right-align numbers**; truncate-with-tooltip.
135
+
136
+ ### Modals, notifications, microcopy
137
+ Sources: NN/g modal-nonmodal, ui-copy; Material snackbar.
138
+ - **Modal only when the user must focus/decide before continuing**; else inline/non-blocking.
139
+ - Toasts for **transient non-critical** feedback (~4–6s); **never auto-dismiss critical errors**.
140
+ - **Button labels = outcome verbs** ("Delete photo" / "Keep photo"), not "Yes/No/OK".
141
+ - Each modal/dialog has **one visually-primary action**; cancel is visually subordinate.
142
+
143
+ ---
144
+
145
+ ## 4. Expert-UX evaluation protocol (run on every mockup)
146
+
147
+ A 5-step review combining heuristic evaluation + accessibility floor + boolean
148
+ rubric + severity rating. **The model never emits the final number — scores are
149
+ derived in code.** (LLM design scores skew positive and are noisy on floats;
150
+ decompose into yes/no checks + rationale-before-verdict, aggregate in code.)
151
+
152
+ **Step 1 — Accessibility floor (HARD GATE · deterministic).**
153
+ Run axe-core in a real browser + compute target-size (≥24px AA / 44px AAA),
154
+ focus-visible, contrast 4.5:1, `prefers-reduced-motion`, viewport/zoom not
155
+ disabled, color-not-sole-channel. Any WCAG-AA failure = blocking defect
156
+ (severity ≥3). Sources: https://www.w3.org/TR/WCAG22/ · https://www.w3.org/WAI/ARIA/apg/
157
+
158
+ **Step 2 — Heuristic boolean rubric (advisory inputs → code-derived score).**
159
+ Score the 10 Nielsen heuristics as yes/no items. For a declared user flow, also
160
+ run the **cognitive-walkthrough 4 questions per step** (goal? notice action?
161
+ associate action with effect? see feedback?). Any "No" = a defect. Multi-pass to
162
+ emulate 3–5 independent evaluators. Source:
163
+ https://www.nngroup.com/articles/how-to-conduct-a-heuristic-evaluation/
164
+
165
+ **Step 3 — PURE friction scoring (deterministic rollup).**
166
+ Rate each task step 1 (green) / 2 (yellow) / 3 (red). Task score = Σ steps; task
167
+ **color = worst step** (one red ⇒ red). Source: https://measuringu.com/pure/
168
+
169
+ **Step 4 — Severity rating 0–4 per defect (schema-locked).**
170
+ Nielsen scale: 0 none · 1 cosmetic · 2 minor · 3 major · 4 catastrophe
171
+ (= frequency × impact × persistence). Map via fixed rubric, not a free float.
172
+ Source: https://www.nngroup.com/articles/how-to-rate-the-severity-of-usability-problems/
173
+
174
+ **Step 5 — Prioritized fix list (deterministic ordering).**
175
+ Sort defects: accessibility-gate first, then severity desc, then frequency. Emit
176
+ `{location, heuristic/criterion, severity, fix, check-type}`. **Block "pass"
177
+ while any severity-4 or WCAG-AA failure remains**; feed the rest into the
178
+ mockup→test→fix→learn loop.
179
+
180
+ ---
181
+
182
+ ## 5. UX rubric seed — the checkable rules (assert TRUE)
183
+
184
+ Use these as the boolean checks in `score_mockup` / `validate_mockup`. Each is
185
+ derived from a cited rule above; score = passed / N, computed in code.
186
+
187
+ **Accessibility floor (deterministic, gate):**
188
+ 1. Text contrast ≥ 4.5:1 (3:1 for large text); UI/non-text ≥ 3:1.
189
+ 2. Interactive targets ≥ 24×24px (AA); primary actions ≥ 44×44px.
190
+ 3. Visible focus indicator on every focusable element.
191
+ 4. State/errors conveyed by more than color (icon/text/outline).
192
+ 5. `prefers-reduced-motion` honored; zoom not disabled.
193
+
194
+ **Heuristics & layout (boolean rubric):**
195
+ 6. Exactly one visually-dominant primary action per view (Von Restorff + H8).
196
+ 7. Every async/state-changing action shows status < 1s (H1 + Doherty).
197
+ 8. Every destructive/multi-step action is reversible (undo) or confirm-gated (H3/H5).
198
+ 9. Repeated components and terms use one consistent pattern (H4 + Similarity).
199
+ 10. Within-group spacing tighter than between-group (Proximity); related items enclosed (Common region).
200
+ 11. No element on screen fails to serve the current goal (H8 + extraneous load).
201
+ 12. Core patterns match platform conventions — logo top-left, search top-right (Jakob + H2).
202
+
203
+ **Component patterns (boolean rubric):**
204
+ 13. Every input has a persistent associated label (not placeholder-only).
205
+ 14. Forms are single-column at mobile width.
206
+ 15. Primary CTA/submit label starts with an action verb (not "Submit/OK").
207
+ 16. Inline validation fires on blur/submit, not per-keystroke.
208
+ 17. Mobile primary nav (tab bar) has ≤ 5 items; desktop nav is visible.
209
+ 18. Field error text states a fix, not just "invalid"; multi-field forms show a linked error summary.
210
+ 19. Zero-data screen has exactly one primary CTA; onboarding is skippable.
211
+ 20. Operations > 10s show a determinate progress indicator + cancel; sub-100ms show none.
212
+ 21. Large/sortable tables keep a sticky header; numeric columns right-aligned.
213
+ 22. Multi-step flows show a progress indicator, front-loaded (Goal-Gradient/Zeigarnik).
214
+
215
+ ---
216
+
217
+ ## 6. Sources index (public, citable)
218
+
219
+ **Principles & laws**
220
+ - NN/g 10 Usability Heuristics — https://www.nngroup.com/articles/ten-usability-heuristics/
221
+ - NN/g Cognitive Load — https://www.nngroup.com/articles/minimize-cognitive-load/
222
+ - NN/g Heuristic Evaluation method + severity — https://www.nngroup.com/articles/how-to-conduct-a-heuristic-evaluation/ · https://www.nngroup.com/articles/how-to-rate-the-severity-of-usability-problems/
223
+ - Laws of UX — https://lawsofux.com/
224
+ - PURE method — https://measuringu.com/pure/ · https://www.nngroup.com/articles/pure-method/
225
+
226
+ **Task patterns & content (freely adaptable)**
227
+ - USWDS patterns + principles (CC0) — https://designsystem.digital.gov/patterns/ · https://designsystem.digital.gov/design-principles/
228
+ - GOV.UK Design System patterns (OGL) — https://design-system.service.gov.uk/patterns/
229
+ - GOV.UK Service Manual — https://www.gov.uk/service-manual/design
230
+ - GOV.UK Content Style Guide — https://www.gov.uk/guidance/style-guide
231
+ - Material 3 foundations + content — https://m3.material.io/foundations
232
+ - IBM Carbon — https://carbondesignsystem.com/
233
+ - Shopify Polaris content — https://polaris-react.shopify.com/content
234
+ - Mailchimp Content Style Guide — https://styleguide.mailchimp.com/
235
+ - UI-Patterns (problem→solution) — https://ui-patterns.com/patterns
236
+
237
+ **Component best-practice articles**
238
+ - NN/g web-form-design — https://www.nngroup.com/articles/web-form-design/
239
+ - Baymard inline validation — https://baymard.com/blog/inline-form-validation
240
+ - NN/g error-message guidelines — https://www.nngroup.com/articles/error-message-guidelines/
241
+ - GOV.UK error summary — https://design-system.service.gov.uk/components/error-summary/
242
+ - NN/g empty-state — https://www.nngroup.com/articles/empty-state-interface-design/
243
+ - NN/g progressive disclosure — https://www.nngroup.com/articles/progressive-disclosure/
244
+ - NN/g response times — https://www.nngroup.com/articles/response-times-3-important-limits/
245
+ - NN/g skeleton screens — https://www.nngroup.com/articles/skeleton-screens/
246
+ - NN/g data tables — https://www.nngroup.com/articles/data-tables/
247
+ - NN/g hamburger menus — https://www.nngroup.com/articles/hamburger-menus/
248
+ - NN/g breadcrumbs — https://www.nngroup.com/articles/breadcrumbs/
249
+ - NN/g modal vs non-modal — https://www.nngroup.com/articles/modal-nonmodal-dialog/
250
+ - NN/g UI copy — https://www.nngroup.com/articles/ui-copy/
251
+
252
+ **Accessibility & inclusive design**
253
+ - WCAG 2.2 — https://www.w3.org/TR/WCAG22/ · What's new — https://www.w3.org/WAI/standards-guidelines/wcag/new-in-22/
254
+ - ARIA Authoring Practices (APG) — https://www.w3.org/WAI/ARIA/apg/
255
+ - Microsoft Inclusive Design — https://inclusive.microsoft.design/
256
+ - GOV.UK making your service inclusive — https://www.gov.uk/service-manual/design/making-your-service-more-inclusive