ccgx-workflow 1.0.0

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.
Files changed (212) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +469 -0
  3. package/README.zh-CN.md +466 -0
  4. package/bin/ccg.mjs +2 -0
  5. package/dist/cli.d.mts +1 -0
  6. package/dist/cli.d.ts +1 -0
  7. package/dist/cli.mjs +173 -0
  8. package/dist/index.d.mts +1774 -0
  9. package/dist/index.d.ts +1774 -0
  10. package/dist/index.mjs +2029 -0
  11. package/dist/shared/ccgx-workflow.WgUzkiC3.mjs +5248 -0
  12. package/package.json +129 -0
  13. package/templates/commands/agents/assumptions-analyzer.md +129 -0
  14. package/templates/commands/agents/code-fixer.md +292 -0
  15. package/templates/commands/agents/codebase-mapper.md +152 -0
  16. package/templates/commands/agents/debug-session-manager.md +247 -0
  17. package/templates/commands/agents/debugger.md +111 -0
  18. package/templates/commands/agents/eval-auditor.md +171 -0
  19. package/templates/commands/agents/framework-selector.md +152 -0
  20. package/templates/commands/agents/get-current-datetime.md +29 -0
  21. package/templates/commands/agents/init-architect.md +114 -0
  22. package/templates/commands/agents/integration-checker.md +163 -0
  23. package/templates/commands/agents/interface-auditor.md +170 -0
  24. package/templates/commands/agents/nyquist-auditor.md +131 -0
  25. package/templates/commands/agents/pattern-mapper.md +111 -0
  26. package/templates/commands/agents/phase-runner.md +321 -0
  27. package/templates/commands/agents/plan-checker.md +255 -0
  28. package/templates/commands/agents/planner.md +320 -0
  29. package/templates/commands/agents/team-architect.md +186 -0
  30. package/templates/commands/agents/team-qa.md +121 -0
  31. package/templates/commands/agents/team-reviewer.md +157 -0
  32. package/templates/commands/agents/ui-ux-designer.md +573 -0
  33. package/templates/commands/agents/verifier.md +274 -0
  34. package/templates/commands/analyze.md +210 -0
  35. package/templates/commands/autonomous.md +792 -0
  36. package/templates/commands/cancel.md +132 -0
  37. package/templates/commands/clean-branches.md +117 -0
  38. package/templates/commands/codex-exec.md +404 -0
  39. package/templates/commands/commit.md +151 -0
  40. package/templates/commands/context.md +332 -0
  41. package/templates/commands/debate.md +165 -0
  42. package/templates/commands/debug.md +226 -0
  43. package/templates/commands/enhance.md +64 -0
  44. package/templates/commands/execute.md +380 -0
  45. package/templates/commands/init.md +123 -0
  46. package/templates/commands/optimize.md +217 -0
  47. package/templates/commands/plan.md +373 -0
  48. package/templates/commands/result.md +106 -0
  49. package/templates/commands/review.md +338 -0
  50. package/templates/commands/rollback.md +116 -0
  51. package/templates/commands/spec-impl.md +139 -0
  52. package/templates/commands/spec-init.md +101 -0
  53. package/templates/commands/spec-plan.md +210 -0
  54. package/templates/commands/spec-research.md +152 -0
  55. package/templates/commands/spec-review.md +120 -0
  56. package/templates/commands/status.md +206 -0
  57. package/templates/commands/team-exec.md +265 -0
  58. package/templates/commands/test.md +236 -0
  59. package/templates/commands/verify-work.md +338 -0
  60. package/templates/commands/verify.md +66 -0
  61. package/templates/commands/workflow.md +190 -0
  62. package/templates/commands/worktree.md +128 -0
  63. package/templates/hooks/ccg-context-monitor.js +159 -0
  64. package/templates/hooks/ccg-session-state.cjs +510 -0
  65. package/templates/hooks/ccg-statusline.js +142 -0
  66. package/templates/output-styles/abyss-command.md +56 -0
  67. package/templates/output-styles/abyss-concise.md +89 -0
  68. package/templates/output-styles/abyss-cultivator.md +302 -0
  69. package/templates/output-styles/abyss-ritual.md +70 -0
  70. package/templates/output-styles/engineer-professional.md +89 -0
  71. package/templates/output-styles/laowang-engineer.md +127 -0
  72. package/templates/output-styles/nekomata-engineer.md +120 -0
  73. package/templates/output-styles/ojousama-engineer.md +121 -0
  74. package/templates/prompts/claude/analyzer.md +59 -0
  75. package/templates/prompts/claude/architect.md +54 -0
  76. package/templates/prompts/claude/debugger.md +71 -0
  77. package/templates/prompts/claude/optimizer.md +73 -0
  78. package/templates/prompts/claude/reviewer.md +63 -0
  79. package/templates/prompts/claude/tester.md +69 -0
  80. package/templates/prompts/codex/analyzer.md +58 -0
  81. package/templates/prompts/codex/architect.md +54 -0
  82. package/templates/prompts/codex/debugger.md +74 -0
  83. package/templates/prompts/codex/optimizer.md +81 -0
  84. package/templates/prompts/codex/reviewer.md +73 -0
  85. package/templates/prompts/codex/tester.md +62 -0
  86. package/templates/prompts/gemini/analyzer.md +61 -0
  87. package/templates/prompts/gemini/architect.md +55 -0
  88. package/templates/prompts/gemini/debugger.md +78 -0
  89. package/templates/prompts/gemini/frontend.md +64 -0
  90. package/templates/prompts/gemini/optimizer.md +84 -0
  91. package/templates/prompts/gemini/reviewer.md +80 -0
  92. package/templates/prompts/gemini/tester.md +68 -0
  93. package/templates/rules/ccg-skill-routing.md +83 -0
  94. package/templates/rules/ccg-skills.md +71 -0
  95. package/templates/scripts/ccg-phase-runner-launcher.mjs +467 -0
  96. package/templates/scripts/invoke-model.mjs +949 -0
  97. package/templates/scripts/repatch-gemini-plugin.mjs +194 -0
  98. package/templates/skills/SKILL.md +92 -0
  99. package/templates/skills/domains/ai/SKILL.md +35 -0
  100. package/templates/skills/domains/ai/agent-dev.md +242 -0
  101. package/templates/skills/domains/ai/llm-security.md +288 -0
  102. package/templates/skills/domains/ai/prompt-and-eval.md +279 -0
  103. package/templates/skills/domains/ai/rag-system.md +542 -0
  104. package/templates/skills/domains/architecture/SKILL.md +43 -0
  105. package/templates/skills/domains/architecture/api-design.md +225 -0
  106. package/templates/skills/domains/architecture/caching.md +299 -0
  107. package/templates/skills/domains/architecture/cloud-native.md +285 -0
  108. package/templates/skills/domains/architecture/message-queue.md +329 -0
  109. package/templates/skills/domains/architecture/security-arch.md +297 -0
  110. package/templates/skills/domains/data-engineering/SKILL.md +208 -0
  111. package/templates/skills/domains/development/SKILL.md +47 -0
  112. package/templates/skills/domains/development/cpp.md +246 -0
  113. package/templates/skills/domains/development/go.md +323 -0
  114. package/templates/skills/domains/development/java.md +277 -0
  115. package/templates/skills/domains/development/python.md +288 -0
  116. package/templates/skills/domains/development/rust.md +313 -0
  117. package/templates/skills/domains/development/shell.md +313 -0
  118. package/templates/skills/domains/development/typescript.md +277 -0
  119. package/templates/skills/domains/devops/SKILL.md +40 -0
  120. package/templates/skills/domains/devops/cost-optimization.md +272 -0
  121. package/templates/skills/domains/devops/database.md +217 -0
  122. package/templates/skills/domains/devops/devsecops.md +198 -0
  123. package/templates/skills/domains/devops/git-workflow.md +181 -0
  124. package/templates/skills/domains/devops/observability.md +280 -0
  125. package/templates/skills/domains/devops/performance.md +336 -0
  126. package/templates/skills/domains/devops/testing.md +283 -0
  127. package/templates/skills/domains/frontend-design/SKILL.md +244 -0
  128. package/templates/skills/domains/frontend-design/agents/openai.yaml +4 -0
  129. package/templates/skills/domains/frontend-design/claymorphism/SKILL.md +121 -0
  130. package/templates/skills/domains/frontend-design/claymorphism/references/tokens.css +52 -0
  131. package/templates/skills/domains/frontend-design/component-patterns.md +202 -0
  132. package/templates/skills/domains/frontend-design/engineering.md +287 -0
  133. package/templates/skills/domains/frontend-design/glassmorphism/SKILL.md +142 -0
  134. package/templates/skills/domains/frontend-design/glassmorphism/references/tokens.css +32 -0
  135. package/templates/skills/domains/frontend-design/liquid-glass/SKILL.md +139 -0
  136. package/templates/skills/domains/frontend-design/liquid-glass/references/tokens.css +81 -0
  137. package/templates/skills/domains/frontend-design/neubrutalism/SKILL.md +145 -0
  138. package/templates/skills/domains/frontend-design/neubrutalism/references/tokens.css +44 -0
  139. package/templates/skills/domains/frontend-design/reference/color-and-contrast.md +132 -0
  140. package/templates/skills/domains/frontend-design/reference/interaction-design.md +195 -0
  141. package/templates/skills/domains/frontend-design/reference/motion-design.md +99 -0
  142. package/templates/skills/domains/frontend-design/reference/responsive-design.md +114 -0
  143. package/templates/skills/domains/frontend-design/reference/spatial-design.md +100 -0
  144. package/templates/skills/domains/frontend-design/reference/typography.md +133 -0
  145. package/templates/skills/domains/frontend-design/reference/ux-writing.md +107 -0
  146. package/templates/skills/domains/frontend-design/state-management.md +680 -0
  147. package/templates/skills/domains/frontend-design/ui-aesthetics.md +110 -0
  148. package/templates/skills/domains/frontend-design/ux-principles.md +156 -0
  149. package/templates/skills/domains/infrastructure/SKILL.md +201 -0
  150. package/templates/skills/domains/mobile/SKILL.md +225 -0
  151. package/templates/skills/domains/orchestration/SKILL.md +30 -0
  152. package/templates/skills/domains/orchestration/multi-agent.md +263 -0
  153. package/templates/skills/domains/security/SKILL.md +73 -0
  154. package/templates/skills/domains/security/blue-team.md +436 -0
  155. package/templates/skills/domains/security/code-audit.md +265 -0
  156. package/templates/skills/domains/security/pentest.md +226 -0
  157. package/templates/skills/domains/security/red-team.md +374 -0
  158. package/templates/skills/domains/security/threat-intel.md +372 -0
  159. package/templates/skills/domains/security/vuln-research.md +369 -0
  160. package/templates/skills/impeccable/adapt/SKILL.md +201 -0
  161. package/templates/skills/impeccable/animate/SKILL.md +176 -0
  162. package/templates/skills/impeccable/arrange/SKILL.md +126 -0
  163. package/templates/skills/impeccable/audit/SKILL.md +149 -0
  164. package/templates/skills/impeccable/bolder/SKILL.md +118 -0
  165. package/templates/skills/impeccable/clarify/SKILL.md +185 -0
  166. package/templates/skills/impeccable/colorize/SKILL.md +144 -0
  167. package/templates/skills/impeccable/critique/SKILL.md +203 -0
  168. package/templates/skills/impeccable/critique/reference/cognitive-load.md +106 -0
  169. package/templates/skills/impeccable/critique/reference/heuristics-scoring.md +234 -0
  170. package/templates/skills/impeccable/critique/reference/personas.md +178 -0
  171. package/templates/skills/impeccable/delight/SKILL.md +305 -0
  172. package/templates/skills/impeccable/distill/SKILL.md +123 -0
  173. package/templates/skills/impeccable/extract/SKILL.md +94 -0
  174. package/templates/skills/impeccable/harden/SKILL.md +357 -0
  175. package/templates/skills/impeccable/normalize/SKILL.md +72 -0
  176. package/templates/skills/impeccable/onboard/SKILL.md +248 -0
  177. package/templates/skills/impeccable/optimize/SKILL.md +268 -0
  178. package/templates/skills/impeccable/overdrive/SKILL.md +143 -0
  179. package/templates/skills/impeccable/polish/SKILL.md +205 -0
  180. package/templates/skills/impeccable/quieter/SKILL.md +104 -0
  181. package/templates/skills/impeccable/teach-impeccable/SKILL.md +72 -0
  182. package/templates/skills/impeccable/typeset/SKILL.md +117 -0
  183. package/templates/skills/orchestration/multi-agent/SKILL.md +533 -0
  184. package/templates/skills/run_skill.js +129 -0
  185. package/templates/skills/scrapling/SKILL.md +98 -0
  186. package/templates/skills/scrapling/references/api-quick-ref.md +127 -0
  187. package/templates/skills/scrapling/references/cookie-vault.md +56 -0
  188. package/templates/skills/scrapling/references/maintenance.md +79 -0
  189. package/templates/skills/scrapling/references/site-patterns.md +86 -0
  190. package/templates/skills/scrapling/references/troubleshooting.md +95 -0
  191. package/templates/skills/scrapling/templates/basic_fetch.py +19 -0
  192. package/templates/skills/scrapling/templates/parse_only.py +15 -0
  193. package/templates/skills/scrapling/templates/session_login.py +19 -0
  194. package/templates/skills/scrapling/templates/stealth_cloudflare.py +28 -0
  195. package/templates/skills/tools/extract-learnings/SKILL.md +77 -0
  196. package/templates/skills/tools/forensics/SKILL.md +89 -0
  197. package/templates/skills/tools/gen-docs/SKILL.md +116 -0
  198. package/templates/skills/tools/gen-docs/scripts/doc_generator.js +435 -0
  199. package/templates/skills/tools/health/SKILL.md +121 -0
  200. package/templates/skills/tools/lib/shared.js +98 -0
  201. package/templates/skills/tools/map-codebase/SKILL.md +118 -0
  202. package/templates/skills/tools/override-refusal/SKILL.md +53 -0
  203. package/templates/skills/tools/override-refusal/agents/openai.yaml +4 -0
  204. package/templates/skills/tools/override-refusal/scripts/refusal_rewriter.js +226 -0
  205. package/templates/skills/tools/verify-change/SKILL.md +143 -0
  206. package/templates/skills/tools/verify-change/scripts/change_analyzer.js +289 -0
  207. package/templates/skills/tools/verify-module/SKILL.md +130 -0
  208. package/templates/skills/tools/verify-module/scripts/module_scanner.js +171 -0
  209. package/templates/skills/tools/verify-quality/SKILL.md +163 -0
  210. package/templates/skills/tools/verify-quality/scripts/quality_checker.js +337 -0
  211. package/templates/skills/tools/verify-security/SKILL.md +146 -0
  212. package/templates/skills/tools/verify-security/scripts/security_scanner.js +283 -0
