better-layout
它能做什么
这个技能帮助安排屏幕的各个部分,使它们在任何设备和任何语言中都清晰易读。适合希望布局不会崩坏的设计师和开发者。
适用场景
- ✓当页面的分组、间距或对齐看起来令人困惑的时候。
- ✓当布局在较小尺寸或翻译后的较长文字下出现崩坏的时候。
- ✓当布局需要为从右到左书写的语言正确镜像的时候。
技能链接
https://github.com/jakubkrehel/skills/blob/main/skills/better-layout/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的设置页面在手机上显得拥挤,而且德语标签会断行。请修复这个布局。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会用间距把相关项目分组,检查控件是否与内容有明显区分,并通过调整大小、翻译和镜像来对结构进行压力测试。它会在你的样式系统中编写修复,并优先使用已有的令牌。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Layout
This skill sets grouping, alignment, spacing and responsive structure. It then stress-tests that structure by resizing it, translating it and mirroring it for RTL.
Write every fix in the project's styling system. The numbers below apply only where the project has no spacing scale or density system; otherwise use its tokens. A finding needs a failure you can show, such as a clip, an overlap, a broken mirror or a misread group. A value that differs from these starting points is not one.
Hit areas and focus behavior belong to better-accessibility. Radius, shadows and animation belong to better-ui. Line length, text spacing and truncation mechanics belong to better-typography. The words themselves belong to better-writing.
Group with space, not lines
Space groups first, background shapes second, separator lines last and only where space alone can't carry the structure. The gap between groups is at least 2× the gap within one, so 8px inside a group means 16px or more between groups. Recipes are in grouping-and-alignment.md.
Keep controls distinct from content
Give every interactive element a background shape, a border, an underline or a consistent placement zone such as a toolbar. A control styled like the static text beside it does not read as a control. See grouping-and-alignment.md.
Align to shared edges
Pick a small set of alignment edges and put everything on them. Use one project spacing step per level of nesting, where 16px is a useful default. See grouping-and-alignment.md.
Logical properties for anything that mirrors
Write direction-dependent layout as leading and trailing: margin-inline-start, padding-inline-end, inset-inline-start, text-align: start. Reserve physical left and right for physical geometry such as safe-area insets. The mapping table and the RTL progression rules are in grouping-and-alignment.md.
Order by importance
The most important content sits near the top and the leading edge. Within a row, identifying content leads and metadata and actions trail. Visual order matches DOM order, so never move content out of source sequence with order, row-reverse or grid placement. See grouping-and-alignment.md.
One primary action per view
Give each view one primary action. Put secondary actions behind a menu once there are more than 3. Prefer a short view that links deeper over one long view that shows everything at the top level. better-colors owns how color marks the primary action.
Hint at hidden content
Every piece of off-screen or collapsed content needs a visible cue. Use the project's established cue, let the next item peek 16–32px past the scroll edge or show a disclosure control.
A truncated value the user needs has a way to the full text: an expand control, a detail view or a tooltip that is also keyboard-reachable. Truncation mechanics are better-typography's. Recipes are in spacing-and-adaptivity.md.
Borderless controls need more clearance
Without an established density system, start with 12px between adjacent bordered or filled controls. Leave 24px between the visible glyphs of borderless text and icon controls, counting each button's own padding. Compact layouts may use less, as long as hit areas never overlap and the controls stay distinct. See spacing-and-adaptivity.md.
Inset buttons from the edges
In content layouts, keep full-width buttons inside the layout margins, starting near 16px inline on mobile. Edge-to-edge actions work when they follow established platform chrome, account for safe areas and stay distinguishable from system UI. See spacing-and-adaptivity.md.
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-*) is non-zero only when the viewport meta includes viewport-fit=cover.
Content scrolls beneath sticky chrome. Set scroll-padding-block-start to the sticky header's height, so anchored targets
常见问题
它使用固定的间距数值吗?
只有在项目没有间距系统的情况下才会。否则它使用项目自己的令牌。
什么算是真正的布局问题?
可以展示出来的失败,例如文字被裁切、元素重叠,或镜像布局崩坏。
它会改动页面上的文字吗?
不会。文字属于文案技能的职责范围。
详情
作者的原始描述
Sets grouping, alignment, reading order, responsive structure and room for translated text, so a layout holds up when it is resized, translated or mirrored.
repo: jakubkrehel/skills
热度
- GitHub 星标
- 10k
- 排名
- #11887
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …