ux-designer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

UX Designer - Perfection-Focused UI/UX Skill

UX设计师 - 专注于极致体验的UI/UX技能

Goal: Zero bugs, perfect usability, flawless user experience.
目标:零漏洞、完美易用性、无瑕疵用户体验。

When to Use

启用时机

Invoke this skill when:
  • User mentions: "perfect the demo", "fix UX bugs", "make it flawless"
  • UI has inconsistencies or bugs
  • User experience is confusing or broken
  • Demo has visual issues
  • Interactive elements don't work properly
当出现以下情况时调用此技能:
  • 用户提及:“优化演示”“修复UX漏洞”“实现无瑕疵体验”
  • UI存在不一致性或漏洞
  • 用户体验混乱或失效
  • 演示存在视觉问题
  • 交互元素无法正常工作

UX Perfection Methodology

UX极致优化方法论

Phase 1: Comprehensive UX Audit

第一阶段:全面UX审计

1A. Visual Inspection
bash
undefined
1A. 视觉检查
bash
undefined

Check all HTML files for common issues

Check all HTML files for common issues

find public -name "*.html" -type f
find public -name "*.html" -type f

For each file, check:

For each file, check:

  • Broken links (404s)
  • Missing images
  • JavaScript errors in console
  • CSS rendering issues
  • Responsive design breakpoints
  • Color contrast (accessibility)
  • Typography consistency

**1B. Interaction Testing**
```markdown
Test every interactive element:
- [ ] Buttons: Click response, hover states, disabled states
- [ ] Forms: Validation, error messages, success states
- [ ] Navigation: All links work, breadcrumbs accurate
- [ ] Modals: Open/close, backdrop click, ESC key
- [ ] Dropdowns: Open/close, keyboard navigation
- [ ] Tables: Sorting, filtering, pagination
- [ ] Real-time updates: WebSocket connection, live data
- [ ] Loading states: Spinners, skeletons, placeholders
1C. User Flow Analysis
markdown
Map critical user journeys:
1. New user onboarding → Should be intuitive, max 3 steps
2. Core feature usage → Should be discoverable, max 2 clicks
3. Error recovery → Clear error messages, obvious next steps
4. Success confirmation → Visible feedback, celebratory if appropriate
  • Broken links (404s)
  • Missing images
  • JavaScript errors in console
  • CSS rendering issues
  • Responsive design breakpoints
  • Color contrast (accessibility)
  • Typography consistency

- 失效链接(404错误)
- 缺失图片
- 控制台中的JavaScript错误
- CSS渲染问题
- 响应式设计断点
- 颜色对比度(无障碍性)
- 排版一致性

**1B. 交互测试**
```markdown
Test every interactive element:
- [ ] Buttons: Click response, hover states, disabled states
- [ ] Forms: Validation, error messages, success states
- [ ] Navigation: All links work, breadcrumbs accurate
- [ ] Modals: Open/close, backdrop click, ESC key
- [ ] Dropdowns: Open/close, keyboard navigation
- [ ] Tables: Sorting, filtering, pagination
- [ ] Real-time updates: WebSocket connection, live data
- [ ] Loading states: Spinners, skeletons, placeholders
测试所有交互元素:
  • 按钮:点击响应、悬停状态、禁用状态
  • 表单:验证、错误提示、成功状态
  • 导航:所有链接正常、面包屑导航准确
  • 模态框:打开/关闭、点击背景关闭、ESC键关闭
  • 下拉菜单:打开/关闭、键盘导航
  • 表格:排序、筛选、分页
  • 实时更新:WebSocket连接、实时数据
  • 加载状态:加载动画、骨架屏、占位符
1C. 用户流程分析
markdown
Map critical user journeys:
1. New user onboarding → Should be intuitive, max 3 steps
2. Core feature usage → Should be discoverable, max 2 clicks
3. Error recovery → Clear error messages, obvious next steps
4. Success confirmation → Visible feedback, celebratory if appropriate
梳理关键用户旅程:
  1. 新用户引导 → 需直观易懂,最多3步
  2. 核心功能使用 → 需易于发现,最多2次点击
  3. 错误恢复 → 清晰的错误提示,明确的后续步骤
  4. 成功确认 → 可见的反馈,必要时添加庆祝效果

Phase 2: Research Best Practices

第二阶段:研究最佳实践

Launch codex-deep-research agent:
markdown
Invoke Task tool with subagent_type="codex-deep-research"

Prompt:
"Research the best UX/UI practices for interactive demos and dashboards.

Context:
- Project Conductor is a workflow orchestration platform
- Demo showcases 7-module workflow (Onboarding → Implementation)
- Tech: HTML, CSS, JavaScript (vanilla), Socket.io
- Users: Product managers, engineers, stakeholders

Provide best practices for:
1. **Demo UX Patterns**
   - Interactive tutorials vs guided tours
   - Progress indicators
   - Contextual help
   - Error handling in demos

2. **Dashboard Design**
   - Card layouts
   - Data visualization
   - Real-time updates (WebSocket)
   - Empty states
   - Loading states

3. **Navigation**
   - Module-to-module flow
   - Breadcrumbs
   - Back button behavior
   - Deep linking

4. **Accessibility**
   - Keyboard navigation
   - Screen reader support
   - Focus management
   - ARIA labels

5. **Performance**
   - Perceived performance
   - Lazy loading
   - Animation frame rate
   - Memory leaks

6. **Error Handling**
   - User-friendly error messages
   - Recovery actions
   - Fallback UI
   - Offline behavior

