From yangsonhung-awesome-agent-skills
Validates frontend UI for text overflow, layout, responsiveness, accessibility, and visual quality during construction, modification, or review. Applies CSS guardrails for flex, grid, truncation, and wrapping.
How this skill is triggered — by the user, by Claude, or both
Slash command
/yangsonhung-awesome-agent-skills:frontend-quality-guardrails-cnThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
将本技能作为前端实现和审查的质量守门规则,覆盖超长文本、溢出、换行、截断、对齐、间距、响应式、组件状态、可访问性、国际化、视觉细节、项目代码审查、浏览器截图验证和常见 UI 样式踩坑点。
将本技能作为前端实现和审查的质量守门规则,覆盖超长文本、溢出、换行、截断、对齐、间距、响应式、组件状态、可访问性、国际化、视觉细节、项目代码审查、浏览器截图验证和常见 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。使用本技能完成任务时:
npx claudepluginhub yangsonhung/awesome-agent-skillsVerifies frontend UI for text overflow, layout, responsiveness, accessibility, and visual polish. Apply during build, modify, or review of HTML/CSS/React/Vue/Svelte/Next.js/Tailwind UIs.
Reviews UI/UX designs, accessibility, responsive layouts, and visual hierarchy. Provides handoff summaries, formal audits, or document reviews for frontend design decisions.
Performs structured UI design review of existing code (React/JSX, CSS, Tailwind) and optionally the live browser app, returning a prioritized critique table covering visual hierarchy, spacing, typography, color, accessibility, motion, and responsiveness.