better-layout
Skill này làm gì
Skill hướng dẫn AI sắp xếp các phần trang, điều khiển và khoảng cách sao cho cấu trúc dễ đọc trên mọi màn hình. Dành cho nhà thiết kế và lập trình viên xây dựng bố cục web.
Khi nào nên dùng
- ✓Khi bạn cấu trúc một trang hoặc thành phần mới và cần bố cục dễ đọc.
- ✓Khi khoảng cách hoặc căn chỉnh của các điều khiển trông lộn xộn.
- ✓Khi bạn cần quyết định phần nào thu gọn hoặc ẩn trên màn hình nhỏ.
Liên kết skill
https://github.com/trycompai/crm/blob/release/.agents/skills/better-layout/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Trang cài đặt này trông chật và lệch trên điện thoại. Bạn có thể sửa bố cục không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
AI nhóm các mục liên quan, căn chúng theo các cạnh chung, dùng hệ thống khoảng cách của dự án và kiểm tra bố cục ở nhiều chiều rộng khác nhau.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Layout that communicates structure
Layout communicates before a single word is read: position, spacing, and alignment carry hierarchy on their own, and generous space beats decoration. A good layout also survives stress: resize it, translate it, mirror it for RTL, and it should still hold together. Apply these principles when building or reviewing UI code, and express every change in the project's existing styling system (Tailwind, plain CSS, CSS-in-JS); never introduce a second styling approach.
Hit-area sizes and focus behavior are covered by the better-accessibility skill; visual polish (radius, shadows, animation) by the better-ui skill; line length and text spacing by the better-typography skill.
Treat the numeric values below as starting points for interfaces without an established density or spacing system. Preserve deliberate platform chrome, compact professional tools, and project tokens when they remain usable under hit-area, zoom, localization, and viewport stress tests.
Quick Reference
| Category | When to Use |
|---|---|
| Grouping & Alignment | Space vs separators, alignment edges, logical properties, importance ordering |
| Spacing & Adaptivity | Spacing between targets, layout margins, progressive disclosure, full-bleed content, breakpoints, i18n growth |
Core Principles
1. Group with Space, Not Lines
Negative space is the primary grouping tool; background shapes second; separator lines last, only where space alone can't carry the structure. The gap between groups must be at least 2× the gap within a group (8px intra-group → 16px+ inter-group), or the grouping reads as noise.
2. Keep Controls Distinct from Content
Interactive elements must look interactive: a background shape, a border, or a consistent placement zone. Never style a control identically to adjacent static text.
3. Align to Shared Edges
Pick alignment edges and stick to them; every stray edge reads as noise. Use one project spacing step for each level of subordination (16px is a useful default). Use logical properties (padding-inline-start, margin-inline-end) for direction-dependent layout; reserve physical left/right for genuinely physical geometry.
4. Order by Importance
The most important content sits near the top and the leading edge; reading order flows top-to-bottom, leading-to-trailing. Think in leading/trailing, not left/right.
5. Hint at Hidden Content
Progressive disclosure needs a visible affordance. Use the project's established cue; without one, let the next item peek 16–32px past the scroll edge or show a disclosure control. Content hidden with zero cue may as well not exist.
6. Breathing Room Between Targets
Without an established density system, start with 12px between adjacent bordered or filled controls and 24px of clearance around borderless text- and icon-only controls. Compact layouts may use less when better-accessibility hit areas do not overlap and the controls remain visually distinct.
7. Inset Buttons from the Edges
In content layouts, keep full-width buttons inside the layout margins (start near 16px inline on mobile) with a visible radius. Edge-to-edge actions are acceptable when they intentionally follow established platform or application chrome, account for safe areas, and remain distinguishable from system UI.
8. Content Bleeds, Controls Float
Backgrounds and media extend to the viewport edges; controls and text stay inside the layout margins and safe areas (env(safe-area-inset-*)). Sticky chrome floats above the content layer, it doesn't dam it.
9. Hold Structure Until It Breaks
Breakpoints come from the content, not device presets. Keep the expanded layout as long as it genuinely fits and collapse late; prefer container queries for component-level adaptation. Test the smallest and largest sizes first.
10. Plan for Growth and Clipping
Plan for substantial and language-dependent string growth rather than relying on a universal percentage: no fixed widths or heights on text containers, and let rows wrap. Never park critical actions where resizing or scrolling clips them; keep them reachable in the normal flow or stable chrome appropriate to the product.
Common Mistakes
| Mistake | Fix |
|---|---|
| Separator line where spacing would do | Remove the line, double the gap between groups |
margin-left / padding-right in a localizable l |
Câu hỏi thường gặp
Skill có thay thế hệ thống tạo kiểu của dự án không?
Không. Skill yêu cầu áp dụng thay đổi bằng hệ thống sẵn có của dự án, như Tailwind hoặc CSS thuần.
Skill có xử lý ngôn ngữ viết từ phải sang trái không?
Có. Nó bao quát hướng bố cục RTL và các thuộc tính CSS theo logic.
Skill có bao quát hoạt ảnh không?
Không. Độ hoàn thiện trực quan và chuyển động thuộc về skill better-ui.
Chi tiết
Mô tả gốc của tác giả
Layout structure for web interfaces, from grouping and alignment to reading order, progressive disclosure, and adaptive breakpoints. Use when structuring a page or component, spacing or aligning controls, deciding what collapses at small sizes, handling RTL layout direction, or reviewing frontend code for layout. Triggers on layout, spacing, alignment, grouping, negative space, whitespace, visual hierarchy, reading order, progressive disclosure, breakpoints, responsive layout, container queries, safe area, full-bleed, edge-to-edge, layout margins, RTL layout, logical properties.
repo: trycompai/crm
Độ phổ biến
- Sao GitHub
- 12k
- Vị trí xếp hạng
- #11512
- Giấy phép
- MIT
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
ai-elements
12kGiúp agent của bạn xây dựng giao diện chat AI với các thành phần có sẵn cho hội thoại, tin nhắn, hiển thị công cụ và ô nhập prompt.
ai-sdk
12kGiúp agent của bạn xây dựng tính năng AI với Vercel AI SDK, gồm tạo văn bản, truyền phát, gọi công cụ và agent.
better-accessibility
12kGiúp agent của bạn làm giao diện dùng được bằng bàn phím và trình đọc màn hình, bao gồm focus, nhãn, ARIA và biểu mẫu.
better-auth-best-practices
12kGiúp agent của bạn thiết lập Better Auth cho đăng nhập, phiên làm việc, OAuth và plugin trong ứng dụng TypeScript, theo các bước tài liệu.
Skill tương tự
canvas
394kCho phép agent của bạn hiện một widget trực quan được lưu trữ trên bảng Mac đã kết nối, rồi ẩn bảng hoặc chuyển nó sang trang khác.
control-ui
394kGiúp agent của bạn sắp xếp và khắc phục sự cố Control UI của OpenClaw, gồm các phiên, bảng điều khiển và Gateway đã kết nối.
diagram-maker
394kGiúp agent của bạn vẽ sơ đồ rõ ràng dạng SVG, HTML hoặc Excalidraw có thể sửa, cho quy trình, kiến trúc hệ thống và bản phác bảng trắng.