Three modes:
Build mode — Generate Rails ERB views/partials using eden-ui components. Compose from the 150+ eden-ui helpers rather than writing raw Tailwind. Produces production-grade views that match the eden-ui design system (configured brand palette, dark mode, Stimulus interactivity).
Review mode — Audit existing views/partials for eden-ui compliance. Check for: raw HTML that should use eden-ui helpers, missing dark mode support, hardcoded colors instead of design tokens, incorrect component composition, accessibility gaps, missing Stimulus controllers for interactive patterns.
Visual mode — Load pages in a browser via Playwright and inspect the rendered output. Check visual consistency, responsive behavior, dark mode rendering, interactive component functionality, and design token compliance in the actual DOM/CSS. Catches issues that static code review misses: layout breaks, z-index conflicts, animation glitches, computed style mismatches.
Output: Working ERB files (build), actionable code findings with fixes (review), or visual audit report with screenshots (visual).
Live reference — read from eden-ui source when needed:
- Component helpers:
../eden-ui/app/helpers/eden_ui/component_helper.rb
- Component partials:
../eden-ui/app/views/eden_ui/components/
- Design tokens:
../eden-ui/app/assets/stylesheets/eden_ui/tokens.css
- Stimulus controllers:
../eden-ui/app/assets/javascripts/eden_ui/controllers/
@.planning/STATE.md
Build Mode
Read project brand — Check config/initializers/eden_ui.rb for brand_color and font_preset settings. This determines the primary palette (e.g., :blue means primary-* maps to blue shades, not gold). Use primary-* classes — never hardcode gold-* unless the brand is explicitly gold.
Understand the request — What page/view/partial is needed? What data does it display? What actions does it support?
Check eden-ui for matching components — Read ../eden-ui/app/helpers/eden_ui/component_helper.rb to find the exact helper signatures for components you'll use. Read specific partials in ../eden-ui/app/views/eden_ui/components/ to understand accepted parameters and rendering behavior.
Plan the composition — List which eden-ui components will compose the view. Identify layout choice (app, auth, marketing). Map data flow from controller to view.
Generate ERB — Write the view files using eden-ui helpers exclusively:
- Use
eden_page_header for page titles with breadcrumbs
- Use
eden_card for content containers
- Use
eden_data_table for tabular data
- Use
eden_form_group + eden_input/eden_select/etc. for forms
- Use
eden_modal / eden_drawer for overlay interactions
- Use
eden_empty_state for zero-data scenarios
- Use
eden_flash_message for notifications
- Include Stimulus controller data attributes for interactivity
- All components must support dark mode (eden-ui handles this internally)
Verify — Confirm all helper calls use valid parameters by cross-referencing eden-ui source. Check that Stimulus controllers referenced exist in the importmap.
Review Mode
Read project brand — Check config/initializers/eden_ui.rb for brand_color and font_preset settings. When brand is not :gold, flag any gold-* hardcodes as violations.
Discover target files — Glob for *.html.erb in the specified paths. If no path given, scan app/views/ excluding vendored/eden_ui engine views.
Read eden-ui component inventory — Load the helper file to know what's available.
Audit each file for these categories:
Component usage:
- Raw HTML that duplicates an eden-ui component (e.g., hand-rolled modal instead of
eden_modal)
- Missing helper usage (e.g., raw
<button> instead of eden_button)
- Incorrect parameter usage (wrong variant names, missing required params)
Design token compliance:
- Hardcoded colors (
bg-yellow-500) instead of token colors (bg-primary-500)
- Non-token fonts, shadows, or spacing
- Missing
dark: variants on custom elements (elements not rendered by eden-ui helpers)
Accessibility:
- Missing ARIA labels on interactive elements
- Missing focus states
- Images without alt text
- Forms without associated labels
Stimulus controllers:
- Interactive patterns without Stimulus (onclick handlers, inline JS)
- Missing data-controller attributes on components that need them
- Incorrect data-action syntax
Composition:
- Forms not using
eden_form_group wrapper
- Tables not using
eden_data_table or eden_table
- Empty states not using
eden_empty_state
- Alerts/flashes not using eden-ui alert components
Report findings — Group by severity:
- Must fix — Broken patterns, accessibility violations, missing dark mode
- Should fix — Raw HTML replaceable by eden-ui components, hardcoded colors
- Consider — Style improvements, better component composition
Generate fixes — For each must-fix and should-fix finding, provide the corrected ERB code. Apply fixes directly if the user approves.
Visual Mode
Uses Playwright to load pages in a real browser and inspect the rendered output.
Setup
Read project brand — Check config/initializers/eden_ui.rb for brand_color and font_preset settings. This context informs what colors to expect when inspecting computed styles.
Confirm the app is running — Ask the user for the base URL (default: http://localhost:3000). Verify the server responds before proceeding.
Determine scope — What pages/flows to inspect:
- Single URL: inspect one page
- Flow: a sequence of URLs or actions (e.g., "the settings flow")
- Full audit: crawl all pages linked from a starting point
Page Inspection Sequence
For each page, run this sequence:
Navigate and snapshot — Load the URL. Take an accessibility snapshot (browser_snapshot) to get the semantic structure. This is the primary inspection tool — it reveals the actual DOM tree, ARIA roles, element hierarchy.
Screenshot for visual context — Take a screenshot to see the rendered visual output. Use this to evaluate layout, spacing, color usage, and overall design quality.
Design token audit — Evaluate computed styles in the browser:
// Check if eden design tokens are being used
// Look for hardcoded values that should use tokens
() => {
const body = getComputedStyle(document.body);
return {
fontFamily: body.fontFamily,
colorScheme: document.documentElement.classList.contains('dark') ? 'dark' : 'light',
// Sample element styles
};
}
Component structure check — Use the snapshot to verify:
- Stimulus controllers are connected (
data-controller attributes present)
- ARIA roles and labels are correct
- Interactive elements are keyboard-accessible (check tabindex, roles)
- Form inputs have associated labels
- Images have alt text
- Heading hierarchy is logical (h1 → h2 → h3, no skips)
Responsive check — Resize the viewport and re-inspect:
- Desktop (1280x800) — Full layout, sidebar visible
- Tablet (768x1024) — Sidebar collapsed, responsive grid
- Mobile (375x812) — Mobile nav, stacked layout
At each breakpoint: take a screenshot, check the snapshot for layout shifts, verify navigation adapts correctly.
Dark mode check — Toggle dark mode and re-inspect:
() => { document.documentElement.classList.toggle('dark'); }
Take a screenshot in dark mode. Verify:
- No white/light backgrounds bleeding through
- Text remains readable (sufficient contrast)
- Brand (
primary-*) colors render correctly on dark backgrounds
- Borders and dividers use appropriate dark variants
- No missing
dark: overrides (elements that look correct in light but break in dark)
Interactive component testing — For pages with interactive elements:
- Modals: Click trigger → verify modal opens → check backdrop → close with Escape
- Dropdowns: Click trigger → verify menu appears → check keyboard navigation
- Tabs: Click each tab → verify content switches
- Accordions: Click items → verify expand/collapse
- Forms: Check validation states (submit empty → check error styling)
- Tooltips/Popovers: Hover triggers → verify positioning
Console check — After interactions, check browser console for:
- JavaScript errors (broken Stimulus controllers, missing dependencies)
- Stimulus controller connection warnings
- Missing asset warnings (fonts, icons, images)
Reporting
Compile visual audit report — Organize findings:
Layout & Spacing:
- Alignment issues, inconsistent padding/margins, overflow problems
- Screenshots with annotations
Color & Tokens:
- Computed colors that don't match eden tokens
- Contrast violations (especially in dark mode)
Responsive:
- Breakpoint-specific layout issues
- Side-by-side screenshots (desktop/tablet/mobile)
Dark Mode:
- Elements that break in dark mode
- Before/after screenshots
Interactivity:
- Components that don't respond to interaction
- Console errors from Stimulus controllers
- Focus trapping / keyboard navigation gaps
Accessibility:
- Missing ARIA attributes found in live DOM
- Focus order issues discovered through tab navigation
- Screen reader concerns from the accessibility snapshot
Cross-reference with code — For each visual finding, trace back to the responsible ERB file using the snapshot's element structure. Provide the file path and specific code that needs to change. Offer to apply fixes.
1---2name: df-frontend-design3description: Build, review, or visually inspect UI using eden-ui components, Rails ERB partials, and Tailwind design tokens. Use when the user wants to create new views, design components, audit existing UI, review frontend code, or visually test rendered pages. Triggers on: "build the UI", "design this page", "create a view", "review the frontend", "audit the UI", "check UI consistency", "make it look good", "frontend review", "visual review", "check how it looks", "inspect the page"4---5<objective>
6Build new UI, review existing code, or visually inspect rendered pages against eden-ui conventions.
7
8**Three modes:**
9
10**Build mode** — Generate Rails ERB views/partials using eden-ui components. Compose from the 150+ eden-ui helpers rather than writing raw Tailwind. Produces production-grade views that match the eden-ui design system (configured brand palette, dark mode, Stimulus interactivity).
11
12**Review mode** — Audit existing views/partials for eden-ui compliance. Check for: raw HTML that should use eden-ui helpers, missing dark mode support, hardcoded colors instead of design tokens, incorrect component composition, accessibility gaps, missing Stimulus controllers for interactive patterns.
13
14**Visual mode** — Load pages in a browser via Playwright and inspect the rendered output. Check visual consistency, responsive behavior, dark mode rendering, interactive component functionality, and design token compliance in the actual DOM/CSS. Catches issues that static code review misses: layout breaks, z-index conflicts, animation glitches, computed style mismatches.
15
16Output: Working ERB files (build), actionable code findings with fixes (review), or visual audit report with screenshots (visual).
17</objective>
18
19<execution_context>
20@~/.claude/devflow/references/eden-ui-conventions.md
21</execution_context>
22
23<context>
24Mode + target: $ARGUMENTS
25- `build <description>` — Generate new views (e.g., "build user settings page")
26- `review [paths]` — Audit existing files (e.g., "review app/views/dashboard/")
27- `visual [URL or path]` — Visual browser inspection (e.g., "visual http://localhost:3000/dashboard")
28- If no mode specified, infer from context
29
30**Live reference — read from eden-ui source when needed:**
31- Component helpers: `../eden-ui/app/helpers/eden_ui/component_helper.rb`
32- Component partials: `../eden-ui/app/views/eden_ui/components/`
33- Design tokens: `../eden-ui/app/assets/stylesheets/eden_ui/tokens.css`
34- Stimulus controllers: `../eden-ui/app/assets/javascripts/eden_ui/controllers/`
35
36@.planning/STATE.md
37</context>
38
39<process>
40
41## Build Mode
42
430. **Read project brand** — Check `config/initializers/eden_ui.rb` for `brand_color` and `font_preset` settings. This determines the primary palette (e.g., `:blue` means `primary-*` maps to blue shades, not gold). Use `primary-*` classes — never hardcode `gold-*` unless the brand is explicitly gold.
44
451. **Understand the request** — What page/view/partial is needed? What data does it display? What actions does it support?
46
472. **Check eden-ui for matching components** — Read `../eden-ui/app/helpers/eden_ui/component_helper.rb` to find the exact helper signatures for components you'll use. Read specific partials in `../eden-ui/app/views/eden_ui/components/` to understand accepted parameters and rendering behavior.
48
493. **Plan the composition** — List which eden-ui components will compose the view. Identify layout choice (app, auth, marketing). Map data flow from controller to view.
50
514. **Generate ERB** — Write the view files using eden-ui helpers exclusively:
52 - Use `eden_page_header` for page titles with breadcrumbs
53 - Use `eden_card` for content containers
54 - Use `eden_data_table` for tabular data
55 - Use `eden_form_group` + `eden_input`/`eden_select`/etc. for forms
56 - Use `eden_modal` / `eden_drawer` for overlay interactions
57 - Use `eden_empty_state` for zero-data scenarios
58 - Use `eden_flash_message` for notifications
59 - Include Stimulus controller data attributes for interactivity
60 - All components must support dark mode (eden-ui handles this internally)
61
625. **Verify** — Confirm all helper calls use valid parameters by cross-referencing eden-ui source. Check that Stimulus controllers referenced exist in the importmap.
63
64## Review Mode
65
660. **Read project brand** — Check `config/initializers/eden_ui.rb` for `brand_color` and `font_preset` settings. When brand is not `:gold`, flag any `gold-*` hardcodes as violations.
67
681. **Discover target files** — Glob for `*.html.erb` in the specified paths. If no path given, scan `app/views/` excluding vendored/eden_ui engine views.
69
702. **Read eden-ui component inventory** — Load the helper file to know what's available.
71
723. **Audit each file** for these categories:
73
74 **Component usage:**
75 - Raw HTML that duplicates an eden-ui component (e.g., hand-rolled modal instead of `eden_modal`)
76 - Missing helper usage (e.g., raw `<button>` instead of `eden_button`)
77 - Incorrect parameter usage (wrong variant names, missing required params)
78
79 **Design token compliance:**
80 - Hardcoded colors (`bg-yellow-500`) instead of token colors (`bg-primary-500`)
81 - Non-token fonts, shadows, or spacing
82 - Missing `dark:` variants on custom elements (elements not rendered by eden-ui helpers)
83
84 **Accessibility:**
85 - Missing ARIA labels on interactive elements
86 - Missing focus states
87 - Images without alt text
88 - Forms without associated labels
89
90 **Stimulus controllers:**
91 - Interactive patterns without Stimulus (onclick handlers, inline JS)
92 - Missing data-controller attributes on components that need them
93 - Incorrect data-action syntax
94
95 **Composition:**
96 - Forms not using `eden_form_group` wrapper
97 - Tables not using `eden_data_table` or `eden_table`
98 - Empty states not using `eden_empty_state`
99 - Alerts/flashes not using eden-ui alert components
100
1014. **Report findings** — Group by severity:
102 - **Must fix** — Broken patterns, accessibility violations, missing dark mode
103 - **Should fix** — Raw HTML replaceable by eden-ui components, hardcoded colors
104 - **Consider** — Style improvements, better component composition
105
1065. **Generate fixes** — For each must-fix and should-fix finding, provide the corrected ERB code. Apply fixes directly if the user approves.
107
108## Visual Mode
109
110Uses Playwright to load pages in a real browser and inspect the rendered output.
111
112### Setup
113
1140. **Read project brand** — Check `config/initializers/eden_ui.rb` for `brand_color` and `font_preset` settings. This context informs what colors to expect when inspecting computed styles.
115
1161. **Confirm the app is running** — Ask the user for the base URL (default: `http://localhost:3000`). Verify the server responds before proceeding.
117
1182. **Determine scope** — What pages/flows to inspect:
119 - Single URL: inspect one page
120 - Flow: a sequence of URLs or actions (e.g., "the settings flow")
121 - Full audit: crawl all pages linked from a starting point
122
123### Page Inspection Sequence
124
125For each page, run this sequence:
126
1273. **Navigate and snapshot** — Load the URL. Take an accessibility snapshot (`browser_snapshot`) to get the semantic structure. This is the primary inspection tool — it reveals the actual DOM tree, ARIA roles, element hierarchy.
128
1294. **Screenshot for visual context** — Take a screenshot to see the rendered visual output. Use this to evaluate layout, spacing, color usage, and overall design quality.
130
1315. **Design token audit** — Evaluate computed styles in the browser:
132 ```js
133 // Check if eden design tokens are being used
134 // Look for hardcoded values that should use tokens
135 () => {
136 const body = getComputedStyle(document.body);
137 return {
138 fontFamily: body.fontFamily,
139 colorScheme: document.documentElement.classList.contains('dark') ? 'dark' : 'light',
140 // Sample element styles
141 };
142 }
143 ```
144
1456. **Component structure check** — Use the snapshot to verify:
146 - Stimulus controllers are connected (`data-controller` attributes present)
147 - ARIA roles and labels are correct
148 - Interactive elements are keyboard-accessible (check tabindex, roles)
149 - Form inputs have associated labels
150 - Images have alt text
151 - Heading hierarchy is logical (h1 → h2 → h3, no skips)
152
1537. **Responsive check** — Resize the viewport and re-inspect:
154 - **Desktop** (1280x800) — Full layout, sidebar visible
155 - **Tablet** (768x1024) — Sidebar collapsed, responsive grid
156 - **Mobile** (375x812) — Mobile nav, stacked layout
157
158 At each breakpoint: take a screenshot, check the snapshot for layout shifts, verify navigation adapts correctly.
159
1608. **Dark mode check** — Toggle dark mode and re-inspect:
161 ```js
162 () => { document.documentElement.classList.toggle('dark'); }
163 ```
164 Take a screenshot in dark mode. Verify:
165 - No white/light backgrounds bleeding through
166 - Text remains readable (sufficient contrast)
167 - Brand (`primary-*`) colors render correctly on dark backgrounds
168 - Borders and dividers use appropriate dark variants
169 - No missing `dark:` overrides (elements that look correct in light but break in dark)
170
1719. **Interactive component testing** — For pages with interactive elements:
172 - **Modals:** Click trigger → verify modal opens → check backdrop → close with Escape
173 - **Dropdowns:** Click trigger → verify menu appears → check keyboard navigation
174 - **Tabs:** Click each tab → verify content switches
175 - **Accordions:** Click items → verify expand/collapse
176 - **Forms:** Check validation states (submit empty → check error styling)
177 - **Tooltips/Popovers:** Hover triggers → verify positioning
178
17910. **Console check** — After interactions, check browser console for:
180 - JavaScript errors (broken Stimulus controllers, missing dependencies)
181 - Stimulus controller connection warnings
182 - Missing asset warnings (fonts, icons, images)
183
184### Reporting
185
18611. **Compile visual audit report** — Organize findings:
187
188 **Layout & Spacing:**
189 - Alignment issues, inconsistent padding/margins, overflow problems
190 - Screenshots with annotations
191
192 **Color & Tokens:**
193 - Computed colors that don't match eden tokens
194 - Contrast violations (especially in dark mode)
195
196 **Responsive:**
197 - Breakpoint-specific layout issues
198 - Side-by-side screenshots (desktop/tablet/mobile)
199
200 **Dark Mode:**
201 - Elements that break in dark mode
202 - Before/after screenshots
203
204 **Interactivity:**
205 - Components that don't respond to interaction
206 - Console errors from Stimulus controllers
207 - Focus trapping / keyboard navigation gaps
208
209 **Accessibility:**
210 - Missing ARIA attributes found in live DOM
211 - Focus order issues discovered through tab navigation
212 - Screen reader concerns from the accessibility snapshot
213
21412. **Cross-reference with code** — For each visual finding, trace back to the responsible ERB file using the snapshot's element structure. Provide the file path and specific code that needs to change. Offer to apply fixes.
215
216</process>