Provide specific code examples and visual patterns."
Check for AI-powered UX tools:
markdown
Invoke Task tool with subagent_type="gemini-research-analyst"

Prompt:
"Research if Google's Gemini AI provides any UX design, usability testing, or UI generation tools.

Investigate:
1. Gemini-powered UX analysis tools
2. Automated accessibility testing
3. UI component generation
4. User flow optimization
5. A/B testing recommendations
6. Heatmap analysis tools

If available, explain how to integrate with HTML/JS demos."
启动codex-deep-research代理:
markdown
Invoke Task tool with subagent_type="codex-deep-research"

Prompt:
"研究交互式演示和仪表板的最佳UX/UI实践。

背景信息:
- Project Conductor是一个工作流编排平台
- 演示展示了7模块工作流(Onboarding → Implementation)
- 技术栈:HTML、CSS、JavaScript(原生)、Socket.io
- 用户群体:产品经理、工程师、利益相关者

请提供以下方面的最佳实践:
1. **演示UX模式**
   - 交互式教程 vs 引导式游览
   - 进度指示器
   - 上下文帮助
   - 演示中的错误处理

2. **仪表板设计**
   - 卡片布局
   - 数据可视化
   - 实时更新(WebSocket)
   - 空状态
   - 加载状态

3. **导航设计**
   - 模块间流转
   - 面包屑导航
   - 返回按钮行为
   - 深度链接

4. **无障碍性**
   - 键盘导航
   - 屏幕阅读器支持
   - 焦点管理
   - ARIA标签

5. **性能优化**
   - 感知性能
   - 懒加载
   - 动画帧率
   - 内存泄漏

6. **错误处理**
   - 用户友好的错误提示
   - 恢复操作
   - 降级UI
   - 离线行为

请提供具体的代码示例和视觉模式。"
调研AI驱动的UX工具:
markdown
Invoke Task tool with subagent_type="gemini-research-analyst"

Prompt:
"调研Google的Gemini AI是否提供UX设计、易用性测试或UI生成工具。

调研方向:
1. Gemini驱动的UX分析工具
2. 自动化无障碍测试
3. UI组件生成
4. 用户流程优化
5. A/B测试建议
6. 热图分析工具

如果有可用工具,请说明如何与HTML/JS演示集成。"

Phase 3: Bug Hunting (Zero Tolerance)

第三阶段:漏洞排查(零容忍)

3A. Console Error Check
javascript
// Check browser console for errors
// Common issues:
- Uncaught ReferenceError (missing variables)
- Uncaught TypeError (null/undefined access)
- Failed to fetch (broken API calls)
- WebSocket connection failed
- CORS errors
- 404 for assets (images, CSS, JS)
3B. Network Tab Analysis
markdown
Check Network tab for:
- [ ] All resources load successfully (no 404s)
- [ ] API endpoints respond <200ms
- [ ] WebSocket connection established
- [ ] No unnecessary requests (optimize)
- [ ] Proper caching headers
- [ ] Compressed assets (gzip)
3C. Responsive Design Testing
bash
undefined
3A. 控制台错误检查
javascript
// Check browser console for errors
// Common issues:
- Uncaught ReferenceError (missing variables)
- Uncaught TypeError (null/undefined access)
- Failed to fetch (broken API calls)
- WebSocket connection failed
- CORS errors
- 404 for assets (images, CSS, JS)
检查浏览器控制台中的错误:
  • 未捕获的ReferenceError(变量缺失)
  • 未捕获的TypeError(访问null/undefined)
  • Fetch失败(API调用失效)
  • WebSocket连接失败
  • CORS错误
  • 资源404错误(图片、CSS、JS)
3B. 网络面板分析
markdown
Check Network tab for:
- [ ] All resources load successfully (no 404s)
- [ ] API endpoints respond <200ms
- [ ] WebSocket connection established
- [ ] No unnecessary requests (optimize)
- [ ] Proper caching headers
- [ ] Compressed assets (gzip)
检查网络面板:
  • 所有资源加载成功(无404错误)
  • API接口响应时间<200ms
  • WebSocket连接已建立
  • 无冗余请求(已优化)
  • 正确的缓存头
  • 压缩后的资源(gzip)
3C. 响应式设计测试
bash
undefined

Test breakpoints

Test breakpoints

  • Mobile: 320px, 375px, 414px
  • Tablet: 768px, 1024px
  • Desktop: 1280px, 1440px, 1920px
  • Mobile: 320px, 375px, 414px
  • Tablet: 768px, 1024px
  • Desktop: 1280px, 1440px, 1920px

Check for:

Check for:

  • Horizontal scroll (should be none)
  • Text overflow
  • Image scaling
  • Button touch targets (min 44x44px)
  • Readable font sizes (min 16px)

**3D. Cross-Browser Testing**
```markdown
Test in:
- [ ] Chrome (latest)
- [ ] Firefox (latest)
- [ ] Safari (latest)
- [ ] Edge (latest)

Check for:
- CSS compatibility (flexbox, grid)
- JavaScript APIs (fetch, WebSocket)
- Event handlers (click, keyboard)
- CSS animations
  • Horizontal scroll (should be none)
  • Text overflow
  • Image scaling
  • Button touch targets (min 44x44px)
  • Readable font sizes (min 16px)

测试断点:
- 移动端:320px、375px、414px
- 平板端:768px、1024px
- 桌面端:1280px、1440px、1920px

检查内容:
- 水平滚动(应完全避免)
- 文本溢出
- 图片缩放
- 按钮触摸目标(最小44x44px)
- 可读字体大小(最小16px)

**3D. 跨浏览器测试**
```markdown
Test in:
- [ ] Chrome (latest)
- [ ] Firefox (latest)
- [ ] Safari (latest)
- [ ] Edge (latest)

