web-design-guidelines

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Web Interface Guidelines

Web Interface Guidelines

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

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: 信息收集
Step 2: 规范获取 + 静态分析
Step 3: 视觉检查(若提供URL)
Step 4: 问题修复
Step 5: 重新验证
(若仍有问题则循环)

Step 1: Information Gathering

Step 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

Step 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. 收集带有
    file:line
    引用的问题

Step 3: Visual Inspection (Browser Mode)

Step 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

Step 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降低用户体验的视觉问题接下来修复
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

Step 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.

若修复后仍存在问题,返回Step 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}
{来自规范检查的file:line格式问题}

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或作用域样式