@@ -0,0 +1,357 @@
1
+ ---
2
+ name: harden
3
+ description: "harden 加固:改善 error handling/i18n/text overflow/edge cases,让界面 production-ready。"
4
+ argument-hint: "[target]"
5
+ user-invocable: true
6
+ context: fork
7
+ paths: "*.tsx,*.jsx,*.vue,*.svelte,*.css,*.scss"
8
+ ---
9
+
10
+ Strengthen interfaces against edge cases, errors, internationalization issues, and real-world usage scenarios that break idealized designs.
11
+
12
+ ## Assess Hardening Needs
13
+
14
+ Identify weaknesses and edge cases:
15
+
16
+ 1. **Test with extreme inputs**:
17
+ - Very long text (names, descriptions, titles)
18
+ - Very short text (empty, single character)
19
+ - Special characters (emoji, RTL text, accents)
20
+ - Large numbers (millions, billions)
21
+ - Many items (1000+ list items, 50+ options)
22
+ - No data (empty states)
23
+
24
+ 2. **Test error scenarios**:
25
+ - Network failures (offline, slow, timeout)
26
+ - API errors (400, 401, 403, 404, 500)
27
+ - Validation errors
28
+ - Permission errors
29
+ - Rate limiting
30
+ - Concurrent operations
31
+
32
+ 3. **Test internationalization**:
33
+ - Long translations (German is often 30% longer than English)
34
+ - RTL languages (Arabic, Hebrew)
35
+ - Character sets (Chinese, Japanese, Korean, emoji)
36
+ - Date/time formats
37
+ - Number formats (1,000 vs 1.000)
38
+ - Currency symbols
39
+
40
+ **CRITICAL**: Designs that only work with perfect data aren't production-ready. Harden against reality.
41
+
42
+ ## Hardening Dimensions
43
+
44
+ Systematically improve resilience:
45
+
46
+ ### Text Overflow & Wrapping
47
+
48
+ **Long text handling**:
49
+ ```css
50
+ /* Single line with ellipsis */
51
+ .truncate {
52
+ overflow: hidden;
53
+ text-overflow: ellipsis;
54
+ white-space: nowrap;
55
+ }
56
+
57
+ /* Multi-line with clamp */
58
+ .line-clamp {
59
+ display: -webkit-box;
60
+ -webkit-line-clamp: 3;
61
+ -webkit-box-orient: vertical;
62
+ overflow: hidden;
63
+ }
64
+
65
+ /* Allow wrapping */
66
+ .wrap {
67
+ word-wrap: break-word;
68
+ overflow-wrap: break-word;
69
+ hyphens: auto;
70
+ }
71
+ ```
72
+
73
+ **Flex/Grid overflow**:
74
+ ```css
75
+ /* Prevent flex items from overflowing */
76
+ .flex-item {
77
+ min-width: 0; /* Allow shrinking below content size */
78
+ overflow: hidden;
79
+ }
80
+
81
+ /* Prevent grid items from overflowing */
82
+ .grid-item {
83
+ min-width: 0;
84
+ min-height: 0;
85
+ }
86
+ ```
87
+
88
+ **Responsive text sizing**:
89
+ - Use `clamp()` for fluid typography
90
+ - Set minimum readable sizes (14px on mobile)
91
+ - Test text scaling (zoom to 200%)
92
+ - Ensure containers expand with text
93
+
94
+ ### Internationalization (i18n)
95
+
96
+ **Text expansion**:
97
+ - Add 30-40% space budget for translations
98
+ - Use flexbox/grid that adapts to content
99
+ - Test with longest language (usually German)
100
+ - Avoid fixed widths on text containers
101
+
102
+ ```jsx
103
+ // ❌ Bad: Assumes short English text
104
+ <button className="w-24">Submit</button>
105
+
106
+ // ✅ Good: Adapts to content
107
+ <button className="px-4 py-2">Submit</button>
108
+ ```
109
+
110
+ **RTL (Right-to-Left) support**:
111
+ ```css
112
+ /* Use logical properties */
113
+ margin-inline-start: 1rem; /* Not margin-left */
114
+ padding-inline: 1rem; /* Not padding-left/right */
115
+ border-inline-end: 1px solid; /* Not border-right */
116
+
117
+ /* Or use dir attribute */
118
+ [dir="rtl"] .arrow { transform: scaleX(-1); }
119
+ ```
120
+
121
+ **Character set support**:
122
+ - Use UTF-8 encoding everywhere
123
+ - Test with Chinese/Japanese/Korean (CJK) characters
124
+ - Test with emoji (they can be 2-4 bytes)
125
+ - Handle different scripts (Latin, Cyrillic, Arabic, etc.)
126
+
127
+ **Date/Time formatting**:
128
+ ```javascript
129
+ // ✅ Use Intl API for proper formatting
130
+ new Intl.DateTimeFormat('en-US').format(date); // 1/15/2024
131
+ new Intl.DateTimeFormat('de-DE').format(date); // 15.1.2024
132
+
133
+ new Intl.NumberFormat('en-US', {
134
+ style: 'currency',
135
+ currency: 'USD'
136
+ }).format(1234.56); // $1,234.56
137
+ ```
138
+
139
+ **Pluralization**:
140
+ ```javascript
141
+ // ❌ Bad: Assumes English pluralization
142
+ `${count} item${count !== 1 ? 's' : ''}`
143
+
144
+ // ✅ Good: Use proper i18n library
145
+ t('items', { count }) // Handles complex plural rules
146
+ ```
147
+
148
+ ### Error Handling
149
+
150
+ **Network errors**:
151
+ - Show clear error messages
152
+ - Provide retry button
153
+ - Explain what happened
154
+ - Offer offline mode (if applicable)
155
+ - Handle timeout scenarios
156
+
157
+ ```jsx
158
+ // Error states with recovery
159
+ {error && (
160
+ <ErrorMessage>
161
+ <p>Failed to load data. {error.message}</p>
162
+ <button onClick={retry}>Try again</button>
163
+ </ErrorMessage>
164
+ )}
165
+ ```
166
+
167
+ **Form validation errors**:
168
+ - Inline errors near fields
169
+ - Clear, specific messages
170
+ - Suggest corrections
171
+ - Don't block submission unnecessarily
172
+ - Preserve user input on error
173
+
174
+ **API errors**:
175
+ - Handle each status code appropriately
176
+ - 400: Show validation errors
177
+ - 401: Redirect to login
178
+ - 403: Show permission error
179
+ - 404: Show not found state
180
+ - 429: Show rate limit message
181
+ - 500: Show generic error, offer support
182
+
183
+ **Graceful degradation**:
184
+ - Core functionality works without JavaScript
185
+ - Images have alt text
186
+ - Progressive enhancement
187
+ - Fallbacks for unsupported features
188
+
189
+ ### Edge Cases & Boundary Conditions
190
+
191
+ **Empty states**:
192
+ - No items in list
193
+ - No search results
194
+ - No notifications
195
+ - No data to display
196
+ - Provide clear next action
197
+
198
+ **Loading states**:
199
+ - Initial load
200
+ - Pagination load
201
+ - Refresh
202
+ - Show what's loading ("Loading your projects...")
203
+ - Time estimates for long operations
204
+
205
+ **Large datasets**:
206
+ - Pagination or virtual scrolling
207
+ - Search/filter capabilities
208
+ - Performance optimization
209
+ - Don't load all 10,000 items at once
210
+
211
+ **Concurrent operations**:
212
+ - Prevent double-submission (disable button while loading)
213
+ - Handle race conditions
214
+ - Optimistic updates with rollback
215
+ - Conflict resolution
216
+
217
+ **Permission states**:
218
+ - No permission to view
219
+ - No permission to edit
220
+ - Read-only mode
221
+ - Clear explanation of why
222
+
223
+ **Browser compatibility**:
224
+ - Polyfills for modern features
225
+ - Fallbacks for unsupported CSS
226
+ - Feature detection (not browser detection)
227
+ - Test in target browsers
228
+
229
+ ### Input Validation & Sanitization
230
+
231
+ **Client-side validation**:
232
+ - Required fields
233
+ - Format validation (email, phone, URL)
234
+ - Length limits
235
+ - Pattern matching
236
+ - Custom validation rules
237
+
238
+ **Server-side validation** (always):
239
+ - Never trust client-side only
240
+ - Validate and sanitize all inputs
241
+ - Protect against injection attacks
242
+ - Rate limiting
243
+
244
+ **Constraint handling**:
245
+ ```html
246
+ <!-- Set clear constraints -->
247
+ <input
248
+ type="text"
249
+ maxlength="100"
250
+ pattern="[A-Za-z0-9]+"
251
+ required
252
+ aria-describedby="username-hint"
253
+ />
254
+ <small id="username-hint">
255
+ Letters and numbers only, up to 100 characters
256
+ </small>
257
+ ```
258
+
259
+ ### Accessibility Resilience
260
+
261
+ **Keyboard navigation**:
262
+ - All functionality accessible via keyboard
263
+ - Logical tab order
264
+ - Focus management in modals
265
+ - Skip links for long content
266
+
267
+ **Screen reader support**:
268
+ - Proper ARIA labels
269
+ - Announce dynamic changes (live regions)
270
+ - Descriptive alt text
271
+ - Semantic HTML
272
+
273
+ **Motion sensitivity**:
274
+ ```css
275
+ @media (prefers-reduced-motion: reduce) {
276
+ * {
277
+ animation-duration: 0.01ms !important;
278
+ animation-iteration-count: 1 !important;
279
+ transition-duration: 0.01ms !important;
280
+ }
281
+ }
282
+ ```
283
+
284
+ **High contrast mode**:
285
+ - Test in Windows high contrast mode
286
+ - Don't rely only on color
287
+ - Provide alternative visual cues
288
+
289
+ ### Performance Resilience
290
+
291
+ **Slow connections**:
292
+ - Progressive image loading
293
+ - Skeleton screens
294
+ - Optimistic UI updates
295
+ - Offline support (service workers)
296
+
297
+ **Memory leaks**:
298
+ - Clean up event listeners
299
+ - Cancel subscriptions
300
+ - Clear timers/intervals
301
+ - Abort pending requests on unmount
302
+
303
+ **Throttling & Debouncing**:
304
+ ```javascript
305
+ // Debounce search input
306
+ const debouncedSearch = debounce(handleSearch, 300);
307
+
308
+ // Throttle scroll handler
309
+ const throttledScroll = throttle(handleScroll, 100);
310
+ ```
311
+
312
+ ## Testing Strategies
313
+
314
+ **Manual testing**:
315
+ - Test with extreme data (very long, very short, empty)
316
+ - Test in different languages
317
+ - Test offline
318
+ - Test slow connection (throttle to 3G)
319
+ - Test with screen reader
320
+ - Test keyboard-only navigation
321
+ - Test on old browsers
322
+
323
+ **Automated testing**:
324
+ - Unit tests for edge cases
325
+ - Integration tests for error scenarios
326
+ - E2E tests for critical paths
327
+ - Visual regression tests
328
+ - Accessibility tests (axe, WAVE)
329
+
330
+ **IMPORTANT**: Hardening is about expecting the unexpected. Real users will do things you never imagined.
331
+
332
+ **NEVER**:
333
+ - Assume perfect input (validate everything)
334
+ - Ignore internationalization (design for global)
335
+ - Leave error messages generic ("Error occurred")
336
+ - Forget offline scenarios
337
+ - Trust client-side validation alone
338
+ - Use fixed widths for text
339
+ - Assume English-length text
340
+ - Block entire interface when one component errors
341
+
342
+ ## Verify Hardening
343
+
344
+ Test thoroughly with edge cases:
345
+
346
+ - **Long text**: Try names with 100+ characters
347
+ - **Emoji**: Use emoji in all text fields
348
+ - **RTL**: Test with Arabic or Hebrew
349
+ - **CJK**: Test with Chinese/Japanese/Korean
350
+ - **Network issues**: Disable internet, throttle connection
351
+ - **Large datasets**: Test with 1000+ items
352
+ - **Concurrent actions**: Click submit 10 times rapidly
353
+ - **Errors**: Force API errors, test all error states
354
+ - **Empty**: Remove all data, test empty states
355
+
356
+ Remember: You're hardening for production reality, not demo perfection. Expect users to input weird data, lose connection mid-flow, and use your product in unexpected ways. Build resilience into every component.
357
+
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: normalize
3
+ description: "normalize 对齐:审计 UI 并对齐 design system 的 spacing/tokens/patterns 标准。"
4
+ argument-hint: "[feature (page, route, component...)]"
5
+ user-invocable: true
6
+ context: fork
7
+ paths: "*.tsx,*.jsx,*.vue,*.svelte,*.css,*.scss"
8
+ ---
9
+
10
+ Analyze and redesign the feature to perfectly match our design system standards, aesthetics, and established patterns.
11
+
12
+ ## MANDATORY PREPARATION
13
+
14
+ Invoke /frontend-design — it contains design principles, anti-patterns, and the **Context Gathering Protocol**. Follow the protocol before proceeding — if no design context exists yet, you MUST run /teach-impeccable first.
15
+
16
+ ---
17
+
18
+ ## Plan
19
+
20
+ Before making changes, deeply understand the context:
21
+
22
+ 1. **Discover the design system**: Search for design system documentation, UI guidelines, component libraries, or style guides (grep for "design system", "ui guide", "style guide", etc.). Study it thoroughly until you understand:
23
+ - Core design principles and aesthetic direction
24
+ - Target audience and personas
25
+ - Component patterns and conventions
26
+ - Design tokens (colors, typography, spacing)
27
+
28
+ **CRITICAL**: If something isn't clear, ask. Don't guess at design system principles.
29
+
30
+ 2. **Analyze the current feature**: Assess what works and what doesn't:
31
+ - Where does it deviate from design system patterns?
32
+ - Which inconsistencies are cosmetic vs. functional?
33
+ - What's the root cause—missing tokens, one-off implementations, or conceptual misalignment?
34
+
35
+ 3. **Create a normalization plan**: Define specific changes that will align the feature with the design system:
36
+ - Which components can be replaced with design system equivalents?
37
+ - Which styles need to use design tokens instead of hard-coded values?
38
+ - How can UX patterns match established user flows?
39
+
40
+ **IMPORTANT**: Great design is effective design. Prioritize UX consistency and usability over visual polish alone. Think through the best possible experience for your use case and personas first.
41
+
42
+ ## Execute
43
+
44
+ Systematically address all inconsistencies across these dimensions:
45
+
46
+ - **Typography**: Use design system fonts, sizes, weights, and line heights. Replace hard-coded values with typographic tokens or classes.
47
+ - **Color & Theme**: Apply design system color tokens. Remove one-off color choices that break the palette.
48
+ - **Spacing & Layout**: Use spacing tokens (margins, padding, gaps). Align with grid systems and layout patterns used elsewhere.
49
+ - **Components**: Replace custom implementations with design system components. Ensure props and variants match established patterns.
50
+ - **Motion & Interaction**: Match animation timing, easing, and interaction patterns to other features.
51
+ - **Responsive Behavior**: Ensure breakpoints and responsive patterns align with design system standards.
52
+ - **Accessibility**: Verify contrast ratios, focus states, ARIA labels match design system requirements.
53
+ - **Progressive Disclosure**: Match information hierarchy and complexity management to established patterns.
54
+
55
+ **NEVER**:
56
+ - Create new one-off components when design system equivalents exist
57
+ - Hard-code values that should use design tokens
58
+ - Introduce new patterns that diverge from the design system
59
+ - Compromise accessibility for visual consistency
60
+
61
+ This is not an exhaustive list—apply judgment to identify all areas needing normalization.
62
+
63
+ ## Clean Up
64
+
65
+ After normalization, ensure code quality:
66
+
67
+ - **Consolidate reusable components**: If you created new components that should be shared, move them to the design system or shared UI component path.
68
+ - **Remove orphaned code**: Delete unused implementations, styles, or files made obsolete by normalization.
69
+ - **Verify quality**: Lint, type-check, and test according to repository guidelines. Ensure normalization didn't introduce regressions.
70
+ - **Ensure DRYness**: Look for duplication introduced during refactoring and consolidate.
71
+
72
+ Remember: You are a brilliant frontend designer with impeccable taste, equally strong in UX and UI. Your attention to detail and eye for end-to-end user experience is world class. Execute with precision and thoroughness.
@@ -0,0 +1,248 @@
1
+ ---
2
+ name: onboard
3
+ description: "onboard 引导:设计 onboarding flows/empty states/first-run,帮新用户快速触达价值。"
4
+ argument-hint: "[target]"
5
+ user-invocable: true
6
+ context: fork
7
+ paths: "*.tsx,*.jsx,*.vue,*.svelte,*.css,*.scss"
8
+ ---
9
+
10
+ ## MANDATORY PREPARATION
11
+
12
+ Invoke /frontend-design — it contains design principles, anti-patterns, and the **Context Gathering Protocol**. Follow the protocol before proceeding — if no design context exists yet, you MUST run /teach-impeccable first. Additionally gather: the "aha moment" you want users to reach, and users' experience level.
13
+
14
+ ---
15
+
16
+ Create or improve onboarding experiences that help users understand, adopt, and succeed with the product quickly.
17
+
18
+ ## Assess Onboarding Needs
19
+
20
+ Understand what users need to learn and why:
21
+
22
+ 1. **Identify the challenge**:
23
+ - What are users trying to accomplish?
24
+ - What's confusing or unclear about current experience?
25
+ - Where do users get stuck or drop off?
26
+ - What's the "aha moment" we want users to reach?
27
+
28
+ 2. **Understand the users**:
29
+ - What's their experience level? (Beginners, power users, mixed?)
30
+ - What's their motivation? (Excited and exploring? Required by work?)
31
+ - What's their time commitment? (5 minutes? 30 minutes?)
32
+ - What alternatives do they know? (Coming from competitor? New to category?)
33
+
34
+ 3. **Define success**:
35
+ - What's the minimum users need to learn to be successful?
36
+ - What's the key action we want them to take? (First project? First invite?)
37
+ - How do we know onboarding worked? (Completion rate? Time to value?)
38
+
39
+ **CRITICAL**: Onboarding should get users to value as quickly as possible, not teach everything possible.
40
+
41
+ ## Onboarding Principles
42
+
43
+ Follow these core principles:
44
+
45
+ ### Show, Don't Tell
46
+ - Demonstrate with working examples, not just descriptions
47
+ - Provide real functionality in onboarding, not separate tutorial mode
48
+ - Use progressive disclosure - teach one thing at a time
49
+
50
+ ### Make It Optional (When Possible)
51
+ - Let experienced users skip onboarding
52
+ - Don't block access to product
53
+ - Provide "Skip" or "I'll explore on my own" options
54
+
55
+ ### Time to Value
56
+ - Get users to their "aha moment" ASAP
57
+ - Front-load most important concepts
58
+ - Teach 20% that delivers 80% of value
59
+ - Save advanced features for contextual discovery
60
+
61
+ ### Context Over Ceremony
62
+ - Teach features when users need them, not upfront
63
+ - Empty states are onboarding opportunities
64
+ - Tooltips and hints at point of use
65
+
66
+ ### Respect User Intelligence
67
+ - Don't patronize or over-explain
68
+ - Be concise and clear
69
+ - Assume users can figure out standard patterns
70
+
71
+ ## Design Onboarding Experiences
72
+
73
+ Create appropriate onboarding for the context:
74
+
75
+ ### Initial Product Onboarding
76
+
77
+ **Welcome Screen**:
78
+ - Clear value proposition (what is this product?)
79
+ - What users will learn/accomplish
80
+ - Time estimate (honest about commitment)
81
+ - Option to skip (for experienced users)
82
+
83
+ **Account Setup**:
84
+ - Minimal required information (collect more later)
85
+ - Explain why you're asking for each piece of information
86
+ - Smart defaults where possible
87
+ - Social login when appropriate
88
+
89
+ **Core Concept Introduction**:
90
+ - Introduce 1-3 core concepts (not everything)
91
+ - Use simple language and examples
92
+ - Interactive when possible (do, don't just read)
93
+ - Progress indication (step 1 of 3)
94
+
95
+ **First Success**:
96
+ - Guide users to accomplish something real
97
+ - Pre-populated examples or templates
98
+ - Celebrate completion (but don't overdo it)
99
+ - Clear next steps
100
+
101
+ ### Feature Discovery & Adoption
102
+
103
+ **Empty States**:
104
+ Instead of blank space, show:
105
+ - What will appear here (description + screenshot/illustration)
106
+ - Why it's valuable
107
+ - Clear CTA to create first item
108
+ - Example or template option
109
+
110
+ Example:
111
+ ```
112
+ No projects yet
113
+ Projects help you organize your work and collaborate with your team.
114
+ [Create your first project] or [Start from template]
115
+ ```
116
+
117
+ **Contextual Tooltips**:
118
+ - Appear at relevant moment (first time user sees feature)
119
+ - Point directly at relevant UI element
120
+ - Brief explanation + benefit
121
+ - Dismissable (with "Don't show again" option)
122
+ - Optional "Learn more" link
123
+
124
+ **Feature Announcements**:
125
+ - Highlight new features when they're released
126
+ - Show what's new and why it matters
127
+ - Let users try immediately
128
+ - Dismissable
129
+
130
+ **Progressive Onboarding**:
131
+ - Teach features when users encounter them
132
+ - Badges or indicators on new/unused features
133
+ - Unlock complexity gradually (don't show all options immediately)
134
+
135
+ ### Guided Tours & Walkthroughs
136
+
137
+ **When to use**:
138
+ - Complex interfaces with many features
139
+ - Significant changes to existing product
140
+ - Industry-specific tools needing domain knowledge
141
+
142
+ **How to design**:
143
+ - Spotlight specific UI elements (dim rest of page)
144
+ - Keep steps short (3-7 steps max per tour)
145
+ - Allow users to click through tour freely
146
+ - Include "Skip tour" option
147
+ - Make replayable (help menu)
148
+
149
+ **Best practices**:
150
+ - Interactive > passive (let users click real buttons)
151
+ - Focus on workflow, not features ("Create a project" not "This is the project button")
152
+ - Provide sample data so actions work
153
+
154
+ ### Interactive Tutorials
155
+
156
+ **When to use**:
157
+ - Users need hands-on practice
158
+ - Concepts are complex or unfamiliar
159
+ - High stakes (better to practice in safe environment)
160
+
161
+ **How to design**:
162
+ - Sandbox environment with sample data
163
+ - Clear objectives ("Create a chart showing sales by region")
164
+ - Step-by-step guidance
165
+ - Validation (confirm they did it right)
166
+ - Graduation moment (you're ready!)
167
+
168
+ ### Documentation & Help
169
+
170
+ **In-product help**:
171
+ - Contextual help links throughout interface
172
+ - Keyboard shortcut reference
173
+ - Search-able help center
174
+ - Video tutorials for complex workflows
175
+
176
+ **Help patterns**:
177
+ - `?` icon near complex features
178
+ - "Learn more" links in tooltips
179
+ - Keyboard shortcut hints (`⌘K` shown on search box)
180
+
181
+ ## Empty State Design
182
+
183
+ Every empty state needs:
184
+
185
+ ### What Will Be Here
186
+ "Your recent projects will appear here"
187
+
188
+ ### Why It Matters
189
+ "Projects help you organize your work and collaborate with your team"
190
+
191
+ ### How to Get Started
192
+ [Create project] or [Import from template]
193
+
194
+ ### Visual Interest
195
+ Illustration or icon (not just text on blank page)
196
+
197
+ ### Contextual Help
198
+ "Need help getting started? [Watch 2-min tutorial]"
199
+
200
+ **Empty state types**:
201
+ - **First use**: Never used this feature (emphasize value, provide template)
202
+ - **User cleared**: Intentionally deleted everything (light touch, easy to recreate)
203
+ - **No results**: Search or filter returned nothing (suggest different query, clear filters)
204
+ - **No permissions**: Can't access (explain why, how to get access)
205
+ - **Error state**: Failed to load (explain what happened, retry option)
206
+
207
+ ## Implementation Patterns
208
+
209
+ ### Technical approaches:
210
+
211
+ **Tooltip libraries**: Tippy.js, Popper.js
212
+ **Tour libraries**: Intro.js, Shepherd.js, React Joyride
213
+ **Modal patterns**: Focus trap, backdrop, ESC to close
214
+ **Progress tracking**: LocalStorage for "seen" states
215
+ **Analytics**: Track completion, drop-off points
216
+
217
+ **Storage patterns**:
218
+ ```javascript
219
+ // Track which onboarding steps user has seen
220
+ localStorage.setItem('onboarding-completed', 'true');
221
+ localStorage.setItem('feature-tooltip-seen-reports', 'true');
222
+ ```
223
+
224
+ **IMPORTANT**: Don't show same onboarding twice (annoying). Track completion and respect dismissals.
225
+
226
+ **NEVER**:
227
+ - Force users through long onboarding before they can use product
228
+ - Patronize users with obvious explanations
229
+ - Show same tooltip repeatedly (respect dismissals)
230
+ - Block all UI during tour (let users explore)
231
+ - Create separate tutorial mode disconnected from real product
232
+ - Overwhelm with information upfront (progressive disclosure!)
233
+ - Hide "Skip" or make it hard to find
234
+ - Forget about returning users (don't show initial onboarding again)
235
+
236
+ ## Verify Onboarding Quality
237
+
238
+ Test with real users:
239
+
240
+ - **Time to completion**: Can users complete onboarding quickly?
241
+ - **Comprehension**: Do users understand after completing?
242
+ - **Action**: Do users take desired next step?
243
+ - **Skip rate**: Are too many users skipping? (Maybe it's too long/not valuable)
244
+ - **Completion rate**: Are users completing? (If low, simplify)
245
+ - **Time to value**: How long until users get first value?
246
+
247
+ Remember: You're a product educator with excellent teaching instincts. Get users to their "aha moment" as quickly as possible. Teach the essential, make it contextual, respect user time and intelligence.
248
+