Check for:
- CSS compatibility (flexbox, grid)
- JavaScript APIs (fetch, WebSocket)
- Event handlers (click, keyboard)
- CSS animations
在以下浏览器中测试:
  • Chrome(最新版)
  • Firefox(最新版)
  • Safari(最新版)
  • Edge(最新版)
检查内容:
  • CSS兼容性(flexbox、grid)
  • JavaScript API兼容性(fetch、WebSocket)
  • 事件处理器(点击、键盘事件)
  • CSS动画

Phase 4: Usability Improvements

第四阶段:易用性提升

4A. First-Time User Experience
markdown
Checklist:
- [ ] Clear value proposition (what is this?)
- [ ] Obvious starting point (where do I begin?)
- [ ] Contextual help (tooltips, hints)
- [ ] Progress indicators (how far have I gone?)
- [ ] Success feedback (I completed something!)
- [ ] Error prevention (guard rails)
- [ ] Easy recovery (undo, reset)
4B. Visual Hierarchy
css
/* Apply visual hierarchy principles */
- Primary actions: Bold, high contrast, larger
- Secondary actions: Less prominent
- Tertiary actions: Text links, subtle
- Destructive actions: Red, confirmation required
- Disabled states: Greyed out, not clickable

/* Example */
.btn-primary {
  background: #007bff;
  color: white;
  font-weight: 600;
  padding: 12px 24px;
  font-size: 16px;
}

.btn-secondary {
  background: transparent;
  border: 1px solid #6c757d;
  color: #6c757d;
  padding: 10px 20px;
  font-size: 14px;
}
4C. Feedback & Confirmation
javascript
// Every user action needs feedback
function handleAction(action) {
  // 1. Immediate feedback (button state)
  button.disabled = true;
  button.textContent = 'Processing...';

  // 2. Action execution
  await performAction(action);

  // 3. Success feedback
  showToast('✅ Action completed successfully!', 'success');
  button.disabled = false;
  button.textContent = 'Done';

  // 4. Update UI to reflect change
  refreshData();
}

// Toast notification system
function showToast(message, type = 'info', duration = 3000) {
  const toast = document.createElement('div');
  toast.className = `toast toast-${type}`;
  toast.textContent = message;
  document.body.appendChild(toast);

  setTimeout(() => {
    toast.classList.add('fade-out');
    setTimeout(() => toast.remove(), 300);
  }, duration);
}
4D. Error Handling (User-Friendly)
javascript
// Bad: Generic error
catch (error) {
  alert('Error');
}

// Good: Helpful error with action
catch (error) {
  showError({
    title: 'Unable to Load Projects',
    message: 'We couldn\'t connect to the server. Please check your internet connection and try again.',
    actions: [
      { label: 'Retry', onClick: () => retryLoad() },
      { label: 'Go Back', onClick: () => history.back() }
    ],
    icon: '🔌'
  });

  // Log detailed error for debugging
  console.error('Project load failed:', error);
}
4A. 首次用户体验
markdown
Checklist:
- [ ] Clear value proposition (what is this?)
- [ ] Obvious starting point (where do I begin?)
- [ ] Contextual help (tooltips, hints)
- [ ] Progress indicators (how far have I gone?)
- [ ] Success feedback (I completed something!)
- [ ] Error prevention (guard rails)
- [ ] Easy recovery (undo, reset)
检查清单:
  • 清晰的价值主张(这是什么?)
  • 明确的起始入口(从哪里开始?)
  • 上下文帮助(工具提示、提示信息)
  • 进度指示器(我已经完成了多少?)
  • 成功反馈(我完成了操作!)
  • 错误预防(防护机制)
  • 轻松恢复(撤销、重置)
4B. 视觉层级
css
/* Apply visual hierarchy principles */
- Primary actions: Bold, high contrast, larger
- Secondary actions: Less prominent
- Tertiary actions: Text links, subtle
- Destructive actions: Red, confirmation required
- Disabled states: Greyed out, not clickable

/* Example */
.btn-primary {
  background: #007bff;
  color: white;
  font-weight: 600;
  padding: 12px 24px;
  font-size: 16px;
}

.btn-secondary {
  background: transparent;
  border: 1px solid #6c757d;
  color: #6c757d;
  padding: 10px 20px;
  font-size: 14px;
}
应用视觉层级原则:
  • 主要操作:加粗、高对比度、更大尺寸
  • 次要操作:低存在感
  • 三级操作:文本链接、样式柔和
  • 破坏性操作:红色、需确认
  • 禁用状态:灰色、不可点击
4C. 反馈与确认
javascript
// Every user action needs feedback
function handleAction(action) {
  // 1. Immediate feedback (button state)
  button.disabled = true;
  button.textContent = 'Processing...';

  // 2. Action execution
  await performAction(action);

  // 3. Success feedback
  showToast('✅ Action completed successfully!', 'success');
  button.disabled = false;
  button.textContent = 'Done';

  // 4. Update UI to reflect change
  refreshData();
}

