Frontend design

From oyi77/1ai-skills · View interactive version

Frontend design is an AI agent skill from the GitHub repository oyi77/1ai-skills. Use when designing frontend systems — component architecture, Tailwind mastery, visual hierarchy, and responsive layouts. Covers design-system patterns, component composition, and responsive implementation.

How to use this skill

Skill file

Overview

Frontend design skill for building beautiful, consistent UIs. Covers design systems, Tailwind CSS, component patterns, spacing, typography, color theory, and responsive design. This skill bridges visual design and engineering: component architecture and design tokens through CSS implementation, accessibility auditing, and design system distribution.

Capabilities

When to Use

Trigger phrases:

Use when:

When NOT to Use

Design Token System

Single source of truth for visual decisions. Map every visual property to a semantic token so themes swap atomically.

// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      colors: {
        primary: { 50: '#eff6ff', 500: '#3b82f6', 900: '#1e3a8a' },
        neutral: { 50: '#fafafa', 500: '#737373', 900: '#171717' }
      },
      spacing: { '18': '4.5rem', '88': '22rem' },
      fontSize: { 'display': ['3rem', { lineHeight: '1.2', fontWeight: '700' }] }
    }
  }
}

Component Pattern

Compose from primitives. Prefer composition over inheritance; each component owns one responsibility.

// Button with variants
const Button = ({ variant = 'primary', size = 'md', children, ...props }) => {
  const styles = {
    primary: 'bg-primary-500 text-white hover:bg-primary-600',
    secondary: 'bg-neutral-100 text-neutral-900 hover:bg-neutral-200',
    ghost: 'bg-transparent hover:bg-neutral-100'
  }
  const sizes = { sm: 'px-3 py-1.5 text-sm', md: 'px-4 py-2', lg: 'px-6 py-3 text-lg' }
  return <button className={`${styles[variant]} ${sizes[size]} rounded-lg transition`} {...props}>{children}</button>
}

Common Patterns

Setup & Configuration

# Create React + TypeScript project with Vite
npm create vite@latest my-app -- --template react-ts
cd my-app

# Install Tailwind CSS v4 with Vite plugin
npm install tailwindcss @tailwindcss/vite

# Install Storybook for component workbench
npx storybook@latest init

# Chromatic for visual regression in CI
npm install -D chromatic

For Vue projects:

npm create vue@latest my-vue-app
cd my-vue-app
npm install unocss

Process

  1. Prepare — Gather brand assets, wireframes, and content strategy. Set up toolchain (Vite, Tailwind, Storybook). Document component hierarchy with a tree diagram before writing code.
  2. Design tokens — Establish color palette, typography scale, spacing units, and shadows as CSS custom properties or Tailwind config. Verify contrast ratios meet WCAG AA.
  3. Component build — Layer components via atomic design (atoms → molecules → organisms). Implement responsive variants and dark mode.
  4. Quality check — Run Lighthouse, AXE DevTools, keyboard navigation audit, and cross-browser visual diff.
  5. Deliver and document — Export component library with usage documentation, Storybook preview, and live demo URL.

Common Issues & Troubleshooting

| Problem | Root Cause | Solution |

|---|---|---|

| CSS specificity conflicts | Nested selectors and !important overrides | Use BEM naming, CSS Modules, or Tailwind utility classes |

| Layout breaks on mobile | Fixed px widths or missing viewport meta | Use relative units (rem, %, vw) and mobile-first media queries |

| Components re-render unexpectedly | Missing React keys or unstable callback references | Add stable keys to lists, memoize callbacks with useCallback |

| Color contrast fails WCAG AA | Insufficient luminance difference against background | Use WCAG contrast calculators; maintain minimum 4.5:1 ratio for normal text |

| Screen reader skips interactive element | Missing or incorrect ARIA role or attribute | Use semantic HTML where possible; add aria-label for visual-only labels |

| Hover styles don't work on touch devices | :hover-dependent interactions without touch fallback | Use @media (hover: hover) to separate pointer and touch interactions |

Production Web Quality Gate

Before calling a page finished, verify the states and delivery surface—not just the happy-path screenshot:

Verification

Anti-Rationalization Table

| Rationalization | Reality |

|---|---|

| "Just use a UI library like MUI or Chakra" | Libraries need deep customization for brand identity; CSS architecture and component composition skills remain essential |

| "Mobile-first is optional for our audience" | 60%+ of global traffic is mobile — responsive design is table stakes, not optional |

| "Accessibility is a nice-to-have add-on" | WCAG compliance is legally required in many jurisdictions and directly affects SEO rankings |

| "CSS is easy, I will just write what works" | Poor CSS architecture leads to specificity wars, !important overrides, and unmaintainable stylesheets |

| "We don't need a design system for a small project" | Even small projects benefit from consistent spacing, typography, and color tokens — prevents tech debt from day one |

| "State management libraries solve everything" | Poor component architecture causes prop-drilling and re-render issues that no state library can fix |

Video / Motion Graphics

Typography hierarchy, spacing rhythm, and visual hierarchy apply directly to Remotion video frames. Key difference: video has fixed dimensions (1920×1080), no responsive design. Text must be larger — main headline ≥84px, supporting ≥44px at 1080p.

Sub-Skills & Specialized Playbooks

| Sub-Skill | Trigger / Kasus Penggunaan | Berkas Referensi |

| :--- | :--- | :--- |

| storybook-ui | Developing, testing, and documenting isolated UI components with stories, controls, accessibility, and visual regression | SKILL.md |

| frontend-ui-design | Production-grade UI component architecture, responsive grids, WCAG accessibility, cross-browser compat, CSS specificity battles | SKILL.md |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.