ui-design
UI/UX Best Practices Frontend Design
Comprehensive UI/UX and frontend design best practices guide. Contains 42 rules across 8 categories, prioritized by impact to guide accessible, performant, and user-friendly interface development.
When to Apply
Reference these guidelines when:
- Structuring HTML for accessibility and semantics
- Writing CSS for responsive layouts and visual hierarchy
- Optimizing images and fonts for Core Web Vitals
- Designing forms with proper validation and error handling
- Adding animations and interactive elements
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Accessibility & WCAG Compliance | CRITICAL | access- |
| 2 | Core Web Vitals Optimization | CRITICAL | cwv- |
| 3 | Visual Hierarchy & Layout | HIGH | layout- |
| 4 | Responsive & Mobile-First Design | HIGH | resp- |
| 5 | Typography & Font Loading | MEDIUM-HIGH | typo- |
| 6 | Color & Contrast | MEDIUM | color- |
| 7 | Forms & Validation UX | MEDIUM | form- |
| 8 | Animation & Performance | LOW-MEDIUM | anim- |
Quick Reference
1. Accessibility & WCAG Compliance (CRITICAL)
access-semantic-html- Use semantic HTML elements for screen readersaccess-keyboard-navigation- Ensure full keyboard navigationaccess-focus-indicators- Provide visible focus indicatorsaccess-alt-text- Provide meaningful alt text for imagesaccess-aria-labels- Use ARIA labels for icon-only controlsaccess-target-size- Ensure minimum touch target size (24×24px)access-heading-hierarchy- Maintain logical heading hierarchy
2. Core Web Vitals Optimization (CRITICAL)
cwv-optimize-lcp- Optimize Largest Contentful Paint under 2.5scwv-minimize-cls- Minimize Cumulative Layout Shift under 0.1cwv-improve-inp- Improve Interaction to Next Paint under 200mscwv-responsive-images- Serve responsive images with srcsetcwv-lazy-load-offscreen- Lazy load offscreen images and iframescwv-critical-css- Inline critical CSS and defer the rest
3. Visual Hierarchy & Layout (HIGH)
layout-visual-hierarchy- Establish clear visual hierarchylayout-whitespace- Use whitespace to improve readabilitylayout-f-pattern- Design for F-pattern reading behaviorlayout-grid-system- Use a consistent grid systemlayout-single-cta- Limit to one primary CTA per screenlayout-proximity-grouping- Group related elements with proximity
4. Responsive & Mobile-First Design (HIGH)
resp-mobile-first- Design mobile-first with min-width queriesresp-fluid-typography- Use fluid typography with clamp()resp-container-queries- Use container queries for componentsresp-touch-targets- Size touch targets for mobile (44×44px)resp-viewport-meta- Configure viewport meta tag correctly
5. Typography & Font Loading (MEDIUM-HIGH)
typo-font-display- Use font-display to control loading behaviortypo-preload-fonts- Preload critical web fontstypo-readable-line-length- Constrain line length (45-75ch)typo-line-height- Set appropriate line height (1.5-1.7)typo-system-font-stack- Use system font stack for UI elements
6. Color & Contrast (MEDIUM)
color-contrast-ratio- Meet WCAG contrast ratio requirements (4.5:1)color-not-only-indicator- Never use color alone to convey informationcolor-dark-mode- Support dark mode with prefers-color-schemecolor-semantic-palette- Use semantic color names in design tokens
7. Forms & Validation UX (MEDIUM)
form-inline-validation- Use inline validation after field blurform-error-messages- Write actionable error messagesform-labels-above- Place labels above input fieldsform-input-types- Use correct HTML input types for mobileform-autocomplete- Enable browser autocomplete with correct attributes
8. Animation & Performance (LOW-MEDIUM)
anim-gpu-properties- Animate only GPU-accelerated propertiesanim-will-change- Use will-change sparingly for animation hintsanim-reduced-motion- Respect user motion preferencesanim-duration-easing- Use appropriate animation duration and easing
How to Use
Read individual reference files for detailed explanations and code examples:
- Section definitions - Category structure and impact levels
- Rule template - Template for adding new rules
- Example: access-semantic-html
Full Compiled Document
For the complete guide with all rules expanded: AGENTS.md
More from thongdn-it/react-agent-skills
typescript
This skill should be used when the user asks to "optimize TypeScript performance", "speed up tsc compilation", "configure tsconfig.json", "fix type errors", "improve async patterns", or encounters TS errors (TS2322, TS2339, "is not assignable to"). Also triggers on .ts, .tsx, .d.ts file work involving type definitions, module organization, or memory management. Does NOT cover TypeScript basics, framework-specific patterns, or testing.
30vitest
Vitest testing framework patterns for test setup, async testing, mocking with vi.*, snapshots, and test performance (formerly test-vitest). This skill should be used when writing or debugging Vitest tests. This skill does NOT cover TDD methodology (use test-tdd skill), API mocking with MSW (use test-msw skill), or Jest-specific APIs.
27react-hook-form
React Hook Form performance optimization for client-side form validation using useForm, useWatch, useController, and useFieldArray. This skill should be used when building client-side controlled forms with React Hook Form library. This skill does NOT cover React 19 Server Actions, useActionState, or server-side form handling (use react-19 skill for those).
26zod
Zod schema validation best practices for type safety, parsing, and error handling. This skill should be used when defining z.object schemas, using z.string validations, safeParse, or z.infer. This skill does NOT cover React Hook Form integration patterns (use react-hook-form skill) or OpenAPI client generation (use orval skill).
22web-design-guidelines
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
22tailwind
Tailwind CSS v4 performance optimization and best practices guidelines (formerly tailwindcss-v4-style). This skill should be used when writing, reviewing, or refactoring Tailwind CSS v4 code to ensure optimal build performance, minimal CSS output, and correct usage of v4 features. Triggers on tasks involving Tailwind configuration, @theme directive, utility classes, responsive design, dark mode, container queries, or CSS generation optimization.
21