// Toast notification system
function showToast(message, type = 'info', duration = 3000) {
  const toast = document.createElement('div');
  toast.className = `toast toast-${type}`;
  toast.textContent = message;
  document.body.appendChild(toast);

  setTimeout(() => {
    toast.classList.add('fade-out');
    setTimeout(() => toast.remove(), 300);
  }, duration);
}
每个用户操作都需要反馈:
javascript
// 每个用户操作都需要反馈
function handleAction(action) {
  // 1. 即时反馈(按钮状态)
  button.disabled = true;
  button.textContent = '处理中...';

  // 2. 执行操作
  await performAction(action);

  // 3. 成功反馈
  showToast('✅ 操作成功完成!', 'success');
  button.disabled = false;
  button.textContent = '完成';

  // 4. 更新UI以反映变化
  refreshData();
}

// 提示通知系统
function showToast(message, type = 'info', duration = 3000) {
  const toast = document.createElement('div');
  toast.className = `toast toast-${type}`;
  toast.textContent = message;
  document.body.appendChild(toast);

  setTimeout(() => {
    toast.classList.add('fade-out');
    setTimeout(() => toast.remove(), 300);
  }, duration);
}
4D. 用户友好的错误处理
javascript
// Bad: Generic error
catch (error) {
  alert('Error');
}

// Good: Helpful error with action
catch (error) {
  showError({
    title: 'Unable to Load Projects',
    message: 'We couldn\'t connect to the server. Please check your internet connection and try again.',
    actions: [
      { label: 'Retry', onClick: () => retryLoad() },
      { label: 'Go Back', onClick: () => history.back() }
    ],
    icon: '🔌'
  });

  // Log detailed error for debugging
  console.error('Project load failed:', error);
}
javascript
// 错误示例:通用错误提示
catch (error) {
  alert('错误');
}

// 正确示例:带操作的有用错误提示
catch (error) {
  showError({
    title: '无法加载项目',
    message: '我们无法连接到服务器,请检查网络连接后重试。',
    actions: [
      { label: '重试', onClick: () => retryLoad() },
      { label: '返回', onClick: () => history.back() }
    ],
    icon: '🔌'
  });

  // 记录详细错误用于调试
  console.error('项目加载失败:', error);
}

Phase 5: Accessibility Perfection

第五阶段:无障碍性优化

5A. Keyboard Navigation
javascript
// Ensure all interactive elements are keyboard accessible
document.querySelectorAll('button, a, input, select, textarea').forEach(el => {
  // Add focus visible styles
  el.addEventListener('focus', (e) => {
    e.target.classList.add('focus-visible');
  });

  // Support Enter/Space on custom buttons
  if (el.getAttribute('role') === 'button') {
    el.addEventListener('keydown', (e) => {
      if (e.key === 'Enter' || e.key === ' ') {
        e.preventDefault();
        el.click();
      }
    });
  }
});

// Trap focus in modals
function trapFocus(modal) {
  const focusableElements = modal.querySelectorAll(
    'a[href], button, textarea, input, select, [tabindex]:not([tabindex="-1"])'
  );
  const firstElement = focusableElements[0];
  const lastElement = focusableElements[focusableElements.length - 1];

  modal.addEventListener('keydown', (e) => {
    if (e.key === 'Tab') {
      if (e.shiftKey && document.activeElement === firstElement) {
        e.preventDefault();
        lastElement.focus();
      } else if (!e.shiftKey && document.activeElement === lastElement) {
        e.preventDefault();
        firstElement.focus();
      }
    } else if (e.key === 'Escape') {
      closeModal();
    }
  });
}
5B. ARIA Labels
html
<!-- Bad: No context for screen readers -->
<button onclick="save()">
  <svg>...</svg>
</button>

<!-- Good: Descriptive label -->
<button onclick="save()" aria-label="Save project changes">
  <svg aria-hidden="true">...</svg>
</button>

<!-- Dynamic content -->
<div role="status" aria-live="polite" aria-atomic="true">
  <span id="status-message">Loading projects...</span>
</div>

<!-- Form validation -->
<input
  type="email"
  id="email"
  aria-describedby="email-error"
  aria-invalid="true"
>
<span id="email-error" role="alert">
  Please enter a valid email address
</span>
5C. Color Contrast Check
javascript
// Ensure WCAG AA compliance (4.5:1 for normal text, 3:1 for large)
// Use tools: Chrome DevTools Lighthouse, axe DevTools

// Example: Check programmatically
function checkContrast(foreground, background) {
  const ratio = getContrastRatio(foreground, background);
  return {
    passAA: ratio >= 4.5,
    passAAA: ratio >= 7,
    ratio: ratio.toFixed(2)
  };
}

