Frontend UI/UX
Build interfaces that are clear, fast, expressive, and hard to confuse for generic AI output.
Default to semantic HTML, modern CSS, and small JavaScript. Stay framework-agnostic unless the user or codebase requires otherwise.
Operating mode
First decide which job you are doing:
- Build: create a new page, component, or styling system.
- Refine: improve an existing implementation without needless rewrites.
- Review: audit UI/UX, accessibility, responsiveness, and interaction quality.
If crucial context is missing, ask only for the minimum:
- Who is this for?
- What is the main user task?
- What should it feel like?
- Any hard constraints: brand, accessibility, performance, browser support, or existing stack?
If the prompt already implies the answers, do not stall; proceed and state assumptions briefly.
Workflow
1. Choose a direction
Before coding, lock a clear direction:
- Purpose: what job the interface helps users do
- Audience: who uses it, in what context
- Tone: pick a distinct aesthetic direction, not a vague midpoint
- Differentiator: one memorable detail or principle that makes it feel intentional
Describe the direction in 1-3 lines before implementation.
2. Build from primitives
Prefer this order:
- semantic structure
- content hierarchy
- layout
- states and interactions
- visual polish
Use HTML/CSS/JS concepts even when writing framework code:
- semantic landmarks, headings, labels, buttons, inputs, lists
- CSS custom properties for tokens
- progressive enhancement over cleverness
- small state surfaces and event flows
3. Make it feel good
Polish the parts users actually touch:
- hierarchy should be obvious at a glance
- spacing should create rhythm, not sameness
- interactions should feel responsive on press, hover, focus, drag, and loading
- copy should be short, specific, and helpful
- empty, error, loading, and success states should feel designed, not tacked on
4. Keep it fast and robust
Prefer simple implementations that survive change:
- mobile-first layouts
- fluid type and spacing with
clamp() where useful
- container-aware components when layout context matters
- CSS variables for color, spacing, radius, shadow, and motion tokens
- animate
transform and opacity first
- minimize JS; use it for state, measurement, and progressive enhancement
5. Self-review
Before finishing, check:
- usable without guessing
- visually cohesive
- responsive at narrow and wide widths
- keyboard and focus friendly
- sufficient contrast
- reduced-motion aware
- no gratuitous complexity
Design rules
Semantics and structure
- Start with semantic HTML. Good structure makes styling, accessibility, and maintenance easier.
- Make headings, labels, actions, and groups unambiguous.
- Prefer real buttons, inputs, links, dialogs, lists, and tables over
div soup.
- Make states visible in the DOM and styling model; do not hide core behavior in fragile JS.
Layout and composition
- Create clear visual hierarchy with size, contrast, spacing, and placement.
- Use asymmetry, overlap, or grid breaks intentionally, not randomly.
- Avoid "card soup": not every section needs a rounded box.
- Avoid nesting boxes inside boxes unless it clarifies hierarchy.
- Left-align long-form content by default; centered layouts are for short, deliberate moments.
- Use dense and loose spacing intentionally to create rhythm.
Typography
- Typography does most of the design work. Treat it that way.
- Use a clear scale. Let headings lead, body copy recede, metadata stay quiet.
- Avoid generic defaults when the task calls for a distinctive feel, but do not chase novelty at the expense of readability.
- Keep line length, line height, and spacing comfortable.
- Make copy concise. Remove filler, repeated labels, and text that restates the obvious.
Color and surfaces
- Commit to a palette with a point of view.
- Use neutrals with slight tint rather than dead grayscale when appropriate.
- Make emphasis sparse and meaningful.
- Use shadows, borders, blur, and gradients as support, not decoration spam.
- Avoid overused AI aesthetics unless the user explicitly wants them: purple-blue gradient hero, random glassmorphism, glowing dark dashboard, identical feature cards.
Interaction and UX
- Make primary actions obvious.
- Use progressive disclosure: start simple, reveal more when needed.
- Prefer inline guidance over hidden rules.
- Design empty states to teach the next step.
- Make loading states preserve context whenever possible.
- Favor optimistic, responsive-feeling interactions when risk is low.
- Never make users work to discover what is clickable or what changed.
Motion rules
Use motion to clarify state, spatial relationships, and feedback. Do not animate just because you can.
When to animate
- Frequent actions: reduce or remove animation.
- Occasional actions: use short, clear transitions.
- Rare or celebratory moments: a little delight is fine.
- Keyboard-driven or repeated expert actions: prefer instant response.
How to animate
- Prefer
ease-out for entrances and direct responses.
- Use stronger custom curves when needed; default CSS easing is often too weak.
- Keep most UI motion under 300ms.
- Use transitions for interruptible UI.
- Avoid animating from
scale(0); start near the resting state and combine with opacity.
- Make anchored elements animate from the right origin.
- Add subtle press feedback to interactive controls.
- Respect
prefers-reduced-motion; reduce movement, keep clarity.
Performance
- Animate
transform and opacity first.
- Be cautious with blur, shadows, and large repaint areas.
- Do not animate layout properties unless the tradeoff is clearly worth it.
Accessibility and quality floor
Always preserve these basics:
- visible focus states
- keyboard reachability
- sufficient color contrast
- labels and affordances that make sense out of context
- touch targets large enough to hit
- hover effects not required for understanding
- forms with helpful errors and recovery paths
- motion that can be reduced
Accessibility is part of polish, not a cleanup pass.
Anti-patterns
Avoid these unless the prompt clearly calls for them:
- generic template aesthetics with no point of view
- every action styled as primary
- giant hero + three feature cards + testimonial strip by default
- excessive border radius everywhere
- decorative charts, icons, or gradients with no informational role
- center-aligned everything
- hidden scrollbars or low-contrast text for style
- over-abstracted CSS/JS for small interfaces
- rewriting an entire UI when the user asked for targeted polish
Delivery
If building
Return:
- a brief direction statement
- the implementation
- any notable UX/accessibility/performance choices
If refining
Preserve what already works. Change the minimum that meaningfully improves clarity, feel, or maintainability.
If reviewing
Use a compact table:
Prioritize the highest-leverage fixes first.
Heuristic
A good result should feel:
- obvious to use
- distinctive without being noisy
- fast without feeling abrupt
- polished in the small details
- simple in structure even when visually rich
If the result looks like it could have been generated for any product, push for a clearer point of view.
1---2name: ui-expert3description: Build, refine, or review web UI/UX with strong visual taste, interaction design, accessibility, and front-end implementation quality. Use whenever the user wants a page, component, layout, design system, dashboard, landing page, form, navigation, responsive behavior, styling pass, UX polish, accessibility improvement, motion pass, or asks to make a web interface look or feel better. Framework-independent: think in HTML, CSS, and JavaScript primitives first, then adapt to the stack at hand.4---56# Frontend UI/UX78Build interfaces that are clear, fast, expressive, and hard to confuse for generic AI output.910Default to semantic HTML, modern CSS, and small JavaScript. Stay framework-agnostic unless the user or codebase requires otherwise.1112## Operating mode1314First decide which job you are doing:15- **Build**: create a new page, component, or styling system.16- **Refine**: improve an existing implementation without needless rewrites.17- **Review**: audit UI/UX, accessibility, responsiveness, and interaction quality.1819If crucial context is missing, ask only for the minimum:201. Who is this for?212. What is the main user task?223. What should it feel like?234. Any hard constraints: brand, accessibility, performance, browser support, or existing stack?2425If the prompt already implies the answers, do not stall; proceed and state assumptions briefly.2627## Workflow2829### 1. Choose a direction30Before coding, lock a clear direction:31- **Purpose**: what job the interface helps users do32- **Audience**: who uses it, in what context33- **Tone**: pick a distinct aesthetic direction, not a vague midpoint34- **Differentiator**: one memorable detail or principle that makes it feel intentional3536Describe the direction in 1-3 lines before implementation.3738### 2. Build from primitives39Prefer this order:401. semantic structure412. content hierarchy423. layout434. states and interactions445. visual polish4546Use HTML/CSS/JS concepts even when writing framework code:47- semantic landmarks, headings, labels, buttons, inputs, lists48- CSS custom properties for tokens49- progressive enhancement over cleverness50- small state surfaces and event flows5152### 3. Make it feel good53Polish the parts users actually touch:54- hierarchy should be obvious at a glance55- spacing should create rhythm, not sameness56- interactions should feel responsive on press, hover, focus, drag, and loading57- copy should be short, specific, and helpful58- empty, error, loading, and success states should feel designed, not tacked on5960### 4. Keep it fast and robust61Prefer simple implementations that survive change:62- mobile-first layouts63- fluid type and spacing with `clamp()` where useful64- container-aware components when layout context matters65- CSS variables for color, spacing, radius, shadow, and motion tokens66- animate `transform` and `opacity` first67- minimize JS; use it for state, measurement, and progressive enhancement6869### 5. Self-review70Before finishing, check:71- usable without guessing72- visually cohesive73- responsive at narrow and wide widths74- keyboard and focus friendly75- sufficient contrast76- reduced-motion aware77- no gratuitous complexity7879## Design rules8081### Semantics and structure82- Start with semantic HTML. Good structure makes styling, accessibility, and maintenance easier.83- Make headings, labels, actions, and groups unambiguous.84- Prefer real buttons, inputs, links, dialogs, lists, and tables over `div` soup.85- Make states visible in the DOM and styling model; do not hide core behavior in fragile JS.8687### Layout and composition88- Create clear visual hierarchy with size, contrast, spacing, and placement.89- Use asymmetry, overlap, or grid breaks intentionally, not randomly.90- Avoid "card soup": not every section needs a rounded box.91- Avoid nesting boxes inside boxes unless it clarifies hierarchy.92- Left-align long-form content by default; centered layouts are for short, deliberate moments.93- Use dense and loose spacing intentionally to create rhythm.9495### Typography96- Typography does most of the design work. Treat it that way.97- Use a clear scale. Let headings lead, body copy recede, metadata stay quiet.98- Avoid generic defaults when the task calls for a distinctive feel, but do not chase novelty at the expense of readability.99- Keep line length, line height, and spacing comfortable.100- Make copy concise. Remove filler, repeated labels, and text that restates the obvious.101102### Color and surfaces103- Commit to a palette with a point of view.104- Use neutrals with slight tint rather than dead grayscale when appropriate.105- Make emphasis sparse and meaningful.106- Use shadows, borders, blur, and gradients as support, not decoration spam.107- Avoid overused AI aesthetics unless the user explicitly wants them: purple-blue gradient hero, random glassmorphism, glowing dark dashboard, identical feature cards.108109### Interaction and UX110- Make primary actions obvious.111- Use progressive disclosure: start simple, reveal more when needed.112- Prefer inline guidance over hidden rules.113- Design empty states to teach the next step.114- Make loading states preserve context whenever possible.115- Favor optimistic, responsive-feeling interactions when risk is low.116- Never make users work to discover what is clickable or what changed.117118## Motion rules119120Use motion to clarify state, spatial relationships, and feedback. Do not animate just because you can.121122### When to animate123- Frequent actions: reduce or remove animation.124- Occasional actions: use short, clear transitions.125- Rare or celebratory moments: a little delight is fine.126- Keyboard-driven or repeated expert actions: prefer instant response.127128### How to animate129- Prefer `ease-out` for entrances and direct responses.130- Use stronger custom curves when needed; default CSS easing is often too weak.131- Keep most UI motion under 300ms.132- Use transitions for interruptible UI.133- Avoid animating from `scale(0)`; start near the resting state and combine with opacity.134- Make anchored elements animate from the right origin.135- Add subtle press feedback to interactive controls.136- Respect `prefers-reduced-motion`; reduce movement, keep clarity.137138### Performance139- Animate `transform` and `opacity` first.140- Be cautious with blur, shadows, and large repaint areas.141- Do not animate layout properties unless the tradeoff is clearly worth it.142143## Accessibility and quality floor144145Always preserve these basics:146- visible focus states147- keyboard reachability148- sufficient color contrast149- labels and affordances that make sense out of context150- touch targets large enough to hit151- hover effects not required for understanding152- forms with helpful errors and recovery paths153- motion that can be reduced154155Accessibility is part of polish, not a cleanup pass.156157## Anti-patterns158159Avoid these unless the prompt clearly calls for them:160- generic template aesthetics with no point of view161- every action styled as primary162- giant hero + three feature cards + testimonial strip by default163- excessive border radius everywhere164- decorative charts, icons, or gradients with no informational role165- center-aligned everything166- hidden scrollbars or low-contrast text for style167- over-abstracted CSS/JS for small interfaces168- rewriting an entire UI when the user asked for targeted polish169170## Delivery171172### If building173Return:1741. a brief direction statement1752. the implementation1763. any notable UX/accessibility/performance choices177178### If refining179Preserve what already works. Change the minimum that meaningfully improves clarity, feel, or maintainability.180181### If reviewing182Use a compact table:183184| Issue | Change | Why |185| --- | --- | --- |186187Prioritize the highest-leverage fixes first.188189## Heuristic190191A good result should feel:192- obvious to use193- distinctive without being noisy194- fast without feeling abrupt195- polished in the small details196- simple in structure even when visually rich197198If the result looks like it could have been generated for any product, push for a clearer point of view.