본문으로 건너뛰기
cccskills
무료GitHub에 공개

responsive-engine

Design multi-device layouts with Container Queries, clamp() fluid typography, :has() selector, subgrid, and modern CSS units (dvh/svh/lvh). Use when user asks to make a layout responsive, handle mobile/tablet/desktop breakpoints, create fluid typography, or use Container Queries. Do NOT use for full-page layouts (use landing-craft), component design (use component-forge), or animation-specific responsive (use motion-craft).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(5)

  • SKILL.md12.6 KB
  • assets/reset.css3.0 KB
  • references/container-queries-deep.md10.1 KB
  • references/responsive-patterns.md12.8 KB
  • scripts/generate-fluid-scale.sh4.5 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Responsive Engine

Layouts that work at every screen size without breakpoint spaghetti. Inspired by Ahmad Shadeed (Container Queries), Jen Simmons (Intrinsic Web Design), and the CSS Working Group.

Core Principle

Responsive design is about containers, not viewports. Use Container Queries first, media queries only for global layout shifts and form factor detection.


Container Queries (preferred over media queries)

.card-grid {
  container-type: inline-size;
  container-name: card-grid;
}

@container card-grid (min-width: 600px) {
  .card {
    display: grid;
    grid-template-columns: 200px 1fr;
  }
}

