responsive-design
Patterns for building responsive, mobile-first user interfaces
What this skill does
# Responsive Design Skill
Patterns for building responsive user interfaces that work across all device sizes.
## Mobile-First Approach
Design for mobile first, then enhance for larger screens.
```css
/* Mobile first (default) */
.container {
padding: 1rem;
display: flex;
flex-direction: column;
}
/* Tablet and up */
@media (min-width: 768px) {
.container {
padding: 2rem;
flex-direction: row;
}
}
/* Desktop and up */
@media (min-width: 1024px) {
.container {
max-width: 1200px;
margin: 0 auto;
}
}
```
## Breakpoint System
### Standard Breakpoints
```typescript
const breakpoints = {
sm: '640px', // Small phones
md: '768px', // Tablets
lg: '1024px', // Small laptops
xl: '1280px', // Desktops
'2xl': '1536px' // Large screens
};
```
### Tailwind CSS Usage
```html
<!-- Mobile: stack, Tablet: 2 columns, Desktop: 3 columns -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
<Card />
<Card />
<Card />
</div>
<!-- Hide on mobile, show on tablet+ -->
<nav class="hidden md:block">
<DesktopNavigation />
</nav>
<!-- Show on mobile, hide on tablet+ -->
<button class="md:hidden">
<MenuIcon />
</button>
```
## Responsive Patterns
### Responsive Grid
```typescript
// CSS Grid with auto-fit
function ResponsiveGrid({ children, minWidth = '300px' }) {
return (
<div
style={{
display: 'grid',
gridTemplateColumns: `repeat(auto-fit, minmax(${minWidth}, 1fr))`,
gap: '1rem',
}}
>
{children}
</div>
);
}
```
### Responsive Typography
```css
/* Fluid typography */
.heading {
font-size: clamp(1.5rem, 4vw, 3rem);
line-height: 1.2;
}
/* Responsive scale */
:root {
--text-base: 1rem;
--text-lg: 1.125rem;
--text-xl: 1.25rem;
}
@media (min-width: 768px) {
:root {
--text-base: 1.125rem;
--text-lg: 1.25rem;
--text-xl: 1.5rem;
}
}
```
### Responsive Navigation
```typescript
function Navigation() {
const [isOpen, setIsOpen] = useState(false);
return (
<nav>
{/* Mobile menu button */}
<button
className="md:hidden"
onClick={() => setIsOpen(!isOpen)}
aria-expanded={isOpen}
aria-label="Toggle menu"
>
{isOpen ? <CloseIcon /> : <MenuIcon />}
</button>
{/* Navigation links */}
<div className={`
${isOpen ? 'block' : 'hidden'}
md:block
absolute md:relative
top-full left-0 right-0
bg-white md:bg-transparent
`}>
<NavLinks />
</div>
</nav>
);
}
```
### Responsive Images
```typescript
function ResponsiveImage({ src, alt, sizes }) {
return (
<picture>
{/* WebP for modern browsers */}
<source
type="image/webp"
srcSet={`
${src}?w=400&format=webp 400w,
${src}?w=800&format=webp 800w,
${src}?w=1200&format=webp 1200w
`}
sizes={sizes}
/>
{/* Fallback */}
<img
src={`${src}?w=800`}
srcSet={`
${src}?w=400 400w,
${src}?w=800 800w,
${src}?w=1200 1200w
`}
sizes={sizes}
alt={alt}
loading="lazy"
/>
</picture>
);
}
// Usage
<ResponsiveImage
src="/hero.jpg"
alt="Hero image"
sizes="(max-width: 768px) 100vw, 50vw"
/>
```
## Layout Patterns
### Sidebar Layout
```typescript
function SidebarLayout({ sidebar, content }) {
return (
<div className="flex flex-col md:flex-row min-h-screen">
{/* Sidebar: Full width on mobile, fixed width on desktop */}
<aside className="w-full md:w-64 lg:w-80 shrink-0">
{sidebar}
</aside>
{/* Content: Takes remaining space */}
<main className="flex-1 p-4 md:p-6 lg:p-8">
{content}
</main>
</div>
);
}
```
### Card Grid
```typescript
function CardGrid({ items }) {
return (
<div className="
grid gap-4
grid-cols-1
sm:grid-cols-2
lg:grid-cols-3
xl:grid-cols-4
">
{items.map(item => (
<Card key={item.id} {...item} />
))}
</div>
);
}
```
### Hero Section
```typescript
function Hero() {
return (
<section className="
min-h-[50vh] md:min-h-[70vh]
flex items-center justify-center
px-4 md:px-8 lg:px-16
text-center
">
<div className="max-w-3xl">
<h1 className="
text-3xl md:text-5xl lg:text-6xl
font-bold
mb-4 md:mb-6
">
Welcome
</h1>
<p className="
text-lg md:text-xl
text-gray-600
mb-6 md:mb-8
">
Description text
</p>
<div className="
flex flex-col sm:flex-row
gap-4
justify-center
">
<Button size="lg">Primary</Button>
<Button size="lg" variant="outline">Secondary</Button>
</div>
</div>
</section>
);
}
```
## Responsive Hooks
### useMediaQuery
```typescript
function useMediaQuery(query: string): boolean {
const [matches, setMatches] = useState(false);
useEffect(() => {
const media = window.matchMedia(query);
setMatches(media.matches);
const listener = (e: MediaQueryListEvent) => setMatches(e.matches);
media.addEventListener('change', listener);
return () => media.removeEventListener('change', listener);
}, [query]);
return matches;
}
// Usage
function Component() {
const isMobile = useMediaQuery('(max-width: 768px)');
const isDesktop = useMediaQuery('(min-width: 1024px)');
return isMobile ? <MobileView /> : <DesktopView />;
}
```
### useBreakpoint
```typescript
function useBreakpoint() {
const isSm = useMediaQuery('(min-width: 640px)');
const isMd = useMediaQuery('(min-width: 768px)');
const isLg = useMediaQuery('(min-width: 1024px)');
const isXl = useMediaQuery('(min-width: 1280px)');
if (isXl) return 'xl';
if (isLg) return 'lg';
if (isMd) return 'md';
if (isSm) return 'sm';
return 'xs';
}
```
## Touch Considerations
```css
/* Larger touch targets on mobile */
.button {
min-height: 44px;
min-width: 44px;
padding: 0.75rem 1rem;
}
/* Disable hover effects on touch */
@media (hover: none) {
.button:hover {
background-color: inherit;
}
}
/* Smooth scrolling */
.scroll-container {
-webkit-overflow-scrolling: touch;
scroll-behavior: smooth;
}
```
## Testing Responsive Designs
1. **Browser DevTools**: Test all breakpoints
2. **Real Devices**: Test on actual phones/tablets
3. **Viewport Units**: Test with different font sizes
4. **Orientation**: Test landscape and portrait
## Integration
Used by:
- `frontend-developer` agent
- All frontend stack skills
Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.