nightytidy 0.3.7 → 0.3.9

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 (37) hide show
  1. package/bin/nightytidy.js +1 -1
  2. package/package.json +1 -1
  3. package/src/agent/git-integration.js +4 -1
  4. package/src/claude.js +1 -1
  5. package/src/prompts/manifest.json +138 -138
  6. package/src/prompts/steps/02-test-coverage.md +181 -181
  7. package/src/prompts/steps/03-test-hardening.md +181 -181
  8. package/src/prompts/steps/04-test-architecture.md +130 -130
  9. package/src/prompts/steps/05-test-consolidation.md +165 -165
  10. package/src/prompts/steps/06-test-quality.md +211 -211
  11. package/src/prompts/steps/07-api-design.md +165 -165
  12. package/src/prompts/steps/08-security-sweep.md +207 -207
  13. package/src/prompts/steps/09-dependency-health.md +217 -217
  14. package/src/prompts/steps/10-codebase-cleanup.md +189 -189
  15. package/src/prompts/steps/11-crosscutting-concerns.md +196 -196
  16. package/src/prompts/steps/12-file-decomposition.md +263 -263
  17. package/src/prompts/steps/13-code-elegance.md +329 -329
  18. package/src/prompts/steps/14-architectural-complexity.md +297 -297
  19. package/src/prompts/steps/15-type-safety.md +192 -192
  20. package/src/prompts/steps/16-logging-error-message.md +173 -173
  21. package/src/prompts/steps/17-data-integrity.md +139 -139
  22. package/src/prompts/steps/18-performance.md +183 -183
  23. package/src/prompts/steps/19-cost-resource-optimization.md +136 -136
  24. package/src/prompts/steps/20-error-recovery.md +145 -145
  25. package/src/prompts/steps/21-race-condition-audit.md +178 -178
  26. package/src/prompts/steps/22-bug-hunt.md +229 -229
  27. package/src/prompts/steps/23-frontend-quality.md +210 -210
  28. package/src/prompts/steps/24-uiux-audit.md +284 -284
  29. package/src/prompts/steps/25-state-management.md +170 -170
  30. package/src/prompts/steps/26-perceived-performance.md +190 -190
  31. package/src/prompts/steps/27-devops.md +165 -165
  32. package/src/prompts/steps/28-scheduled-job-chron-jobs.md +141 -141
  33. package/src/prompts/steps/29-observability.md +152 -152
  34. package/src/prompts/steps/30-backup-check.md +155 -155
  35. package/src/prompts/steps/31-product-polish-ux-friction.md +122 -122
  36. package/src/prompts/steps/32-feature-discovery-opportunity.md +128 -128
  37. package/src/prompts/steps/33-strategic-opportunities.md +217 -217
