Implement production-grade responsive design: breakpoint strategy, fluid typography with clamp(), container queries, responsive images with srcset/sizes, and cross-device testing methodology. Use when user asks to "make responsive", "implement responsive design", or "fix layout on mobile".
From sovereign-architectnpx claudepluginhub javimontano/mao-sovereign-architectThis skill is limited to using the following tools:
agents/container-query-specialist.mdagents/responsive-design-agent.mdagents/responsive-image-optimizer.mdevals/evals.jsonexamples/sample-output.mdprompts/use-case-prompts.mdreferences/body-of-knowledge.mdreferences/knowledge-graph.mmdreferences/state-of-the-art.mdImplement adaptive, fluid layouts that work correctly across viewports, device classes, and user preferences using modern CSS techniques.
"Good responsive design isn't about making it work on every screen size — it's about making the content determine the layout, not the device."
grep -r "width: [0-9]*px" src/ --include="*.css".grep -r "font-size: [0-9]*px" src/ --include="*.css".<meta name="viewport"> exists and is correct: width=device-width, initial-scale=1.[HECHO] for measured issues, [INFERENCIA] for patterns.List all content types: text-heavy, image-heavy, data tables, navigation, cards.
Let content determine breakpoints — don't target device widths.
Define a named scale:
| Token | Value | Use Case |
|---|---|---|
--bp-sm | 640px | Single-column to two-column |
--bp-md | 768px | Tablet layout inflection |
--bp-lg | 1024px | Desktop navigation pattern |
--bp-xl | 1280px | Wide content areas |
--bp-2xl | 1536px | Ultra-wide / dashboard |
Write breakpoints mobile-first: default styles = smallest, @media (min-width: ...) for larger.
Limit viewport breakpoints to layout changes only. Use container queries for components.
clamp() values for each type step:
font-size: clamp(min, preferred, max)
preferred = calc(Vmin + (Vmax - Vmin) * (100vw - BPmin) / (BPmax - BPmin))
--text-xs through --text-6xl with clamp() values.line-height as unitless ratio: 1.4 for body, 1.1 for headings.rem for min/max values (respects user font preferences), vi for viewport dimension.Example fluid type scale:
:root {
--text-sm: clamp(0.8rem, 0.77rem + 0.18vw, 0.875rem);
--text-base: clamp(1rem, 0.95rem + 0.24vw, 1.125rem);
--text-lg: clamp(1.125rem,1.07rem + 0.29vw, 1.25rem);
--text-xl: clamp(1.25rem, 1.19rem + 0.31vw, 1.5rem);
--text-2xl: clamp(1.5rem, 1.41rem + 0.46vw, 1.875rem);
--text-3xl: clamp(1.875rem,1.72rem + 0.78vw, 2.5rem);
}
container-type and optionally container-name:
.card-wrapper { container-type: inline-size; container-name: card; }
@container card (min-width: 400px) {
.card { flex-direction: row; }
}
cqi (container query inline) units for font sizes inside containers.srcset + sizes for art-direction-free responsive images:
<img
srcset="hero-400.webp 400w, hero-800.webp 800w, hero-1200.webp 1200w"
sizes="(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 800px"
src="hero-800.webp"
alt="Hero image"
loading="lazy"
decoding="async"
>
<picture> for art direction (different crops at different viewports).width and height attributes to prevent layout shift (CLS).loading="lazy" for below-fold images; loading="eager" + fetchpriority="high" for LCP image.grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)) — no breakpoints needed.display: flex; flex-direction: column; gap: var(--space-4) — vertical rhythm.max-width + margin-inline: auto + padding-inline: var(--space-4).prefers-reduced-motion: reduce.| Use Case | Use This |
|---|---|
| Page layout (grid, columns, sidebar) | Viewport media query |
| Component internal layout (card, widget) | Container query |
| Typography scaling | clamp() fluid values |
| Image serving | srcset + sizes |
| Navigation menu collapse | Viewport media query |
| Card layout inside sidebar vs. main | Container query |
| Situation | Fixed px | Fluid clamp() | % / fr |
|---|---|---|---|
| Border widths | Yes | No | No |
| Font sizes | No | Yes | No |
| Spacing | No | Yes (large) | No |
| Grid columns | No | No | Yes |
| Max widths | Yes (ch/rem) | No | No |
320px (iPhone 5) or 375px (iPhone X) creates a maintenance trap. Let content dictate breakpoints.font-size: 4vw causes extreme sizes at large/small viewports. Always use clamp().width: 960px breaks on smaller screens. Use max-width + fluid padding.!important for mobile overrides — Sign of desktop-first gone wrong. Rewrite mobile-first.width and height even for responsive images.@container rules silently fail if no ancestor has container-type. Always verify the containment tree.styles/breakpoints.css — Named breakpoint tokensstyles/typography.css — Fluid type scalestyles/layout.css — Layout patterns (grid, stack, sidebar, center)tests/responsive.spec.tsADR-RESPONSIVE-001.md — Architecture Decision RecordDesigns and optimizes AI agent action spaces, tool definitions, observation formats, error recovery, and context for higher task completion rates.