responsive-patterns by yonatangross/orchestkit
npx skills add https://github.com/yonatangross/orchestkit --skill responsive-patterns使用容器查询、流式排版和移动优先策略的现代响应式设计模式,适用于 React 应用程序(2026 年最佳实践)。
| 特性 | 媒体查询 | 容器查询 |
|---|---|---|
| 响应对象 | 视口尺寸 | 容器尺寸 |
| 组件复用性 | 依赖上下文 | 真正可移植 |
| 浏览器支持 | 通用 | 2023+ 基线 |
| 使用场景 | 页面布局 | 组件布局 |
加载
Read("${CLAUDE_SKILL_DIR}/rules/css-subgrid.md")以获取 CSS 子网格模式:嵌套网格对齐、标题/内容/操作对齐的卡片布局、二维子网格。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
加载
Read("${CLAUDE_SKILL_DIR}/rules/css-intrinsic-responsive.md")以获取内建响应式布局:auto-fit/minmax 网格、用于流式一切的 clamp()、用于组件逻辑的容器查询、零媒体查询模式。
加载
Read("${CLAUDE_SKILL_DIR}/rules/responsive-foldables.md")以获取可折叠/多屏幕设备支持:env(safe-area-inset-*)、视口分段查询、双屏布局、渐进增强。
涵盖的关键模式: CSS 子网格对齐、内建响应式网格(auto-fit + minmax)、流式 clamp() 缩放、可折叠设备布局、安全区域插入、视口分段查询。
加载
Read("${CLAUDE_SKILL_DIR}/rules/css-patterns.md")以获取完整的 CSS 示例:容器查询、cqi/cqb 单位、使用 clamp() 的流式排版、移动优先断点、CSS 网格模式和滚动查询。
涵盖的关键模式: 容器查询基础、容器查询单位(cqi/cqb)、使用 clamp() 的流式排版、基于容器的流式排版、移动优先断点、CSS 网格响应式模式、容器滚动查询(Chrome 126+)。
加载
Read("${CLAUDE_SKILL_DIR}/rules/react-patterns.md")以获取完整的 React 示例:ResponsiveCard 组件、Tailwind 容器查询、useContainerQuery 钩子和响应式图片。
涵盖的关键模式: 使用容器查询的响应式组件、Tailwind CSS 容器查询、useContainerQuery 钩子、响应式图片模式。
/* 重要:流式排版中始终包含 rem */
/* 这确保尊重用户的字体偏好设置 */
/* ❌ 错误:仅视口单位会忽略用户偏好 */
font-size: 5vw;
/* ✅ 正确:包含 rem 以尊重用户设置 */
font-size: clamp(1rem, 0.5rem + 2vw, 2rem);
/* 用户缩放功能必须仍然有效 */
@media (min-width: 768px) {
/* 在理想情况下,断点使用 em/rem,而不是 px */
/* (浏览器仍使用 px,但需考虑用户缩放) */
}
/* ❌ 禁止:仅使用视口单位设置文本 */
.title {
font-size: 5vw; /* 忽略用户字体偏好! */
}
/* ❌ 禁止:使用 cqw/cqh(应使用 cqi/cqb) */
.card {
padding: 5cqw; /* cqw = 容器宽度,非逻辑单位 */
}
/* ✅ 正确:使用逻辑单位 */
.card {
padding: 5cqi; /* 容器内联 = 逻辑方向 */
}
/* ❌ 禁止:没有 container-type 的容器查询 */
@container (min-width: 400px) {
/* 父元素没有 container-type 将无法工作! */
}
/* ❌ 禁止:桌面优先的媒体查询 */
.element {
display: grid;
grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 768px) {
.element {
grid-template-columns: 1fr; /* 覆盖 = 更多 CSS */
}
}
/* ❌ 禁止:为文本使用固定像素断点 */
@media (min-width: 768px) {
body { font-size: 18px; } /* 使用 rem! */
}
/* ❌ 禁止:过度嵌套容器查询 */
@container a {
@container b {
@container c {
/* 过于复杂,重新考虑架构 */
}
}
}
| 特性 | Chrome | Safari | Firefox | Edge |
|---|---|---|---|---|
| 容器尺寸查询 | 105+ | 16+ | 110+ | 105+ |
| 容器样式查询 | 111+ | ❌ | ❌ | 111+ |
| 容器滚动状态 | 126+ | ❌ | ❌ | 126+ |
| cqi/cqb 单位 | 105+ | 16+ | 110+ | 105+ |
| clamp() | 79+ | 13.1+ | 75+ | 79+ |
| 子网格 | 117+ | 16+ | 71+ | 117+ |
每个类别在 rules/ 目录下都有按需加载的独立规则文件:
| 类别 | 规则 | 影响 | 关键模式 |
|---|---|---|---|
| 现代 CSS 布局 | rules/css-subgrid.md | 高 | 用于嵌套网格对齐、卡片布局的 CSS 子网格 |
| 现代 CSS 布局 | rules/css-intrinsic-responsive.md | 高 | 内建响应式布局、auto-fit/minmax、clamp()、零断点 |
| 现代 CSS 布局 | rules/responsive-foldables.md | 中 | 可折叠设备、安全区域插入、视口分段 |
| CSS | rules/css-patterns.md | 高 | 容器查询、cqi/cqb、流式排版、网格、滚动查询 |
| React | rules/react-patterns.md | 高 | 容器查询组件、Tailwind、useContainerQuery、响应式图片 |
| PWA | rules/pwa-service-worker.md | 高 | Workbox 缓存策略、VitePWA、更新管理 |
| PWA | rules/pwa-offline.md | 高 | 离线钩子、后台同步、安装提示 |
| 动画 | rules/animation-motion.md | 高 | 运动预设、AnimatePresence、视图过渡 |
| 动画 | rules/animation-scroll.md | 中 | CSS 滚动驱动动画、视差、渐进增强 |
| 触摸与移动端 | rules/touch-interaction.md | 高 | 触摸目标(最小 44px)、拇指区域、捏合缩放、安全区域、手势 |
总计:6 个类别共 10 条规则
| 决策 | 选项 A | 选项 B | 推荐 |
|---|---|---|---|
| 查询类型 | 媒体查询 | 容器查询 | 组件用容器查询,布局用媒体查询 |
| 容器单位 | cqw/cqh | cqi/cqb | cqi/cqb(逻辑单位,支持国际化) |
| 流式排版基础 | 仅 vw | rem + vw | rem + vw(无障碍性) |
| 移动优先 | 是 | 桌面优先 | 移动优先(CSS 更少,渐进增强) |
| 网格模式 | auto-fit | auto-fill | 卡片用 auto-fit,图标用 auto-fill |
design-system-starter - 构建响应式设计系统ork:performance - CLS、响应式图片和图片优化ork:i18n-date-patterns - RTL/LTR 响应式注意事项关键词 : @container, container-type, inline-size, container-name 解决的问题 : 组件级响应式设计
关键词 : clamp(), fluid, vw, rem, scale, typography 解决的问题 : 无需断点的平滑字体缩放
关键词 : srcset, sizes, picture, art direction 解决的问题 : 针对不同视口的响应式图片
关键词 : min-width, mobile, progressive, breakpoints 解决的问题 : 高效的响应式 CSS 架构
关键词 : auto-fit, auto-fill, subgrid, minmax 解决的问题 : 响应式网格和弹性盒布局
关键词 : cqi, cqb, container width, container height 解决的问题 : 相对于容器尺寸进行大小调整
使用 Read("${CLAUDE_SKILL_DIR}/references/<file>") 按需加载:
| 文件 | 内容 |
|---|---|
container-queries.md | 容器查询模式 |
fluid-typography.md | 无障碍流式排版缩放 |
每周安装量
250
代码仓库
GitHub 星标数
132
首次出现
2026 年 1 月 22 日
安全审计
安装于
opencode233
gemini-cli226
codex226
cursor222
github-copilot217
kimi-cli203
Modern responsive design patterns using Container Queries, fluid typography, and mobile-first strategies for React applications (2026 best practices).
| Feature | Media Queries | Container Queries |
|---|---|---|
| Responds to | Viewport size | Container size |
| Component reuse | Context-dependent | Truly portable |
| Browser support | Universal | Baseline 2023+ |
| Use case | Page layouts | Component layouts |
Load
Read("${CLAUDE_SKILL_DIR}/rules/css-subgrid.md")for CSS Subgrid patterns: nested grid alignment, card layouts with aligned titles/content/actions, two-dimensional subgrid.
Load
Read("${CLAUDE_SKILL_DIR}/rules/css-intrinsic-responsive.md")for intrinsically responsive layouts: auto-fit/minmax grids, clamp() for fluid everything, container queries for component logic, zero media query patterns.
Load
Read("${CLAUDE_SKILL_DIR}/rules/responsive-foldables.md")for foldable/multi-screen device support: env(safe-area-inset-*), viewport segment queries, dual-screen layouts, progressive enhancement.
Key patterns covered: CSS Subgrid alignment, intrinsic responsive grids (auto-fit + minmax), fluid clamp() scales, foldable device layouts, safe area insets, viewport segment queries.
Load
Read("${CLAUDE_SKILL_DIR}/rules/css-patterns.md")for complete CSS examples: container queries, cqi/cqb units, fluid typography with clamp(), mobile-first breakpoints, CSS Grid patterns, and scroll-queries.
Key patterns covered: Container Query basics, Container Query Units (cqi/cqb), Fluid Typography with clamp(), Container-Based Fluid Typography, Mobile-First Breakpoints, CSS Grid Responsive Patterns, Container Scroll-Queries (Chrome 126+).
Load
Read("${CLAUDE_SKILL_DIR}/rules/react-patterns.md")for complete React examples: ResponsiveCard component, Tailwind container queries, useContainerQuery hook, and responsive images.
Key patterns covered: Responsive Component with Container Queries, Tailwind CSS Container Queries, useContainerQuery Hook, Responsive Images Pattern.
/* IMPORTANT: Always include rem in fluid typography */
/* This ensures user font preferences are respected */
/* ❌ WRONG: Viewport-only ignores user preferences */
font-size: 5vw;
/* ✅ CORRECT: Include rem to respect user settings */
font-size: clamp(1rem, 0.5rem + 2vw, 2rem);
/* User zooming must still work */
@media (min-width: 768px) {
/* Use em/rem, not px, for breakpoints in ideal world */
/* (browsers still use px, but consider user zoom) */
}
/* ❌ NEVER: Use only viewport units for text */
.title {
font-size: 5vw; /* Ignores user font preferences! */
}
/* ❌ NEVER: Use cqw/cqh (use cqi/cqb instead) */
.card {
padding: 5cqw; /* cqw = container width, not logical */
}
/* ✅ CORRECT: Use logical units */
.card {
padding: 5cqi; /* Container inline = logical direction */
}
/* ❌ NEVER: Container queries without container-type */
@container (min-width: 400px) {
/* Won't work without container-type on parent! */
}
/* ❌ NEVER: Desktop-first media queries */
.element {
display: grid;
grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 768px) {
.element {
grid-template-columns: 1fr; /* Overriding = more CSS */
}
}
/* ❌ NEVER: Fixed pixel breakpoints for text */
@media (min-width: 768px) {
body { font-size: 18px; } /* Use rem! */
}
/* ❌ NEVER: Over-nesting container queries */
@container a {
@container b {
@container c {
/* Too complex, reconsider architecture */
}
}
}
| Feature | Chrome | Safari | Firefox | Edge |
|---|---|---|---|---|
| Container Size Queries | 105+ | 16+ | 110+ | 105+ |
| Container Style Queries | 111+ | ❌ | ❌ | 111+ |
| Container Scroll-State | 126+ | ❌ | ❌ | 126+ |
| cqi/cqb units | 105+ | 16+ | 110+ | 105+ |
| clamp() | 79+ | 13.1+ | 75+ | 79+ |
| Subgrid | 117+ | 16+ | 71+ |
Each category has individual rule files in rules/ loaded on-demand:
| Category | Rule | Impact | Key Pattern |
|---|---|---|---|
| Modern CSS Layout | rules/css-subgrid.md | HIGH | CSS Subgrid for nested grid alignment, card layouts |
| Modern CSS Layout | rules/css-intrinsic-responsive.md | HIGH | Intrinsic responsive layouts, auto-fit/minmax, clamp(), zero breakpoints |
| Modern CSS Layout | rules/responsive-foldables.md | MEDIUM | Foldable devices, safe area insets, viewport segments |
| CSS | rules/css-patterns.md |
Total: 10 rules across 6 categories
| Decision | Option A | Option B | Recommendation |
|---|---|---|---|
| Query type | Media queries | Container queries | Container for components, Media for layout |
| Container units | cqw/cqh | cqi/cqb | cqi/cqb (logical, i18n-ready) |
| Fluid type base | vw only | rem + vw | rem + vw (accessibility) |
| Mobile-first | Yes | Desktop-first | Mobile-first (less CSS, progressive) |
| Grid pattern | auto-fit | auto-fill | auto-fit for cards, auto-fill for icons |
design-system-starter - Building responsive design systemsork:performance - CLS, responsive images, and image optimizationork:i18n-date-patterns - RTL/LTR responsive considerationsKeywords : @container, container-type, inline-size, container-name Solves : Component-level responsive design
Keywords : clamp(), fluid, vw, rem, scale, typography Solves : Smooth font scaling without breakpoints
Keywords : srcset, sizes, picture, art direction Solves : Responsive images for different viewports
Keywords : min-width, mobile, progressive, breakpoints Solves : Efficient responsive CSS architecture
Keywords : auto-fit, auto-fill, subgrid, minmax Solves : Responsive grid and flexbox layouts
Keywords : cqi, cqb, container width, container height Solves : Sizing relative to container dimensions
Load on demand with Read("${CLAUDE_SKILL_DIR}/references/<file>"):
| File | Content |
|---|---|
container-queries.md | Container query patterns |
fluid-typography.md | Accessible fluid type scales |
Weekly Installs
250
Repository
GitHub Stars
132
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode233
gemini-cli226
codex226
cursor222
github-copilot217
kimi-cli203
TanStack Query v5 完全指南:React 数据管理、乐观更新、离线支持
2,500 周安装
| 117+ |
| HIGH |
| Container queries, cqi/cqb, fluid typography, grid, scroll-queries |
| React | rules/react-patterns.md | HIGH | Container query components, Tailwind, useContainerQuery, responsive images |
| PWA | rules/pwa-service-worker.md | HIGH | Workbox caching strategies, VitePWA, update management |
| PWA | rules/pwa-offline.md | HIGH | Offline hooks, background sync, install prompts |
| Animation | rules/animation-motion.md | HIGH | Motion presets, AnimatePresence, View Transitions |
| Animation | rules/animation-scroll.md | MEDIUM | CSS scroll-driven animations, parallax, progressive enhancement |
| Touch & Mobile | rules/touch-interaction.md | HIGH | Touch targets (44px min), thumb zones, pinch-to-zoom, safe areas, gestures |