ui-testing by alinaqi/claude-bootstrap
npx skills add https://github.com/alinaqi/claude-bootstrap --skill ui-testing加载方式:ui-web.md 或 ui-mobile.md
快速验证生成的 UI 是否符合无障碍标准。在创建任何新的 UI 组件后运行这些检查。
## 可见性检查
- [ ] 所有按钮都有可见的背景或边框
- [ ] 没有文字颜色与其背景色相同
- [ ] 所有文字都满足 4.5:1 的对比度比率
- [ ] 幽灵/文字按钮有可见的边框
## 触摸/点击目标
- [ ] 所有按钮的最小高度为 44px
- [ ] 图标按钮的最小尺寸为 44x44px
- [ ] 可点击元素之间有足够的间距
## 状态
- [ ] 悬停状态可见(网页端)
- [ ] 按下状态可见(移动端)
- [ ] 键盘导航时有焦点环
- [ ] 禁用状态在视觉上可区分(不透明度 0.5)
- [ ] 加载状态显示指示器
## 深色模式(如适用)
- [ ] 深色背景上的文字可读
- [ ] 深色模式下边框可见
- [ ] 深色背景上没有使用 gray-400 文字
## 响应式(网页端)
- [ ] 在移动端(320px)没有水平滚动
- [ ] 在所有断点下内容都可读
- [ ] 移动端触摸目标大小合适
1. 右键点击元素 → 检查
2. 在样式面板中,点击颜色值
3. 查看对比度比率显示
4. 必须显示 ✓ 以表示符合 AA 标准(文字为 4.5:1)
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
浅色模式(白色背景上):
✓ text-gray-900 (#111827) = 16:1
✓ text-gray-800 (#1F2937) = 12:1
✓ text-gray-700 (#374151) = 9:1
✓ text-gray-600 (#4B5563) = 6:1
✗ text-gray-500 (#6B7280) = 4.6:1 (勉强)
✗ text-gray-400 (#9CA3AF) = 2.6:1 (失败)
深色模式(gray-900 背景上):
✓ text-white (#FFFFFF) = 16:1
✓ text-gray-100 (#F3F4F6) = 13:1
✓ text-gray-200 (#E5E7EB) = 11:1
✓ text-gray-300 (#D1D5DB) = 8:1
✗ text-gray-400 (#9CA3AF) = 5:1 (勉强)
✗ text-gray-500 (#6B7280) = 3:1 (失败)
// 问题:没有可见边界
<button className="text-gray-500">Click</button>
// 修复:添加背景或边框
<button className="bg-gray-100 text-gray-900 px-4 py-3 rounded-lg">
Click
</button>
// 或
<button className="border border-gray-300 text-gray-700 px-4 py-3 rounded-lg">
Click
</button>
// 问题:浅灰色在白色上
<p className="text-gray-400">Secondary text</p>
// 修复:使用更深的灰色
<p className="text-gray-600">Secondary text</p>
// 问题:焦点被移除且没有替代方案
<button className="outline-none">Submit</button>
// 修复:添加可见的焦点环
<button className="outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2">
Submit
</button>
// 问题:对于手指来说太小
<button className="p-1 text-sm">×</button>
// 修复:最小 44px
<button className="w-11 h-11 flex items-center justify-center">×</button>
// 问题:两种模式下使用相同的颜色
<p className="text-gray-400">Text</p>
// 修复:为深色模式调整
<p className="text-gray-600 dark:text-gray-300">Text</p>
npm install -D eslint-plugin-jsx-a11y
// .eslintrc
{
"extends": ["plugin:jsx-a11y/recommended"]
}
// e2e/accessibility.spec.ts
import { test, expect } from '@playwright/test';
import AxeBuilder from '@axe-core/playwright';
test('no accessibility violations', async ({ page }) => {
await page.goto('/');
const results = await new AxeBuilder({ page }).analyze();
expect(results.violations).toEqual([]);
});
在以下情况下添加全面的视觉测试(Playwright 截图、Storybook):
对于个人项目或最小可行产品,上述检查清单已足够。
每周安装数
86
代码仓库
GitHub 星标数
529
首次出现
2026年1月20日
安全审计
安装于
opencode69
claude-code68
gemini-cli63
codex62
cursor55
antigravity52
Load with: ui-web.md or ui-mobile.md
Quick verification that generated UI meets accessibility standards. Run these checks after creating any new UI components.
## Visibility Check
- [ ] All buttons have visible background OR border
- [ ] No text is same color as its background
- [ ] All text meets 4.5:1 contrast ratio
- [ ] Ghost/text buttons have visible borders
## Touch/Click Targets
- [ ] All buttons are minimum 44px height
- [ ] Icon buttons are minimum 44x44px
- [ ] Adequate spacing between clickable elements
## States
- [ ] Hover states visible (web)
- [ ] Pressed states visible (mobile)
- [ ] Focus rings on keyboard navigation
- [ ] Disabled states visually distinct (opacity 0.5)
- [ ] Loading states show indicators
## Dark Mode (if applicable)
- [ ] Text readable on dark backgrounds
- [ ] Borders visible in dark mode
- [ ] No gray-400 text on dark backgrounds
## Responsive (web)
- [ ] No horizontal scroll on mobile (320px)
- [ ] Content readable at all breakpoints
- [ ] Touch targets adequate on mobile
1. Right-click element → Inspect
2. In Styles panel, click on color value
3. Look for contrast ratio display
4. Must show ✓ for AA compliance (4.5:1 for text)
LIGHT MODE (on white bg):
✓ text-gray-900 (#111827) = 16:1
✓ text-gray-800 (#1F2937) = 12:1
✓ text-gray-700 (#374151) = 9:1
✓ text-gray-600 (#4B5563) = 6:1
✗ text-gray-500 (#6B7280) = 4.6:1 (barely)
✗ text-gray-400 (#9CA3AF) = 2.6:1 (FAILS)
DARK MODE (on gray-900 bg):
✓ text-white (#FFFFFF) = 16:1
✓ text-gray-100 (#F3F4F6) = 13:1
✓ text-gray-200 (#E5E7EB) = 11:1
✓ text-gray-300 (#D1D5DB) = 8:1
✗ text-gray-400 (#9CA3AF) = 5:1 (barely)
✗ text-gray-500 (#6B7280) = 3:1 (FAILS)
// PROBLEM: No visible boundary
<button className="text-gray-500">Click</button>
// FIX: Add background OR border
<button className="bg-gray-100 text-gray-900 px-4 py-3 rounded-lg">
Click
</button>
// OR
<button className="border border-gray-300 text-gray-700 px-4 py-3 rounded-lg">
Click
</button>
// PROBLEM: Light gray on white
<p className="text-gray-400">Secondary text</p>
// FIX: Use darker gray
<p className="text-gray-600">Secondary text</p>
// PROBLEM: Focus removed without replacement
<button className="outline-none">Submit</button>
// FIX: Add visible focus ring
<button className="outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2">
Submit
</button>
// PROBLEM: Too small for fingers
<button className="p-1 text-sm">×</button>
// FIX: Minimum 44px
<button className="w-11 h-11 flex items-center justify-center">×</button>
// PROBLEM: Same colors in both modes
<p className="text-gray-400">Text</p>
// FIX: Adjust for dark mode
<p className="text-gray-600 dark:text-gray-300">Text</p>
npm install -D eslint-plugin-jsx-a11y
// .eslintrc
{
"extends": ["plugin:jsx-a11y/recommended"]
}
// e2e/accessibility.spec.ts
import { test, expect } from '@playwright/test';
import AxeBuilder from '@axe-core/playwright';
test('no accessibility violations', async ({ page }) => {
await page.goto('/');
const results = await new AxeBuilder({ page }).analyze();
expect(results.violations).toEqual([]);
});
Add comprehensive visual testing (Playwright screenshots, Storybook) when:
For solo projects or MVPs, the checklist above is sufficient.
Weekly Installs
86
Repository
GitHub Stars
529
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode69
claude-code68
gemini-cli63
codex62
cursor55
antigravity52
代码审查最佳实践指南:完整流程、安全与性能审查清单
12,400 周安装
Slack GIF制作工具包:创建符合Slack要求的动画GIF,支持消息和表情符号
1,100 周安装
Claude技能创建与分享工具 - 自动化技能开发、团队协作与Slack集成
1,100 周安装
LangSmith Fetch 代理调试技能 - 快速调试 LangChain/LangGraph 代理执行轨迹
1,100 周安装
内部沟通AI技能:自动生成3P更新、公司通讯、FAQ回复等内部沟通内容
1,100 周安装
Anthropic品牌风格指南技能 - 获取官方品牌标识、颜色、字体和视觉设计规范
1,200 周安装
Base44 JavaScript SDK 使用指南 - 在 Base44 平台构建应用程序
1,100 周安装