Token导航 LogoToken导航TokenDH.com
前端设计权限需确认github未标认证来源可访问clear审计通过

layout-system布局系统

Agent Skill

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

总安装

1,053

周安装

43

GitHub Stars

21

下载量

337
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:layout-system(布局系统)
来源仓库:https://github.com/sanky369/vibe-building-skills
仓库路径:skills/layout-system
安装命令:
npx skills add https://github.com/sanky369/vibe-building-skills --skill layout-system
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/sanky369/vibe-building-skills --skill layout-system

简介

layout-system 用于辅助前端页面、组件、样式和交互逻辑的开发与维护。

  • 适合生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构。
  • 使用时需结合项目现有设计系统、路由和构建方式,避免生成孤立片段。
  • 涉及页面改动时,应配合本地预览和构建检查确认视觉效果。
  • 安装前建议确认权限范围和维护状态,注意可能触发文件读写操作。

SKILL.md

Layout System

Overview

Layout is the skeleton of your interface. It determines how content is organized, how users navigate, and how the experience adapts across devices. A well-designed layout system is invisible—users don't notice it because it works so well.

This skill teaches you to think about layout systematically, using modern CSS techniques (Flexbox, Grid, Container Queries) and a mobile-first approach that ensures your product works beautifully everywhere.

Core Methodology: Mobile-First Responsive Design

The mobile-first approach is not just about making things smaller on mobile. It's a fundamental shift in thinking: start with the simplest, most constrained context (mobile), then progressively enhance for larger screens.

Why Mobile-First?

  1. Constraints Drive Clarity — Mobile forces you to prioritize. What's essential? What can wait? This clarity benefits all screen sizes.
  2. Progressive Enhancement — Start with a solid foundation, then add complexity. This is more robust than trying to "shrink" a desktop design.
  3. Performance — Mobile-first often results in faster, leaner code.
  4. Accessibility — Simpler layouts are often more accessible.

The Mobile-First Workflow

Step 1: Design for Mobile (320px - 480px)

  • Single column layout
  • Full-width content
  • Touch-friendly targets (minimum 44x44px)
  • Simplified navigation (hamburger menu, bottom nav)
  • Prioritized content

Step 2: Enhance for Tablet (481px - 768px)

  • Two-column layouts become possible
  • Sidebar navigation
  • Grid-based layouts (2-3 columns)
  • Larger typography
  • More whitespace

Step 3: Optimize for Desktop (769px - 1024px)

  • Three-column layouts
  • Sidebar + main content + sidebar
  • Rich navigation
  • Larger typography
  • Generous whitespace

Step 4: Maximize for Wide Screens (1025px+)

  • Four-column layouts
  • Maximum content width (e.g., 1280px)
  • Advanced grid layouts
  • Optimal reading line length

Modern Layout Techniques

Technique 1: Flexbox for One-Dimensional Layouts

Flexbox is perfect for layouts that flow in one direction (row or column). Use it for:

  • Navigation bars
  • Button groups
  • Card layouts
  • Centering content
  • Distributing space

Key Flexbox Properties:

  • flex-direction — row (default) or column
  • justify-content — Align items along the main axis (space-between, space-around, center, flex-start, flex-end)
  • align-items — Align items along the cross axis (center, flex-start, flex-end, stretch)
  • gap — Space between items
  • flex-wrap — Wrap items to next line if needed
  • flex — Shorthand for flex-grow, flex-shrink, flex-basis

Example: Responsive Navigation

