frontend-design
npx skills add https://github.com/saccoai/agent-skills --skill frontend-design
Agent 安装分布
Skill 文档
This skill creates production-grade frontend interfaces that are distinctive, accessible, and performant. Every project gets a bespoke aesthetic direction â no two designs should look alike.
The user provides: the client context (industry, audience, brand), the tech stack, and any design constraints.
Non-Negotiable Quality Standards
Every project MUST meet these. No exceptions, no shortcuts:
1. Mobile-First Responsive
- Design at 390px first, then scale up
- Test at 390px, 768px, 1280px+ breakpoints after implementing each component
- No horizontal scrolling at any breakpoint
- Touch targets ⥠44Ã44px on mobile
- Stack layouts vertically on mobile, expand to grid on desktop
2. WCAG AA Accessibility
- Color contrast: 4.5:1 for normal text, 3:1 for large text (18px+ bold or 24px+)
- Keyboard navigation: every interactive element reachable via Tab, activatable via Enter/Space
- Focus indicators: visible focus ring on all interactive elements (never
outline: nonewithout replacement) - ARIA: proper roles, labels, and descriptions. Headings in logical order (no skipped levels)
- Alt text: every
<img>has meaningful alt text (oralt=""for decorative images) - Form labels: every input has a visible
<label>. Error messages linked viaaria-describedby - Screen readers: test with VoiceOver (macOS) â content must be logical when read linearly
- Reduced motion: respect
prefers-reduced-motionâ disable animations for users who opt out
3. Performance Budget
- No single component adds more than 50KB of JavaScript
- All images: use
next/imagewith propersizesandpriorityattributes - Images served in modern formats (WebP/AVIF) via Next.js automatic optimization
- Total page JS bundle: flag if exceeding 200KB gzipped
- Animations: use
LazyMotion+mfrom Framer Motion (tree-shakeable), never importmotiondirectly - Fonts: load via
next/fontwithdisplay: swap. Maximum 2 font families per project - Lighthouse Performance score target: ⥠90
4. Dark Mode Support
- Every project ships with working dark mode
- Use CSS variables in Tailwind v4
@themefor all colors - Use
dark:variants in Tailwind for component-level overrides - Toggle mechanism: respect
prefers-color-schemesystem preference, with optional manual toggle - Test both modes visually â dark mode is not an afterthought
/* Example: globals.css */
@import "tailwindcss";
@theme {
--color-background: #f8f7f5;
--color-foreground: #1c1917;
--color-primary: #8e375c;
--color-muted: #a8a29e;
}
@media (prefers-color-scheme: dark) {
:root {
--color-background: #1c1917;
--color-foreground: #f5f5f4;
--color-primary: #c76b94;
--color-muted: #78716c;
}
}
Aesthetic Direction â Decision Tree
Before writing any code, run this decision tree to select the right aesthetic for the client. Ask these questions (use AskUserQuestion or discuss with the user):
Q1: What is the client’s industry?
| Industry | Lean toward |
|---|---|
| Finance, law, consulting | Refined Professional |
| Fashion, art, architecture | Editorial Luxury |
| Tech, SaaS, startup | Clean Technical |
| Food, hospitality, wellness | Warm Organic |
| Education, non-profit, government | Trustworthy Minimal |
| Creative agency, entertainment | Bold Expressive |
Q2: Who is the primary audience?
| Audience | Adjust toward |
|---|---|
| Corporate / B2B | More restraint, more whitespace, conventional layouts |
| Consumer / B2C | More personality, bolder colors, more engaging interactions |
| Elderly / accessibility-first | Larger text, higher contrast, simpler layouts, less motion |
| Young / digital-native | More dynamic, more motion, more experimental layouts |
Q3: What is the brand personality?
| Personality | Design expression |
|---|---|
| Authoritative / trustworthy | Serif headings, muted palette, symmetric layouts |
| Innovative / forward-thinking | Geometric sans-serif, asymmetric, accent gradients |
| Warm / approachable | Rounded elements, warm colors, friendly typography |
| Premium / exclusive | High contrast, editorial spacing, restrained palette |
| Playful / energetic | Bold colors, large type, dynamic layouts, more animation |
Result: Select one of these directions
1. Refined Professional
- Typography: Serif display (e.g., Playfair Display, DM Serif Display, Lora) + clean sans body (e.g., Inter, DM Sans, Source Sans 3)
- Palette: Muted, warm neutrals. One sophisticated accent (navy, burgundy, forest green). No bright colors.
- Layout: Symmetric, generous whitespace, max-w-5xl content, clear hierarchy
- Motion: Subtle â fade-in reveals on scroll, gentle hover states
- Spacing: py-20 md:py-28 section padding, relaxed line-height (1.7+)
2. Editorial Luxury
- Typography: Elegant serif (e.g., Cormorant Garamond, Libre Baskerville, Noto Serif Display) + refined sans (e.g., Outfit, Satoshi, General Sans)
- Palette: Near-monochrome with one rich accent. Black/cream base. Gold, plum, or deep teal accent.
- Layout: Magazine-inspired. Asymmetric grids, overlapping elements, dramatic hero images
- Motion: Moderate â parallax on heroes, staggered list reveals, text character animations
- Spacing: Very generous. Content floats in space. Negative space is a design element.
3. Clean Technical
- Typography: Modern geometric sans (e.g., Plus Jakarta Sans, Geist, Manrope) for both display and body
- Palette: Cool neutrals (slate, zinc). One vibrant accent (blue, violet, emerald). Clean whites.
- Layout: Grid-based, card-heavy, data-friendly. Dashboard-like precision.
- Motion: Functional â hover lifts on cards, smooth page transitions, loading states
- Spacing: Compact but not cramped. Efficient use of space. gap-6 between cards.
4. Warm Organic
- Typography: Rounded or humanist sans (e.g., Nunito, Quicksand, Rubik) or soft serif (e.g., Merriweather, Bitter)
- Palette: Earth tones â terracotta, sage, cream, warm brown. Soft pastels. No harsh contrasts.
- Layout: Rounded corners, soft shadows, flowing sections. Organic shapes (SVG blobs, curves).
- Motion: Gentle â slow fades, easing that feels natural, subtle breathing animations
- Spacing: Generous and flowing. Sections merge softly. Rounded containers.
5. Trustworthy Minimal
- Typography: Neutral, highly legible sans (e.g., IBM Plex Sans, Atkinson Hyperlegible, Open Sans) for everything
- Palette: High-contrast. Dark text on white. One institutional accent (blue, teal). No gradients.
- Layout: Simple, predictable, content-first. Single-column where possible. Large text.
- Motion: Minimal â content appears immediately. Maybe a single page-load fade.
- Spacing: Generous but functional. Focus on readability over aesthetics.
6. Bold Expressive
- Typography: Statement display fonts (e.g., Space Grotesk, Syne, Cabinet Grotesk, Clash Display) + contrasting body
- Palette: High saturation. Unexpected combinations. Dark backgrounds with neon accents. Or pure white with a single bold color.
- Layout: Breaking the grid. Oversized headings. Diagonal flow. Overlapping elements. Scroll-triggered reveals.
- Motion: Rich â page transitions, scroll-linked animations, hover transformations, parallax
- Spacing: Dramatic contrasts â tight in some areas, extremely open in others.
Font Selection Criteria
Since every project gets custom fonts, follow these rules:
- Never reuse fonts across projects â each client gets a unique typographic identity
- Always pair a display font with a body font â same font for both is lazy
- Test at multiple sizes â display fonts must work at h1 AND h3 sizes
- Check language support â verify the font covers all characters the client needs (accents, special chars)
- Load via
next/fontâ always. No external font CDN links. - Maximum 2 families â one display, one body. More than 2 hurts performance.
- Avoid overused fonts â do NOT use: Inter (alone), Roboto, Open Sans, Montserrat, Poppins, Lato, or Raleway as display fonts. These are fine for body text paired with a distinctive display font.
Where to find distinctive fonts:
- Google Fonts (filter by popularity: avoid top 20)
- Fontsource (local hosting for any Google Font)
- Variable fonts preferred (one file, multiple weights)
Component Library: shadcn/ui
Always use shadcn/ui as the component base:
npx shadcn@latest add button input textarea label sheet
Customization approach:
- Override via CSS variables in
globals.css(colors, radius, fonts) - Override via Tailwind classes on the component (spacing, sizing)
- Never edit files in
components/ui/directly â customize via wrapper components if needed
Essential components to install per project:
button,input,textarea,labelâ formssheetâ mobile navigationdialogâ modalsseparatorâ visual dividersskeletonâ loading states- Add others as needed per project
Animation Tiers
Select the animation tier based on the aesthetic direction:
Tier 1: Subtle (Trustworthy Minimal, Refined Professional)
// Fade in on scroll, once
<m.div
initial={{ opacity: 0, y: 16 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true }}
transition={{ duration: 0.5 }}
/>
Tier 2: Moderate (Editorial Luxury, Warm Organic, Clean Technical)
// Staggered reveals + hover effects
<m.div
initial={{ opacity: 0, y: 20 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, margin: "-100px" }}
transition={{ duration: 0.6, delay: index * 0.08 }}
/>
// Hover lift on cards
<m.div whileHover={{ y: -4, transition: { duration: 0.2 } }} />
Tier 3: Rich (Bold Expressive)
// Page transitions, parallax, character animations
// Use AnimatePresence for page transitions
// Use useScroll + useTransform for parallax
// Use staggerChildren for text reveals
Always respect prefers-reduced-motion:
const prefersReducedMotion = usePrefersReducedMotion();
const animation = prefersReducedMotion
? { opacity: 1, y: 0 }
: { opacity: 0, y: 20 };
Implementation Workflow
For each component/page:
- Select direction â run decision tree if not done yet
- Choose fonts â pick a unique pairing, test at multiple sizes
- Define palette â set CSS variables in globals.css, include dark mode
- Build mobile-first â start at 390px, add responsive breakpoints going up
- Add motion â select animation tier, implement with LazyMotion + m
- Test accessibility â keyboard nav, contrast, screen reader, focus indicators
- Screenshot at 390px + 1280px â verify responsive layout
- Check dark mode â toggle and verify visually
- Check performance â no unnecessary JS, images optimized
Anti-Patterns
- Cookie-cutter designs â if two client projects could swap stylesheets and look the same, you failed
- Desktop-first â designing at 1280px and “making it fit” on mobile always produces bad mobile UX
- Ignoring dark mode â adding it later is 5x harder. Build it from the start with CSS variables
- Animation overload â more animation â better design. Match the tier to the aesthetic direction
- Generic font choices â Inter + no display font = looks like every other site built with AI
- Decorating instead of designing â gradients, shadows, and borders don’t make a design good. Typography, spacing, and hierarchy do
- Skipping the decision tree â jumping to code without choosing a direction produces incoherent designs