@@ -1,284 +1,284 @@
1
- # UI Design Quality & Visual Polish
2
-
3
- You are running an overnight UI design quality audit. Your job: assess this app against professional design standards and produce a comprehensive visual quality report that a developer can act on immediately. You are not a designer making subjective taste calls — you are an engineer identifying specific, measurable deviations from established best practices.
4
-
5
- **This is primarily a documentation run.** Fix only issues that are unambiguously broken (e.g., a button with zero padding, text with no contrast, a layout with no max-width at all). Everything else — even things that clearly should be fixed — goes in the report with a specific recommendation. A thorough written report is more valuable than aggressive changes that might require reverting.
6
-
7
- Work on branch `ui-polish-[date]`.
8
-
9
- ---
10
-
11
- ## Global Rules
12
-
13
- - Run tests after every change. Commit format: `design: [what] in [component/page]`
14
- - **Fix only**: issues that are objectively broken, have a single obvious correct solution, and carry near-zero risk of unintended visual side effects. If you have any doubt, document it.
15
- - **Document everything else** — with enough specificity that a developer can execute the fix without guessing.
16
- - DO NOT change business logic, routing, or data fetching.
17
- - DO NOT introduce new UI libraries or dependencies.
18
- - DO NOT redesign the visual identity. Identify and reinforce the best version of what's already there.
19
- - Use Playwright MCP for screenshotting and interaction verification where available.
20
- - You have all night. Go screen by screen, component by component.
21
-
22
- ---
23
-
24
- ## Phase 1: Visual Audit with Playwright
25
-
26
- ### Step 0: Setup — a mandatory pre-flight checklist before any visual auditing:
27
-
28
- Install the Playwright browser via browser_install MCP tool (this was the likely cause of your hang — without it, Playwright tries to use a missing browser and gets stuck)
29
- Find the dev server command from package.json scripts or README
30
- Start the dev server in the background (don't block waiting for it to exit)
31
- Verify the app is reachable — try the URL, try alternative ports, bail after 3 attempts
32
- Discover all routes from the codebase before screenshotting
33
-
34
- Plus two fallback guardrails:
35
-
36
- If there's no web UI at all (CLI tool, library), skip Phases 1 & 3 entirely
37
- Page load resilience — 15-second timeout per page, note failures and move on instead of hanging
38
-
39
- ### Step 1: Screenshot every screen
40
- Use Playwright MCP to navigate to every route and capture full-page screenshots.
41
-
42
- **Handling authentication:** Before navigating to any protected route, attempt to reach it and check whether you land on a login page or are redirected to auth. If auth is required and no test credentials are available in the codebase (check `.env.example`, seed scripts, test fixtures, and README for any documented test accounts):
43
- 1. Open the browser to the login page via Playwright
44
- 2. **Pause and print a clear message in the chat:** "⏸️ WAITING FOR LOGIN — The app requires authentication and no test credentials were found. Please log in manually in the Playwright browser window, then type 'continue' to proceed with the audit."
45
- 3. Wait for the user to confirm before proceeding
46
- 4. Once confirmed, resume screenshotting all authenticated routes
47
-
48
- Capture at:
49
- - Desktop (1440px), laptop (1280px), tablet (768px), mobile (375px)
50
- - Key interactive states: hover, focus, loading, empty, error
51
- - Modal/drawer open states
52
- - Form validation states (both valid and error)
53
-
54
- ### Step 2: Assess each screenshot against the antipattern checklist
55
-
56
- For every screen, flag every instance of the following. Be exhaustive — these are the specific failure modes that separate amateur from professional UI work.
57
-
58
- **Layout:**
59
- - Content spanning full viewport width with no max-width container (the #1 developer default crime)
60
- - Text lines exceeding ~75 characters (measure a representative line; above 75ch is a readability problem)
61
- - Asymmetric or inconsistent page margins across different routes
62
- - Elements touching the viewport edge with no gutters
63
- - Cards or panels that expand to fill without a sensible max-width, creating wide flat boxes on large screens
64
- - Sidebar or panel widths that seem arbitrary vs. sized to their content
65
-
66
- **Spacing:**
67
- - Inconsistent gap between similar repeating elements (e.g., some cards 12px apart, others 24px — measure them)
68
- - No discernible vertical rhythm — sections that feel crowded or randomly spaced
69
- - Form fields with no visual grouping between sections
70
- - Buttons or inputs with padding that makes them feel cramped or bloated
71
- - Content that appears to "float" with no clear belonging to a section
72
-
73
- **Typography:**
74
- - Body text below 14px or above 18px (note the exact px value found)
75
- - Line-height below 1.4 on paragraph text (note the exact value)
76
- - Heading hierarchy that doesn't feel meaningfully different from body text
77
- - Multiple competing type scales with no apparent system
78
- - Paragraphs exceeding 65-70ch in a reading-focused layout
79
- - Letter-spacing applied to lowercase body text (almost always wrong)
80
- - ALL CAPS blocks of body text
81
-
82
- **Color:**
83
- - Interactive elements (buttons, links, toggles) that don't look interactive — no visual affordance
84
- - Disabled states visually identical to enabled states
85
- - Multiple competing accent colors with no hierarchy (note each color used)
86
- - Saturated colors used for large background areas creating visual fatigue
87
- - Status colors (red/green/yellow) used decoratively rather than semantically
88
- - Text or icon colors that appear low-contrast (flag for manual contrast ratio check)
89
-
90
- **Components:**
91
- - Buttons with visibly insufficient padding (note the component)
92
- - Buttons that are full-width in desktop contexts where they shouldn't be
93
- - Inputs that appear unstyled or browser-default
94
- - Missing focus ring on interactive elements (test with Tab key in Playwright)
95
- - Tables with no row hover state, no clear header differentiation
96
- - Empty states showing only raw "No data" or nothing at all
97
- - Loading states missing entirely, or a massive spinner where a skeleton would be appropriate
98
- - Modals without a visible close button or with no backdrop
99
-
100
- **Responsiveness:**
101
- - Desktop nav that simply overflows or disappears on mobile — no mobile nav pattern
102
- - Tables that overflow without horizontal scroll or card collapse
103
- - Inputs below 44px height on mobile (iOS/Android tap target minimum)
104
- - Modals that remain desktop-sized on mobile instead of going full-screen or near-full-screen
105
- - Font sizes below 16px on inputs on mobile (triggers iOS auto-zoom)
106
-
107
- Document every finding with: **Screen | Component | Issue | Specific Measurement (if applicable) | Severity**
108
-
109
- Severity:
110
- - **Critical** — Looks broken, unusable, or actively hurts the user (missing contrast, no mobile nav)
111
- - **High** — Clearly amateurish, would cause a user or stakeholder to question quality
112
- - **Medium** — A polish gap a professional designer would flag
113
- - **Low** — Nice-to-have refinement
114
-
115
- ---
116
-
117
- ## Phase 2: Design System Audit
118
-
119
- ### Step 1: Inventory every design decision currently in the codebase
120
- Extract and catalog:
121
- - Every distinct color value used (hex/hsl/variable) and where
122
- - Every distinct font size used and where
123
- - Every distinct spacing value used (padding, margin, gap) and the range
124
- - Every distinct border-radius value used
125
- - Every distinct box-shadow value used
126
- - Every distinct transition duration used
127
- - Every breakpoint used
128
-
129
- ### Step 2: Assess systematically
130
-
131
- **Color system:**
132
- - Is there a defined color palette, or are colors scattered ad hoc throughout component files?
133
- - How many distinct "primary" or "brand" colors are there? (More than 2-3 main colors suggests no system)
134
- - Are neutral grays on a scale, or random values?
135
- - Are semantic colors (success, warning, error, info) consistent across the app, or does every component pick its own red?
136
- - Are colors defined as CSS variables or theme tokens, or hardcoded throughout?
137
-
138
- **Spacing system:**
139
- - Is spacing on a consistent scale (multiples of 4px or 8px), or are values arbitrary?
140
- - Count how many distinct spacing values exist. More than 10-12 unique values suggests drift.
141
- - Are spacing values defined centrally or hardcoded per component?
142
-
143
- **Typography system:**
144
- - How many distinct font sizes exist? More than 6-8 distinct sizes suggests no scale.
145
- - Is there a clear heading hierarchy (h1 through h4) with visually distinct sizes?
146
- - Are font sizes defined centrally or scattered?
147
-
148
- **Component consistency:**
149
- - Do all buttons of the same type (primary, secondary, etc.) share the same height?
150
- - Do all text inputs share the same height and padding?
151
- - Is border-radius consistent across same-type components (e.g., all cards have the same radius)?
152
-
153
- ### Step 3: Identify the dominant pattern
154
- For each dimension, the most common value is the de-facto standard. Document what it is, and list all deviations from it.
155
-
156
- ### Step 4: Generate `docs/DESIGN_SYSTEM.md`
157
- Write a design system documentation file based purely on what currently exists in the codebase — not what should exist, but what IS. Sections:
158
- - Color palette (every used value, organized by role)
159
- - Spacing scale (actual values used, which is the base unit)
160
- - Type scale (actual values used, which are headings vs. body vs. labels)
161
- - Component patterns (button sizes/styles, input sizes, card patterns)
162
- - Deviations: values that exist in the codebase but don't fit the dominant system
163
-
164
- This document is the baseline. It answers the question: "What does our design system actually look like right now?"
165
-
166
- ---
167
-
168
- ## Phase 3: Interaction & Animation Audit
169
-
170
- Use Playwright to test every interactive element. Tab through every page. Hover every interactive element. Focus every input.
171
-
172
- **Hover states:**
173
- - Does every button have a visible hover state (color change, shadow, brightness shift)?
174
- - Do links have hover states?
175
- - Do table rows have hover states?
176
- - Do clickable cards have hover states?
177
- - Note any interactive element with no visible hover feedback.
178
-
179
- **Focus states:**
180
- - Does every interactive element show a visible focus ring when focused via keyboard?
181
- - Is the focus ring distinct from the hover state?
182
- - Note any interactive element where focus is invisible (this is also an accessibility issue).
183
-
184
- **Transitions:**
185
- - Do hover/focus state changes happen instantly (jarring) or with a brief transition (polished)?
186
- - Note any state change that would benefit from a transition but has none.
187
- - Note any transition that is too slow (above 300ms for hover states) or has the wrong easing.
188
-
189
- **Feedback:**
190
- - Is there immediate visual feedback on every button click? (Brief active/pressed state)
191
- - Do form submissions provide feedback while in-flight?
192
- - Do any interactive elements produce "nothing happened" moments — click with no response?
193
-
194
- ---
195
-
196
- ## Phase 4: Safe Fixes Only
197
-
198
- Execute fixes only for issues that meet ALL of these criteria:
199
- 1. The correct solution is unambiguous (not a design judgment call)
200
- 2. The change is mechanical (adding a property, changing a value)
201
- 3. There's no risk of cascading visual side effects across the codebase
202
- 4. You're confident it's wrong, not just different from your preference
203
-
204
- **Examples of safe fixes:**
205
- - A button or input with literally `padding: 0` — add a sensible default
206
- - A page with no max-width container at all — wrap in a container with an appropriate max-width
207
- - A focus state with `outline: none` and no replacement — restore a visible outline
208
- - A transition duration of `0ms` on hover states that clearly should animate — add 150ms ease
209
- - A color variable that's used in one place but defined differently than everywhere else — align to the dominant value
210
- - A missing `cursor: pointer` on a clearly clickable element
211
-
212
- **Do NOT fix:**
213
- - Anything where reasonable designers could disagree
214
- - Anything that requires visual judgment about proportions, sizing, or color relationships
215
- - Anything that would change the visual layout in ways that might surprise the team
216
- - Spacing and sizing that feels off but isn't zero — document it
217
-
218
- ---
219
-
220
- ## Output
221
-
222
- Create `audit-reports/` in project root if needed. Save as `audit-reports/24_UI_DESIGN_QUALITY_REPORT_[run-number]_[date]_[time in user's local time].md`, incrementing run number based on existing reports.
223
-
224
- ### Report Structure
225
-
226
- 1. **Executive Summary** — Design quality rating (rough / developing / competent / polished / excellent), critical issue count by severity, whether a coherent design system exists, top 5 highest-impact improvements.
227
- 2. **Screen-by-Screen Audit** — Full findings table organized by screen/route.
228
- 3. **Design System State** — Token inventory, system coherence assessment, link to `docs/DESIGN_SYSTEM.md`.
229
- 4. **Interaction Audit** — Hover/focus/transition findings per component.
230
- 5. **Fixes Applied** — Everything changed, with before/after. (Expected to be a short section.)
231
- 6. **Priority Remediation Plan** — All documented issues organized by effort and impact.
232
-
233
- ---
234
-
235
- ## Chat Output Requirement
236
-
237
- The chat summary IS the primary deliverable. Write it comprehensively enough that the developer never needs to open the report file unless they want full detail. Do not truncate findings — if there are 30 issues, list all 30.
238
-
239
- ### 1. Status Line
240
- One sentence: what you audited, how long it took, whether all tests still pass.
241
-
242
- ### 2. Design System Assessment
243
- A clear paragraph describing the current state: Does a coherent system exist? What's working? What's fragmented? What's the single biggest structural problem?
244
-
245
- ### 3. Screen-by-Screen Findings
246
- For every screen audited, list all findings grouped by screen. Use this format:
247
-
248
- **[Screen Name / Route]**
249
- - 🔴 CRITICAL: [specific issue with measurement where applicable] → [specific fix recommendation]
250
- - 🟠 HIGH: [specific issue] → [specific fix recommendation]
251
- - 🟡 MEDIUM: [specific issue] → [specific fix recommendation]
252
- - ⚪ LOW: [specific issue] → [specific fix recommendation]
253
-
254
- If a screen has no issues, say so in one line: "✅ [Screen] — No significant issues found."
255
-
256
- ### 4. Cross-Cutting Patterns
257
- Issues that appear on multiple screens (the systemic problems, not one-offs). These are the highest-leverage fixes because solving them once fixes everywhere.
258
-
259
- For each pattern:
260
- - **What:** Specific description of the pattern
261
- - **Where:** Every screen/component it appears on
262
- - **Fix:** Exactly what to change and where to change it
263
- - **Effort:** Hours / Days
264
-
265
- ### 5. Fixes Applied
266
- Short bullet list of what was actually changed. If nothing was changed, say so.
267
-
268
- ### 6. Priority Recommendations Table
269
-
270
- | # | Recommendation | Screens Affected | Effort | Impact | Worth Doing? | How To Fix |
271
- |---|---|---|---|---|---|---|
272
- | *#* | *≤10 words* | *count or list* | *Hours / Days / Weeks* | *Low / Medium / High / Critical* | *Yes / Probably / Only if time* | *1–3 sentences of specific implementation guidance* |
273
-
274
- Order by impact descending. Be honest about effort — "add max-width to one wrapper class" is hours, not days.
275
-
276
- ### 7. Design System Recommendations
277
- Specific, actionable list of design system improvements:
278
- - What tokens/variables to create
279
- - What values to standardize
280
- - What deviations to eliminate
281
- - Estimated effort to establish a proper system vs. continuing ad hoc
282
-
283
- ### 8. Report & Design System Docs Location
284
- Full paths to the report file and `docs/DESIGN_SYSTEM.md`.
1
+ # UI Design Quality & Visual Polish
2
+
3
+ You are running an overnight UI design quality audit. Your job: assess this app against professional design standards and produce a comprehensive visual quality report that a developer can act on immediately. You are not a designer making subjective taste calls — you are an engineer identifying specific, measurable deviations from established best practices.
4
+
5
+ **This is primarily a documentation run.** Fix only issues that are unambiguously broken (e.g., a button with zero padding, text with no contrast, a layout with no max-width at all). Everything else — even things that clearly should be fixed — goes in the report with a specific recommendation. A thorough written report is more valuable than aggressive changes that might require reverting.
6
+
7
+ Work on branch `ui-polish-[date]`.
8
+
9
+ ---
10
+
11
+ ## Global Rules
12
+
13
+ - Run tests after every change. Commit format: `design: [what] in [component/page]`
14
+ - **Fix only**: issues that are objectively broken, have a single obvious correct solution, and carry near-zero risk of unintended visual side effects. If you have any doubt, document it.
15
+ - **Document everything else** — with enough specificity that a developer can execute the fix without guessing.
16
+ - DO NOT change business logic, routing, or data fetching.
17
+ - DO NOT introduce new UI libraries or dependencies.
18
+ - DO NOT redesign the visual identity. Identify and reinforce the best version of what's already there.
19
+ - Use Playwright MCP for screenshotting and interaction verification where available.
20
+ - You have all night. Go screen by screen, component by component.
21
+
22
+ ---
23
+
24
+ ## Phase 1: Visual Audit with Playwright
25
+
26
+ ### Step 0: Setup — a mandatory pre-flight checklist before any visual auditing:
27
+
28
+ Install the Playwright browser via browser_install MCP tool (this was the likely cause of your hang — without it, Playwright tries to use a missing browser and gets stuck)
29
+ Find the dev server command from package.json scripts or README
30
+ Start the dev server in the background (don't block waiting for it to exit)
31
+ Verify the app is reachable — try the URL, try alternative ports, bail after 3 attempts
32
+ Discover all routes from the codebase before screenshotting
33
+
34
+ Plus two fallback guardrails:
35
+
36
+ If there's no web UI at all (CLI tool, library), skip Phases 1 & 3 entirely
37
+ Page load resilience — 15-second timeout per page, note failures and move on instead of hanging
38
+
39
+ ### Step 1: Screenshot every screen
40
+ Use Playwright MCP to navigate to every route and capture full-page screenshots.
41
+
42
+ **Handling authentication:** Before navigating to any protected route, attempt to reach it and check whether you land on a login page or are redirected to auth. If auth is required and no test credentials are available in the codebase (check `.env.example`, seed scripts, test fixtures, and README for any documented test accounts):
43
+ 1. Open the browser to the login page via Playwright
44
+ 2. **Pause and print a clear message in the chat:** "⏸️ WAITING FOR LOGIN — The app requires authentication and no test credentials were found. Please log in manually in the Playwright browser window, then type 'continue' to proceed with the audit."
45
+ 3. Wait for the user to confirm before proceeding
46
+ 4. Once confirmed, resume screenshotting all authenticated routes
47
+
48
+ Capture at:
49
+ - Desktop (1440px), laptop (1280px), tablet (768px), mobile (375px)
50
+ - Key interactive states: hover, focus, loading, empty, error
51
+ - Modal/drawer open states
52
+ - Form validation states (both valid and error)
53
+
54
+ ### Step 2: Assess each screenshot against the antipattern checklist
55
+
56
+ For every screen, flag every instance of the following. Be exhaustive — these are the specific failure modes that separate amateur from professional UI work.
57
+
58
+ **Layout:**
59
+ - Content spanning full viewport width with no max-width container (the #1 developer default crime)
60
+ - Text lines exceeding ~75 characters (measure a representative line; above 75ch is a readability problem)
61
+ - Asymmetric or inconsistent page margins across different routes
62
+ - Elements touching the viewport edge with no gutters
63
+ - Cards or panels that expand to fill without a sensible max-width, creating wide flat boxes on large screens
64
+ - Sidebar or panel widths that seem arbitrary vs. sized to their content
65
+
66
+ **Spacing:**
67
+ - Inconsistent gap between similar repeating elements (e.g., some cards 12px apart, others 24px — measure them)
68
+ - No discernible vertical rhythm — sections that feel crowded or randomly spaced
69
+ - Form fields with no visual grouping between sections
70
+ - Buttons or inputs with padding that makes them feel cramped or bloated
71
+ - Content that appears to "float" with no clear belonging to a section
72
+
73
+ **Typography:**
74
+ - Body text below 14px or above 18px (note the exact px value found)
75
+ - Line-height below 1.4 on paragraph text (note the exact value)
76
+ - Heading hierarchy that doesn't feel meaningfully different from body text
77
+ - Multiple competing type scales with no apparent system
78
+ - Paragraphs exceeding 65-70ch in a reading-focused layout
79
+ - Letter-spacing applied to lowercase body text (almost always wrong)
80
+ - ALL CAPS blocks of body text
81
+
82
+ **Color:**
83
+ - Interactive elements (buttons, links, toggles) that don't look interactive — no visual affordance
84
+ - Disabled states visually identical to enabled states
85
+ - Multiple competing accent colors with no hierarchy (note each color used)
86
+ - Saturated colors used for large background areas creating visual fatigue
87
+ - Status colors (red/green/yellow) used decoratively rather than semantically
88
+ - Text or icon colors that appear low-contrast (flag for manual contrast ratio check)
89
+
90
+ **Components:**
91
+ - Buttons with visibly insufficient padding (note the component)
92
+ - Buttons that are full-width in desktop contexts where they shouldn't be
93
+ - Inputs that appear unstyled or browser-default
94
+ - Missing focus ring on interactive elements (test with Tab key in Playwright)
95
+ - Tables with no row hover state, no clear header differentiation
96
+ - Empty states showing only raw "No data" or nothing at all
97
+ - Loading states missing entirely, or a massive spinner where a skeleton would be appropriate
98
+ - Modals without a visible close button or with no backdrop
99
+
100
+ **Responsiveness:**
101
+ - Desktop nav that simply overflows or disappears on mobile — no mobile nav pattern
102
+ - Tables that overflow without horizontal scroll or card collapse
103
+ - Inputs below 44px height on mobile (iOS/Android tap target minimum)
104
+ - Modals that remain desktop-sized on mobile instead of going full-screen or near-full-screen
105
+ - Font sizes below 16px on inputs on mobile (triggers iOS auto-zoom)
106
+
107
+ Document every finding with: **Screen | Component | Issue | Specific Measurement (if applicable) | Severity**
108
+
109
+ Severity:
110
+ - **Critical** — Looks broken, unusable, or actively hurts the user (missing contrast, no mobile nav)
111
+ - **High** — Clearly amateurish, would cause a user or stakeholder to question quality
112
+ - **Medium** — A polish gap a professional designer would flag
113
+ - **Low** — Nice-to-have refinement
114
+
115
+ ---
116
+
117
+ ## Phase 2: Design System Audit
118
+
119
+ ### Step 1: Inventory every design decision currently in the codebase
120
+ Extract and catalog:
121
+ - Every distinct color value used (hex/hsl/variable) and where
122
+ - Every distinct font size used and where
123
+ - Every distinct spacing value used (padding, margin, gap) and the range
124
+ - Every distinct border-radius value used
125
+ - Every distinct box-shadow value used
126
+ - Every distinct transition duration used
127
+ - Every breakpoint used
128
+
129
+ ### Step 2: Assess systematically
130
+
131
+ **Color system:**
132
+ - Is there a defined color palette, or are colors scattered ad hoc throughout component files?
133
+ - How many distinct "primary" or "brand" colors are there? (More than 2-3 main colors suggests no system)
134
+ - Are neutral grays on a scale, or random values?
135
+ - Are semantic colors (success, warning, error, info) consistent across the app, or does every component pick its own red?
136
+ - Are colors defined as CSS variables or theme tokens, or hardcoded throughout?
137
+
138
+ **Spacing system:**
139
+ - Is spacing on a consistent scale (multiples of 4px or 8px), or are values arbitrary?
140
+ - Count how many distinct spacing values exist. More than 10-12 unique values suggests drift.
141
+ - Are spacing values defined centrally or hardcoded per component?
142
+
143
+ **Typography system:**
144
+ - How many distinct font sizes exist? More than 6-8 distinct sizes suggests no scale.
145
+ - Is there a clear heading hierarchy (h1 through h4) with visually distinct sizes?
146
+ - Are font sizes defined centrally or scattered?
147
+
148
+ **Component consistency:**
149
+ - Do all buttons of the same type (primary, secondary, etc.) share the same height?
150
+ - Do all text inputs share the same height and padding?
151
+ - Is border-radius consistent across same-type components (e.g., all cards have the same radius)?
152
+
153
+ ### Step 3: Identify the dominant pattern
154
+ For each dimension, the most common value is the de-facto standard. Document what it is, and list all deviations from it.
155
+
156
+ ### Step 4: Generate `docs/DESIGN_SYSTEM.md`
157
+ Write a design system documentation file based purely on what currently exists in the codebase — not what should exist, but what IS. Sections:
158
+ - Color palette (every used value, organized by role)
159
+ - Spacing scale (actual values used, which is the base unit)
160
+ - Type scale (actual values used, which are headings vs. body vs. labels)
161
+ - Component patterns (button sizes/styles, input sizes, card patterns)
162
+ - Deviations: values that exist in the codebase but don't fit the dominant system
163
+
164
+ This document is the baseline. It answers the question: "What does our design system actually look like right now?"
165
+
166
+ ---
167
+
168
+ ## Phase 3: Interaction & Animation Audit
169
+
170
+ Use Playwright to test every interactive element. Tab through every page. Hover every interactive element. Focus every input.
171
+
172
+ **Hover states:**
173
+ - Does every button have a visible hover state (color change, shadow, brightness shift)?
174
+ - Do links have hover states?
175
+ - Do table rows have hover states?
176
+ - Do clickable cards have hover states?
177
+ - Note any interactive element with no visible hover feedback.
178
+
179
+ **Focus states:**
180
+ - Does every interactive element show a visible focus ring when focused via keyboard?
181
+ - Is the focus ring distinct from the hover state?
182
+ - Note any interactive element where focus is invisible (this is also an accessibility issue).
183
+
184
+ **Transitions:**
185
+ - Do hover/focus state changes happen instantly (jarring) or with a brief transition (polished)?
186
+ - Note any state change that would benefit from a transition but has none.
187
+ - Note any transition that is too slow (above 300ms for hover states) or has the wrong easing.
188
+
189
+ **Feedback:**
190
+ - Is there immediate visual feedback on every button click? (Brief active/pressed state)
191
+ - Do form submissions provide feedback while in-flight?
192
+ - Do any interactive elements produce "nothing happened" moments — click with no response?
193
+
194
+ ---
195
+
196
+ ## Phase 4: Safe Fixes Only
197
+
198
+ Execute fixes only for issues that meet ALL of these criteria:
199
+ 1. The correct solution is unambiguous (not a design judgment call)
200
+ 2. The change is mechanical (adding a property, changing a value)
201
+ 3. There's no risk of cascading visual side effects across the codebase
202
+ 4. You're confident it's wrong, not just different from your preference
203
+
204
+ **Examples of safe fixes:**
205
+ - A button or input with literally `padding: 0` — add a sensible default
206
+ - A page with no max-width container at all — wrap in a container with an appropriate max-width
207
+ - A focus state with `outline: none` and no replacement — restore a visible outline
208
+ - A transition duration of `0ms` on hover states that clearly should animate — add 150ms ease
209
+ - A color variable that's used in one place but defined differently than everywhere else — align to the dominant value
210
+ - A missing `cursor: pointer` on a clearly clickable element
211
+
212
+ **Do NOT fix:**
213
+ - Anything where reasonable designers could disagree
214
+ - Anything that requires visual judgment about proportions, sizing, or color relationships
215
+ - Anything that would change the visual layout in ways that might surprise the team
216
+ - Spacing and sizing that feels off but isn't zero — document it
217
+
218
+ ---
219
+
220
+ ## Output
221
+
222
+ Create `audit-reports/` in project root if needed. Save as `audit-reports/24_UI_DESIGN_QUALITY_REPORT_[run-number]_[date]_[time in user's local time].md`, incrementing run number based on existing reports.
223
+
224
+ ### Report Structure
225
+
226
+ 1. **Executive Summary** — Design quality rating (rough / developing / competent / polished / excellent), critical issue count by severity, whether a coherent design system exists, top 5 highest-impact improvements.
227
+ 2. **Screen-by-Screen Audit** — Full findings table organized by screen/route.
228
+ 3. **Design System State** — Token inventory, system coherence assessment, link to `docs/DESIGN_SYSTEM.md`.
229
+ 4. **Interaction Audit** — Hover/focus/transition findings per component.
230
+ 5. **Fixes Applied** — Everything changed, with before/after. (Expected to be a short section.)
231
+ 6. **Priority Remediation Plan** — All documented issues organized by effort and impact.
232
+
233
+ ---
234
+
235
+ ## Chat Output Requirement
236
+
237
+ The chat summary IS the primary deliverable. Write it comprehensively enough that the developer never needs to open the report file unless they want full detail. Do not truncate findings — if there are 30 issues, list all 30.
238
+
239
+ ### 1. Status Line
240
+ One sentence: what you audited, how long it took, whether all tests still pass.
241
+
242
+ ### 2. Design System Assessment
243
+ A clear paragraph describing the current state: Does a coherent system exist? What's working? What's fragmented? What's the single biggest structural problem?
244
+
245
+ ### 3. Screen-by-Screen Findings
246
+ For every screen audited, list all findings grouped by screen. Use this format:
247
+
248
+ **[Screen Name / Route]**
249
+ - 🔴 CRITICAL: [specific issue with measurement where applicable] → [specific fix recommendation]
250
+ - 🟠 HIGH: [specific issue] → [specific fix recommendation]
251
+ - 🟡 MEDIUM: [specific issue] → [specific fix recommendation]
252
+ - ⚪ LOW: [specific issue] → [specific fix recommendation]
253
+
254
+ If a screen has no issues, say so in one line: "✅ [Screen] — No significant issues found."
255
+
256
+ ### 4. Cross-Cutting Patterns
257
+ Issues that appear on multiple screens (the systemic problems, not one-offs). These are the highest-leverage fixes because solving them once fixes everywhere.
258
+
259
+ For each pattern:
260
+ - **What:** Specific description of the pattern
261
+ - **Where:** Every screen/component it appears on
262
+ - **Fix:** Exactly what to change and where to change it
263
+ - **Effort:** Hours / Days
264
+
265
+ ### 5. Fixes Applied
266
+ Short bullet list of what was actually changed. If nothing was changed, say so.
267
+
268
+ ### 6. Priority Recommendations Table
269
+
270
+ | # | Recommendation | Screens Affected | Effort | Impact | Worth Doing? | How To Fix |
271
+ |---|---|---|---|---|---|---|
272
+ | *#* | *≤10 words* | *count or list* | *Hours / Days / Weeks* | *Low / Medium / High / Critical* | *Yes / Probably / Only if time* | *1–3 sentences of specific implementation guidance* |
273
+
274
+ Order by impact descending. Be honest about effort — "add max-width to one wrapper class" is hours, not days.
275
+
276
+ ### 7. Design System Recommendations
277
+ Specific, actionable list of design system improvements:
278
+ - What tokens/variables to create
279
+ - What values to standardize
280
+ - What deviations to eliminate
281
+ - Estimated effort to establish a proper system vs. continuing ad hoc
282
+
283
+ ### 8. Report & Design System Docs Location
284
+ Full paths to the report file and `docs/DESIGN_SYSTEM.md`.