/* Mobile: Vertical stack */
nav {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Tablet and up: Horizontal */
@media (min-width: 768px) {
  nav {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

Technique 2: CSS Grid for Two-Dimensional Layouts

Grid is perfect for layouts that need to align in both rows and columns. Use it for:

  • Page layouts (header, sidebar, main, footer)
  • Dashboard layouts
  • Gallery layouts
  • Complex component layouts

Key Grid Properties:

  • grid-template-columns — Define column sizes
  • grid-template-rows — Define row sizes
  • gap — Space between items
  • grid-auto-flow — How items flow (row or column)
  • grid-column / grid-row — Position items in the grid
  • grid-template-areas — Named grid areas for semantic layouts

Example: Responsive Page Layout

/* Mobile: Single column */
body {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "header"
    "main"
    "footer";
  gap: 1rem;
}

/* Tablet and up: Sidebar + main */
@media (min-width: 768px) {
  body {
    grid-template-columns: 250px 1fr;
    grid-template-areas:
      "header header"
      "sidebar main"
      "footer footer";
  }
}

/* Desktop: Sidebar + main + secondary */
@media (min-width: 1024px) {
  body {
    grid-template-columns: 250px 1fr 300px;
    grid-template-areas:
      "header header header"
      "sidebar main secondary"
      "footer footer footer";
  }
}

Technique 3: Container Queries for Component-Level Responsiveness

Container queries allow components to respond to their container's size, not the viewport size. This is powerful for reusable components.

Example: Responsive Card

/* Define a container context */
.card-container {
  container-type: inline-size;
}

/* Card responds to its container, not the viewport */
.card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

/* When container is wider than 400px, use 2 columns */
@container (min-width: 400px) {
  .card {
    grid-template-columns: 1fr 1fr;
  }
}

Technique 4: Aspect Ratio for Maintaining Proportions

Use aspect-ratio to maintain consistent proportions for images, videos, and other media.

/* 16:9 aspect ratio (video) */
.video-container {
  aspect-ratio: 16 / 9;
  width: 100%;
}

/* 1:1 aspect ratio (square) */
.image-square {
  aspect-ratio: 1;
  width: 100%;
  object-fit: cover;
}

/* 4:3 aspect ratio (photo) */
.image-photo {
  aspect-ratio: 4 / 3;
  width: 100%;
  object-fit: cover;
}

Responsive Breakpoint Strategy

Define breakpoints based on your content, not device sizes. Common breakpoints:

BreakpointSizeContextUse Case
xs320px - 480pxSmall mobileSingle column, simplified
sm481px - 640pxLarge mobileStill mostly single column
md641px - 768pxTablet (portrait)Two columns possible
lg769px - 1024pxTablet (landscape) / Small desktopThree columns possible
xl1025px - 1280pxDesktopFull layout
2xl1281px+Large desktopMaximum width containers

Tailwind CSS Breakpoints:

module.exports = {
  theme: {
    screens: {
      'xs': '320px',
      'sm': '640px',
      'md': '768px',
      'lg': '1024px',
      'xl': '1280px',
      '2xl': '1536px',
    },
  },
};

Common Responsive Patterns

Pattern 1: Hero Section

<section class="hero">
  <div class="hero-content">
    <h1>Welcome</h1>
    <p>Your tagline here</p>
    <button>Get Started</button>
  </div>
  <div class="hero-image">
    <img src="hero.jpg" alt="Hero" />
  </div>
</section>
/* Mobile: Single column, image below text */
.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding: 2rem 1rem;
}

/* Tablet and up: Two columns, image beside text */
@media (min-width: 768px) {
  .hero {
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    padding: 4rem 2rem;
    align-items: center;
  }
}

Pattern 2: Card Grid

<div class="card-grid">
  <div class="card"><!-- content --></div>
  <div class="card"><!-- content --></div>
  <div class="card"><!-- content --></div>
</div>
/* Mobile: 1 column */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

/* Tablet: 2 columns */
@media (min-width: 768px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Desktop: 3 columns */
@media (min-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

Pattern 3: Sidebar + Main

<div class="layout">
  <aside class="sidebar"><!-- navigation --></aside>
  <main class="main"><!-- content --></main>
</div>
/* Mobile: Stacked */
.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

/* Tablet and up: Sidebar beside main */
@media (min-width: 768px) {
  .layout {
    grid-template-columns: 250px 1fr;
    gap: 2rem;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: fit-content;
  }
}

Pattern 4: Responsive Typography

/* Mobile: Smaller text */
h1 {
  font-size: 24px;
  line-height: 1.2;
}

/* Tablet: Medium text */
@media (min-width: 768px) {
  h1 {
    font-size: 32px;
  }
}

/* Desktop: Larger text */
@media (min-width: 1024px) {
  h1 {
    font-size: 40px;
  }
}

/* Or use fluid typography */
h1 {
  font-size: clamp(24px, 5vw, 40px);
}

Accessibility Considerations

1. Touch Targets

Ensure interactive elements are at least 44x44px (WCAG 2.5.5 Level AAA):

button, a, input {
  min-width: 44px;
  min-height: 44px;
  padding: 0.75rem 1rem; /* Adjust as needed */
}

2. Reading Line Length

Optimal line length is 50-75 characters. Use max-width to constrain text:

main {
  max-width: 65ch; /* ~65 characters */
  margin: 0 auto;
  padding: 0 1rem;
}

3. Whitespace and Breathing Room

Generous whitespace improves readability and reduces cognitive load:

section {
  padding: 2rem 1rem; /* Mobile */
}

@media (min-width: 768px) {
  section {
    padding: 4rem 2rem; /* Tablet */
  }
}

@media (min-width: 1024px) {
  section {
    padding: 6rem 4rem; /* Desktop */
  }
}

4. Logical Tab Order

Ensure keyboard navigation follows a logical order:

/* Use flexbox or grid order property to reorder visually without affecting tab order */
.item {
  order: 1; /* Visual order, doesn't affect tab order */
}

/* For tab order, use HTML source order or tabindex (use sparingly) */

How to Use This Skill with Claude Code

Audit Your Current Layout

"I'm using the layout-system skill. Can you audit my current layouts?
- Analyze my responsive behavior
- Check for accessibility issues (touch targets, line length, whitespace)
- Identify layouts that don't work well on mobile
- Suggest improvements"

Create Responsive Layouts

"Can you create responsive layouts for:
- Hero section (mobile-first)
- Card grid (1 column mobile, 2 tablet, 3 desktop)
- Sidebar + main content
- Navigation bar (hamburger on mobile, horizontal on desktop)
- Footer"

Implement Container Queries

"Can you help me implement container queries for my card component?
- Define container context
- Create responsive card layout based on container width
- Ensure accessibility"

Test Responsive Behavior

"Can you create a responsive testing checklist?
- Mobile (320px, 480px)
- Tablet (768px)
- Desktop (1024px, 1280px)
- What to check at each breakpoint"

Design Critique: Evaluating Your Layouts

Claude Code can critique your layouts:

"Can you evaluate my layouts?
- Are they truly mobile-first?
- Are touch targets large enough?
- Is the reading line length appropriate?
- Is there enough whitespace?
- Do they work well at all breakpoints?
- Are there any accessibility issues?"

Integration with Other Skills

  • design-foundation — Uses tokens for spacing and breakpoints
  • typography-system — Responsive typography scales
  • component-architecture — Responsive component layouts
  • accessibility-excellence — Touch targets, reading line length, whitespace
  • interaction-design — Responsive animations and transitions

Key Principles

1. Mobile-First is a Mindset Start simple, progressively enhance. This results in better products for everyone.

2. Content Determines Breakpoints Don't use arbitrary breakpoints. Use breakpoints where your content needs them.

3. Whitespace is Content Generous whitespace improves readability and reduces cognitive load.

4. Flexibility Over Rigidity Use flexible units (%, em, rem) instead of fixed pixels. This allows your layout to adapt.

5. Test on Real Devices Emulators are helpful, but test on real devices. Real network conditions, real touch, real performance.

Checklist: Is Your Layout System Ready?

  • All layouts are mobile-first
  • Responsive breakpoints are defined and consistent
  • Touch targets are at least 44x44px
  • Reading line length is 50-75 characters
  • Whitespace is generous and intentional
  • Layouts work well at all breakpoints (test on real devices)
  • Container queries are used for component-level responsiveness
  • Aspect ratios are used for media
  • Keyboard navigation works well
  • Layouts are tested with screen readers
  • Performance is good on slow networks and devices

A well-designed layout system is the foundation of a great experience across all devices.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

29.55%
按下载量换算100

Codex

22.08%
按下载量换算74

Gemini CLI

16.51%
按下载量换算56

OpenCode

13.92%
按下载量换算47

Antigravity

8.87%
按下载量换算30

Cursor

3.88%
按下载量换算13

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

权限需确认

当前来源未能明确判断权限范围,默认进入异常复核队列。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills