web-design-guidelines

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Web Interface Guidelines

Web界面指南

Review and fix UI for compliance with Web Interface Guidelines through static code analysis and visual browser inspection.
通过静态代码分析和浏览器视觉检查,审查并修复UI以符合Web界面指南要求。

Scope of Application

适用范围

  • Static sites (HTML/CSS/JS)
  • SPA frameworks: React / Vue / Angular / Svelte
  • Full-stack frameworks: Next.js / Nuxt / SvelteKit
  • Any web application with accessible source code
  • 静态站点(HTML/CSS/JS)
  • SPA框架:React / Vue / Angular / Svelte
  • 全栈框架:Next.js / Nuxt / SvelteKit
  • 所有可获取源代码的Web应用

Workflow Overview

工作流概览

Step 1: Information Gathering
Step 2: Guidelines Fetch + Static Analysis
Step 3: Visual Inspection (if URL provided)
Step 4: Issue Fixing
Step 5: Re-verification
(Loop if issues remain)

Step 1: Information Gathering
Step 2: Guidelines Fetch + Static Analysis
Step 3: Visual Inspection (if URL provided)
Step 4: Issue Fixing
Step 5: Re-verification
(Loop if issues remain)

Step 1: Information Gathering

步骤1:信息收集

1.1 Determine Review Mode

1.1 确定审查模式

InputModeActions
File/pattern onlyStatic AnalysisCode review against guidelines
URL onlyVisual InspectionBrowser-based visual review
URL + filesFull ReviewBoth static and visual analysis
输入模式操作
仅提供文件/匹配规则静态分析依据指南开展代码审查
仅提供URL视觉检查基于浏览器的视觉审查
URL+文件全量审查同时开展静态和视觉分析

1.2 URL Confirmation (Visual Mode)

1.2 URL确认(视觉模式)

