Skip to content

Commit 072959d

Browse files
committed
feat(styling): add priority-based styling hierarchy and validation rules
1 parent 99eb09e commit 072959d

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

agents/gem-designer.agent.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,51 @@ Designer validates accessibility SPEC COMPLIANCE in code:
192192
- For design patterns: Use component architecture. Implement state management. Apply responsive patterns.
193193
- Use project's existing tech stack for decisions/ planning. Use the project's CSS framework and component library — no new styling solutions.
194194

195+
## Styling Priority (CRITICAL)
196+
Apply styles in this EXACT order (stop at first available):
197+
198+
0. **Component Library Config** (Global theme override)
199+
- Nuxt UI: `app.config.ts``theme: { colors: { primary: '...' } }`
200+
- Tailwind: `tailwind.config.ts``theme.extend.{colors,spacing,fonts}`
201+
- Override global tokens BEFORE writing component styles
202+
- Example: `export default defineAppConfig({ ui: { primary: 'blue' } })`
203+
204+
1. **Component Library Props** (Nuxt UI, MUI)
205+
- `<UButton color="primary" size="md" />`
206+
- Use themed props, not custom classes
207+
- Check component metadata for props/slots
208+
209+
2. **CSS Framework Utilities** (Tailwind)
210+
- `class="flex gap-4 bg-primary text-white"`
211+
- Use framework tokens, not custom values
212+
213+
3. **CSS Variables** (Global theme only)
214+
- `--color-brand: #0066FF;` in global CSS
215+
- Use: `color: var(--color-brand)`
216+
217+
4. **Inline Styles** (NEVER - except runtime)
218+
- ONLY: dynamic positions, runtime colors
219+
- NEVER: static colors, spacing, typography
220+
221+
**VIOLATION = Critical**: Inline styles for static values, hardcoded hex, custom CSS when framework exists, overriding via CSS when app.config available.
222+
223+
## Styling Validation Rules
224+
During validate mode, flag violations:
225+
226+
```jsonc
227+
{
228+
severity: "critical|high|medium",
229+
category: "styling-hierarchy",
230+
description: "What's wrong",
231+
location: "file:line",
232+
recommendation: "Use X instead of Y"
233+
}
234+
```
235+
236+
**Critical** (block): `style={}` for static, hex values, custom CSS when Tailwind/app.config exists
237+
**High** (revision): Missing component props, inconsistent tokens, duplicate patterns
238+
**Medium** (log): Suboptimal utilities, missing responsive variants
239+
195240
## Anti-Patterns
196241
- Adding designs that break accessibility
197242
- Creating inconsistent patterns (different buttons, different spacing)

0 commit comments

Comments
 (0)