npx skills add ...
npx skills add am-will/codex-skills --skill frontend-responsive-design-standards
Build responsive, mobile-first layouts using fluid containers, flexible units, media queries, and touch-friendly design that works across all screen sizes. Use this skill when creating or modifying UI layouts, responsive grids, breakpoint styles, mobile navigation, or any interface that needs to adapt to different screen sizes. Apply when working with responsive CSS, media queries, viewport settings, flexbox/grid layouts, mobile-first styling, breakpoint definitions (mobile, tablet, desktop), touch target sizing, relative units (rem, em, %), image optimization for different screens, or testing layouts across multiple devices. Use for any task involving multi-device support, responsive design patterns, or adaptive layouts.
npx skills add am-will/codex-skills --skill frontend-responsive-design-standards
Rule: Mobile-first development with consistent breakpoints, fluid layouts, relative units, and touch-friendly targets.
This Skill provides Codex with specific guidance on how to adhere to coding standards as they relate to how it should handle frontend responsive.
Always start with mobile layout, then enhance for larger screens.
Bad (desktop-first):
Good (mobile-first):
Why mobile-first:
Identify and use project breakpoints consistently:
Common breakpoint systems:
Tailwind:
Bootstrap:
Check existing codebase for breakpoint definitions before creating new ones.
Usage (Tailwind):
Usage (CSS):
Never use arbitrary breakpoints like 850px or 1150px unless explicitly required.
Use flexible containers that adapt to screen size:
Bad (fixed widths):
Good (fluid):
Patterns for fluid layouts:
flex: 1, flex-grow, flex-shrink1fr, minmax(), auto-fit, auto-fillwidth: 100%, max-width: 1200px@container (min-width: 400px)Use rem/em for scalability and accessibility:
Bad:
Good:
When to use each unit:
rem: Font sizes, spacing, layout dimensions (scales with root font size)em: Component-relative sizing (scales with parent font size)%: Widths, heights relative to parentpx: Borders (1px), shadows, very small valuesvw/vh: Full viewport dimensions, hero sectionsch: Text-based widths (e.g., max-width: 65ch for readable line length)Framework utilities handle this automatically:
Minimum touch target size: 44x44px (iOS) / 48x48px (Android)
Bad:
Good:
Touch target checklist:
Maintain readable font sizes without zoom:
Bad:
Good:
Typography guidelines:
max-width: 65ch)Responsive typography:
Or with clamp (fluid):
Show most important content first, hide or collapse secondary content:
Bad:
Good:
Strategies:
order property to reorder contentServe appropriate images for device size:
Bad:
Good:
Or with modern formats:
Framework-specific:
Verify layouts at key breakpoints before completing work:
Test checklist:
Testing methods:
Common issues to check:
Navigation:
Grid layouts:
Sidebar layouts:
Before completing responsive work:
| Situation | Action |
|---|---|
| Starting new layout | Begin with mobile (320-375px) |
| Need breakpoint | Use project standard (check existing code) |
| Setting width | Use width: 100% + max-width |
| Setting font size | Use rem (16px = 1rem) |
| Setting spacing | Use rem or framework utilities |
| Button too small | Ensure min 44x44px with padding |
| Text too small | Minimum 16px (1rem) for body |
| Testing layout | Check 375px, 768px, 1024px, 1440px |
| Images loading slow | Use srcset and modern formats |
.container {
width: 100%;
display: grid;
grid-template-columns: 1fr;
}
@media (min-width: 768px) {
.container {
grid-template-columns: repeat(2, 1fr);
}
}
@media (min-width: 1024px) {
.container {
max-width: 1200px;
grid-template-columns: repeat(4, 1fr);
}
}sm: 640px (small tablets)
md: 768px (tablets)
lg: 1024px (laptops)
xl: 1280px (desktops)
2xl: 1536px (large desktops)sm: 576px
md: 768px
lg: 992px
xl: 1200px
xxl: 1400px<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4">@media (min-width: 768px) { }
@media (min-width: 1024px) { }.container { width: 1200px; }
.sidebar { width: 300px; }
.content { width: 900px; }.container {
width: 100%;
max-width: 1200px;
padding: 0 1rem;
}
.layout {
display: grid;
grid-template-columns: 1fr;
}
@media (min-width: 1024px) {
.layout {
grid-template-columns: 300px 1fr;
}
}font-size: 16px;
padding: 20px;
margin: 10px;
border-radius: 8px;font-size: 1rem; /* 16px base */
padding: 1.25rem; /* 20px */
margin: 0.625rem; /* 10px */
border-radius: 0.5rem; /* 8px */<div className="text-base p-5 m-2.5 rounded-lg">.icon-button {
width: 24px;
height: 24px;
}.icon-button {
width: 24px;
height: 24px;
padding: 12px; /* Total: 48x48px */
/* Or use min-width/min-height */
min-width: 44px;
min-height: 44px;
}body { font-size: 12px; }
.small-text { font-size: 10px; }body { font-size: 1rem; } /* 16px minimum */
.small-text { font-size: 0.875rem; } /* 14px minimum */h1 {
font-size: 2rem;
}
@media (min-width: 768px) {
h1 {
font-size: 2.5rem;
}
}
@media (min-width: 1024px) {
h1 {
font-size: 3rem;
}
}h1 {
font-size: clamp(2rem, 5vw, 3rem);
}<div>
<Sidebar /> {/* Full sidebar on mobile */}
<MainContent />
</div><div className="flex flex-col lg:flex-row">
<MainContent className="order-1" />
<Sidebar className="order-2 hidden lg:block" />
</div><img src="hero-4000x3000.jpg" alt="Hero"><img
src="hero-800x600.jpg"
srcset="
hero-400x300.jpg 400w,
hero-800x600.jpg 800w,
hero-1600x1200.jpg 1600w
"
sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 800px"
alt="Hero"
><picture>
<source srcset="hero.avif" type="image/avif">
<source srcset="hero.webp" type="image/webp">
<img src="hero.jpg" alt="Hero">
</picture>// Next.js
<Image
src="/hero.jpg"
width={800}
height={600}
sizes="(max-width: 768px) 100vw, 50vw"
alt="Hero"
/>// Mobile: Hamburger menu
// Desktop: Horizontal nav
<nav className="lg:flex lg:items-center">
<button className="lg:hidden">Menu</button>
<ul className="hidden lg:flex lg:gap-4">
<li>Home</li>
<li>About</li>
</ul>
</nav>.grid {
display: grid;
grid-template-columns: 1fr;
gap: 1rem;
}
@media (min-width: 640px) {
.grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
.grid { grid-template-columns: repeat(4, 1fr); }
}.layout {
display: flex;
flex-direction: column;
}
@media (min-width: 1024px) {
.layout {
flex-direction: row;
}
.sidebar { width: 300px; }
.content { flex: 1; }
}