Agent skill
frontend-design
Unified frontend skill for building distinctive, production-grade interfaces. Activate when writing UI components, pages, layouts, styling, design system work, React/Next.js code, or reviewing frontend code for accessibility, performance, and UX quality.
Install this agent skill to your Project
npx add-skill https://github.com/jjeremycai/claudekit/tree/main/skills/frontend-design
SKILL.md
This skill guides creation of distinctive, production-grade frontend interfaces. It covers design philosophy, implementation constraints, accessibility, performance optimization, and UX best practices. Activate it for any frontend work: building components, pages, applications, reviewing UI code, or optimizing React/Next.js applications.
Part 1: Design Philosophy
Before coding, understand the context and commit to a BOLD aesthetic direction:
- Purpose: What problem does this interface solve? Who uses it?
- Tone: Pick an extreme: brutally minimal, maximalist chaos, retro-futuristic, organic/natural, luxury/refined, playful/toy-like, editorial/magazine, brutalist/raw, art deco/geometric, soft/pastel, industrial/utilitarian, etc. Use these for inspiration but design one that is true to the aesthetic direction.
- Constraints: Technical requirements (framework, performance, accessibility).
- Differentiation: What makes this UNFORGETTABLE? What is the one thing someone will remember?
CRITICAL: Choose a clear conceptual direction and execute it with precision. Bold maximalism and refined minimalism both work -- the key is intentionality, not intensity.
Then implement working code (HTML/CSS/JS, React, Vue, etc.) that is:
- Production-grade and functional
- Visually striking and memorable
- Cohesive with a clear aesthetic point-of-view
- Meticulously refined in every detail
Aesthetics
- Typography: Choose fonts that are beautiful, unique, and interesting. Avoid generic fonts like Arial and Inter; opt for distinctive choices that elevate the interface. Pair a distinctive display font with a refined body font.
- Color & Theme: Commit to a cohesive aesthetic. Use CSS variables for consistency. Dominant colors with sharp accents outperform timid, evenly-distributed palettes.
- Motion: Use animations for effects and micro-interactions. Prioritize CSS-only solutions for HTML. Use Motion library for React when available. Focus on high-impact moments: one well-orchestrated page load with staggered reveals creates more delight than scattered micro-interactions. Use scroll-triggering and hover states that surprise.
- Spatial Composition: Unexpected layouts. Asymmetry. Overlap. Diagonal flow. Grid-breaking elements. Generous negative space OR controlled density.
- Backgrounds & Visual Details: Create atmosphere and depth rather than defaulting to solid colors. Add contextual effects and textures that match the overall aesthetic: gradient meshes, noise textures, geometric patterns, layered transparencies, dramatic shadows, decorative borders, custom cursors, grain overlays.
NEVER use generic AI-generated aesthetics: overused font families (Inter, Roboto, Arial, system fonts), cliched color schemes (particularly purple gradients on white backgrounds), predictable layouts and component patterns, cookie-cutter design that lacks context-specific character.
Interpret creatively and make unexpected choices that feel genuinely designed for the context. No design should be the same. Vary between light and dark themes, different fonts, different aesthetics. NEVER converge on common choices (Space Grotesk, for example) across generations.
IMPORTANT: Match implementation complexity to the aesthetic vision. Maximalist designs need elaborate code with extensive animations and effects. Minimalist or refined designs need restraint, precision, and careful attention to spacing, typography, and subtle details.
Part 2: Implementation Constraints
Opinionated rules for consistent, high-quality UI code.
Stack
- MUST use Tailwind CSS defaults unless custom values already exist or are explicitly requested
- MUST use
motion/react(formerlyframer-motion) when JavaScript animation is required - SHOULD use
tw-animate-cssfor entrance and micro-animations in Tailwind CSS - MUST use
cnutility (clsx+tailwind-merge) for class logic
Components
- MUST use accessible component primitives for keyboard/focus behavior (
Base UI,React Aria,Radix) - MUST use the project's existing component primitives first
- NEVER mix primitive systems within the same interaction surface
- SHOULD prefer
Base UIfor new primitives if compatible with the stack - NEVER rebuild keyboard or focus behavior by hand unless explicitly requested
Animation
- NEVER add animation unless it is explicitly requested
- MUST animate only compositor props (
transform,opacity) - NEVER animate layout properties (
width,height,top,left,margin,padding) - SHOULD avoid animating paint properties (
background,color) except for small, local UI (text, icons) - SHOULD use
ease-outon entrance - NEVER exceed
200msfor interaction feedback - MUST pause looping animations when off-screen
- MUST respect
prefers-reduced-motion(provide reduced variant or disable) - NEVER introduce custom easing curves unless explicitly requested
- SHOULD avoid animating large images or full-screen surfaces
- NEVER animate large
blur()orbackdrop-filtersurfaces - NEVER
transition: all-- list properties explicitly - Set correct
transform-origin - SVG: transforms on
<g>wrapper withtransform-box: fill-box; transform-origin: center - Animations interruptible -- respond to user input mid-animation
- NEVER apply
will-changeoutside an active animation
Typography
- MUST use
text-balancefor headings andtext-prettyfor body/paragraphs - MUST use
tabular-numsfor data columns and number comparisons - SHOULD use
truncateorline-clampfor dense UI - NEVER modify
letter-spacing(tracking-*) unless explicitly requested - Use
...as…(ellipsis character, not three dots) - Curly quotes
""not straight" - Non-breaking spaces:
10 MB, brand names - Loading states end with
…:"Loading…","Saving…"
Layout
- MUST use a fixed
z-indexscale (no arbitraryz-*) - SHOULD use
size-*for square elements instead ofw-*+h-* - NEVER use
h-screen, useh-dvh - Flex/grid over JS measurement for layout
Design Constraints
- NEVER use gradients unless explicitly requested
- NEVER use purple or multicolor gradients
- NEVER use glow effects as primary affordances
- SHOULD use Tailwind CSS default shadow scale unless explicitly requested
- MUST give empty states one clear next action
- SHOULD limit accent color usage to one per view
- SHOULD use existing theme or Tailwind CSS color tokens before introducing new ones
Performance Guards
- NEVER use
useEffectfor anything that can be expressed as render logic - Prefer uncontrolled inputs; controlled inputs must be cheap per keystroke
- No layout reads in render (
getBoundingClientRect,offsetHeight,offsetWidth,scrollTop) - Batch DOM reads/writes; avoid interleaving
Part 3: Accessibility & UX
Comprehensive rules for accessible, usable interfaces.
Accessibility
- Icon-only buttons need
aria-label - Form controls need
<label>oraria-label - Interactive elements need keyboard handlers (
onKeyDown/onKeyUp) <button>for actions,<a>/<Link>for navigation (not<div onClick>)- Images need
alt(oralt=""if decorative) - Decorative icons need
aria-hidden="true" - Async updates (toasts, validation) need
aria-live="polite" - Use semantic HTML (
<button>,<a>,<label>,<table>) before ARIA - Headings hierarchical
<h1>-<h6>; include skip link for main content scroll-margin-topon heading anchors
Focus States
- Interactive elements need visible focus:
focus-visible:ring-*or equivalent - Never
outline-none/outline: nonewithout focus replacement - Use
:focus-visibleover:focus(avoid focus ring on click) - Group focus with
:focus-withinfor compound controls
Forms
- Inputs need
autocompleteand meaningfulname - Use correct
type(email,tel,url,number) andinputmode - Never block paste (
onPaste+preventDefault) - Labels clickable (
htmlForor wrapping control) - Disable spellcheck on emails, codes, usernames (
spellCheck={false}) - Checkboxes/radios: label + control share single hit target (no dead zones)
- Submit button stays enabled until request starts; spinner during request
- Errors inline next to fields; focus first error on submit
- Placeholders end with
…and show example pattern autocomplete="off"on non-auth fields to avoid password manager triggers- Warn before navigation with unsaved changes (
beforeunloador router guard) - MUST use an
AlertDialogfor destructive or irreversible actions
Content Handling
- Text containers handle long content:
truncate,line-clamp-*, orbreak-words - Flex children need
min-w-0to allow text truncation - Handle empty states -- do not render broken UI for empty strings/arrays
- User-generated content: anticipate short, average, and very long inputs
Images
<img>needs explicitwidthandheight(prevents CLS)- Below-fold images:
loading="lazy" - Above-fold critical images:
priorityorfetchpriority="high"
Navigation & State
- URL reflects state -- filters, tabs, pagination, expanded panels in query params
- Links use
<a>/<Link>(Cmd/Ctrl+click, middle-click support) - Deep-link all stateful UI (if uses
useState, consider URL sync via nuqs or similar) - Destructive actions need confirmation modal or undo window -- never immediate
Touch & Interaction
touch-action: manipulation(prevents double-tap zoom delay)-webkit-tap-highlight-colorset intentionallyoverscroll-behavior: containin modals/drawers/sheets- During drag: disable text selection,
inerton dragged elements autoFocussparingly -- desktop only, single primary input; avoid on mobile- MUST respect
safe-area-insetfor fixed elements
Safe Areas & Layout
- Full-bleed layouts need
env(safe-area-inset-*)for notches - Avoid unwanted scrollbars:
overflow-x-hiddenon containers, fix content overflow
Dark Mode & Theming
color-scheme: darkon<html>for dark themes (fixes scrollbar, inputs)<meta name="theme-color">matches page background- Native
<select>: explicitbackground-colorandcolor(Windows dark mode)
Locale & i18n
- Dates/times: use
Intl.DateTimeFormatnot hardcoded formats - Numbers/currency: use
Intl.NumberFormatnot hardcoded formats - Detect language via
Accept-Language/navigator.languages, not IP
Hydration Safety
- Inputs with
valueneedonChange(or usedefaultValuefor uncontrolled) - Date/time rendering: guard against hydration mismatch (server vs client)
suppressHydrationWarningonly where truly needed- Prevent hydration mismatch with inline scripts
Hover & Interactive States
- Buttons/links need
hover:state (visual feedback) - Interactive states increase contrast: hover/active/focus more prominent than rest
- SHOULD use structural skeletons for loading states
Content & Copy
- Active voice: "Install the CLI" not "The CLI will be installed"
- Title Case for headings/buttons (Chicago style)
- Numerals for counts: "8 deployments" not "eight"
- Specific button labels: "Save API Key" not "Continue"
- Error messages include fix/next step, not just problem
- Second person; avoid first person
&over "and" where space-constrained
Anti-Patterns (flag these)
user-scalable=noormaximum-scale=1disabling zoomonPastewithpreventDefaulttransition: alloutline-nonewithout focus-visible replacement- Inline
onClicknavigation without<a> <div>or<span>with click handlers (should be<button>)- Images without dimensions
- Large arrays
.map()without virtualization - Form inputs without labels
- Icon buttons without
aria-label - Hardcoded date/number formats (use
Intl.*) autoFocuswithout clear justification
Part 4: React & Next.js Performance
Performance optimization patterns for React and Next.js, prioritized by impact.
| Priority | Category | Impact |
|---|---|---|
| 1 | Eliminating Waterfalls | CRITICAL |
| 2 | Bundle Size Optimization | CRITICAL |
| 3 | Server-Side Performance | HIGH |
| 4 | Client-Side Data Fetching | MEDIUM-HIGH |
| 5 | Re-render Optimization | MEDIUM |
| 6 | Rendering Performance | MEDIUM |
| 7 | JavaScript Performance | LOW-MEDIUM |
| 8 | Advanced Patterns | LOW |
Critical: Eliminate Waterfalls
- Defer
awaituntil needed (move into branches) - Use
Promise.all()for independent async operations - Start promises early, await late
- Use
better-allfor partial dependencies - Use Suspense boundaries to stream content
Critical: Reduce Bundle Size
- Avoid barrel file imports (import directly from source)
- Use
next/dynamicfor heavy components - Defer non-critical third-party libraries
- Preload based on user intent
- Add
<link rel="preconnect">for CDN/asset domains - Critical fonts:
<link rel="preload" as="font">withfont-display: swap
High: Server-Side Patterns
- Use
React.cache()for per-request deduplication - Use LRU cache for cross-request caching
- Minimize serialization at RSC boundaries
- Parallelize data fetching with component composition
Medium-High: Client-Side Data Fetching
- Use SWR for automatic request deduplication
- Defer state reads to usage point
- Use lazy state initialization for expensive values
- Use derived state subscriptions
- Apply
startTransitionfor non-urgent updates
Medium: Rendering Patterns
- Animate SVG wrappers, not SVG elements directly
- Use
content-visibility: autofor long lists (>50 items) - Use explicit conditional rendering (
? :not&&)
Low-Medium: JavaScript Patterns
- Batch DOM CSS changes via classes
- Build index maps for repeated lookups
- Cache repeated function calls
- Use
toSorted()instead ofsort()for immutability - Early length check for array comparisons
Part 5: Review Mode
When reviewing existing frontend code, output concise findings grouped by file. Use file:line format (VS Code clickable). Terse findings -- state issue + location. Skip explanation unless fix is non-obvious.
## src/Button.tsx
src/Button.tsx:42 - icon button missing aria-label
src/Button.tsx:18 - input lacks label
src/Button.tsx:55 - animation missing prefers-reduced-motion
src/Button.tsx:67 - transition: all -> list properties
## src/Modal.tsx
src/Modal.tsx:12 - missing overscroll-behavior: contain
src/Modal.tsx:34 - "..." -> ellipsis character
## src/Card.tsx
pass
Part 6: Design Review (Rams)
When reviewing existing frontend code for accessibility and visual design issues, use this structured review format.
Accessibility Review (WCAG 2.1)
Critical (Must Fix)
| Check | WCAG | What to look for |
|---|---|---|
| Images without alt | 1.1.1 | <img> without alt attribute |
| Icon-only buttons | 4.1.2 | <button> with only SVG/icon, no aria-label |
| Form inputs without labels | 1.3.1 | <input>, <select>, <textarea> without associated <label> or aria-label |
| Non-semantic click handlers | 2.1.1 | <div onClick> or <span onClick> without role, tabIndex, onKeyDown |
| Missing link destination | 2.1.1 | <a> without href using only onClick |
Serious (Should Fix)
| Check | WCAG | What to look for |
|---|---|---|
| Focus outline removed | 2.4.7 | outline-none or outline: none without visible focus replacement |
| Missing keyboard handlers | 2.1.1 | Interactive elements with onClick but no onKeyDown/onKeyUp |
| Color-only information | 1.4.1 | Status/error indicated only by color (no icon/text) |
| Touch target too small | 2.5.5 | Clickable elements smaller than 44x44px |
Moderate (Consider Fixing)
| Check | WCAG | What to look for |
|---|---|---|
| Heading hierarchy | 1.3.1 | Skipped heading levels (h1 → h3) |
| Positive tabIndex | 2.4.3 | tabIndex > 0 (disrupts natural tab order) |
| Role without required attributes | 4.1.2 | role="button" without tabIndex="0" |
Visual Design Review
Layout & Spacing
- Inconsistent spacing values, overflow issues, alignment problems, z-index conflicts
Typography
- Mixed font families/weights/sizes, line height issues, missing font fallbacks
Color & Contrast
- Contrast ratio below 4.5:1, missing hover/focus states, dark mode inconsistencies
Components
- Missing button states (disabled, loading, hover, active, focus)
- Missing form field states (error, success, disabled)
- Inconsistent borders, shadows, or icon sizing
Review Output Format
═══════════════════════════════════════════════════
DESIGN REVIEW: [filename]
═══════════════════════════════════════════════════
CRITICAL (X issues)
───────────────────
[A11Y] Line 24: Button missing accessible name
<button><CloseIcon /></button>
Fix: Add aria-label="Close"
WCAG: 4.1.2
SERIOUS (X issues)
──────────────────
...
═══════════════════════════════════════════════════
SUMMARY: X critical, X serious, X moderate
Score: XX/100
═══════════════════════════════════════════════════
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
himalaya
Use when the user asks to read, send, search, or manage email from the terminal. Himalaya is a CLI email client supporting IMAP, Maildir, Notmuch, SMTP, and Sendmail backends. Trigger on: email, inbox, send email, check mail, reply to email, forward email, email folders.
gh-fix-ci
Use when a user asks to debug or fix failing GitHub PR checks that run in GitHub Actions; use `gh` to inspect checks and logs, summarize failure context, draft a fix plan, and implement only after explicit approval. Treat external providers (for example Buildkite) as out of scope and report only the details URL.
yeet
Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).
ashby
This skill should be used when the user asks about "Ashby API", "how to use Ashby tools", "Ashby authentication", "recruiting workflows", "candidate pipeline", "interview scheduling", "hiring process", "move candidate through pipeline", "schedule an interview", "manage applications", "track hiring progress", "source candidates", or "advance to next stage". Provides complete API reference and recruiting workflow guidance for the Ashby ATS integration.
skill-installer
Install Codex skills into $CODEX_HOME/skills from a curated list or a GitHub repo path. Use when a user asks to list installable skills, install a curated skill, or install a skill from another repo (including private repos).
skill-creator
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Codex's capabilities with specialized knowledge, workflows, or tool integrations.
Didn't find tool you were looking for?