Communitygithub.com

LIKELION-CAPSULE/Landing_Page

帮助处理分组、对齐、阅读顺序、响应式结构以及翻译文本的空间预留,确保布局在缩放、翻译或镜像翻转时保持稳定。

Landing_Page 是什么?

此技能专注于前端布局的健壮性与国际化适配。它提供了一整套规则和检测模式,帮助开发者在创建或审查布局时,确保其能够优雅地处理内容分组、对齐、阅读顺序、响应式断点,以及文本翻译后长度变化和RTL(从右至左)镜像等场景。该技能强调使用逻辑属性(如 `margin-inline-start`)代替物理属性,并建议优先使用容器查询而非媒体查询,源自内容本身的断点。它还提供了详细的“检测模式与修复”表格,涵盖常见的布局陷阱(如 `100vw` 导致水平滚动条),并附带了基于严重级别(HIGH/MEDIUM/LOW)的问题报告格式。该技能适用于 Claude Code、Cursor 等AI编码助手,通过其 SKILL.md 文档指导AI代理分析代码并产出结构化的可操作反馈。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/LIKELION-CAPSULE/Landing_Page/tree/HEAD/.agents/skills/better-layout

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

布局

此技能设定了分组、对齐、间距和响应式结构。然后通过缩放、翻译和RTL镜像来压力测试该结构。

将每次修复写入项目的样式系统。以下数字仅适用于项目没有间距比例或密度系统的情况;否则使用其设计令牌。发现问题需要有一个可展示的失败案例,例如裁剪、重叠、镜像断裂或错误的分组。与这些起始值不同的值本身不构成问题。

点击区域和焦点行为属于 better-accessibility。圆角、阴影和动画属于 better-ui。行长、文本间距和截断机制属于 better-typography。文字本身属于 better-writing。

用间距分组,而非线条

优先使用间距分组,其次使用背景形状,最后考虑分隔线,且仅当间距本身无法承载结构时使用。组与组之间的间隔至少是组内间隔的2倍,因此如果组内间距为 8px,则组间间距应为 16px 或更大。详细方法请参考 grouping-and-alignment.md。

保持控件与内容的区分

为每个可交互元素提供背景形状、边框、下划线或一致的放置区域(如工具栏)。如果控件样式与旁边静态文本一样,那么它不会被识别为控件。详见 grouping-and-alignment.md。

对齐到共享边缘

选择一小部分对齐边缘,并将所有内容对齐到这些边缘上。每个嵌套层级使用项目的一个间距步长,16px 是一个有用的默认值。详见 grouping-and-alignment.md。

对于任何需要镜像翻转的内容使用逻辑属性

将方向相关的布局编写为起始和结束方向:margin-inline-start、padding-inline-end、inset-inline-start、text-align: start。仅在处理物理几何(如安全区域插入)时保留物理的 left 和 right。映射表和 RTL 推进规则请参考 grouping-and-alignment.md。

按重要性排序

最重要的内容靠近顶部和起始边缘。在一行内,标识性内容在前,元数据和操作在后。视觉顺序需与 DOM 顺序一致,切勿使用 order、row-reverse 或 grid 放置来将内容移出源代码顺序。详见 grouping-and-alignment.md。

每个视图一个主要操作

为每个视图提供一个主要操作。当次要操作超过3个时,将其放入菜单。更倾向于使用一个较短的视图并提供深层链接,而不是一个在顶层显示所有内容的长视图。better-colors 负责如何通过颜色标记主要操作。

提示隐藏内容

每一段屏幕外或折叠的内容都需要一个可见的提示。使用项目已建立的提示方式,让下一个项目在滚动边缘外露出 16–32px,或显示一个展开控件。

用户需要的被截断的值必须提供获取完整文本的途径:展开控件、详情视图或可通过键盘访问的工具提示。截断机制属于 better-typography。详细方法请参考 spacing-and-adaptivity.md。

