@brunosps00/dev-workflow 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +48 -5
  2. package/lib/constants.js +20 -20
  3. package/lib/init.js +24 -1
  4. package/lib/migrate-skills.js +129 -0
  5. package/lib/removed-bundled-skills.js +16 -0
  6. package/lib/uninstall.js +6 -2
  7. package/lib/utils.js +43 -1
  8. package/package.json +1 -1
  9. package/scaffold/en/agent-instructions.md +68 -0
  10. package/scaffold/en/commands/dw-autopilot.md +1 -1
  11. package/scaffold/en/commands/dw-brainstorm.md +1 -1
  12. package/scaffold/en/commands/dw-bugfix.md +3 -3
  13. package/scaffold/en/commands/dw-create-techspec.md +1 -1
  14. package/scaffold/en/commands/dw-deps-audit.md +1 -1
  15. package/scaffold/en/commands/dw-fix-qa.md +1 -1
  16. package/scaffold/en/commands/dw-functional-doc.md +2 -2
  17. package/scaffold/en/commands/dw-help.md +1 -1
  18. package/scaffold/en/commands/dw-redesign-ui.md +7 -7
  19. package/scaffold/en/commands/dw-run-qa.md +4 -4
  20. package/scaffold/en/commands/dw-run-task.md +2 -2
  21. package/scaffold/en/templates/constitution-template.md +1 -1
  22. package/scaffold/pt-br/agent-instructions.md +68 -0
  23. package/scaffold/pt-br/commands/dw-autopilot.md +1 -1
  24. package/scaffold/pt-br/commands/dw-brainstorm.md +1 -1
  25. package/scaffold/pt-br/commands/dw-bugfix.md +3 -3
  26. package/scaffold/pt-br/commands/dw-create-techspec.md +1 -1
  27. package/scaffold/pt-br/commands/dw-deps-audit.md +1 -1
  28. package/scaffold/pt-br/commands/dw-fix-qa.md +1 -1
  29. package/scaffold/pt-br/commands/dw-functional-doc.md +2 -2
  30. package/scaffold/pt-br/commands/dw-help.md +1 -1
  31. package/scaffold/pt-br/commands/dw-redesign-ui.md +7 -7
  32. package/scaffold/pt-br/commands/dw-run-qa.md +4 -4
  33. package/scaffold/pt-br/commands/dw-run-task.md +2 -2
  34. package/scaffold/pt-br/templates/constitution-template.md +1 -1
  35. package/scaffold/skills/dw-council/SKILL.md +1 -1
  36. package/scaffold/skills/dw-testing-discipline/SKILL.md +148 -0
  37. package/scaffold/skills/dw-testing-discipline/references/ai-agent-gates.md +170 -0
  38. package/scaffold/skills/dw-testing-discipline/references/anti-patterns.md +336 -0
  39. package/scaffold/skills/dw-testing-discipline/references/flaky-discipline.md +163 -0
  40. package/scaffold/skills/dw-testing-discipline/references/iron-laws.md +128 -0
  41. package/scaffold/skills/dw-testing-discipline/references/playwright-recipes.md +282 -0
  42. package/scaffold/skills/dw-testing-discipline/references/positive-patterns.md +241 -0
  43. package/scaffold/skills/{webapp-testing → dw-testing-discipline}/references/security-boundary.md +1 -1
  44. package/scaffold/skills/dw-ui-discipline/SKILL.md +128 -0
  45. package/scaffold/skills/dw-ui-discipline/references/accessibility-floor.md +225 -0
  46. package/scaffold/skills/dw-ui-discipline/references/anti-slop.md +162 -0
  47. package/scaffold/skills/dw-ui-discipline/references/curated-defaults.md +195 -0
  48. package/scaffold/skills/dw-ui-discipline/references/hard-gate.md +142 -0
  49. package/scaffold/skills/dw-ui-discipline/references/state-matrix.md +101 -0
  50. package/scaffold/skills/ui-ux-pro-max/LICENSE +0 -21
  51. package/scaffold/skills/ui-ux-pro-max/SKILL.md +0 -659
  52. package/scaffold/skills/ui-ux-pro-max/data/_sync_all.py +0 -414
  53. package/scaffold/skills/ui-ux-pro-max/data/app-interface.csv +0 -31
  54. package/scaffold/skills/ui-ux-pro-max/data/charts.csv +0 -26
  55. package/scaffold/skills/ui-ux-pro-max/data/colors.csv +0 -162
  56. package/scaffold/skills/ui-ux-pro-max/data/design.csv +0 -1776
  57. package/scaffold/skills/ui-ux-pro-max/data/draft.csv +0 -1779
  58. package/scaffold/skills/ui-ux-pro-max/data/google-fonts.csv +0 -1924
  59. package/scaffold/skills/ui-ux-pro-max/data/icons.csv +0 -106
  60. package/scaffold/skills/ui-ux-pro-max/data/landing.csv +0 -35
  61. package/scaffold/skills/ui-ux-pro-max/data/products.csv +0 -162
  62. package/scaffold/skills/ui-ux-pro-max/data/react-performance.csv +0 -45
  63. package/scaffold/skills/ui-ux-pro-max/data/stacks/angular.csv +0 -51
  64. package/scaffold/skills/ui-ux-pro-max/data/stacks/astro.csv +0 -54
  65. package/scaffold/skills/ui-ux-pro-max/data/stacks/flutter.csv +0 -53
  66. package/scaffold/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +0 -56
  67. package/scaffold/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +0 -53
  68. package/scaffold/skills/ui-ux-pro-max/data/stacks/laravel.csv +0 -51
  69. package/scaffold/skills/ui-ux-pro-max/data/stacks/nextjs.csv +0 -53
  70. package/scaffold/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +0 -51
  71. package/scaffold/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +0 -59
  72. package/scaffold/skills/ui-ux-pro-max/data/stacks/react-native.csv +0 -52
  73. package/scaffold/skills/ui-ux-pro-max/data/stacks/react.csv +0 -54
  74. package/scaffold/skills/ui-ux-pro-max/data/stacks/shadcn.csv +0 -61
  75. package/scaffold/skills/ui-ux-pro-max/data/stacks/svelte.csv +0 -54
  76. package/scaffold/skills/ui-ux-pro-max/data/stacks/swiftui.csv +0 -51
  77. package/scaffold/skills/ui-ux-pro-max/data/stacks/threejs.csv +0 -54
  78. package/scaffold/skills/ui-ux-pro-max/data/stacks/vue.csv +0 -50
  79. package/scaffold/skills/ui-ux-pro-max/data/styles.csv +0 -85
  80. package/scaffold/skills/ui-ux-pro-max/data/typography.csv +0 -74
  81. package/scaffold/skills/ui-ux-pro-max/data/ui-reasoning.csv +0 -162
  82. package/scaffold/skills/ui-ux-pro-max/data/ux-guidelines.csv +0 -100
  83. package/scaffold/skills/ui-ux-pro-max/scripts/core.py +0 -262
  84. package/scaffold/skills/ui-ux-pro-max/scripts/design_system.py +0 -1148
  85. package/scaffold/skills/ui-ux-pro-max/scripts/search.py +0 -114
  86. package/scaffold/skills/ui-ux-pro-max/skills/brand/SKILL.md +0 -97
  87. package/scaffold/skills/ui-ux-pro-max/skills/design/SKILL.md +0 -302
  88. package/scaffold/skills/ui-ux-pro-max/skills/design-system/SKILL.md +0 -244
  89. package/scaffold/skills/ui-ux-pro-max/templates/base/quick-reference.md +0 -297
  90. package/scaffold/skills/ui-ux-pro-max/templates/base/skill-content.md +0 -358
  91. package/scaffold/skills/ui-ux-pro-max/templates/platforms/agent.json +0 -21
  92. package/scaffold/skills/ui-ux-pro-max/templates/platforms/augment.json +0 -18
  93. package/scaffold/skills/ui-ux-pro-max/templates/platforms/claude.json +0 -21
  94. package/scaffold/skills/ui-ux-pro-max/templates/platforms/codebuddy.json +0 -21
  95. package/scaffold/skills/ui-ux-pro-max/templates/platforms/codex.json +0 -21
  96. package/scaffold/skills/ui-ux-pro-max/templates/platforms/continue.json +0 -21
  97. package/scaffold/skills/ui-ux-pro-max/templates/platforms/copilot.json +0 -21
  98. package/scaffold/skills/ui-ux-pro-max/templates/platforms/cursor.json +0 -21
  99. package/scaffold/skills/ui-ux-pro-max/templates/platforms/droid.json +0 -21
  100. package/scaffold/skills/ui-ux-pro-max/templates/platforms/gemini.json +0 -21
  101. package/scaffold/skills/ui-ux-pro-max/templates/platforms/kilocode.json +0 -21
  102. package/scaffold/skills/ui-ux-pro-max/templates/platforms/kiro.json +0 -21
  103. package/scaffold/skills/ui-ux-pro-max/templates/platforms/opencode.json +0 -21
  104. package/scaffold/skills/ui-ux-pro-max/templates/platforms/qoder.json +0 -21
  105. package/scaffold/skills/ui-ux-pro-max/templates/platforms/roocode.json +0 -21
  106. package/scaffold/skills/ui-ux-pro-max/templates/platforms/trae.json +0 -21
  107. package/scaffold/skills/ui-ux-pro-max/templates/platforms/warp.json +0 -18
  108. package/scaffold/skills/ui-ux-pro-max/templates/platforms/windsurf.json +0 -21
  109. package/scaffold/skills/webapp-testing/SKILL.md +0 -138
  110. package/scaffold/skills/webapp-testing/assets/test-helper.js +0 -56
  111. /package/scaffold/skills/{webapp-testing → dw-testing-discipline}/references/three-workflow-patterns.md +0 -0