If visual inspection requested but no URL provided, ask:
Please provide the URL of the website to review (e.g.,
http://localhost:3000
)
如果用户请求视觉检查但未提供URL,询问:
请提供需要审查的网站URL(例如:
http://localhost:3000

1.3 Project Detection

1.3 项目检测

Attempt automatic detection from workspace files:
FileDetection
package.json
Framework and dependencies
tailwind.config.*
Tailwind CSS
next.config.*
Next.js
nuxt.config.*
Nuxt
vite.config.*
Vite
尝试从工作区文件自动检测:
文件检测结果
package.json
框架和依赖
tailwind.config.*
Tailwind CSS
next.config.*
Next.js
nuxt.config.*
Nuxt
vite.config.*
Vite

1.4 Styling Method Identification

1.4 样式方案识别

MethodDetectionEdit Target
Pure CSS
*.css
files
Global or component CSS
SCSS/Sass
*.scss
,
*.sass
SCSS files
CSS Modules
*.module.css
Module CSS files
Tailwind CSS
tailwind.config.*
className in components
styled-components
styled.
in code
JS/TS files
CSS-in-JSInline stylesJS/TS files

方案检测依据编辑目标
纯CSS
*.css
文件
全局或组件CSS
SCSS/Sass
*.scss
*.sass
文件
SCSS文件
CSS Modules
*.module.css
文件
模块CSS文件
Tailwind CSS存在
tailwind.config.*
组件内的className
styled-components代码中包含
styled.
JS/TS文件
CSS-in-JS内联样式JS/TS文件

Step 2: Guidelines Fetch + Static Analysis

步骤2:拉取指南+静态分析

2.1 Fetch Latest Guidelines

2.1 拉取最新指南

Fetch fresh guidelines before each review:
https://raw.githubusercontent.com/vercel-labs/web-interface-guidelines/main/command.md
Use WebFetch to retrieve the latest rules. The fetched content contains all the rules and output format instructions.
每次审查前拉取最新指南:
https://raw.githubusercontent.com/vercel-labs/web-interface-guidelines/main/command.md
使用WebFetch获取最新规则,拉取的内容包含所有规则和输出格式说明。

2.2 Static Code Analysis

2.2 静态代码分析

  1. Read the specified files (or prompt user for files/pattern)
  2. Check against all rules in the fetched guidelines
  3. Collect findings with
    file:line
    references

  1. 读取指定文件(或提示用户提供文件/匹配规则)
  2. 对照拉取的指南中的所有规则进行检查
  3. 收集问题并标注
    文件:行号
    引用

Step 3: Visual Inspection (Browser Mode)

步骤3:视觉检查(浏览器模式)

3.1 Prerequisites

3.1 前置条件

  • Target website must be running (local dev server or remote)
  • Browser automation available (Playwright MCP or cursor-browser-extension)
  • 目标网站必须处于运行状态(本地开发服务器或远程服务)
  • 浏览器自动化工具可用(Playwright MCP或cursor-browser-extension)

3.2 Page Inspection

3.2 页面检查

  1. Navigate to the specified URL
  2. Capture screenshots
  3. Retrieve DOM structure/snapshot
  4. If additional pages exist, traverse through navigation
  1. 访问指定URL
  2. 截图
  3. 获取DOM结构/快照
  4. 如果存在其他页面,通过导航遍历所有页面

3.3 Viewport Testing

3.3 视口测试

Test at the following viewports for responsive issues:
NameWidthRepresentative Device
Mobile375pxiPhone SE/12 mini
Tablet768pxiPad
Desktop1280pxStandard PC
Wide1920pxLarge display
在以下视口下测试响应式问题:
名称宽度代表设备
移动端375pxiPhone SE/12 mini
平板端768pxiPad
桌面端1280px标准PC
宽屏1920px大屏显示器

3.4 Visual Inspection Checklist

3.4 视觉检查清单

Layout Issues

布局问题

IssueDescriptionSeverity
Element OverflowContent overflows container or viewportHigh
Element OverlapUnintended overlapping of elementsHigh
Alignment IssuesGrid or flex alignment problemsMedium
Inconsistent SpacingPadding/margin inconsistenciesMedium
Text ClippingLong text not handled properlyMedium
问题描述严重程度
元素溢出内容超出容器或视口范围
元素重叠非预期的元素重叠
对齐问题Grid或flex布局对齐异常
间距不一致内边距/外边距不统一
文本截断长文本处理不当

Responsive Issues

响应式问题

IssueDescriptionSeverity
Non-mobile FriendlyLayout breaks on small screensHigh
Breakpoint IssuesUnnatural transitions at breakpointsMedium
Touch TargetsButtons too small on mobileMedium
问题描述严重程度
移动端适配差小屏幕下布局错乱
断点问题断点处过渡不自然
点击区域问题移动端按钮尺寸过小

Accessibility Issues

无障碍问题

IssueDescriptionSeverity
Insufficient ContrastLow contrast ratio text/backgroundHigh
No Focus StateCannot see focus during keyboard navHigh
Missing alt TextNo alternative text for imagesMedium
问题描述严重程度
对比度不足文本与背景对比度低
无聚焦状态键盘导航时无法看到聚焦状态
缺失alt文本图片无替代文本

Visual Consistency

视觉一致性

IssueDescriptionSeverity
Font InconsistencyMixed font familiesMedium
Color InconsistencyNon-unified brand colorsMedium
Spacing InconsistencyNon-uniform spacing patternsLow

问题描述严重程度
字体不一致字体家族混用
颜色不一致品牌色不统一
间距不一致间距规范不统一

Step 4: Issue Fixing

步骤4:问题修复

4.1 Issue Prioritization

4.1 问题优先级

PriorityCriteriaAction
P1Layout issues affecting functionalityFix immediately
P2Visual issues degrading UXFix next
P3Minor visual inconsistenciesFix if possible
优先级判定标准处理方式
P1影响功能的布局问题立即修复
P2影响UX的视觉问题次优先修复
P3轻微视觉不一致尽量修复

4.2 Identifying Source Files

4.2 定位源文件

  1. Selector-based Search: Search codebase by class name or ID
  2. Component-based Search: Identify components from element text/structure
  3. File Pattern Filtering:
    src/**/*.css
    ,
    styles/**/*
    ,
    src/components/**/*
  1. 基于选择器搜索:通过类名或ID搜索代码库
  2. 基于组件搜索:通过元素文本/结构识别对应组件
  3. 文件模式过滤
    src/**/*.css
    styles/**/*
    src/components/**/*

4.3 Fix Principles

4.3 修复原则

  1. Minimal Changes: Only make minimum changes necessary
  2. Respect Existing Patterns: Follow existing code style
  3. Avoid Breaking Changes: Be careful not to affect other areas
  4. Add Comments: Explain reason for fixes where appropriate

  1. 最小改动:仅进行必要的最小范围修改
  2. 遵循现有规范:保持现有代码风格
  3. 避免破坏性改动:注意不要影响其他功能模块
  4. 添加注释:必要时添加注释说明修复原因

Step 5: Re-verification

步骤5:重新验证

5.1 Post-fix Confirmation

5.1 修复后确认

  1. Reload browser (or wait for HMR)
  2. Capture screenshots of fixed areas
  3. Compare before and after
  1. 重载浏览器(或等待HMR更新)
  2. 对修复区域截图
  3. 对比修复前后效果

5.2 Regression Testing

5.2 回归测试

  • Verify fixes haven't affected other areas
  • Confirm responsive display is not broken
  • 确认修复未影响其他区域
  • 确认响应式展示未被破坏

5.3 Iteration

5.3 迭代

If issues remain after fix, return to Step 3. Limit to 3 fix attempts per issue before consulting user.

如果修复后仍存在问题,返回步骤3。每个问题最多尝试3次修复,若仍未解决需咨询用户。

Output Format

输出格式

Review Results Report

审查结果报告

markdown
undefined
markdown
undefined

Web Design Review Results

Web设计审查结果

Summary

概览

ItemValue
Target{URL or files}
Framework{Detected framework}
Styling{CSS / Tailwind / etc.}
Review Mode{Static / Visual / Full}
Issues Detected{N}
Issues Fixed{M}
审查目标{URL或文件路径}
所用框架{检测到的框架}
样式方案{CSS / Tailwind / 其他}
审查模式{静态 / 视觉 / 全量}
检测到的问题数{N}
已修复的问题数{M}

Static Analysis Findings

静态分析结果

{file:line format findings from guidelines check}
{依据指南检查得到的
文件:行号
格式的问题列表}

Visual Inspection Findings

视觉检查结果

[P1] {Issue Title}

[P1] {问题标题}

  • Page: {Page path}
  • Element: {Selector or description}
  • Issue: {Detailed description}
  • Fixed File:
    {File path}
  • Fix Details: {Description of changes}
  • 页面:{页面路径}
  • 元素:{选择器或描述}
  • 问题:{详细描述}
  • 已修复文件
    {文件路径}
  • 修复详情:{修改内容描述}

[P2] {Issue Title}

[P2] {问题标题}

...
...

Unfixed Issues (if any)

未修复问题(如有)

{Issue Title}

{问题标题}

  • Reason: {Why it was not fixed}
  • Recommended Action: {Recommendations for user}
  • 原因:{未修复的原因}
  • 建议操作:{给用户的建议}

Recommendations

优化建议

  • {Suggestions for future improvements}

---
  • {后续改进建议}

---

Usage Examples

使用示例

Static Analysis Only

仅静态分析

Review my UI in src/components/
Check accessibility of my forms
Audit design of src/pages/
Review my UI in src/components/
Check accessibility of my forms
Audit design of src/pages/

Visual Inspection

仅视觉检查

Review the design at http://localhost:3000
Check the UI at http://localhost:5173/dashboard
Find layout problems on my site
Review the design at http://localhost:3000
Check the UI at http://localhost:5173/dashboard
Find layout problems on my site

Full Review (Recommended)

全量审查(推荐)

Review my UI at localhost:3000 and fix issues in src/
Audit the design and fix responsive problems

Review my UI at localhost:3000 and fix issues in src/
Audit the design and fix responsive problems

Best Practices

最佳实践

DO

推荐做法

  • Always save screenshots before making fixes
  • Fix one issue at a time and verify each
  • Follow the project's existing code style
  • Confirm with user before major changes
  • 修复前务必保存截图
  • 每次修复一个问题并逐一验证
  • 遵循项目现有代码风格
  • 进行重大修改前先和用户确认

DON'T

禁止做法

  • Large-scale refactoring without confirmation
  • Ignore design systems or brand guidelines
  • Fix multiple issues at once (difficult to verify)
  • Skip re-verification after fixes

  • 未经确认就进行大规模重构
  • 忽略设计系统或品牌规范
  • 同时修复多个问题(难以验证)
  • 修复后跳过重新验证步骤

Troubleshooting

故障排查

Style files not found

找不到样式文件

  1. Check dependencies in
    package.json
  2. Consider CSS-in-JS possibility
  3. Ask user about styling method
  1. 检查
    package.json
    中的依赖
  2. 考虑是否使用了CSS-in-JS方案
  3. 询问用户使用的样式方案

Fixes not reflected

修复未生效

  1. Check if dev server HMR is working
  2. Clear browser cache
  3. Check CSS specificity issues
  1. 检查开发服务器HMR是否正常工作
  2. 清除浏览器缓存
  3. 检查CSS选择器优先级问题

Fixes affecting other areas

修复影响了其他区域

  1. Rollback changes
  2. Use more specific selectors
  3. Consider CSS Modules or scoped styles
  1. 回滚改动
  2. 使用更精确的选择器
  3. 考虑使用CSS Modules或scoped styles