@container card-grid (min-width: 900px) {
  .card {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

Container query length units

.card {
  padding: 10cqw;      /* 10% of container width */
  font-size: 5cqi;     /* 5% of container inline size */
  margin-block: 2cqb;  /* 2% of container block size */
  border-radius: 1cqmin; /* 1% of container smaller side */
}

Form Factor Detection

Detect the device type, not just width.

/* Touch vs mouse */
@media (pointer: coarse) {
  .button { min-height: 48px; }
}

@media (hover: hover) {
  .card:hover { transform: scale(1.02); }
}

@media (hover: none) {
  .card:active { transform: scale(0.98); }
}

/* Portrait vs landscape */
@media (orientation: portrait) {
  .hero-grid { grid-template-columns: 1fr; }
}

Viewport Unit Decision Tree

Use caseUnitWhy
Full-screen heromin-h-[100dvh]Adapts to URL bar on mobile. Never 100vh — iOS Safari viewport jumps.
Minimum safe heightmin-height: 100svhSmall viewport height. Fallback for when URL bar is visible.
Large viewport design100lvhMaximum when URL bar hidden. Only for desktop-like experiences.
Width-baseddvwDynamic viewport width. Avoid on scroll-zooming mobile pages.
.hero {
  height: 100dvh;
  min-height: 100svh;  /* Fallback: never smaller than smallest viewport */
}

The h-screen ban

h-screen equals 100vh which equals disaster on iOS Safari. The URL bar entering/exiting causes catastrophic layout jumps. Always use min-h-[100dvh].


Fluid Typography

:root {
  --text-sm:      clamp(0.875rem, 0.8rem + 0.25vw, 1rem);
  --text-base:    clamp(1rem, 0.9rem + 0.35vw, 1.25rem);
  --text-lg:      clamp(1.25rem, 1rem + 0.75vw, 1.75rem);
  --text-xl:      clamp(1.5rem, 1rem + 1.5vw, 2.5rem);
  --text-2xl:     clamp(1.75rem, 1.25rem + 2vw, 3rem);
  --text-3xl:     clamp(2rem, 1.5rem + 3vw, 4rem);
  --text-display: clamp(2.5rem, 1.5rem + 5vw, 6rem);
}

Fluid spacing

:root {
  --space-xs: clamp(0.25rem, 0.2rem + 0.25vw, 0.5rem);
  --space-sm: clamp(0.5rem, 0.4rem + 0.5vw, 1rem);
  --space-md: clamp(1rem, 0.8rem + 1vw, 2rem);
  --space-lg: clamp(2rem, 1.5rem + 2vw, 4rem);
  --space-xl: clamp(3rem, 2rem + 3vw, 6rem);
  --space-2xl: clamp(4rem, 3rem + 5vw, 10rem);
}

Subgrid

.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.card {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 3;
}

All children across cards align to the same row heights.


Parent-Based Responsive with :has()

/* Sidebar mode: when parent has class .sidebar */
.sidebar:has(.card) .card {
  flex-direction: column;
  text-align: center;
}

/* Card layout changes based on number of siblings */
.grid:has(> :last-child:nth-child(3)) .item {
  grid-column: span 1;
}

/* Detect empty state */
.container:has(.empty-state) {
  justify-content: center;
}

Fallback check:

@supports not selector(:has(*)) {
  .grid .item { grid-column: span 1; } /* fallback */
}

Touch Target Physics

ElementMinimumRecommended
Button44×44px48×48px
Link in nav44×44px48×48px
Checkbox / radio24×24px32×32px (invisible hit area)
Input field44px height48px height
Gap between touchable8px12px
.interactive {
  min-width: 44px;
  min-height: 44px;
}

/* Invisible hit area for small controls */
.small-control::after {
  content: '';
  position: absolute;
  inset: -8px;  /* expands hit area without visual change */
}

Layout Strategy by Device

Each layout archetype needs a mobile collapse rule.

Desktop layoutMobile collapse
3 columns1 column stack (grid-cols-1)
Split screen 50/50Full-width stack (w-full)
Asymmetric grid (2fr 1fr)grid-template-columns: 1fr, remove all col-span overrides
Horizontal scrollPreserve if content is images/cards, restack if text
Overlapping elementsRemove all negative margins and rotations below 768px
Sidebar + contentStack: sidebar collapses to top (or hamburger)
/* Universal mobile collapse */
@media (max-width: 767px) {
  .split-layout { grid-template-columns: 1fr; }
  .asymmetric-grid { grid-template-columns: 1fr; }
  .overlap-card { margin-top: 0; transform: none; }
  [class*="col-span"] { grid-column: span 1; }
}

Breakpoint System (global layout only)

NameWidthTarget
sm640pxMobile landscape
md768pxTablet portrait
lg1024pxTablet landscape / small desktop
xl1280pxDesktop
2xl1536pxLarge desktop

Never add a breakpoint "just in case." If you have more than 4 breakpoints, refactor to Container Queries.


Testing Checklist

  • Content does not overflow on 320px width
  • No horizontal scroll on any breakpoint
  • Text readable without zoom (min 16px body)
  • Images scale correctly at all sizes
  • Navigation usable at all breakpoints
  • Forms not broken on mobile
  • Tables have horizontal scroll or responsive variant
  • Container Queries used over media queries where possible
  • h-screen replaced with min-h-[100dvh] everywhere
  • Touch targets ≥ 44×44px with 8px gap
  • Fixed widths in px replaced with clamp(), %, cqi
  • Asymmetric layouts collapse to 1 column below 768px
  • Overlapping elements separated on mobile
  • :has() guarded with @supports fallback

Error Handling

ProblemCauseFix
Horizontal scrollbar on mobileFixed-width element > viewportReplace px with clamp(), %, or 100%
Layout jump on iOS Safarih-screen usedReplace with min-h-[100dvh]
Text unreadable on mobileBody font < 16pxMinimum 16px, scale with clamp()
Touch target too smallClickable < 44pxExpand hit area with padding or ::after
Container Query not workingMissing container-typeSet container-type: inline-size on parent
Subgrid rows not alignedMissing grid-template-rows: subgridVerify parent has explicit rows
100vh causes scrollDidn't account for URL barUse dvh or svh
Hover effect fires on touchNo @media (hover: hover) guardGate hover behind pointer media query

Anti-Patterns

Anti-patternFix
Media queries for component responsivenessContainer Queries
Fixed widths in pxclamp(), %, dvw, or cqi/cqw
Hover-only interactions on mobileAdd @media (hover: hover) guard
Touch targets < 44pxInteractive elements ≥ 44×44px
Body font < 16pxMinimum 16px, clamp() for fluid scaling
No :has() fallback@supports selector(:has(*)) guard
Deeply nested media queriesContainer Queries eliminate most
h-screen for full-heightmin-h-[100dvh]
Same layout at all sizesLayout must collapse on mobile
Asymmetric layout stays asymmetric on mobileForce 1-column below 768px
Overlapping elements on touchSeparate on mobile. Touch layers cause mis-taps.
calc() with mixed units for gridUse CSS Grid fr units + minmax()
Complex flexbox math (w-[calc(33%-1rem)])CSS Grid grid-cols-3 with gap
Testing only at desktop widthTest at 320px, 375px, 768px, 1024px, 1440px

Pre-Flight Checklist

Before delivering responsive layout code:

  • No horizontal scroll at any width (tested at 320px)
  • min-h-[100dvh] used instead of h-screen
  • Body font ≥ 16px at all widths
  • Touch targets ≥ 44×44px, gap ≥ 8px
  • Media queries only for global layout shifts
  • Container Queries for component responsiveness
  • Asymmetric layouts collapse to single column below 768px
  • Overlapping elements separated on mobile
  • Hover interactions gated behind @media (hover: hover)
  • Images have width/height attributes + object-fit or aspect-ratio
  • Forms single-column on mobile, large inputs (44px+)
  • :has() fallbacks defined
  • No px-only spacing — use fluid or relative units
  • Grid used instead of complex flexbox math
  • Table has responsive wrapper or data-label approach
  • Navigation is usable via touch at all widths

Sources

  • Ahmad Shadeed — Container Queries deep dive (ishadeed.com)
  • Jen Simmons — Intrinsic Web Design
  • CSS Container Queries (MDN)
  • CSS :has() selector (MDN)
  • CSS Subgrid (MDN)
  • web.dev — Responsive and fluid typography with clamp()
  • New Viewport Units (dvh, svh, lvh) — web.dev
  • Every Layout — responsive layout patterns
  • WCAG 2.2 — Touch target size
  • iOS Safari viewport bug documentation (WebKit blog)

Workflow

Step 1: Audit existing layout

Before writing any CSS, identify what's broken:

  • Open Chrome DevTools Device Toolbar (Ctrl+Shift+M)
  • Test at 320px, 375px, 768px, 1024px, 1440px
  • Flag: horizontal scrollbars, overflowing content, text < 16px, touch targets < 44px
  • Screenshot at each breakpoint for before/after comparison

Step 2: Establish container query boundaries

  1. Identify components needing independent responsiveness (cards, sidebars, grid items)
  2. Set container-type: inline-size on their direct parent
  3. Name containers with container-name for complex nested layouts
  4. Replace any media queries targeting those components with @container rules

Step 3: Replace fixed units with fluid units

  1. Find all px values for widths, font sizes, spacing
  2. Convert fonts to clamp() (minimum, preferred, maximum)
  3. Convert spacing to clamp() or relative units (%, cqi, cqw)
  4. Replace h-screen with min-h-[100dvh] everywhere

Step 4: Write mobile collapse rules

  1. Identify asymmetric layouts, overlapping elements, multi-column grids
  2. Write @media (max-width: 767px) block collapsing everything to single column
  3. Remove negative margins and rotations on mobile
  4. Ensure touch targets >= 44x44px with 8px gap between interactive elements

Step 5: Add form factor and accessibility guards

  1. Gate hover effects behind @media (hover: hover)
  2. Gate fine-pointer interactions behind @media (pointer: fine)
  3. Add @supports selector(:has(*)) fallbacks for all :has() selectors
  4. Respect prefers-reduced-motion on all animations
  5. Set minimum body font-size to 16px

Step 6: Verify across devices

  1. No horizontal scroll at any width from 320px to 2560px
  2. min-h-[100dvh] replaces all h-screen instances
  3. Touch targets >= 44x44px with 8px gap
  4. Container Queries used for component responsiveness
  5. Asymmetric layouts collapse to single column below 768px
  6. All :has() selectors guarded with @supports fallback

Checklist

  • Skill loads without errors in the AI agent
  • YAML frontmatter is valid (description, compatibility, audience)
  • Workflow section provides clear step-by-step instructions
  • Error handling section covers common failure modes
  • All referenced files (references/, scripts/, assets/) exist
  • Skill triggers correctly for intended use cases
  • No broken links or missing resources

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Apply professional, premium UI/UX design standards when building or styling web interfaces. Use this skill when the user asks to create a website, landing page, web app, dashboard, UI component, or any visual interface — or when they ask to make something look better, more professional, or more beautiful. Covers visual hierarchy, typography, color systems, layout, spacing, motion, dark mode, responsive design, and conversion patterns. Activate even when the user doesn't say "design" — if they're building a web frontend, these standards apply.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

EliasOulkadi/shokunin1132026년 10월 5일 업데이트

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

EliasOulkadi/shokunin1132026년 10월 5일 업데이트

Run 150+ AI apps via inference.sh CLI - image generation, video creation, LLMs, search, 3D, Twitter automation. Models: FLUX, Veo, Gemini, Grok, Claude, Seedance, OmniHuman, Tavily, Exa, OpenRouter, and many more. Use when running AI apps, generating images/videos, calling LLMs, web search, or automating Twitter. Triggers: inference.sh, infsh, ai model, run ai, serverless ai, ai api, flux, veo, claude api, image generation, video generation, openrouter, tavily, exa search, twitter api, grok

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

EliasOulkadi/shokunin1132026년 10월 5일 업데이트

api-forge

무료

Design REST/GraphQL APIs with OpenAPI 3.1, error handling, pagination, rate limiting, webhooks, and idempotency. Use when user asks to design an API, create endpoints, define REST/GraphQL schema, or generate OpenAPI spec. Do NOT use for database schema design, frontend API integration, or non-HTTP protocols (gRPC, WebSocket, MQTT).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

EliasOulkadi/shokunin1132026년 10월 5일 업데이트

Implement authentication and authorization with OWASP Top 10 standards, OAuth 2.0 + OIDC, WebAuthn/Passkeys, session management, and RBAC/ABAC. Use when user asks to implement login, signup, authentication, authorization, JWT, OAuth, SSO, passkeys, MFA, or role-based access. Do NOT use for API key management (use api-forge), encryption at rest, or network-level security (firewalls, WAF).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

EliasOulkadi/shokunin1132026년 10월 5일 업데이트

Generate brand guidelines, design systems with design tokens (W3C format), creative direction (SCAMPER, Design Thinking, TRIZ), and design briefs with scope and success criteria.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

EliasOulkadi/shokunin1132026년 10월 5일 업데이트

EliasOulkadi의 스킬 모두 보기

이 스킬의 문제 신고