@@ -0,0 +1,195 @@
1
+ # Curated defaults — 10 palettes + 10 font pairings + spacing scale
2
+
3
+ Use this reference when the project has **no design authority** (no `.dw/rules/` design section, no `DESIGN.md`, no Tailwind theme tokens, no component library config).
4
+
5
+ The values below cover ~90% of cases that need a starting point. Not opinionated branding — neutral, accessible, professional defaults.
6
+
7
+ ## How to use
8
+
9
+ 1. Pick ONE palette + ONE font pairing + the spacing scale.
10
+ 2. Commit the choice to the project (`.dw/rules/<frontend>.md` design section OR a new `DESIGN.md`).
11
+ 3. From there, the project HAS a design authority; downstream `dw-ui-discipline` invocations defer to that authority.
12
+
13
+ This is bootstrap, not destination. The goal is to escape "no authority" mode within the first feature.
14
+
15
+ ## The 10 palettes
16
+
17
+ Each palette below: neutral scale (gray, slate, etc.) + 1 accent + semantic colors. All WCAG 2.2 AA compliant for body text.
18
+
19
+ ### 1. Cool Stone
20
+ - Neutrals: Tailwind `slate` (50-950)
21
+ - Accent: `#3B82F6` (blue-500) — wait, no, see Anti-Slop. Use `#0066CC` instead.
22
+ - Semantic: success `#16A34A`, warning `#D97706`, danger `#DC2626`
23
+ - **Tone:** Calm, corporate, trustworthy. Default for SaaS dashboards.
24
+
25
+ ### 2. Warm Sand
26
+ - Neutrals: Tailwind `stone` (50-950)
27
+ - Accent: `#CA8A04` (warm amber)
28
+ - Semantic: success `#16A34A`, warning `#EA580C`, danger `#DC2626`
29
+ - **Tone:** Approachable, hospitality-adjacent, organic.
30
+
31
+ ### 3. Forest Pine
32
+ - Neutrals: Tailwind `gray` (50-950)
33
+ - Accent: `#15803D` (deep green)
34
+ - Semantic: success `#16A34A`, warning `#D97706`, danger `#B91C1C`
35
+ - **Tone:** Steady, financial, sustainable.
36
+
37
+ ### 4. Plum Velvet
38
+ - Neutrals: Tailwind `zinc` (50-950)
39
+ - Accent: `#7C3AED` (violet-600)
40
+ - Semantic: success `#22C55E`, warning `#EAB308`, danger `#E11D48`
41
+ - **Tone:** Creative, premium, design-tool.
42
+
43
+ ### 5. Coral Reef
44
+ - Neutrals: Tailwind `neutral` (50-950)
45
+ - Accent: `#E11D48` (rose-600)
46
+ - Semantic: success `#16A34A`, warning `#F59E0B`, danger `#B91C1C`
47
+ - **Tone:** Energetic, consumer, retail.
48
+
49
+ ### 6. Steel Blue
50
+ - Neutrals: Tailwind `slate` (50-950)
51
+ - Accent: `#0F766E` (teal-700)
52
+ - Semantic: success `#16A34A`, warning `#D97706`, danger `#DC2626`
53
+ - **Tone:** Technical, infrastructure, devops.
54
+
55
+ ### 7. Burnt Sienna
56
+ - Neutrals: Tailwind `stone` (50-950)
57
+ - Accent: `#C2410C` (orange-700)
58
+ - Semantic: success `#15803D`, warning `#A16207`, danger `#B91C1C`
59
+ - **Tone:** Bold, news, sports.
60
+
61
+ ### 8. Ink and Paper
62
+ - Neutrals: Pure `#000` and `#FFF` with `#E5E5E5` divider
63
+ - Accent: `#000` (no accent — minimal)
64
+ - Semantic: success `#16A34A`, warning `#D97706`, danger `#DC2626`
65
+ - **Tone:** Editorial, brutalist, magazine. Pair with serif body.
66
+
67
+ ### 9. Midnight Indigo
68
+ - Neutrals: Tailwind `slate` dark-mode-first (900-50)
69
+ - Accent: `#6366F1` (indigo-500)
70
+ - Semantic: success `#22C55E`, warning `#FACC15`, danger `#EF4444`
71
+ - **Tone:** Tech-forward, dark-mode-default, on-call tooling.
72
+
73
+ ### 10. Sea Salt
74
+ - Neutrals: Tailwind `gray` cool (50-950)
75
+ - Accent: `#0891B2` (cyan-600)
76
+ - Semantic: success `#10B981`, warning `#F59E0B`, danger `#F43F5E`
77
+ - **Tone:** Fresh, healthcare, education.
78
+
79
+ ## The 10 font pairings
80
+
81
+ Each pairing: heading font / body font. All available on Google Fonts. Variable fonts where possible.
82
+
83
+ | # | Headings | Body | Tone |
84
+ |---|----------|------|------|
85
+ | 1 | Inter | Inter | Modern SaaS default. Workhorse pairing. |
86
+ | 2 | Geist Sans | Geist Sans | Vercel-aesthetic; clean, geometric. |
87
+ | 3 | Söhne (or Manrope) | Söhne (or Manrope) | Editorial-modern; replaces Inter when Inter feels overused. |
88
+ | 4 | DM Serif Display | Inter | Editorial-meets-product. Strong headlines, neutral body. |
89
+ | 5 | Fraunces | Inter | Variable serif headlines, sans body. Premium feel. |
90
+ | 6 | Source Serif 4 | Source Sans 3 | Adobe pairing; balanced editorial. |
91
+ | 7 | Space Grotesk | Inter | Slightly quirky headlines, neutral body. Tech with personality. |
92
+ | 8 | IBM Plex Serif | IBM Plex Sans | Industrial, opinionated. Good for enterprise tooling. |
93
+ | 9 | Playfair Display | Manrope | High contrast pairing; hospitality, lifestyle. |
94
+ | 10 | JetBrains Mono | Inter | Code-first products; mono for headlines and accents. |
95
+
96
+ **Anti-default reminder:** Inter / Inter is fine. Inter / Inter as the ONLY pairing you ever pick is a tell.
97
+
98
+ ## Spacing scale
99
+
100
+ Use a 4px-base scale with intentional jumps:
101
+
102
+ ```
103
+ 0: 0px
104
+ 1: 4px (tight controls, icon padding)
105
+ 2: 8px (compact spacing)
106
+ 3: 12px (default gap in form fields)
107
+ 4: 16px (default gap between blocks)
108
+ 6: 24px (section padding)
109
+ 8: 32px (large section spacing)
110
+ 12: 48px (page header / hero padding)
111
+ 16: 64px (between major sections)
112
+ 24: 96px (hero / landing block separators)
113
+ 32: 128px (rare; signature spacing)
114
+ ```
115
+
116
+ **Skip these by default:** 5, 7, 9, 10, 11, 13, 14, 15. Picking exactly 4-6-8-12-16 reads more intentional than 1-2-3-4-5-6-...
117
+
118
+ ## Border radius scale
119
+
120
+ Pick a "personality" once and use it consistently:
121
+
122
+ | Radius | Tone |
123
+ |--------|------|
124
+ | 0 (square) | Brutalist, editorial |
125
+ | 2px | Subtle modernist |
126
+ | 4px (Tailwind `rounded`) | Standard |
127
+ | 6px | Slightly friendly |
128
+ | 8px (Tailwind `rounded-lg`) | Default SaaS; **anti-default if used universally** |
129
+ | 12px | Softer, consumer |
130
+ | 16px+ | Rounded everything; friendly/youth-oriented |
131
+ | Full / 9999px | Pills, buttons, avatars only |
132
+
133
+ Don't mix more than 2 radii in one surface (e.g., 4px for inputs, 8px for cards). Three+ radii = visual noise.
134
+
135
+ ## Type scale
136
+
137
+ For body=16px baseline:
138
+
139
+ ```
140
+ xs: 12px (captions, helper text — minimum 11px)
141
+ sm: 14px (secondary, labels)
142
+ base: 16px (body)
143
+ lg: 18px (lead paragraphs)
144
+ xl: 20px (small headings)
145
+ 2xl: 24px (subheadings)
146
+ 3xl: 30px (section headings)
147
+ 4xl: 36px (page titles)
148
+ 5xl: 48px (hero, marketing)
149
+ 6xl+: 60-96px (display, marketing only)
150
+ ```
151
+
152
+ Line-height pairs:
153
+ - Body text: 1.5 to 1.6
154
+ - Headings: 1.1 to 1.25
155
+ - Buttons: 1 (tight)
156
+
157
+ ## How to commit a choice
158
+
159
+ After picking a palette + pairing + spacing, write `.dw/rules/<frontend>.md` (or `DESIGN.md`) with:
160
+
161
+ ```markdown
162
+ ## Design System (bootstrap)
163
+
164
+ **Source:** Curated default — `dw-ui-discipline/references/curated-defaults.md`, picked Cool Stone + Inter/Inter + 4px-base scale on 2026-05-12.
165
+
166
+ ### Colors
167
+ - Neutrals: Tailwind slate (50-950)
168
+ - Accent: #0066CC (links, primary buttons, focus rings)
169
+ - Success: #16A34A · Warning: #D97706 · Danger: #DC2626
170
+
171
+ ### Typography
172
+ - Headings: Inter, weight 600-700
173
+ - Body: Inter, weight 400-500
174
+ - Mono: JetBrains Mono (code blocks only)
175
+
176
+ ### Spacing
177
+ 4px base scale: 4 / 8 / 12 / 16 / 24 / 32 / 48 / 64 / 96.
178
+
179
+ ### Border radius
180
+ 4px on inputs, 8px on cards, full on pills/avatars.
181
+
182
+ ### Updates
183
+ This file is the canonical design source. To change a value, propose a PR
184
+ that updates this file FIRST, then propagates through code.
185
+ ```
186
+
187
+ Once written, `dw-ui-discipline` reads this file instead of `curated-defaults.md`. The bootstrap step is done.
188
+
189
+ ## What this catalog is NOT
190
+
191
+ - Not 161 palettes. Not 57 fonts. By design.
192
+ - Not a substitute for brand work — for a serious product, hire a designer.
193
+ - Not opinionated about industry-specific aesthetics (med-tech, gaming, kids' content). Those need real design pass.
194
+
195
+ The point is: have ONE intentional starting point so the agent isn't reaching for `#3B82F6` and `rounded-lg`. Project-specific design follows.
@@ -0,0 +1,142 @@
1
+ # The hard-gate protocol — full version
2
+
3
+ Four checkpoints before any UI work touches code. Each has a concrete output. Don't proceed without finishing the current one.
4
+
5
+ ## Why a gate at all
6
+
7
+ Training-data defaults are the enemy. An LLM proposing UI without grounding will:
8
+ - Reach for `#3B82F6` blue and `rounded-lg` because they appeared 10M times in training data.
9
+ - Default to glass morphism, gradient backgrounds, and center-aligned everything because those screenshots dominate the web.
10
+ - Skip empty/error states because happy-path screenshots are the most common training signal.
11
+
12
+ The gate forces grounding in this project's reality before training-data autopilot fires.
13
+
14
+ ## Checkpoint 1: Brand authorities OR curated defaults
15
+
16
+ **Goal:** know where visual decisions come from. Documented authority, or curated default — never invented.
17
+
18
+ **How:**
19
+
20
+ 1. Search the project for design source-of-truth:
21
+ - `.dw/rules/*.md` — look for "Design", "Patterns to Follow", "Naming Conventions" sections.
22
+ - `DESIGN.md`, `BRAND.md`, `BRANDING.md`, `STYLE_GUIDE.md` at root.
23
+ - Tailwind `tailwind.config.{ts,js}` — theme tokens.
24
+ - CSS variables in `globals.css`, `theme.css`, `tokens.css`.
25
+ - Component library config (shadcn `components.json`, MUI theme, Chakra theme).
26
+ - Storybook stories — implicit canonical components.
27
+
28
+ 2. If **at least one** authority exists: it wins. Decisions defer to it. If a needed token doesn't exist (e.g., a danger-secondary color), propose adding it to the authority FIRST, not inline.
29
+
30
+ 3. If **none exists**: pick a curated default. Read `curated-defaults.md` in this references folder. Pick one of the 10 palettes + one of the 10 font pairings. Mark the choice in the techspec/PR description:
31
+
32
+ > **Design source:** No project authority found. Using curated default "Cool Stone" (neutral grays + electric blue accent) + "Inter / Source Serif" pairing. Recommend establishing `DESIGN.md` to formalize.
33
+
34
+ **Anti-patterns at this checkpoint:**
35
+
36
+ - Inventing color hex values inline (`bg-[#FF6B35]`).
37
+ - "I'll use Tailwind defaults" — Tailwind defaults are training-data defaults, not project authority.
38
+ - Copying values from "a site I like" without understanding what it solved.
39
+
40
+ **Output:** A one-sentence note in the techspec/PR describing the authority consulted.
41
+
42
+ ## Checkpoint 2: Surface job sentence
43
+
44
+ **Goal:** the user's intent at this surface, stated in one specific sentence.
45
+
46
+ **Format:** "This surface helps the user **<verb-phrase>** so that **<outcome>**."
47
+
48
+ **Examples — good:**
49
+
50
+ - "This surface helps the user filter overdue invoices so they can chase late payers in under 30 seconds."
51
+ - "This surface helps the on-call engineer diagnose which deploy caused the spike so they can roll back without paging the team."
52
+ - "This surface helps the manager approve or reject expense reports without leaving Slack."
53
+
54
+ **Examples — bad:**
55
+
56
+ - "This surface displays invoice data." (no user, no outcome)
57
+ - "Settings page for managing the account." (vague, no specificity)
58
+ - "Dashboard." (one word)
59
+
60
+ **How to push back when the brief is vague:**
61
+
62
+ If the requester can't articulate the job, the requirements aren't ready. Reply with: "Before I design this surface, I need the job sentence: <example>. Can you fill in the verb-phrase and outcome?"
63
+
64
+ Designing without this sentence produces generic surfaces — the "just another dashboard" outcome.
65
+
66
+ **Output:** The one-sentence job, committed to the techspec/PR description.
67
+
68
+ ## Checkpoint 3: Complete state matrix
69
+
70
+ **Goal:** enumerate every state the surface can be in, BEFORE designing for the happy path.
71
+
72
+ **Minimum states (always enumerate):**
73
+
74
+ | State | Trigger | What user sees |
75
+ |-------|---------|---------------|
76
+ | `default` | First load, no interaction | Initial render |
77
+ | `hover` | Cursor over interactive element | Visual feedback |
78
+ | `active` | Click in progress | Pressed/depressed visual |
79
+ | `focus-visible` | Keyboard tab arrived | Distinct outline, not the same as hover |
80
+ | `disabled` | Interaction unavailable | Reduced opacity + cursor change, NO action |
81
+ | `loading` | Async operation in flight | Skeleton, spinner, or progress — context-appropriate |
82
+ | `empty` | No data to show | Guidance on what to do next |
83
+ | `error` | Operation failed | What broke + how to recover |
84
+ | `success` | Operation succeeded | Confirmation that doesn't require ack |
85
+
86
+ **Add domain-specific states as needed:**
87
+
88
+ - Read/unread (notifications, messages)
89
+ - Online/offline (chat, collaborative tools)
90
+ - Stale/fresh (dashboards with cached data)
91
+ - Pending/approved/rejected (workflow states)
92
+ - New/saved/dirty (forms)
93
+
94
+ **Tripwire:** if the design has only `default`, you missed 8 states. If it has `default` + `loading`, you missed 6. The full matrix is non-negotiable.
95
+
96
+ **Output:** A state matrix table in the techspec or design doc.
97
+
98
+ ## Checkpoint 4: Scene sentence
99
+
100
+ **Goal:** the physical context the surface lives in.
101
+
102
+ **Format:** "**<Who>** uses this **<where>** in **<what light>** while **<what mood>**."
103
+
104
+ **Examples — good:**
105
+
106
+ - "An on-call engineer uses this on a dark-room laptop at 3am while troubleshooting a fire."
107
+ - "A field nurse uses this on a phone in bright outdoor light while juggling clipboards."
108
+ - "A receptionist uses this on a 24" monitor at a busy front desk while talking to a visitor."
109
+
110
+ **Why this matters:**
111
+
112
+ Decisions cascade from the scene:
113
+ - 3am dark room → dark mode, high contrast, no flashing animations.
114
+ - Bright outdoor → minimum 7:1 contrast, larger touch targets, no thin fonts.
115
+ - Busy front desk → glanceable info, no nested menus, big numbers.
116
+
117
+ Without the scene, defaults take over: light mode, default contrasts, animations, regular touch targets. Production users hate it; you can't articulate why.
118
+
119
+ **Output:** Scene sentence in the techspec.
120
+
121
+ ## What "passing the gate" looks like
122
+
123
+ A PR description / techspec UI section that includes:
124
+
125
+ ```markdown
126
+ ## UI Discipline Gate
127
+
128
+ **Authority:** `.dw/rules/frontend.md` design tokens (Tailwind theme + custom CSS vars).
129
+ **Surface job:** Helps on-call engineers diagnose which deploy caused the latency spike so they can roll back without paging the team.
130
+ **State matrix:**
131
+ - default, hover, active, focus-visible, disabled, loading, empty (no spikes detected), error (metrics API down), success (rollback completed)
132
+ - Plus: stale (>5min old data) — show timestamp + refresh CTA.
133
+ **Scene:** On-call engineer uses this on a dark-room laptop at 3am while troubleshooting a production fire.
134
+ ```
135
+
136
+ This is the minimum disclosure. Anything less and the gate didn't pass.
137
+
138
+ ## When this gate has been run
139
+
140
+ The downstream skills (`anti-slop.md`, `state-matrix.md`, `accessibility-floor.md`) assume gate passed. They won't re-verify; if you skipped, you get bad output.
141
+
142
+ `/dw-code-review` failing verdict on a UI PR where this disclosure is missing.
@@ -0,0 +1,101 @@
1
+ # State matrix — enumerate before designing the happy path
2
+
3
+ The single biggest UI bug factory: designing for the default state, shipping it, and discovering empty/error/loading at production time. This reference enforces enumeration BEFORE design.
4
+
5
+ ## The mandatory minimum (every interactive surface)
6
+
7
+ | State | When it fires | Visual rule | Common mistake |
8
+ |-------|---------------|-------------|----------------|
9
+ | `default` | First load, no interaction | Calm baseline; nothing competes with content | Designing only this state |
10
+ | `hover` | Cursor over interactive element | Subtle change signals click affordance | Hover on non-clickable shapes (fake interactivity) |
11
+ | `active` | Click in progress (mouse down) | Distinct from hover; pressed/depressed | Skipping; click feels unresponsive |
12
+ | `focus-visible` | Keyboard tab arrives | Distinct outline, NOT same as hover | Using `outline: none` and not replacing |
13
+ | `disabled` | Interaction unavailable | Reduced opacity + cursor change; no on-click | Looks like enabled, confuses user |
14
+ | `loading` | Async operation in flight | Skeleton/spinner sized to incoming content | Generic spinner regardless of context |
15
+ | `empty` | No data to show | Why-it's-empty + what-to-do-next CTA | "No items found." centered, full stop |
16
+ | `error` | Operation failed | What broke + how to recover + retry CTA | Generic "Something went wrong." |
17
+ | `success` | Operation succeeded | Brief confirmation; auto-dismiss when safe | Toast spam |
18
+
19
+ ## Common domain states
20
+
21
+ Add these when the surface has matching semantics:
22
+
23
+ | State | Surfaces | Visual rule |
24
+ |-------|----------|-------------|
25
+ | `read` / `unread` | Notifications, messages, inbox | Weight differential; new is bolder |
26
+ | `online` / `offline` / `connecting` | Chat, presence indicators | Color dot + label; offline is visually quieter |
27
+ | `stale` / `fresh` | Dashboards with cached data | Timestamp + refresh CTA when stale > N min |
28
+ | `pending` / `approved` / `rejected` | Workflow records | Color-coded badges; never color alone (a11y) |
29
+ | `draft` / `saved` / `dirty` | Forms, editors | Indicator near save button; "unsaved changes" |
30
+ | `new` / `existing` | Composers, dialogs | Title and CTA wording differ ("Create" vs "Update") |
31
+ | `partial` / `complete` | Multi-step flows | Progress indicator; remaining steps visible |
32
+ | `selected` / `unselected` | Lists with multi-select | Border + bg change + checkbox mark |
33
+ | `expired` / `active` | Tokens, subscriptions | Visual deemphasis when expired + revocation CTA |
34
+
35
+ ## Loading state granularity (don't just pick "spinner")
36
+
37
+ | Operation duration | Right loading treatment |
38
+ |--------------------|-------------------------|
39
+ | <300ms | Show nothing. Spinner appearing then vanishing = flicker. |
40
+ | 300ms – 2s | Skeleton loader matching content shape |
41
+ | 2s – 10s | Spinner + status text ("Loading orders...") |
42
+ | 10s – 60s | Progress bar with percentage + cancel button |
43
+ | >60s | Step indicator OR async with notify-when-done |
44
+
45
+ A spinner that runs forever with no progress info is one of the worst UX patterns. If the operation can take >10s, show progress; if it can take >60s, make it background-able.
46
+
47
+ ## Error state granularity
48
+
49
+ Errors are not all equal:
50
+
51
+ | Error type | Treatment |
52
+ |------------|-----------|
53
+ | Validation (client-side, single field) | Inline below field; red text + icon |
54
+ | Validation (form-level) | Summary at top + per-field inline |
55
+ | Authorization (401/403) | Modal or banner; sign-in CTA |
56
+ | Not found (404) | Inline empty-state variant with "go back" |
57
+ | Server error (5xx) | Banner with retry button; preserve user input |
58
+ | Network timeout | Inline message + auto-retry button |
59
+ | Partial data | Show what loaded + indicator for what failed |
60
+
61
+ Generic "Something went wrong" is the lazy default. Categorize the failure; show actionable guidance.
62
+
63
+ ## Empty state granularity
64
+
65
+ Empty is not always "no data ever existed":
66
+
67
+ | Empty reason | Treatment |
68
+ |--------------|-----------|
69
+ | Genuinely first-time empty (new user) | Welcoming illustration + onboarding CTA |
70
+ | Filter excluded everything | Show filter chips + "Clear filters" CTA |
71
+ | Search returned nothing | Echo the query + spelling suggestions / refinement tips |
72
+ | All items completed / archived | Acknowledge + "View archived" CTA |
73
+ | Permissions block visibility | Explain (don't pretend it's empty) + request-access CTA |
74
+ | Loading hasn't completed | This is `loading`, not `empty` — different state |
75
+
76
+ ## Verification checklist
77
+
78
+ Before declaring the design "done":
79
+
80
+ - [ ] All 9 minimum states are designed (not just default).
81
+ - [ ] All applicable domain states are designed.
82
+ - [ ] Loading granularity matches operation duration.
83
+ - [ ] Error states are categorized (not all "something went wrong").
84
+ - [ ] Empty states explain WHY and offer WHAT to do.
85
+ - [ ] `disabled` state has visual + cursor differentiation, NO on-click handler.
86
+ - [ ] `focus-visible` is distinct from `hover` (keyboard users need their own affordance).
87
+ - [ ] Color is never the SOLE differentiator (a11y); pair with shape/text/position.
88
+
89
+ ## Integration with `/dw-code-review`
90
+
91
+ Review fails verdict (REJECTED) on a UI PR when:
92
+ - A new component handles async data but renders only the default state.
93
+ - An interactive element has `:hover` but no `:focus-visible`.
94
+ - An error path falls through to a generic message with no recovery action.
95
+ - Loading state is a spinner where the operation takes >2s (should be progress).
96
+
97
+ These are not stylistic preferences — they're production bugs waiting to surface.
98
+
99
+ ## Anti-pattern: "We'll add states later"
100
+
101
+ Empirically: states added later are added under duress (after a user reports). The cost of designing them now is small (15-30 minutes for a component); the cost of finding them in production is large (user trust + incident response). The matrix is non-negotiable.
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 Next Level Builder
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.