无边框控件需要更大的间距

在没有既定密度系统的情况下,相邻的有边框或有填充的控件之间至少留出 12px。对于无边框文本和图标控件,在它们的可见字形之间至少留出 24px 间距(包括每个按钮自身的内边距)。紧凑布局可以使用更小的间距,但前提是点击区域不得重叠且控件保持清晰可辨。详见 spacing-and-adaptivity.md。

按钮与边缘保持内边距

在内容布局中,将全宽按钮放置在布局边距内部,在移动端从内联方向约 16px 开始。边缘到边缘的操作在遵循既定平台 chrome、处理安全区域且能与系统UI区分开时可以使用。详见 spacing-and-adaptivity.md。

内容出血,控件浮动

背景和媒体延伸到视口边缘。控件和文本保持在布局边距和安全区域内部。env(safe-area-inset-*) 仅在视口 meta 包含 viewport-fit=cover 时非零。

内容在粘性 chrome 下方滚动。设置 scroll-padding-block-start 为粘性头部的高度,以确保锚定目标和聚焦元素永远不会位于其下方。详见 spacing-and-adaptivity.md。

保持结构直到它无法容纳

断点应源自内容,而非设备预设。保持展开布局直到它无法容纳,然后折叠。组件级适配优先使用容器查询,并首先测试最小和最大支持尺寸。详见 spacing-and-adaptivity.md。

为增长和裁剪做规划

翻译后的字符串会增长,短字符串的增长比例更大,因此一个单词的按钮标签是屏幕上风险最高的元素。使用 max-width 和 min-height 调整文本容器大小,切勿使用固定宽度或高度,并允许行内换行。使用伪本地化和一种长字符串语言(如德语)进行测试。

切勿将关键操作放置在缩放、滚动或裁剪会将其截断的位置。将其保留在正常流或稳定的 chrome 中。详见 spacing-and-adaptivity.md。

完成前检查

检测模式修复方法
grid-template-columns: … 1fr 或包含长文本/宽表格的 flex 子项导致轨道溢出在轨道上使用 minmax(0, 1fr),在 flex 子项上使用 min-width: 0
width: 100vw使用 width: 100%;100vw 包含滚动条,在桌面上会横向滚动
在全高移动端面板上使用 height: 100vh使用 100dvh,这样浏览器工具栏和键盘不会覆盖底部
在包含文本的盒子上使用固定长度的 height:使用 min-height,或使用 max-height 配合 overflow-y: auto
在可复用组件内部使用 @media (max-width: …)在组件的父元素上使用 @container
在 flex 项、inline-block 或未设置宽度的绝对定位元素上使用 container-type: inline-size为其设置明确的宽度;尺寸包含会将收缩适应盒缩小到零
视口 meta 中没有 viewport-fit=cover 时使用 env(safe-area-inset-*)添加 viewport-fit=cover,否则插入值解析为 0
inset-inline-* 或 *-inline-* 与 safe-area-inset-left 或 -right 结合使用物理的 left 或 right 配合相应的插入,以及一个 [dir="rtl"] 覆盖
在镜像UI上使用 float: left使用 float: inline-start
在镜像UI上使用 translateX 或 background-position: left使用 [dir="rtl"] 覆盖;两者均无逻辑形式
粘性头部没有 scroll-padding-block-start将其设置为头部高度

报告

严重级别。 HIGH 表示在支持的视口下阻挡内容或操作。在 320px 宽度或 200% 缩放下的裁剪或重叠始终为 HIGH,截断内容且无法获取完整值也是如此。内容超出滚动边缘或位于展开控件后方且无可见提示同样属于此级别。MEDIUM 损害层级结构、阅读顺序或适应性。LOW 是孤立的对齐或间距优化。