// Fix: Increase contrast
/* Before */
.text-muted { color: #999; } /* 2.8:1 - FAILS */

/* After */
.text-muted { color: #6c757d; } /* 4.5:1 - PASSES */
5A. 键盘导航
javascript
// Ensure all interactive elements are keyboard accessible
document.querySelectorAll('button, a, input, select, textarea').forEach(el => {
  // Add focus visible styles
  el.addEventListener('focus', (e) => {
    e.target.classList.add('focus-visible');
  });

  // Support Enter/Space on custom buttons
  if (el.getAttribute('role') === 'button') {
    el.addEventListener('keydown', (e) => {
      if (e.key === 'Enter' || e.key === ' ') {
        e.preventDefault();
        el.click();
      }
    });
  }
});

// Trap focus in modals
function trapFocus(modal) {
  const focusableElements = modal.querySelectorAll(
    'a[href], button, textarea, input, select, [tabindex]:not([tabindex="-1"])'
  );
  const firstElement = focusableElements[0];
  const lastElement = focusableElements[focusableElements.length - 1];

  modal.addEventListener('keydown', (e) => {
    if (e.key === 'Tab') {
      if (e.shiftKey && document.activeElement === firstElement) {
        e.preventDefault();
        lastElement.focus();
      } else if (!e.shiftKey && document.activeElement === lastElement) {
        e.preventDefault();
        firstElement.focus();
      }
    } else if (e.key === 'Escape') {
      closeModal();
    }
  });
}
确保所有交互元素支持键盘导航:
javascript
// 确保所有交互元素支持键盘导航
document.querySelectorAll('button, a, input, select, textarea').forEach(el => {
  // 添加焦点可见样式
  el.addEventListener('focus', (e) => {
    e.target.classList.add('focus-visible');
  });

  // 自定义按钮支持Enter/Space键
  if (el.getAttribute('role') === 'button') {
    el.addEventListener('keydown', (e) => {
      if (e.key === 'Enter' || e.key === ' ') {
        e.preventDefault();
        el.click();
      }
    });
  }
});

// 模态框焦点锁定
function trapFocus(modal) {
  const focusableElements = modal.querySelectorAll(
    'a[href], button, textarea, input, select, [tabindex]:not([tabindex="-1"])'
  );
  const firstElement = focusableElements[0];
  const lastElement = focusableElements[focusableElements.length - 1];

  modal.addEventListener('keydown', (e) => {
    if (e.key === 'Tab') {
      if (e.shiftKey && document.activeElement === firstElement) {
        e.preventDefault();
        lastElement.focus();
      } else if (!e.shiftKey && document.activeElement === lastElement) {
        e.preventDefault();
        firstElement.focus();
      }
    } else if (e.key === 'Escape') {
      closeModal();
    }
  });
}
5B. ARIA标签
html
<!-- Bad: No context for screen readers -->
<button onclick="save()">
  <svg>...</svg>
</button>

<!-- Good: Descriptive label -->
<button onclick="save()" aria-label="Save project changes">
  <svg aria-hidden="true">...</svg>
</button>

<!-- Dynamic content -->
<div role="status" aria-live="polite" aria-atomic="true">
  <span id="status-message">Loading projects...</span>
</div>

<!-- Form validation -->
<input
  type="email"
  id="email"
  aria-describedby="email-error"
  aria-invalid="true"
>
<span id="email-error" role="alert">
  Please enter a valid email address
</span>
html
<!-- 错误示例:屏幕阅读器无上下文 -->
<button onclick="save()">
  <svg>...</svg>
</button>

<!-- 正确示例:带描述性标签 -->
<button onclick="save()" aria-label="保存项目更改">
  <svg aria-hidden="true">...</svg>
</button>

<!-- 动态内容 -->
<div role="status" aria-live="polite" aria-atomic="true">
  <span id="status-message">加载项目中...</span>
</div>

<!-- 表单验证 -->
<input
  type="email"
  id="email"
  aria-describedby="email-error"
  aria-invalid="true"
>
<span id="email-error" role="alert">
  请输入有效的邮箱地址
</span>
5C. 颜色对比度检查
javascript
// Ensure WCAG AA compliance (4.5:1 for normal text, 3:1 for large)
// Use tools: Chrome DevTools Lighthouse, axe DevTools

// Example: Check programmatically
function checkContrast(foreground, background) {
  const ratio = getContrastRatio(foreground, background);
  return {
    passAA: ratio >= 4.5,
    passAAA: ratio >= 7,
    ratio: ratio.toFixed(2)
  };
}

// Fix: Increase contrast
/* Before */
.text-muted { color: #999; } /* 2.8:1 - FAILS */

/* After */
.text-muted { color: #6c757d; } /* 4.5:1 - PASSES */
确保符合WCAG AA标准(普通文本对比度4.5:1,大文本3:1): 使用工具:Chrome DevTools Lighthouse、axe DevTools
示例:程序化检查
javascript
// 确保符合WCAG AA标准(普通文本对比度4.5:1,大文本3:1)
// 使用工具:Chrome DevTools Lighthouse、axe DevTools

// 示例:程序化检查
function checkContrast(foreground, background) {
  const ratio = getContrastRatio(foreground, background);
  return {
    passAA: ratio >= 4.5,
    passAAA: ratio >= 7,
    ratio: ratio.toFixed(2)
  };
}

// 修复方案:提升对比度
/* 修复前 */
.text-muted { color: #999; } /* 2.8:1 - 不通过 */

/* 修复后 */
.text-muted { color: #6c757d; } /* 4.5:1 - 通过 */

Phase 6: Performance Optimization

第六阶段:性能优化

6A. Perceived Performance
javascript
// Instant feedback, lazy load heavy content
async function loadDashboard() {
  // 1. Show skeleton immediately (0ms)
  showSkeleton();

  // 2. Load critical data first (100ms)
  const criticalData = await fetchCritical();
  renderCritical(criticalData);
  hideSkeleton();

  // 3. Load secondary data (background)
  fetchSecondary().then(renderSecondary);

  // 4. Prefetch likely next page
  prefetchNextPage();
}

// Skeleton UI
function showSkeleton() {
  const skeleton = `
    <div class="skeleton-card">
      <div class="skeleton-line skeleton-title"></div>
      <div class="skeleton-line"></div>
      <div class="skeleton-line"></div>
    </div>
  `;
  container.innerHTML = skeleton.repeat(6);
}
6B. Animation Performance
css
/* Bad: Causes layout thrashing */
.animate-bad {
  animation: slide-in 0.3s ease;
}
@keyframes slide-in {
  from { margin-left: -100px; }
  to { margin-left: 0; }
}

/* Good: GPU-accelerated */
.animate-good {
  animation: slide-in 0.3s ease;
}
@keyframes slide-in {
  from { transform: translateX(-100px); }
  to { transform: translateX(0); }
}

/* Use will-change for complex animations */
.will-animate {
  will-change: transform, opacity;
}
6C. Memory Leak Prevention
javascript
// Bad: Event listeners not cleaned up
socket.on('update', handleUpdate);

// Good: Clean up on unmount
const listeners = [];

function addListener(event, handler) {
  socket.on(event, handler);
  listeners.push({ event, handler });
}

function cleanup() {
  listeners.forEach(({ event, handler }) => {
    socket.off(event, handler);
  });
  listeners.length = 0;
}

// Call cleanup when leaving page
window.addEventListener('beforeunload', cleanup);
6A. 感知性能
javascript
// Instant feedback, lazy load heavy content
async function loadDashboard() {
  // 1. Show skeleton immediately (0ms)
  showSkeleton();

  // 2. Load critical data first (100ms)
  const criticalData = await fetchCritical();
  renderCritical(criticalData);
  hideSkeleton();

  // 3. Load secondary data (background)
  fetchSecondary().then(renderSecondary);

  // 4. Prefetch likely next page
  prefetchNextPage();
}

// Skeleton UI
function showSkeleton() {
  const skeleton = `
    <div class="skeleton-card">
      <div class="skeleton-line skeleton-title"></div>
      <div class="skeleton-line"></div>
      <div class="skeleton-line"></div>
    </div>
  `;
  container.innerHTML = skeleton.repeat(6);
}
即时反馈,懒加载重型内容:
javascript
// 即时反馈,懒加载重型内容
async function loadDashboard() {
  // 1. 立即显示骨架屏(0ms)
  showSkeleton();

  // 2. 优先加载关键数据(100ms)
  const criticalData = await fetchCritical();
  renderCritical(criticalData);
  hideSkeleton();

  // 3. 后台加载次要数据
  fetchSecondary().then(renderSecondary);

  // 4. 预加载可能访问的下一页
  prefetchNextPage();
}

// 骨架屏UI
function showSkeleton() {
  const skeleton = `
    <div class="skeleton-card">
      <div class="skeleton-line skeleton-title"></div>
      <div class="skeleton-line"></div>
      <div class="skeleton-line"></div>
    </div>
  `;
  container.innerHTML = skeleton.repeat(6);
}
6B. 动画性能
css
/* Bad: Causes layout thrashing */
.animate-bad {
  animation: slide-in 0.3s ease;
}
@keyframes slide-in {
  from { margin-left: -100px; }
  to { margin-left: 0; }
}

/* Good: GPU-accelerated */
.animate-good {
  animation: slide-in 0.3s ease;
}
@keyframes slide-in {
  from { transform: translateX(-100px); }
  to { transform: translateX(0); }
}

/* Use will-change for complex animations */
.will-animate {
  will-change: transform, opacity;
}
css
/* 错误示例:导致布局抖动 */
.animate-bad {
  animation: slide-in 0.3s ease;
}
@keyframes slide-in {
  from { margin-left: -100px; }
  to { margin-left: 0; }
}

/* 正确示例:GPU加速 */
.animate-good {
  animation: slide-in 0.3s ease;
}
@keyframes slide-in {
  from { transform: translateX(-100px); }
  to { transform: translateX(0); }
}

/* 复杂动画使用will-change */
.will-animate {
  will-change: transform, opacity;
}
6C. 内存泄漏预防
javascript
// Bad: Event listeners not cleaned up
socket.on('update', handleUpdate);

// Good: Clean up on unmount
const listeners = [];

function addListener(event, handler) {
  socket.on(event, handler);
  listeners.push({ event, handler });
}

function cleanup() {
  listeners.forEach(({ event, handler }) => {
    socket.off(event, handler);
  });
  listeners.length = 0;
}

// Call cleanup when leaving page
window.addEventListener('beforeunload', cleanup);
javascript
// 错误示例:未清理事件监听器
socket.on('update', handleUpdate);

// 正确示例:卸载时清理
const listeners = [];

function addListener(event, handler) {
  socket.on(event, handler);
  listeners.push({ event, handler });
}

function cleanup() {
  listeners.forEach(({ event, handler }) => {
    socket.off(event, handler);
  });
  listeners.length = 0;
}

// 离开页面时调用清理
window.addEventListener('beforeunload', cleanup);

Phase 7: Final Polish

第七阶段:最终打磨

7A. Micro-interactions
css
/* Smooth button interactions */
button {
  transition: all 0.2s ease;
  transform: scale(1);
}

button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

button:active {
  transform: scale(0.98);
}

/* Loading spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  animation: spin 1s linear infinite;
}
7B. Empty States
html
<!-- Instead of blank screen -->
<div class="empty-state">
  <svg class="empty-icon"><!-- Icon --></svg>
  <h3>No projects yet</h3>
  <p>Create your first project to get started</p>
  <button class="btn-primary">Create Project</button>
</div>
7C. Consistency Check
markdown
Ensure consistency across:
- [ ] Button styles (primary, secondary, danger)
- [ ] Spacing (use 8px grid: 8, 16, 24, 32, 48, 64)
- [ ] Typography (max 3 font sizes, consistent weights)
- [ ] Colors (stick to design system palette)
- [ ] Icons (same style, size, stroke width)
- [ ] Shadows (consistent elevation levels)
- [ ] Border radius (consistent rounding)
- [ ] Animations (consistent timing, easing)
7A. 微交互
css
/* Smooth button interactions */
button {
  transition: all 0.2s ease;
  transform: scale(1);
}

button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

button:active {
  transform: scale(0.98);
}

/* Loading spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  animation: spin 1s linear infinite;
}
流畅的按钮交互:
css
/* 流畅的按钮交互 */
button {
  transition: all 0.2s ease;
  transform: scale(1);
}

button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

button:active {
  transform: scale(0.98);
}

/* 加载动画 */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  animation: spin 1s linear infinite;
}
7B. 空状态
html
<!-- Instead of blank screen -->
<div class="empty-state">
  <svg class="empty-icon"><!-- Icon --></svg>
  <h3>No projects yet</h3>
  <p>Create your first project to get started</p>
  <button class="btn-primary">Create Project</button>
</div>
html
<!-- 替代空白屏幕 -->
<div class="empty-state">
  <svg class="empty-icon"><!-- 图标 --></svg>
  <h3>暂无项目</h3>
  <p>创建你的第一个项目开始使用</p>
  <button class="btn-primary">创建项目</button>
</div>
7C. 一致性检查
markdown
Ensure consistency across:
- [ ] Button styles (primary, secondary, danger)
- [ ] Spacing (use 8px grid: 8, 16, 24, 32, 48, 64)
- [ ] Typography (max 3 font sizes, consistent weights)
- [ ] Colors (stick to design system palette)
- [ ] Icons (same style, size, stroke width)
- [ ] Shadows (consistent elevation levels)
- [ ] Border radius (consistent rounding)
- [ ] Animations (consistent timing, easing)
确保以下内容的一致性:
  • 按钮样式(主要、次要、危险)
  • 间距(使用8px网格:8、16、24、32、48、64)
  • 排版(最多3种字体大小,字重一致)
  • 颜色(遵循设计系统调色板)
  • 图标(样式、尺寸、描边宽度一致)
  • 阴影(层级一致)
  • 圆角(圆角大小一致)
  • 动画(时长、缓动函数一致)

Validation Checklist

验证清单

Before marking UX as "perfect":
在标记UX为“完美”之前:

Functionality

功能

  • All buttons work (no broken onClick handlers)
  • All links go to correct destinations
  • Forms validate properly
  • API calls succeed
  • WebSocket connects and receives updates
  • Error states display correctly
  • Success states display correctly
  • Loading states show during async operations
  • 所有按钮正常工作(无失效的onClick处理器)
  • 所有链接指向正确目标
  • 表单验证正常
  • API调用成功
  • WebSocket连接并接收更新
  • 错误状态正确显示
  • 成功状态正确显示
  • 异步操作时显示加载状态

Visual

视觉

  • No layout shift (CLS score <0.1)
  • No horizontal scroll
  • Consistent spacing
  • Consistent typography
  • High color contrast (WCAG AA)
  • Icons are clear and consistent
  • Images load correctly
  • No visual bugs (overlapping, cutoff text)
  • 无布局偏移(CLS分数<0.1)
  • 无水平滚动
  • 间距一致
  • 排版一致
  • 高颜色对比度(WCAG AA)
  • 图标清晰一致
  • 图片加载正常
  • 无视觉漏洞(重叠、文本截断)

Usability

易用性

  • Clear navigation
  • Obvious primary actions
  • Helpful error messages
  • Success confirmation
  • Undo/cancel available
  • Keyboard accessible
  • Screen reader compatible
  • Mobile responsive (320px - 1920px)
  • 导航清晰
  • 主要操作明确
  • 错误提示有用
  • 成功确认可见
  • 支持撤销/取消
  • 键盘可访问
  • 屏幕阅读器兼容
  • 移动端响应式(320px - 1920px)

Performance

性能

  • Page load <2s
  • API calls <200ms
  • Smooth animations (60fps)
  • No memory leaks
  • Efficient rendering (no jank)
  • 页面加载<2s
  • API调用<200ms
  • 动画流畅(60fps)
  • 无内存泄漏
  • 渲染高效(无卡顿)

Browser Compatibility

浏览器兼容性

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)
  • Chrome(最新版)
  • Firefox(最新版)
  • Safari(最新版)
  • Edge(最新版)

Demo-Specific Checks

演示专属检查

For Project Conductor demo:
针对Project Conductor演示:

Module Navigation

模块导航

bash
undefined
bash
undefined

Test all module transitions

Test all module transitions

Module 0 (Onboarding) → Module 1 (Dashboard) Module 1 (Dashboard) → Module 2 (BRD) Module 2 (BRD) → Module 3 (PRD) Module 3 (PRD) → Module 4 (Engineering Design) Module 4 (Engineering Design) → Module 5 (Conflicts) Module 5 (Conflicts) → Module 6 (Implementation) Module 6 (Implementation) → Module 1 (Dashboard)
Module 0 (Onboarding) → Module 1 (Dashboard) Module 1 (Dashboard) → Module 2 (BRD) Module 2 (BRD) → Module 3 (PRD) Module 3 (PRD) → Module 4 (Engineering Design) Module 4 (Engineering Design) → Module 5 (Conflicts) Module 5 (Conflicts) → Module 6 (Implementation) Module 6 (Implementation) → Module 1 (Dashboard)

Check:

Check:

  • All links work
  • Navigation breadcrumbs update
  • Back button works
  • State persists (if applicable)
undefined
  • All links work
  • Navigation breadcrumbs update
  • Back button works
  • State persists (if applicable)

测试所有模块流转:
模块0(引导)→ 模块1(仪表板)
模块1(仪表板)→ 模块2(BRD)
模块2(BRD)→ 模块3(PRD)
模块3(PRD)→ 模块4(工程设计)
模块4(工程设计)→ 模块5(冲突处理)
模块5(冲突处理)→ 模块6(实施)
模块6(实施)→ 模块1(仪表板)

检查内容:
- [ ] 所有链接正常
- [ ] 面包屑导航更新
- [ ] 返回按钮正常
- [ ] 状态持久化(如适用)

Real-Time Features

实时功能

javascript
// Test WebSocket functionality
- [ ] Connection establishes on page load
- [ ] Live updates appear without refresh
- [ ] Multiple tabs stay in sync
- [ ] Reconnects after disconnect
- [ ] Shows offline indicator if disconnected
- [ ] No duplicate updates
javascript
// Test WebSocket functionality
- [ ] Connection establishes on page load
- [ ] Live updates appear without refresh
- [ ] Multiple tabs stay in sync
- [ ] Reconnects after disconnect
- [ ] Shows offline indicator if disconnected
- [ ] No duplicate updates
测试WebSocket功能:
  • 页面加载时建立连接
  • 无需刷新即可显示实时更新
  • 多标签页保持同步
  • 断开后自动重连
  • 断开时显示离线指示器
  • 无重复更新

Data Display

数据展示

markdown
- [ ] Projects list loads correctly
- [ ] Requirements display properly
- [ ] Status badges show correct colors
- [ ] Progress bars update in real-time
- [ ] Filters work correctly
- [ ] Sorting works correctly
- [ ] Pagination works correctly
- [ ] Search works correctly
markdown
- [ ] Projects list loads correctly
- [ ] Requirements display properly
- [ ] Status badges show correct colors
- [ ] Progress bars update in real-time
- [ ] Filters work correctly
- [ ] Sorting works correctly
- [ ] Pagination works correctly
- [ ] Search works correctly
  • 项目列表加载正常
  • 需求显示正常
  • 状态标签颜色正确
  • 进度条实时更新
  • 筛选功能正常
  • 排序功能正常
  • 分页功能正常
  • 搜索功能正常

Output Format

输出格式

After UX audit, provide:
markdown
undefined
UX审计完成后,提供:
markdown
undefined

UX Audit Report

UX审计报告

Status: [PERFECT ✅ / NEEDS FIXES ⚠️ / CRITICAL ISSUES ❌]
状态: [完美 ✅ / 需要修复 ⚠️ / 严重问题 ❌]

Issues Found

发现的问题

Critical (Must Fix) 🔴

严重(必须修复)🔴

  1. [Issue description]
    • Impact: [How this affects users]
    • Fix: [Specific code changes needed]
    • File: [path/to/file.html]
    • Line: [line number]
  1. [问题描述]
    • 影响:[对用户的影响]
    • 修复方案:[具体代码修改]
    • 文件:[path/to/file.html]
    • 行号:[行号]

Important (Should Fix) 🟡

重要(应该修复)🟡

  1. [Issue description]
    • Impact: [How this affects users]
    • Fix: [Specific code changes needed]
  1. [问题描述]
    • 影响:[对用户的影响]
    • 修复方案:[具体代码修改]

Nice to Have (Polish) 🟢

优化建议(打磨)🟢

  1. [Issue description]
    • Enhancement: [How this improves UX]
    • Suggestion: [Code example]
  1. [问题描述]
    • 提升点:[对UX的提升]
    • 建议:[代码示例]

UX Score

UX评分

  • Functionality: [X/10]
  • Visual Design: [X/10]
  • Usability: [X/10]
  • Accessibility: [X/10]
  • Performance: [X/10]
Overall: [X/50] - [Grade: A+ to F]
  • 功能:[X/10]
  • 视觉设计:[X/10]
  • 易用性:[X/10]
  • 无障碍性:[X/10]
  • 性能:[X/10]
总分: [X/50] - [等级: A+ 至 F]

Next Steps

后续步骤

  1. Fix critical issues first
  2. Implement important fixes
  3. Add polish enhancements
  4. Re-test all flows
  5. Final validation
  1. 优先修复严重问题
  2. 实施重要修复
  3. 添加优化建议
  4. 重新测试所有流程
  5. 最终验证

Code Fixes

代码修复

[Provide specific code changes with file paths and line numbers]
undefined
[提供具体代码修改,包含文件路径和行号]
undefined

Example Usage

使用示例

User: "Make sure the demo is perfect"
This skill will:
  1. Audit all demo HTML files
  2. Test every interactive element
  3. Research best UX practices
  4. Find and document all bugs
  5. Provide specific fixes with code
  6. Validate accessibility
  7. Check performance
  8. Test across browsers
  9. Generate comprehensive report
  10. Implement fixes if requested
用户:“确保演示完美无缺”
此技能将:
  1. 审计所有演示HTML文件
  2. 测试所有交互元素
  3. 研究最佳UX实践
  4. 发现并记录所有漏洞
  5. 提供带代码的具体修复方案
  6. 验证无障碍性
  7. 检查性能
  8. 跨浏览器测试
  9. 生成全面报告
  10. 如请求则实施修复