Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

responsive-layout

БесплатноБез исполняемых скриптовНе проверен

Design and implement adaptive layouts using CSS Grid, Flexbox, container queries, and fluid typography/spacing — the craft layer for layouts that work…

eugenelimот eugenelim★ 35 звёзд на GitHub

Об этом скилле

Skill: responsive-layout

Load this skill when the primary task is designing or debugging a layout that must work across breakpoints. Do not load it for routine margin or padding adjustments on an already-responsive surface. Load responsive-layout when:

  • Building the layout structure for a new page or section from scratch
  • Debugging a layout that breaks at a specific viewport width
  • Designing a shared component that must adapt to variable-width containers
  • Evaluating whether a layout approach is correct before implementation

Layout primitive selection

CSS Grid: for two-dimensional layouts and page-level structure. Use when elements need to be positioned on both a row axis and a column axis, or when the layout requires elements to align with other elements across rows/columns.

Flexbox: for one-dimensional alignment and component-level distribution. Use when elements need to be distributed along a single axis (row or column), with flexible sizing and alignment.

The mixing rule: never use Grid and Flexbox to solve the same axis in the same container. Use Grid for the page layout; use Flexbox inside a Grid cell for component-level distribution within that cell.

Common mistakes:

  • Using Flexbox for a two-column layout with a sidebar — Grid is the right tool; Flexbox cannot express "sidebar is fixed-width, content fills the rest" without a min-width: 0 hack on the content column.
  • Using Grid for a single-axis distribution of buttons in a toolbar — Flexbox is the right tool; Grid's two-dimensional power is wasted here.

Container queries vs. media queries

Use container queries when a component must adapt to the width of its own container rather than the viewport. This is the correct tool for shared components that appear in multiple layout contexts (e.g., a card that appears in a sidebar at 320px and in a main content area at 600px).

/* Define the containment context on the parent */
.card-container {
  container-type: inline-size;
  container-name: card;
}

/* Query the container, not the viewport */
@container card (min-width: 500px) {
  .card {
    display: grid;
    grid-template-columns: 120px 1fr;
  }
}

Container queries are Baseline Widely Available as of 2023.

Use media queries when layout changes are driven by the viewport — page-level structure that changes how sections are arranged. Navigation, sidebar visibility, and column count at the page level belong here.

@media (min-width: 768px) {
  .page-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
  }
}

Decision rule: if the layout change is for a shared component that appears in multiple container widths — use container queries. If the layout change is for the page structure that responds to the viewport — use media queries.


Fluid typography

Use clamp() for type that scales smoothly between a minimum and maximum viewport width without breakpoint jumps:

/* clamp(minimum, preferred, maximum) */
/* Preferred: linear interpolation from min-size at min-viewport to max-size at max-viewport */

h1 {
  /* 24px at 320px viewport, scales to 48px at 1280px viewport */
  font-size: clamp(1.5rem, 2.5vw + 0.5rem, 3rem);
}

p {
  /* 16px at 320px viewport, scales to 18px at 1280px viewport */
  font-size: clamp(1rem, 0.5vw + 0.875rem, 1.125rem);
}

Formula for the vw + rem preferred value:

slope = (max-size - min-size) / (max-viewport - min-viewport)
y-intercept = min-size - (slope * min-viewport)
preferred = slope * 100vw + y-intercept

Derive min and max font sizes from the spacing scale (see token-architecture) so typography and spacing scales remain proportional.


Breakpoint strategy

Name breakpoints semantically — not by device. Device names encode specific dimensions that change with hardware generations; semantic names are stable:

/* Token-defined breakpoints — semantic names */
:root {
  --breakpoint-sm:  480px;
  --breakpoint-md:  768px;
  --breakpoint-lg:  1024px;
  --breakpoint-xl:  1280px;
  --breakpoint-2xl: 1536px;
}

Mobile-first (min-width): write base styles for mobile, then use @media (min-width: ...) to enhance for larger viewports. Mobile-first produces smaller files for mobile users (the base styles need no media query).

Never encode specific device names (@media (max-width: 375px) for "iPhone SE") — those dimensions are historical snapshots that will be wrong within 18 months.


Grid patterns

The 12-column grid — flexible foundation for page layouts:

.layout {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--ds-space-4);
}

/* A content area spanning 8 columns, centered */
.main-content {
  grid-column: 3 / span 8;
}

auto-fill vs. auto-fit for responsive card grids:

/* auto-fill: preserves empty tracks (grid does not collapse) */
.card-grid-fill {
  display: grid;
  grid-template-columns: repea
Полный SKILL.md на GitHub

Установить responsive-layout в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

evals/eval_queries.json

FAQ

Что делает скилл responsive-layout?

Design and implement adaptive layouts using CSS Grid, Flexbox, container queries, and fluid typography/spacing — the craft layer for layouts that work correctly across all viewport sizes without JavaScript. Triggers on "build this page layout so it works at every viewport", "fix the card grid that breaks at 720 pixels", "make this shared card adapt to its container without JavaScript".

Как установить скилл responsive-layout?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл responsive-layout запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить responsive-layout с