验证。 在没有浏览器的情况下,检查逻辑属性是否替换了物理属性,容器查询和媒体查询是否与支持的视口列表匹配,DOM 顺序是否与视觉顺序一致。在有浏览器的情况下,检查每个支持的宽度、320px、200% 缩放以及 RTL 镜像。将每个无法运行的检查报告为 Not verified。

格式。 将发现的问题按照其违反的原则分组,按严重级别排序,每个根本原因一行,列出其出现的每个位置:

严重级别位置修改前修改后原因

位置 为 路径/至/文件:行号。原因 应说明违反的原则及对用户的影响。

如果存在任何 HIGH 级别的问题,则以 Block 结尾;否则以 Approve 结尾,并将剩余问题保留在表格中作为待办事项。切勿对未检查的覆盖范围进行 Approve。若无任何可报告内容,则声明“无可操作的布局发现”并报告验证结果。

Individual skills in this repo

This repo contains 14 individual skills — each has its own dedicated page.

LIKELION-CAPSULE/Landing_Page

Reviews and fixes keyboard and focus behavior, ARIA, accessible names, forms, screen-reader announcements, motion and zoom in your project against WCAG 2.2.

LIKELION-CAPSULE/Landing_Page

Helps you build and check a color system for your project. It generates palettes, names semantic tokens, converts between formats and measures contrast.

LIKELION-CAPSULE/Landing_Page

Combines all of the `better-*` skills into a single review across accessibility, layout, writing, typography, color and UI polish.

LIKELION-CAPSULE/Landing_Page

Sets and reviews how text renders in your product, from the type scale and spacing to font features, wrapping, truncation and punctuation.

LIKELION-CAPSULE/Landing_Page

Polishes the surfaces, icons and motion in your project with exact values for border radius, optical alignment, shadows, icon states and animation.

LIKELION-CAPSULE/Landing_Page

Writes and reviews your interface copy, from labels and errors to empty states and confirmations, so it matches your product's voice and tells people what to do next.

LIKELION-CAPSULE/Landing_Page

Renders a component you choose under every scenario that can reach it on a temporary page and stress tests it.

LIKELION-CAPSULE/Landing_Page

Try to break a piece of UI by feeding it worst-case data — long names, unbreakable emails, one-letter names, missing fields, huge counts, zero items, long labels, non-Latin text, emoji, extreme numbers — then render it behind a "Demo data / Worst case" toggle and report everything that broke, with the fix for each. Use when the user asks to stress-test, break, or find edge cases in a component or screen, or to "try the worst case". For visual design critique use emil-design-eng; for motion use review-animations.

LIKELION-CAPSULE/Landing_Page

Builds UI from a Figma file or a design image so it matches the design, using your project's existing tokens and components.

LIKELION-CAPSULE/Landing_Page

Explains how a website, a visual effect or an animation was built, from a live URL or a screenshot.

LIKELION-CAPSULE/Landing_Page

Reviews a branch, pull request or uncommitted change for the interface problems it introduced or regressed, across accessibility, layout, writing, typography, color and UI.

LIKELION-CAPSULE/Landing_Page

Make a web app feel native on a phone — the small CSS and meta-tag fixes that separate "a website in a browser" from something that feels installed. Covers sticky hover states, tap highlight flashes, the 100vh bug, inputs that zoom the page, laggy taps, pull-to-refresh hijacking scroll, content under the notch, long-press selecting button text, carousels that scroll the wrong way, mismatched status bars, and the rule that you test on real hardware. Use when a web app is being built for or reviewed on mobile, when something "works in Chrome but feels wrong on my phone", when building a PWA, a bottom sheet, a carousel, a full-screen layout, or any touch interaction. For motion itself use animate; for React Native use animate-expo.

LIKELION-CAPSULE/Landing_Page

Renders every state of a component you choose on a throwaway page, with mock data and a switcher, so you can work on each state.

LIKELION-CAPSULE/Landing_Page

Builds multiple variants of a component you're working on and helps you iterate and pick one.

相关技能