webcraft-skills 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +67 -0
- package/CHANGELOG_zh_CN.md +67 -0
- package/LICENSE +21 -0
- package/README.md +148 -0
- package/README_zh_CN.md +148 -0
- package/commands/ui-audit.md +21 -0
- package/commands/ui-build.md +21 -0
- package/commands/ui-fix.md +21 -0
- package/commands/ui-polish.md +21 -0
- package/commands/ui-preset.md +15 -0
- package/commands/ui-review.md +21 -0
- package/package.json +36 -0
- package/scripts/install.mjs +101 -0
- package/skills/webcraft-skills/SKILL.md +45 -0
- package/skills/webcraft-skills/agents/openai.yaml +4 -0
- package/skills/webcraft-skills/references/checklists/ui-audit.md +621 -0
- package/skills/webcraft-skills/references/checklists/ui-audit.zh.md +675 -0
- package/skills/webcraft-skills/references/presets/cinematic-minimal.md +48 -0
- package/skills/webcraft-skills/references/presets/cinematic-minimal.zh.md +53 -0
- package/skills/webcraft-skills/references/workflows/audit-ui.md +272 -0
- package/skills/webcraft-skills/references/workflows/audit-ui.zh.md +299 -0
- package/skills/webcraft-skills/references/workflows/build-ui.md +12 -0
- package/skills/webcraft-skills/references/workflows/build-ui.zh.md +385 -0
- package/skills/webcraft-skills/references/workflows/fix-ui.md +261 -0
- package/skills/webcraft-skills/references/workflows/fix-ui.zh.md +261 -0
- package/skills/webcraft-skills/references/workflows/polish-ui.md +12 -0
- package/skills/webcraft-skills/references/workflows/polish-ui.zh.md +246 -0
- package/skills/webcraft-skills/references/workflows/review-ui.md +12 -0
- package/skills/webcraft-skills/references/workflows/review-ui.zh.md +207 -0
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
# UI Build Workflow
|
|
2
|
+
|
|
3
|
+
用于从零生成页面、站点、组件或在现有项目中新增 UI。`build-ui` 的目标是生成真实可用、符合项目语境、后续可维护的界面,而不是生成一张漂亮但脆弱的概念图。
|
|
4
|
+
|
|
5
|
+
Build 必须继承 audit、review、polish、fix 的质量标准:先理解目标和约束,再生成结构,最后自检和修复明显问题。
|
|
6
|
+
|
|
7
|
+
## 1. 先确认构建场景
|
|
8
|
+
|
|
9
|
+
开始前先判断用户要的是哪一种:
|
|
10
|
+
|
|
11
|
+
- 新项目静态页面:例如完整 `index.html`。
|
|
12
|
+
- 现有项目新增页面:例如 Next.js / Astro / Vue / Svelte / React 页面。
|
|
13
|
+
- 现有页面新增 section。
|
|
14
|
+
- 单组件或组件组。
|
|
15
|
+
- 原型页面,用于快速展示想法。
|
|
16
|
+
- 高保真页面,用于接近上线质量。
|
|
17
|
+
|
|
18
|
+
不同场景的完成标准不同。不要把原型做成复杂工程,也不要把上线页面做成只适配理想内容的 demo。
|
|
19
|
+
|
|
20
|
+
## 2. Build Modes
|
|
21
|
+
|
|
22
|
+
根据用户目标选择构建深度:
|
|
23
|
+
|
|
24
|
+
### Prototype Build
|
|
25
|
+
|
|
26
|
+
- 用于快速验证想法。
|
|
27
|
+
- 可以使用少量占位内容,但必须标明。
|
|
28
|
+
- 不追求完整业务状态,但不能出现明显响应式崩坏。
|
|
29
|
+
- 不添加后端、认证、数据库或复杂状态管理。
|
|
30
|
+
|
|
31
|
+
### Page Build
|
|
32
|
+
|
|
33
|
+
- 默认模式。
|
|
34
|
+
- 构建一个真实可用页面。
|
|
35
|
+
- 需要考虑响应式、核心状态、长内容和基础可访问性。
|
|
36
|
+
- 适合 landing page、个人页、产品页、功能页。
|
|
37
|
+
|
|
38
|
+
### Production Build
|
|
39
|
+
|
|
40
|
+
- 用于接近上线质量的页面。
|
|
41
|
+
- 必须补齐关键状态、错误/空状态、移动端、内容压力和验证。
|
|
42
|
+
- 优先复用现有组件和 token。
|
|
43
|
+
- 不编造真实业务信息。
|
|
44
|
+
|
|
45
|
+
### Component Build
|
|
46
|
+
|
|
47
|
+
- 用于单组件或组件组。
|
|
48
|
+
- 必须考虑变体、状态、长内容、可访问名称、组合使用。
|
|
49
|
+
- 不按整页标准过度设计组件。
|
|
50
|
+
|
|
51
|
+
## 3. 询问与合理补全
|
|
52
|
+
|
|
53
|
+
信息不足时不要机械追问,也不要随意编造。
|
|
54
|
+
|
|
55
|
+
应该先问的情况:
|
|
56
|
+
|
|
57
|
+
- 页面主体、产品名或目标用户完全不清楚。
|
|
58
|
+
- 用户要求高保真或上线质量,但核心内容缺失。
|
|
59
|
+
- 是否沿用现有风格、是否指定 preset、是否允许外部资源会影响实现方向。
|
|
60
|
+
- 需求涉及真实价格、客户、指标、案例、合规或业务承诺。
|
|
61
|
+
|
|
62
|
+
可以合理补全的情况:
|
|
63
|
+
|
|
64
|
+
- section 顺序、按钮次级文案、空状态文案、FAQ 占位。
|
|
65
|
+
- 示例列表、占位图片说明、非关键辅助文案。
|
|
66
|
+
- 原型阶段的 mock 内容。
|
|
67
|
+
|
|
68
|
+
合理补全必须克制、具体、可信,并避免伪造真实事实。
|
|
69
|
+
|
|
70
|
+
## 4. 生成前检查清单
|
|
71
|
+
|
|
72
|
+
动手前确认:
|
|
73
|
+
|
|
74
|
+
- 构建模式是什么:Prototype / Page / Production / Component。
|
|
75
|
+
- 页面类型是什么。
|
|
76
|
+
- 目标用户是谁。
|
|
77
|
+
- 主 CTA 是什么。
|
|
78
|
+
- 内容是真实内容还是占位内容。
|
|
79
|
+
- 是否在现有项目中构建。
|
|
80
|
+
- 是否已有组件、token、视觉体系。
|
|
81
|
+
- 是否提供了设计图、截图、Figma 导出图或参考页面。
|
|
82
|
+
- 是否指定 preset。
|
|
83
|
+
- 是否有技术限制,例如不使用外部资源、不引入新依赖。
|
|
84
|
+
|
|
85
|
+
不要在这些关键点完全不清楚时直接生成大页面。
|
|
86
|
+
|
|
87
|
+
## 5. 收集必要信息
|
|
88
|
+
|
|
89
|
+
优先识别:
|
|
90
|
+
|
|
91
|
+
- 页面类型:landing page、dashboard、docs、portfolio、form、checkout、settings、admin 等。
|
|
92
|
+
- 主体名称:产品、人、品牌、项目或功能。
|
|
93
|
+
- 目标用户:普通用户、开发者、企业客户、创作者、内部运营等。
|
|
94
|
+
- 核心任务:注册、购买、阅读、搜索、管理、创作、联系、下载等。
|
|
95
|
+
- 主要内容:首屏、功能、案例、价格、FAQ、表单、列表、数据、作品等。
|
|
96
|
+
- 技术栈:HTML/CSS/JS、React、Next.js、Astro、Vue、Svelte、Tailwind、组件库。
|
|
97
|
+
- 约束:不使用外部资源、必须移动端可用、必须沿用现有组件、必须保留品牌色等。
|
|
98
|
+
|
|
99
|
+
信息不足时可以合理补全,但不要编造真实客户、价格、指标、案例、团队、公司或产品事实。
|
|
100
|
+
|
|
101
|
+
## 6. 识别现有项目和视觉体系
|
|
102
|
+
|
|
103
|
+
如果是在现有项目中构建,先检查:
|
|
104
|
+
|
|
105
|
+
- 页面入口、路由结构和目录约定。
|
|
106
|
+
- 全局样式、Tailwind 配置、design tokens。
|
|
107
|
+
- 已有组件:Button、Card、Input、Modal、Nav、Table、Toast。
|
|
108
|
+
- 现有视觉体系:颜色、字体、spacing、圆角、边框、阴影、组件状态。
|
|
109
|
+
- 页面语气:营销型、工具型、内容型、后台型、个人品牌型等。
|
|
110
|
+
|
|
111
|
+
默认沿用现有体系。不要在现有项目里强行引入另一套风格、组件库或 preset。
|
|
112
|
+
|
|
113
|
+
## 7. 设计图 / 参考图输入
|
|
114
|
+
|
|
115
|
+
当用户提供截图、设计图、Figma 导出图、参考页面截图或视觉参考时,先判断它的用途:
|
|
116
|
+
|
|
117
|
+
- 结构参考:主要参考布局、信息顺序、组件关系。
|
|
118
|
+
- 风格参考:主要参考颜色、字体感觉、圆角、边框、阴影、氛围。
|
|
119
|
+
- 完整设计稿:同时参考结构和风格,尽量还原。
|
|
120
|
+
|
|
121
|
+
### 新项目
|
|
122
|
+
|
|
123
|
+
没有既有视觉体系时,默认按设计图的结构和风格生成。
|
|
124
|
+
|
|
125
|
+
- 尽量还原设计图的信息结构、布局比例、视觉层级和组件关系。
|
|
126
|
+
- 尽量还原颜色、字体感觉、圆角、边框、阴影和整体氛围。
|
|
127
|
+
- 可以做必要的响应式、可访问性和真实内容适配。
|
|
128
|
+
- 不要擅自换成其它风格或 preset。
|
|
129
|
+
|
|
130
|
+
### 现有项目
|
|
131
|
+
|
|
132
|
+
如果用户没有明确要求改变风格,默认:
|
|
133
|
+
|
|
134
|
+
- 结构参考设计图。
|
|
135
|
+
- 信息顺序和组件关系参考设计图。
|
|
136
|
+
- 颜色、字体、圆角、按钮、卡片、表单等风格沿用现有网站。
|
|
137
|
+
|
|
138
|
+
如果用户明确说“按图上的风格”“照这个设计稿实现”“视觉也按这个来”,则:
|
|
139
|
+
|
|
140
|
+
- 可以按设计图风格实现当前范围。
|
|
141
|
+
- 不要顺手改全站。
|
|
142
|
+
- 如果设计图风格与现有系统冲突,说明冲突和影响。
|
|
143
|
+
- 如果需要全站统一,建议后续做 design system 或 token 迁移,不要在当前任务里擅自扩展。
|
|
144
|
+
|
|
145
|
+
### 不确定时
|
|
146
|
+
|
|
147
|
+
如果用户没有说明设计图用途,且项目已有明确视觉体系,先问一句:
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
这张图是作为布局结构参考,还是希望新页面也采用图里的视觉风格?
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
如果用户不想停下来确认,采用保守策略:结构参考设计图,风格沿用现有项目。
|
|
154
|
+
|
|
155
|
+
## 8. Preset 使用规则
|
|
156
|
+
|
|
157
|
+
- 用户明确指定 preset 时,按指定 preset 执行。
|
|
158
|
+
- 用户没有指定 preset 时,先根据页面类型和现有项目语境选择合适方向。
|
|
159
|
+
- 如果现有项目已有明确视觉体系,preset 只能作为参考,不得覆盖现有风格。
|
|
160
|
+
- 不要默认套用 `cinematic-minimal`。
|
|
161
|
+
- 不要为了“高级感”强行改成暗色、电影感、极简或 SaaS 风。
|
|
162
|
+
|
|
163
|
+
Preset 是风格约束,不是产品事实来源。不要根据 preset 编造文案、案例或业务数据。
|
|
164
|
+
|
|
165
|
+
## 9. 页面类型结构模板
|
|
166
|
+
|
|
167
|
+
根据页面类型选择信息结构。模板只是起点,不要机械套用。
|
|
168
|
+
|
|
169
|
+
### Landing Page / Marketing Site
|
|
170
|
+
|
|
171
|
+
- Hero:是谁、做什么、给谁用、下一步动作。
|
|
172
|
+
- Problem:用户当前痛点。
|
|
173
|
+
- Solution:产品如何解决。
|
|
174
|
+
- Features:少量具体能力。
|
|
175
|
+
- Proof:真实案例、作品、指标或可信说明。
|
|
176
|
+
- CTA:主行动和次行动。
|
|
177
|
+
- FAQ:消除关键疑虑。
|
|
178
|
+
|
|
179
|
+
### SaaS / Product Page
|
|
180
|
+
|
|
181
|
+
- Hero:具体产品主张。
|
|
182
|
+
- Use Cases:目标用户和使用场景。
|
|
183
|
+
- Feature Detail:关键功能和实际工作流。
|
|
184
|
+
- Screenshot / Mockup:服务理解,不炫技。
|
|
185
|
+
- Pricing / Trial:如果用户提供或明确需要。
|
|
186
|
+
- FAQ / Security / Support:根据产品语境补充。
|
|
187
|
+
|
|
188
|
+
### Dashboard / Admin
|
|
189
|
+
|
|
190
|
+
- Overview:核心指标或状态。
|
|
191
|
+
- Controls:搜索、过滤、排序、时间范围。
|
|
192
|
+
- Main Content:表格、列表、图表或任务流。
|
|
193
|
+
- Detail / Action:详情面板、批量操作、状态反馈。
|
|
194
|
+
- Empty / Loading / Error:数据状态。
|
|
195
|
+
|
|
196
|
+
### Portfolio / Personal Site
|
|
197
|
+
|
|
198
|
+
- Hero:人、定位、主张。
|
|
199
|
+
- Selected Work:精选作品,不堆数量。
|
|
200
|
+
- Process / Thinking:方法和判断力。
|
|
201
|
+
- About:可信背景。
|
|
202
|
+
- Contact:清楚但不过度销售。
|
|
203
|
+
|
|
204
|
+
### Form / Checkout / Onboarding
|
|
205
|
+
|
|
206
|
+
- Step Context:当前步骤和剩余路径。
|
|
207
|
+
- Input Group:清楚 label、帮助、错误。
|
|
208
|
+
- Review / Confirmation:确认信息和风险。
|
|
209
|
+
- Submit State:loading、success、error、disabled。
|
|
210
|
+
|
|
211
|
+
### Docs / Content Site
|
|
212
|
+
|
|
213
|
+
- Title / Summary:页面主题。
|
|
214
|
+
- TOC:目录或锚点。
|
|
215
|
+
- Content Sections:清晰 heading 层级。
|
|
216
|
+
- Code / Table:移动端可滚动或可换行。
|
|
217
|
+
- Next Step:下一篇、相关文档、操作入口。
|
|
218
|
+
|
|
219
|
+
## 10. 先规划信息结构
|
|
220
|
+
|
|
221
|
+
生成视觉前,先建立信息结构:
|
|
222
|
+
|
|
223
|
+
- 首屏:页面是谁、做什么、给谁用、下一步动作是什么。
|
|
224
|
+
- 主体内容:每个 section 只表达一个核心信息。
|
|
225
|
+
- 行动路径:主 CTA、次 CTA、联系/购买/注册/继续阅读路径。
|
|
226
|
+
- 信任信息:真实案例、作品、功能说明、FAQ、数据解释。
|
|
227
|
+
- 状态和边界:loading、empty、error、success、disabled、长内容、无图片。
|
|
228
|
+
|
|
229
|
+
不要从背景、渐变、卡片、动效开始设计。好的页面先有结构,再有视觉。
|
|
230
|
+
|
|
231
|
+
## 11. 实现策略
|
|
232
|
+
|
|
233
|
+
### 新静态页面
|
|
234
|
+
|
|
235
|
+
- 生成完整可运行文件。
|
|
236
|
+
- CSS 组织清晰,避免大量重复 magic number。
|
|
237
|
+
- 不依赖不可用的远程资源。
|
|
238
|
+
- 移动端、平板、桌面都可用。
|
|
239
|
+
|
|
240
|
+
### 现有项目页面
|
|
241
|
+
|
|
242
|
+
- 遵循项目已有目录、组件和样式方式。
|
|
243
|
+
- 优先复用已有组件和 token。
|
|
244
|
+
- 不引入新依赖,除非用户要求或项目已有约定。
|
|
245
|
+
- 不破坏已有路由和业务逻辑。
|
|
246
|
+
|
|
247
|
+
### 组件
|
|
248
|
+
|
|
249
|
+
- 支持常见变体:default、hover、active、focus-visible、disabled、loading。
|
|
250
|
+
- 支持长内容和不同数量。
|
|
251
|
+
- 有可访问名称和键盘路径。
|
|
252
|
+
- 不依赖父容器偶然尺寸才能正常显示。
|
|
253
|
+
|
|
254
|
+
## 12. 不要过度实现
|
|
255
|
+
|
|
256
|
+
只实现用户请求的 UI 范围。
|
|
257
|
+
|
|
258
|
+
不要默认添加:
|
|
259
|
+
|
|
260
|
+
- 登录、权限、用户系统。
|
|
261
|
+
- 数据库、CMS、后端 API。
|
|
262
|
+
- 复杂状态管理。
|
|
263
|
+
- 支付流程。
|
|
264
|
+
- 多语言系统。
|
|
265
|
+
- 主题切换。
|
|
266
|
+
- 动画系统。
|
|
267
|
+
- 大量筛选、排序、批量操作。
|
|
268
|
+
- mock API 或复杂数据层。
|
|
269
|
+
|
|
270
|
+
如果这些能力对页面体验是必要的,可以做轻量 UI 占位或说明,不要擅自扩展成完整产品。
|
|
271
|
+
|
|
272
|
+
## 13. 必须补齐的 UI 状态
|
|
273
|
+
|
|
274
|
+
根据页面功能补齐:
|
|
275
|
+
|
|
276
|
+
- 按钮:primary、secondary、disabled、loading、hover、active、focus-visible。
|
|
277
|
+
- 表单:label、placeholder、help、error、disabled、loading、success。
|
|
278
|
+
- 列表/数据:loading、empty、error、success、分页或数量变化。
|
|
279
|
+
- 弹窗/菜单:打开、关闭、遮罩、focus、移动端滚动。
|
|
280
|
+
- 导航:当前状态、移动端入口、键盘可达。
|
|
281
|
+
|
|
282
|
+
如果页面没有相关功能,不要硬塞状态展示;但涉及用户操作的地方必须有状态闭环。
|
|
283
|
+
|
|
284
|
+
## 14. 响应式要求
|
|
285
|
+
|
|
286
|
+
默认至少考虑:
|
|
287
|
+
|
|
288
|
+
- 375px mobile
|
|
289
|
+
- 768px tablet
|
|
290
|
+
- 1280px desktop
|
|
291
|
+
|
|
292
|
+
需要避免:
|
|
293
|
+
|
|
294
|
+
- 横向滚动。
|
|
295
|
+
- 文字贴边。
|
|
296
|
+
- 按钮太小或文案溢出。
|
|
297
|
+
- 图片、mockup、表格、代码块溢出。
|
|
298
|
+
- sticky/fixed 元素遮挡内容。
|
|
299
|
+
- 桌面正常但移动端只是缩小版。
|
|
300
|
+
|
|
301
|
+
对固定格式元素使用 `max-width`、`min-width: 0`、`aspect-ratio`、合理 wrapping 和断点,而不是靠内容撑开。
|
|
302
|
+
|
|
303
|
+
## 15. 内容压力测试
|
|
304
|
+
|
|
305
|
+
生成时必须考虑真实内容变化:
|
|
306
|
+
|
|
307
|
+
- 标题变长。
|
|
308
|
+
- 按钮文案变长。
|
|
309
|
+
- 中英文混排。
|
|
310
|
+
- 图片比例不同。
|
|
311
|
+
- 卡片内容长短不一。
|
|
312
|
+
- 列表为 0、1、3、10、20 项。
|
|
313
|
+
- 表单错误信息较长。
|
|
314
|
+
- 用户名、项目名、邮箱、文件名很长。
|
|
315
|
+
|
|
316
|
+
不要生成只适配理想短文案的布局。
|
|
317
|
+
|
|
318
|
+
## 16. 自检与修复
|
|
319
|
+
|
|
320
|
+
生成完成后,按顺序自检:
|
|
321
|
+
|
|
322
|
+
1. 是否有 Critical 问题:不可读、不可点击、溢出、遮挡、导航/表单/弹窗不可用。
|
|
323
|
+
2. 是否符合现有视觉体系或用户指定 preset。
|
|
324
|
+
3. spacing、typography、颜色、圆角、边框、阴影是否统一。
|
|
325
|
+
4. 组件状态是否完整。
|
|
326
|
+
5. 移动端是否可用。
|
|
327
|
+
6. 长内容和真实内容是否会破坏布局。
|
|
328
|
+
7. 是否有 AI 模板感:过多 badge、bento grid、渐变光斑、空泛口号、虚构数据。
|
|
329
|
+
|
|
330
|
+
发现明显问题时,直接修复。不要把可修的问题留给用户。
|
|
331
|
+
|
|
332
|
+
## 17. 何时转入其它 workflow
|
|
333
|
+
|
|
334
|
+
- 用户要求检查已有页面:转入 `review-ui` 或 `audit-ui`。
|
|
335
|
+
- 生成后发现系统性质量问题:转入 `audit-ui`。
|
|
336
|
+
- 生成后只需局部细节提升:转入 `polish-ui`。
|
|
337
|
+
- 生成后发现具体可修缺陷:转入 `fix-ui`。
|
|
338
|
+
|
|
339
|
+
Build 不应该承担所有质量工作。它负责生成可用初稿,并完成必要自检。
|
|
340
|
+
|
|
341
|
+
## 18. 输出格式
|
|
342
|
+
|
|
343
|
+
```markdown
|
|
344
|
+
## Build Summary
|
|
345
|
+
|
|
346
|
+
- 构建了什么:
|
|
347
|
+
- 构建模式:
|
|
348
|
+
- 采用了什么结构:
|
|
349
|
+
- 是否参考了设计图:
|
|
350
|
+
- 遵循了哪些现有风格或 preset:
|
|
351
|
+
|
|
352
|
+
## Changed Files
|
|
353
|
+
|
|
354
|
+
- `path/to/file`
|
|
355
|
+
|
|
356
|
+
## States Covered
|
|
357
|
+
|
|
358
|
+
- hover / active / focus-visible / disabled / loading / empty / error / success
|
|
359
|
+
|
|
360
|
+
## Responsive Checks
|
|
361
|
+
|
|
362
|
+
- 375px:
|
|
363
|
+
- 768px:
|
|
364
|
+
- 1280px:
|
|
365
|
+
|
|
366
|
+
## Verification
|
|
367
|
+
|
|
368
|
+
- 已运行:
|
|
369
|
+
- 未验证:
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
不要只输出抽象设计建议。能实现时直接实现,并说明验证结果。
|
|
373
|
+
|
|
374
|
+
## 19. 禁止事项
|
|
375
|
+
|
|
376
|
+
- 不要在用户未指定 preset 时强行套用 preset。
|
|
377
|
+
- 不要在现有项目中把参考图风格当成默认风格,除非用户明确要求。
|
|
378
|
+
- 不要在现有项目中引入另一套视觉体系。
|
|
379
|
+
- 不要编造真实客户、价格、指标、案例或团队信息。
|
|
380
|
+
- 不要生成只适配理想短文案的页面。
|
|
381
|
+
- 不要只做静态好看的截图,忽略状态和响应式。
|
|
382
|
+
- 不要为了丰富页面增加无意义卡片、徽章、图标、渐变和动效。
|
|
383
|
+
- 不要把简单页面扩展成带后端、认证、数据库和复杂状态管理的大项目。
|
|
384
|
+
- 不要引入新依赖或换技术栈,除非用户要求。
|
|
385
|
+
- 不要伪造 lint/build/browser 验证结果。
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
# UI Fix Workflow
|
|
2
|
+
|
|
3
|
+
Use this workflow to implement UI fixes from review findings, audit findings, user-reported issues, screenshots, or code observation. The goal is to make confirmed issues usable, clear, and consistent without turning a fix into a redesign.
|
|
4
|
+
|
|
5
|
+
By default, fix only issues with evidence, impact, and a clear repair direction. Put unsupported issues into `Open Questions`; do not pretend they are confirmed.
|
|
6
|
+
|
|
7
|
+
## 1. Confirm Fix Boundary
|
|
8
|
+
|
|
9
|
+
Before editing code, confirm or infer:
|
|
10
|
+
|
|
11
|
+
- Source: audit, review, user-specified issue, or current observation.
|
|
12
|
+
- Scope: single page, component, whole site, viewport, or state category.
|
|
13
|
+
- Severity: Critical only, or Critical / Major / Minor.
|
|
14
|
+
- Whether visual tokens may change: color, radius, shadow, spacing, type hierarchy.
|
|
15
|
+
- Whether existing style, copy, layout structure, and tech stack must be preserved.
|
|
16
|
+
- Whether the user needs a fix plan before execution.
|
|
17
|
+
|
|
18
|
+
If the user says "fix it directly" or equivalent, proceed. If the scope may become broad, provide a short fix plan first.
|
|
19
|
+
|
|
20
|
+
## 2. Preserve Existing Visual System
|
|
21
|
+
|
|
22
|
+
Before fixing, identify and respect the current visual system:
|
|
23
|
+
|
|
24
|
+
- Color: brand, background, text, state, and accent colors.
|
|
25
|
+
- Typography: type scale, weight, line-height, heading/body rhythm.
|
|
26
|
+
- Spacing: container width, section spacing, component padding, grid gap.
|
|
27
|
+
- Radius, border, shadow: shared rules for buttons, cards, inputs, dialogs, menus.
|
|
28
|
+
- Component style: buttons, forms, navigation, cards, tables, dialogs, toasts.
|
|
29
|
+
- Page tone: marketing, tool, content, admin, personal brand, etc.
|
|
30
|
+
|
|
31
|
+
Unless the user explicitly asks for redesign or a preset, fix within the existing visual system. Do not change the page into a different style to repair one issue.
|
|
32
|
+
|
|
33
|
+
## 3. Choose Strategy By Source
|
|
34
|
+
|
|
35
|
+
### From Audit
|
|
36
|
+
|
|
37
|
+
- Fix in Critical / Major / Minor and Fix Order priority.
|
|
38
|
+
- Every change should map to a finding.
|
|
39
|
+
- Do not opportunistically fix unsupported low-value issues.
|
|
40
|
+
|
|
41
|
+
### From Review
|
|
42
|
+
|
|
43
|
+
- Prioritize reviewer-identified risks.
|
|
44
|
+
- If review feedback is directional, convert it into executable findings before fixing.
|
|
45
|
+
- Do not expand an ordinary review into a full redesign.
|
|
46
|
+
|
|
47
|
+
### From User-Specified Issue
|
|
48
|
+
|
|
49
|
+
- Fix only the named issue and direct dependencies.
|
|
50
|
+
- Do not expand scope unless the issue cannot be fixed otherwise.
|
|
51
|
+
- If you find an extra Critical issue, mention it, but do not broadly rewrite without user intent.
|
|
52
|
+
|
|
53
|
+
### From Screenshot
|
|
54
|
+
|
|
55
|
+
- Fix only visible layout, visual hierarchy, copy, and obvious state issues.
|
|
56
|
+
- Do not assert or fix behavior that cannot be confirmed from the screenshot.
|
|
57
|
+
- Hover, focus, loading, dialog close behavior, and similar interactions need runtime verification.
|
|
58
|
+
|
|
59
|
+
### From Code Observation
|
|
60
|
+
|
|
61
|
+
- Label code-based inferences.
|
|
62
|
+
- If the page can run, verify before fixing when practical.
|
|
63
|
+
- If it cannot run, keep fixes conservative and report unverified risk.
|
|
64
|
+
|
|
65
|
+
## 4. Fix Plan Format
|
|
66
|
+
|
|
67
|
+
For larger scopes or multiple files, provide a short plan:
|
|
68
|
+
|
|
69
|
+
```markdown
|
|
70
|
+
## Fix Plan
|
|
71
|
+
|
|
72
|
+
1. Fix mobile hero CTA overflow.
|
|
73
|
+
Finding: Mobile hero CTA overflows.
|
|
74
|
+
Scope: `src/app/page.tsx`
|
|
75
|
+
|
|
76
|
+
2. Add button focus-visible / disabled / loading states.
|
|
77
|
+
Finding: Primary actions lack complete states.
|
|
78
|
+
Scope: `src/components/Button.tsx`
|
|
79
|
+
|
|
80
|
+
3. Align card/button/input radius system.
|
|
81
|
+
Finding: Radius system is inconsistent.
|
|
82
|
+
Scope: shared component styles
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The plan must map to findings. Do not include "also improve the whole UI" as hidden scope.
|
|
86
|
+
|
|
87
|
+
## 5. Fix Priority
|
|
88
|
+
|
|
89
|
+
Fix in this order:
|
|
90
|
+
|
|
91
|
+
1. `Critical`: unusable, unreadable, unclickable, unclosable, horizontal scrolling, broken core flow.
|
|
92
|
+
2. `Major`: failed responsive degradation, unclear hierarchy, missing component states, inconsistent visual tokens.
|
|
93
|
+
3. Content Stress: long copy, mixed-language content, real data counts, media ratios.
|
|
94
|
+
4. AI Template Smell: remove template noise and add real information structure.
|
|
95
|
+
5. `Minor`: alignment, spacing, motion, copy, and visual polish.
|
|
96
|
+
|
|
97
|
+
Do not fix Minor first. If Critical issues remain, do not spend time on local refinement.
|
|
98
|
+
|
|
99
|
+
## 6. Fix Strategies
|
|
100
|
+
|
|
101
|
+
### Layout / Responsive
|
|
102
|
+
|
|
103
|
+
- Find the root cause first: fixed width, container padding, grid/flex breakpoint, overflow, absolute/fixed positioning.
|
|
104
|
+
- Prefer responsive constraints: `max-width`, `min-width: 0`, `flex-wrap`, reasonable breakpoints, single-column degradation, `aspect-ratio`.
|
|
105
|
+
- Do not hide content to mask layout problems unless the content is truly secondary on mobile.
|
|
106
|
+
- Recheck the affected viewports after fixing.
|
|
107
|
+
|
|
108
|
+
### Typography
|
|
109
|
+
|
|
110
|
+
- Fix readability first: size, line-height, paragraph width, contrast, wrapping.
|
|
111
|
+
- Break Chinese headings by meaning, not by decorative block shape.
|
|
112
|
+
- Long English, emails, filenames, numbers, and IDs need wrapping or truncation strategies.
|
|
113
|
+
- Do not make headings huge to simulate premium quality.
|
|
114
|
+
|
|
115
|
+
### Color
|
|
116
|
+
|
|
117
|
+
- Ensure contrast and state recognition first.
|
|
118
|
+
- Limit accent usage; avoid spreading the primary color everywhere.
|
|
119
|
+
- Preserve existing brand colors unless the user asks for a new visual direction.
|
|
120
|
+
- Do not repaint the whole page into a single style palette.
|
|
121
|
+
|
|
122
|
+
### Border / Radius / Shadow
|
|
123
|
+
|
|
124
|
+
- Prefer token convergence over per-component tweaks.
|
|
125
|
+
- Extract the smallest useful scale, such as button/input, card, modal.
|
|
126
|
+
- Use shadows only for real elevation such as popovers, modals, and dropdowns.
|
|
127
|
+
- Avoid heavy outlines, glow effects, and excessive glassmorphism.
|
|
128
|
+
|
|
129
|
+
### Components And States
|
|
130
|
+
|
|
131
|
+
- Add usability states first: focus-visible, disabled, loading, error.
|
|
132
|
+
- Then add experience states: hover, active, empty, success.
|
|
133
|
+
- State feedback must not cause layout shift.
|
|
134
|
+
- Icon buttons need visible text, tooltip, or `aria-label`.
|
|
135
|
+
- When fixing inconsistent inputs, selects, dropdowns, multiselects, or menus, first check whether the project already has matching custom components. Reuse or extend them instead of continuing to hand-style native controls.
|
|
136
|
+
- If the project has no matching custom control and native controls visibly break the visual system, create the smallest reusable control or shared style so core filtering, editing, and bulk actions use one interaction and visual pattern.
|
|
137
|
+
|
|
138
|
+
### Accessibility
|
|
139
|
+
|
|
140
|
+
- Fix keyboard path, focus-visible, accessible names, and label associations first.
|
|
141
|
+
- Icon buttons, close buttons, and menu buttons need clear `aria-label` or visible text.
|
|
142
|
+
- Do not rely on color as the only state indicator.
|
|
143
|
+
- Form errors must be associated with their inputs.
|
|
144
|
+
- Dialogs must handle focus entry, focus return, Escape, and close button paths.
|
|
145
|
+
|
|
146
|
+
### Forms / Modals / Navigation
|
|
147
|
+
|
|
148
|
+
- Form fixes should close the loop: label, help, error, disabled, loading, success.
|
|
149
|
+
- Select-like controls should cover trigger, menu/popup, option, selected, disabled, empty, error, focus-visible, keyboard path, and long options.
|
|
150
|
+
- Dialogs should first guarantee close, scroll, focus, and destructive confirmation.
|
|
151
|
+
- Navigation should first guarantee usable desktop and mobile paths, then visual polish.
|
|
152
|
+
|
|
153
|
+
## 7. Local Vs Systemic Fix
|
|
154
|
+
|
|
155
|
+
- If a problem appears once, prefer a local fix.
|
|
156
|
+
- If the same problem appears in 3+ components or pages, consider a shared component, design token, or utility.
|
|
157
|
+
- If related issues have different root causes, do not force abstraction.
|
|
158
|
+
- Abstraction must reduce duplication or risk; do not abstract for architecture theater.
|
|
159
|
+
- Before changing shared components, check that other usage scenarios will not break.
|
|
160
|
+
|
|
161
|
+
## 8. Scope Control
|
|
162
|
+
|
|
163
|
+
- Follow the existing framework, components, styling system, and naming habits.
|
|
164
|
+
- Prefer local components and styles; avoid unrelated architecture refactors.
|
|
165
|
+
- Do not change UI library, routes, or business logic.
|
|
166
|
+
- Do not remove necessary content for visual consistency.
|
|
167
|
+
- If multiple pages share the same issue, prefer shared components or tokens.
|
|
168
|
+
- If only one page has the issue, do not over-abstract.
|
|
169
|
+
|
|
170
|
+
## 9. User Decisions
|
|
171
|
+
|
|
172
|
+
Put these under `Open Questions`; do not decide silently:
|
|
173
|
+
|
|
174
|
+
- Product positioning, target user, or core value is unclear.
|
|
175
|
+
- Real data, cases, customers, pricing, or metrics need confirmation.
|
|
176
|
+
- Brand color, typeface, or visual direction requires tradeoff.
|
|
177
|
+
- Removing business content may harm information completeness.
|
|
178
|
+
- The fix requires a new dependency, UI library change, or design-system refactor.
|
|
179
|
+
|
|
180
|
+
## 10. Post-Fix Recheck
|
|
181
|
+
|
|
182
|
+
After each fix, recheck the affected dimension:
|
|
183
|
+
|
|
184
|
+
- Overflow: relevant viewports, especially 375px, 768px, 1280px.
|
|
185
|
+
- Buttons/forms: hover, active, focus-visible, disabled, loading, error.
|
|
186
|
+
- Select/dropdown/multiselect/menu: open, close, selected, clear, keyboard path, long options, empty state, mobile.
|
|
187
|
+
- Dialogs: open, close, overlay, scroll, focus, mobile.
|
|
188
|
+
- Navigation: desktop, mobile, current state, keyboard path.
|
|
189
|
+
- Tokens: whether same-type components remain consistent and no new conflict appears.
|
|
190
|
+
- Copy/headings: long copy and mixed Chinese/English content.
|
|
191
|
+
|
|
192
|
+
If the page cannot run, state which rechecks are code-based only.
|
|
193
|
+
|
|
194
|
+
## 11. Verification
|
|
195
|
+
|
|
196
|
+
### Engineering Verification
|
|
197
|
+
|
|
198
|
+
Prefer existing project commands:
|
|
199
|
+
|
|
200
|
+
- lint
|
|
201
|
+
- typecheck
|
|
202
|
+
- test
|
|
203
|
+
- build
|
|
204
|
+
|
|
205
|
+
Do not add new tools only for validation. Report anything not verified.
|
|
206
|
+
|
|
207
|
+
### Visual Verification
|
|
208
|
+
|
|
209
|
+
- Recheck relevant viewports, at least the widths where issues occurred.
|
|
210
|
+
- Compare the fixed area before and after, ensuring no new overlap, overflow, or layout shift.
|
|
211
|
+
- When fixing visual tokens, check same-type components remain consistent.
|
|
212
|
+
|
|
213
|
+
### Interaction Verification
|
|
214
|
+
|
|
215
|
+
- Recheck hover, active, focus-visible, disabled, loading, error.
|
|
216
|
+
- When fixing dialogs, menus, forms, or navigation, recheck open, close, keyboard path, and mobile.
|
|
217
|
+
- When replacing native controls or creating custom controls, recheck same-type pages for remaining native-control mixing and verify the new control follows existing tokens.
|
|
218
|
+
- Without a browser, explain unverified interaction risk based on code.
|
|
219
|
+
|
|
220
|
+
## 12. Output Format
|
|
221
|
+
|
|
222
|
+
```markdown
|
|
223
|
+
## Fix Summary
|
|
224
|
+
|
|
225
|
+
- Fixed:
|
|
226
|
+
- Preserved:
|
|
227
|
+
- Not handled:
|
|
228
|
+
|
|
229
|
+
## Fixed Findings
|
|
230
|
+
|
|
231
|
+
- Finding:
|
|
232
|
+
Change:
|
|
233
|
+
Recheck:
|
|
234
|
+
|
|
235
|
+
## Changed Files
|
|
236
|
+
|
|
237
|
+
- `path/to/file`
|
|
238
|
+
|
|
239
|
+
## Verification
|
|
240
|
+
|
|
241
|
+
- Ran:
|
|
242
|
+
- Not verified:
|
|
243
|
+
|
|
244
|
+
## Remaining Questions
|
|
245
|
+
|
|
246
|
+
- Questions needing user confirmation.
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Be specific. Do not say only "optimized UI". State which finding was fixed, how, and whether it was rechecked.
|
|
250
|
+
|
|
251
|
+
## 13. Prohibited
|
|
252
|
+
|
|
253
|
+
- Do not turn fix into redesign unless explicitly requested.
|
|
254
|
+
- Do not rewrite a page because of taste.
|
|
255
|
+
- Do not force a preset when the user did not choose one.
|
|
256
|
+
- Do not perform unrelated refactors.
|
|
257
|
+
- Do not change tech stack or introduce dependencies unless necessary and approved.
|
|
258
|
+
- Do not delete user content, business logic, or real data.
|
|
259
|
+
- Do not fabricate lint/build/browser verification.
|
|
260
|
+
- Do not fix one issue by introducing new responsive, state, or accessibility problems.
|
|
261
|
+
- Do not introduce global visual changes to repair a local issue.
|