con un clic
frontend-quality-guardrails-cn
当用户需要构建、修改或审查前端界面,并验证文本溢出、布局、响应式、可访问性和视觉质量时使用。
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
当用户需要构建、修改或审查前端界面,并验证文本溢出、布局、响应式、可访问性和视觉质量时使用。
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional SOC
Use when creating one local Git commit without pushing. Supports diff-based Conventional Commit type/scope/message generation, staged or requested change handling, segmented commit bodies for non-trivial changes, and safe commit-only workflows. Trigger for requests such as "commit this", "create a commit", "commit current changes without pushing", or local-only handoff.
Use when committing and pushing current changes on one branch with a Conventional Commit message. Supports diff-based type/scope/message generation, staged or requested change handling, segmented commit bodies for non-trivial changes, and safe single-branch push handling.
当用户只需要创建一个本地 Git 提交且不推送时使用。支持基于 diff 自动判断 Conventional Commit 的 type/scope/summary、处理已暂存或用户要求的改动范围、为非简单改动生成分段提交正文,并执行安全的仅提交工作流。适用于“提交当前改动”“只 commit 不 push”“创建一个本地提交”等请求。
当用户需要在当前单分支提交并推送改动,并生成 Conventional Commit 信息时使用。支持基于 diff 自动判断 type/scope/summary、处理已暂存或用户要求的改动范围、为非简单改动生成分段提交正文,并安全处理单分支推送。
Use when creating, critiquing, or iterating logo and brand-mark concepts through a designer-distillation board, including brand intake, public-source designer lenses, concept territories, visual prompts, and logo quality scoring.
当用户需要用设计师人格蒸馏、品牌策略、概念方向、视觉提示词和质量评分来设计、评审或迭代 Logo 与品牌标识时使用。
| name | frontend-quality-guardrails-cn |
| description | 当用户需要构建、修改或审查前端界面,并验证文本溢出、布局、响应式、可访问性和视觉质量时使用。 |
将本技能作为前端实现和审查的质量守门规则,覆盖超长文本、溢出、换行、截断、对齐、间距、响应式、组件状态、可访问性、国际化、视觉细节、项目代码审查、浏览器截图验证和常见 UI 样式踩坑点。
把所有 UI 都当成会遇到不完美内容来处理。默认假设标签、姓名、URL、ID、价格、翻译文本、用户输入、错误信息、表格单元格、徽章、面包屑、Tab 和按钮文案都可能比设计稿更长。
优先做小而局部的 CSS/布局修复,不要为了局部问题重写整体结构。除非用户明确要求重设计,否则保留现有设计系统、组件 API、设计 token、间距尺度和框架约定。
在构建、修改或审查前端 UI 且布局质量重要时使用本技能,尤其是:
以下场景不要把本技能作为主要指南:
把下面的流程作为项目现有前端规范之上的质量守门层。简单修改只使用核心清单;更深入的开发、审查或验收,按需读取“深度参考”里的文件。
先检查现有 UI 约定:
找出文本风险面:
明确每个文本容器的预期行为:
实现最小且稳健的修复:
min-width: 0 或 min-height: 0。max-width、overflow-wrap、text-overflow、line-clamp 或滚动行为。用极端内容和视口验证:
需要更完整覆盖时读取这些参考文件:
用户必须直接阅读的内容优先换行:
.wrap-text {
overflow-wrap: anywhere;
word-break: normal;
hyphens: auto;
}
只有在空间刻意紧凑且完整值仍可访问时才截断:
.truncate-one-line {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
对于重复 UI 里的紧凑名称或标题,优先使用单行省略号,并通过项目已有的 Tooltip/title 模式在鼠标悬停和键盘聚焦时展示完整文本。不要只靠裁剪来“保护布局”;用户仍然必须能查看完整值。
卡片摘要、搜索结果和说明文本可使用多行限行:
.clamp-2 {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
日志、代码、长表格和原始技术值适合滚动:
.scroll-panel {
min-width: 0;
min-height: 0;
overflow: auto;
}
避免这些陷阱:
overflow: hidden 解决问题,它会隐藏 bug 并让内容不可访问。white-space: nowrap 套在可能接收翻译文案的容器上。word-break: break-all;长无空格 token 优先用 overflow-wrap: anywhere。含文本的 flex/grid 子项通常要检查 min-width: 0:
.row {
display: flex;
}
.row__content {
min-width: 0;
flex: 1;
}
CSS Grid 中含长内容的列优先使用 minmax(0, 1fr):
.grid {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
}
防止布局抖动:
flex: none 或等价写法。gap。box-sizing: border-box。min-height: 0。按视觉角色对齐,不按偶然的 DOM 顺序对齐:
inline-flex、align-items: center 和稳定 gap。推荐:
.button {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
}
保持字体可读且稳定:
建议起点:
1.45 到 1.7,按密度调整。1.2 到 1.4。面向真实断点设计,不只看一个桌面宽度:
320px、375px、768px、1024px、1280px 和一个宽屏尺寸。max-width: 100%。44px 高/宽,除非项目明确采用高密度规范。svh、dvh 或项目支持的 fallback。移动端:
object-fit。避免脆弱 CSS:
z-index、position: absolute 或负 margin 修溢出。height: 100vh,要考虑移动端视口。overflow: hidden。稳健基础属性:
box-sizing: border-boxmin-width: 0min-height: 0max-width: 100%overflow-wrap: anywheretext-wrap: balance 只用于标题增强,不作为正确性依赖contain、content-visibility 或虚拟列表只在确有性能需求时使用min-w-0。truncate 必须配合受约束宽度。break-words,只有技术 token 可接受时才用 break-all。line-clamp-* 处理摘要。overflow-x-auto,不要让整页横向滚动。shrink-0,文本用 flex-1 min-w-0。常见写法:
<div className="flex min-w-0 items-center gap-2">
<Icon className="size-4 shrink-0" aria-hidden="true" />
<span className="min-w-0 truncate">Very long label</span>
</div>
<div className="grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3">
<p className="min-w-0 break-words">Long readable content</p>
<button className="shrink-0">Action</button>
</div>
Table 列宽、ellipsis、scroll.x、Tooltip、Form.Item help、Select option 渲染、Typography.Text ellipsis。dir、逻辑 CSS 属性或组件库 RTL 能力。完成 UI 修改前扫描:
可行时使用这些字符串验证:
This is a normal sentence that should wrap naturally without breaking the layout.
SuperLongUnbrokenOrganizationNameWithNoSpacesAndManyCharacters1234567890
https://example.com/a/very/long/path/with/query?search=frontend-layout-overflow-and-wrapping
张三李四王五赵六前端页面超长文本混排ABCDEFGHIJKLMN1234567890
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
同时测试:
不要在这些条件满足前标记完成:
min-width: 0 或 min-height: 0。使用本技能完成任务时: