UI Design
Overview
Modern component library and design system engineering. Enforces design token hierarchies (spacing, radii, elevation), accessible component primitives (shadcn/ui, Radix), and responsive layout constraints.
When to Use
Activate when designing design systems, reusable UI component libraries, navigation bars, modals, data tables, and interactive dashboards.
Rules & Patterns
UI Design — Best Practices
Design System Foundations
Color
- Never use generic colors — curate a harmonious palette
- Always tint — no pure black (#000), no pure gray. Add a subtle warm or cool tint
- Color roles: primary (action), secondary (accent), neutral (text, borders), semantic (error, success, warning, info)
- Dark mode: design intentionally, not just invert. Surface hierarchy: background < surface < elevated
- Contrast: 4.5:1 minimum for body text, 3:1 for large text
Typography
- Never use browser defaults — choose a curated font (Inter, Outfit, Geist, Sora)
- Type scale: use a modular scale (1.25 ratio) — 12, 14, 16, 20, 24, 32, 40, 48
- Font weights: Regular (400), Medium (500), Semibold (600), Bold (700). Don't use all of them — pick 2-3
- Line height: 1.5 for body, 1.2 for headings, 1.6 for long-form text
- Max line width: 65-75 characters for readability
Spacing
- Use a 4px grid — all spacing should be multiples of 4
- Spacing scale: 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 80, 96
- Consistency — same spacing between similar elements
- Whitespace is design — don't fill every pixel
Layout
- Grid system: 12-column grid for desktop, 4-column for mobile
- Visual hierarchy: size, weight, color, spacing, position
- F-pattern/Z-pattern — for content-heavy pages
- Group related items — use proximity and boundaries
Component Patterns
Buttons
- Clear hierarchy: Primary > Secondary > Ghost/Text
- Consistent sizing: sm (32px), md (40px), lg (48px)
- States: default, hover, active, disabled, loading
- Always accessible: sufficient contrast, focus indicator
Forms
- Labels above inputs (not floating labels for critical forms)
- Clear error states with inline messages
- Logical tab order
- Progressive disclosure — don't show all fields at once
Cards
- Don't nest cards inside cards
- Clear visual hierarchy within the card
- Consistent padding and spacing
- Interactive cards need hover state
Navigation
- Maximum 7±2 items in primary nav
- Clear active state
- Mobile: bottom nav or hamburger (not both)
- Breadcrumbs for deep hierarchies
Animation Principles
- Purpose: guide attention, show relationships, provide feedback
- Duration: 150-300ms for micro-interactions, 300-500ms for transitions
- Easing:
ease-out for entrances, ease-in for exits. Never bounce or elastic
- Reduce motion: respect
prefers-reduced-motion
Anti-Patterns (from Impeccable)
- [FAIL] Gray text on colored backgrounds — destroys readability
- [FAIL] Pure black text on white (#000 on #fff) — too harsh, tint the black
- [FAIL] Cards nested inside cards — visual noise
- [FAIL] Bounce/elastic easing — feels dated
- [FAIL] Icon tile above every heading — SaaS template tell
- [FAIL] Purple-to-blue gradient on everything — overused
- [FAIL] Using Inter for everything — pick a font that matches your brand
- [FAIL] Rounded-square icons everywhere — lack of visual variety
Dark Mode
- Surface elevation through subtle lightening (not colored backgrounds)
- Reduce white contrast — use #E0E0E0, not #FFFFFF
- Shadows become less visible — use subtle borders or elevation changes
- Test all states in both modes
Code Examples
See EXAMPLES.md for detailed code examples.
Validation Checklist
What to verify during the review phase before completing the task.
Common Mistakes
Anti-patterns and things to explicitly avoid. See TROUBLESHOOTING.md.
Integration Notes
How this skill interacts with other skills.
ui-design Examples — Anti-patterns vs ContextOS Standard
Example 1: Component Token Consistency
Anti-pattern: Hardcoded Arbitrary Tailwind Utilities
// BAD: Inconsistent spacing, arbitrary colors, unmaintainable styling
<div className="p-[13px] bg-[#1a1b2e] rounded-[7px] text-[#99aab5] border border-[#2b2d42]">
<button className="px-[15px] py-[7px] bg-[#5865f2] hover:bg-[#4752c4]">Action</button>
</div>
Best practice: ContextOS Standard (Semantic Theme Tokens)
// GOOD: Consistent scale utilities driven by Tailwind v4 @theme design tokens
<div className="p-4 bg-card rounded-lg text-muted-foreground border border-border">
<Button variant="primary" size="md">Action</Button>
</div>
ui-design Troubleshooting & Common Mistakes
1. Z-Index Chaos
- Symptom: Tooltips rendered underneath dialog overlays, or dropdowns hidden behind sticky headers.
- Root Cause: Ad-hoc hardcoded values (z-50, z-[999], z-[9999]).
- Fix: Use Radix / shadcn Portals for floating elements so they render at root DOM level, or declare strict z-index tokens.
2. Inconsistent Component States
- Symptom: Buttons have hover states but lack focus-visible rings or disabled states.
- Root Cause: Styling only the default and hover states.
- Fix: Standardize state matrices for every interactive element: default, hover, focus-visible, active, disabled, loading.
3. Ignoring Empty and Error Component States
- Symptom: Tables or list views show a blank white box when there are 0 records.
- Root Cause: Developers only design for the "ideal data" case.
- Fix: Every data component must explicitly render designed EmptyState and ErrorState fallbacks.
1---2name: ui-design3description: ContextOS skill for UI Design4---5# UI Design67## Overview89Modern component library and design system engineering. Enforces design token hierarchies (spacing, radii, elevation), accessible component primitives (shadcn/ui, Radix), and responsive layout constraints.1011## When to Use1213Activate when designing design systems, reusable UI component libraries, navigation bars, modals, data tables, and interactive dashboards.1415## Rules & Patterns16<!-- Source: ui.md -->1718## UI Design — Best Practices1920## Design System Foundations2122### Color2324- **Never use generic colors** — curate a harmonious palette25- **Always tint** — no pure black (#000), no pure gray. Add a subtle warm or cool tint26- **Color roles**: primary (action), secondary (accent), neutral (text, borders), semantic (error, success, warning, info)27- **Dark mode**: design intentionally, not just invert. Surface hierarchy: background < surface < elevated28- **Contrast**: 4.5:1 minimum for body text, 3:1 for large text2930### Typography3132- **Never use browser defaults** — choose a curated font (Inter, Outfit, Geist, Sora)33- **Type scale**: use a modular scale (1.25 ratio) — 12, 14, 16, 20, 24, 32, 40, 4834- **Font weights**: Regular (400), Medium (500), Semibold (600), Bold (700). Don't use all of them — pick 2-335- **Line height**: 1.5 for body, 1.2 for headings, 1.6 for long-form text36- **Max line width**: 65-75 characters for readability3738### Spacing3940- **Use a 4px grid** — all spacing should be multiples of 441- **Spacing scale**: 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 80, 9642- **Consistency** — same spacing between similar elements43- **Whitespace is design** — don't fill every pixel4445### Layout4647- **Grid system**: 12-column grid for desktop, 4-column for mobile48- **Visual hierarchy**: size, weight, color, spacing, position49- **F-pattern/Z-pattern** — for content-heavy pages50- **Group related items** — use proximity and boundaries5152## Component Patterns5354### Buttons5556- Clear hierarchy: Primary > Secondary > Ghost/Text57- Consistent sizing: sm (32px), md (40px), lg (48px)58- States: default, hover, active, disabled, loading59- Always accessible: sufficient contrast, focus indicator6061### Forms6263- Labels above inputs (not floating labels for critical forms)64- Clear error states with inline messages65- Logical tab order66- Progressive disclosure — don't show all fields at once6768### Cards6970- Don't nest cards inside cards71- Clear visual hierarchy within the card72- Consistent padding and spacing73- Interactive cards need hover state7475### Navigation7677- Maximum 7±2 items in primary nav78- Clear active state79- Mobile: bottom nav or hamburger (not both)80- Breadcrumbs for deep hierarchies8182## Animation Principles8384- **Purpose**: guide attention, show relationships, provide feedback85- **Duration**: 150-300ms for micro-interactions, 300-500ms for transitions86- **Easing**: `ease-out` for entrances, `ease-in` for exits. Never `bounce` or `elastic`87- **Reduce motion**: respect `prefers-reduced-motion`8889## Anti-Patterns (from Impeccable)9091- [FAIL] Gray text on colored backgrounds — destroys readability92- [FAIL] Pure black text on white (#000 on #fff) — too harsh, tint the black93- [FAIL] Cards nested inside cards — visual noise94- [FAIL] Bounce/elastic easing — feels dated95- [FAIL] Icon tile above every heading — SaaS template tell96- [FAIL] Purple-to-blue gradient on everything — overused97- [FAIL] Using Inter for everything — pick a font that matches your brand98- [FAIL] Rounded-square icons everywhere — lack of visual variety99100## Dark Mode101102- Surface elevation through subtle lightening (not colored backgrounds)103- Reduce white contrast — use #E0E0E0, not #FFFFFF104- Shadows become less visible — use subtle borders or elevation changes105- Test all states in both modes106107108## Code Examples109110See `EXAMPLES.md` for detailed code examples.111112## Validation Checklist113114What to verify during the review phase before completing the task.115116## Common Mistakes117118Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.119120## Integration Notes121122How this skill interacts with other skills.123124125<!-- Source: EXAMPLES.md -->126127# ui-design Examples — Anti-patterns vs ContextOS Standard128129## Example 1: Component Token Consistency130131### Anti-pattern: Hardcoded Arbitrary Tailwind Utilities132133```tsx134// BAD: Inconsistent spacing, arbitrary colors, unmaintainable styling135<div className="p-[13px] bg-[#1a1b2e] rounded-[7px] text-[#99aab5] border border-[#2b2d42]">136 <button className="px-[15px] py-[7px] bg-[#5865f2] hover:bg-[#4752c4]">Action</button>137</div>138```139140### Best practice: ContextOS Standard (Semantic Theme Tokens)141142```tsx143// GOOD: Consistent scale utilities driven by Tailwind v4 @theme design tokens144<div className="p-4 bg-card rounded-lg text-muted-foreground border border-border">145 <Button variant="primary" size="md">Action</Button>146</div>147```148149<!-- Source: TROUBLESHOOTING.md -->150151# ui-design Troubleshooting & Common Mistakes152153## 1. Z-Index Chaos154155- **Symptom**: Tooltips rendered underneath dialog overlays, or dropdowns hidden behind sticky headers.156- **Root Cause**: Ad-hoc hardcoded values (z-50, z-[999], z-[9999]).157- **Fix**: Use Radix / shadcn Portals for floating elements so they render at root DOM level, or declare strict z-index tokens.158159## 2. Inconsistent Component States160161- **Symptom**: Buttons have hover states but lack focus-visible rings or disabled states.162- **Root Cause**: Styling only the default and hover states.163- **Fix**: Standardize state matrices for every interactive element: default, hover, focus-visible, active, disabled, loading.164165## 3. Ignoring Empty and Error Component States166167- **Symptom**: Tables or list views show a blank white box when there are 0 records.168- **Root Cause**: Developers only design for the "ideal data" case.169- **Fix**: Every data component must explicitly render designed EmptyState and ErrorState fallbacks.