Tech Stack
- Next.js 14+ App Router
- TypeScript
- Tailwind CSS
- Mobile-first breakpoints (sm → md → lg → xl)
Mobile-First Rules
- Default styles = mobile. No breakpoint prefix means phone.
- Scale up:
text-sm md:text-base lg:text-lg
- Touch targets: Minimum 44x44px for interactive elements
- Stack by default: Use
flex-col then md:flex-row
- Test at 375px width first, then 320px for edge cases
- Thumb zones: Place primary actions in bottom 60% of screen
Low-Bandwidth & Emerging Markets
Design for users with slow 3G, data caps, and older devices.
Performance Budget
- First paint: Under 1.5s on 3G
- Total page weight: Under 500KB ideal, 1MB maximum
- JavaScript: Minimize client-side JS, prefer Server Components
- Images: Under 100KB each, use WebP/AVIF with fallbacks
Asset Optimization
- Use Next.js
<Image> — never raw <img> tags
- Lazy load below-fold content —
loading="lazy" or dynamic imports
- Subset fonts — only characters you need, prefer
font-display: swap
- Compress aggressively — quality 75-80 is usually indistinguishable
- Avoid decorative images — every image must earn its bytes
Code Splitting
- Dynamic imports for routes/modules —
next/dynamic with ssr: false when appropriate
- Split by interaction — don't load modal code until modal opens
- Analyze bundle — run
next build and check chunk sizes regularly
Offline-Tolerant Patterns
- localStorage for progress — save state so users can resume
- Graceful degradation — app works if analytics/fonts fail to load
- Optimistic UI — show success immediately, sync when possible
- Cache static assets — configure proper Cache-Control headers
Reduce Third-Party Scripts
- One analytics tool — not three
- Defer non-critical scripts —
strategy="lazyOnload" in next/script
- Self-host when possible — fonts, icons, critical libraries
- Audit regularly — each external script = potential failure point
Device Constraints
- Older Android phones — test on Chrome DevTools throttling (4x CPU slowdown)
- Limited RAM — avoid memory-heavy animations, large state objects
- Small screens — some users still on 320px width devices
- Touch-only — no hover states as primary interaction
Design Principles
Before coding, commit to a BOLD aesthetic direction:
- Tone: Pick one extreme—brutally minimal, maximalist, retro-futuristic, organic, luxury, playful, editorial, brutalist, art deco, soft/pastel, industrial
- Differentiation: What makes this UNFORGETTABLE?
Typography
- Choose distinctive fonts, never Inter/Arial/Roboto/system fonts
- Pair a display font with a refined body font
- Use Google Fonts or next/font for optimization
- For low-bandwidth: Consider system font stacks as fallback-first
Color & Theme
- Use CSS variables in globals.css
- Dominant color + sharp accent beats evenly-distributed palettes
- Commit to light OR dark, don't hedge
- High contrast — many users outdoors on dim screens
Motion
- CSS-only when possible
- One orchestrated page load > scattered micro-interactions
- Use
animation-delay for staggered reveals
- Respect
prefers-reduced-motion — some devices struggle with animations
Layout
- Unexpected compositions: asymmetry, overlap, grid-breaking
- Generous negative space OR controlled density
- Never center everything
- Single-column default — complexity only at larger breakpoints
File Structure
src/
components/ # Reusable components
app/ # Pages and layouts
styles/ # Global CSS
Anti-Patterns (NEVER)
- Generic gradients on white backgrounds
- Cookie-cutter card layouts
- Predictable hero + 3-column features
- Space Grotesk (overused)
- Purple/blue tech gradients
- Heavy client-side rendering for static content
- Multiple analytics scripts loading synchronously
- Unoptimized images or raw
<img> tags
- Assuming fast, stable internet
1---2name: frontend-design-263description: Create distinctive, mobile-first Next.js interfaces with high design quality. Use when building pages, components, or layouts. Generates polished code that avoids generic AI aesthetics.4---5
6## Tech Stack
7
8- Next.js 14+ App Router
9- TypeScript
10- Tailwind CSS
11- Mobile-first breakpoints (sm → md → lg → xl)
12
13## Mobile-First Rules
14
151. **Default styles = mobile**. No breakpoint prefix means phone.
162. **Scale up**: `text-sm md:text-base lg:text-lg`
173. **Touch targets**: Minimum 44x44px for interactive elements
184. **Stack by default**: Use `flex-col` then `md:flex-row`
195. **Test at 375px width first**, then 320px for edge cases
206. **Thumb zones**: Place primary actions in bottom 60% of screen
21
22## Low-Bandwidth & Emerging Markets
23
24Design for users with slow 3G, data caps, and older devices.
25
26### Performance Budget
27
28- **First paint**: Under 1.5s on 3G
29- **Total page weight**: Under 500KB ideal, 1MB maximum
30- **JavaScript**: Minimize client-side JS, prefer Server Components
31- **Images**: Under 100KB each, use WebP/AVIF with fallbacks
32
33### Asset Optimization
34
351. **Use Next.js `<Image>`** — never raw `<img>` tags
362. **Lazy load below-fold content** — `loading="lazy"` or dynamic imports
373. **Subset fonts** — only characters you need, prefer `font-display: swap`
384. **Compress aggressively** — quality 75-80 is usually indistinguishable
395. **Avoid decorative images** — every image must earn its bytes
40
41### Code Splitting
42
431. **Dynamic imports for routes/modules** — `next/dynamic` with `ssr: false` when appropriate
442. **Split by interaction** — don't load modal code until modal opens
453. **Analyze bundle** — run `next build` and check chunk sizes regularly
46
47### Offline-Tolerant Patterns
48
491. **localStorage for progress** — save state so users can resume
502. **Graceful degradation** — app works if analytics/fonts fail to load
513. **Optimistic UI** — show success immediately, sync when possible
524. **Cache static assets** — configure proper Cache-Control headers
53
54### Reduce Third-Party Scripts
55
561. **One analytics tool** — not three
572. **Defer non-critical scripts** — `strategy="lazyOnload"` in next/script
583. **Self-host when possible** — fonts, icons, critical libraries
594. **Audit regularly** — each external script = potential failure point
60
61### Device Constraints
62
631. **Older Android phones** — test on Chrome DevTools throttling (4x CPU slowdown)
642. **Limited RAM** — avoid memory-heavy animations, large state objects
653. **Small screens** — some users still on 320px width devices
664. **Touch-only** — no hover states as primary interaction
67
68## Design Principles
69
70Before coding, commit to a BOLD aesthetic direction:
71
72- **Tone**: Pick one extreme—brutally minimal, maximalist, retro-futuristic, organic, luxury, playful, editorial, brutalist, art deco, soft/pastel, industrial
73- **Differentiation**: What makes this UNFORGETTABLE?
74
75## Typography
76
77- Choose distinctive fonts, never Inter/Arial/Roboto/system fonts
78- Pair a display font with a refined body font
79- Use Google Fonts or next/font for optimization
80- **For low-bandwidth**: Consider system font stacks as fallback-first
81
82## Color & Theme
83
84- Use CSS variables in globals.css
85- Dominant color + sharp accent beats evenly-distributed palettes
86- Commit to light OR dark, don't hedge
87- **High contrast** — many users outdoors on dim screens
88
89## Motion
90
91- CSS-only when possible
92- One orchestrated page load > scattered micro-interactions
93- Use `animation-delay` for staggered reveals
94- **Respect `prefers-reduced-motion`** — some devices struggle with animations
95
96## Layout
97
98- Unexpected compositions: asymmetry, overlap, grid-breaking
99- Generous negative space OR controlled density
100- Never center everything
101- **Single-column default** — complexity only at larger breakpoints
102
103## File Structure
104```
105src/
106 components/ # Reusable components
107 app/ # Pages and layouts
108 styles/ # Global CSS
109```
110
111## Anti-Patterns (NEVER)
112
113- Generic gradients on white backgrounds
114- Cookie-cutter card layouts
115- Predictable hero + 3-column features
116- Space Grotesk (overused)
117- Purple/blue tech gradients
118- **Heavy client-side rendering for static content**
119- **Multiple analytics scripts loading synchronously**
120- **Unoptimized images or raw `<img>` tags**
121- **Assuming fast, stable internet**