@bovinphang/frontend-craft 2.6.0 → 2.8.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 (414) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +72 -1
  4. package/CHANGELOG.zh-CN.md +71 -1
  5. package/README.md +10 -6
  6. package/README.openclaw.md +100 -42
  7. package/README.openclaw.zh-CN.md +100 -42
  8. package/README.zh-CN.md +10 -6
  9. package/agents/fec-architect.md +70 -70
  10. package/agents/fec-code-reviewer.md +82 -82
  11. package/agents/fec-debugger.md +20 -20
  12. package/agents/fec-design-token-mapper.md +36 -36
  13. package/agents/fec-doc-updater.md +13 -13
  14. package/agents/fec-e2e-runner.md +45 -45
  15. package/agents/fec-figma-implementer.md +59 -59
  16. package/agents/fec-performance-optimizer.md +128 -128
  17. package/agents/fec-refactor-cleaner.md +14 -14
  18. package/agents/fec-security-reviewer.md +66 -67
  19. package/agents/fec-test-planner.md +27 -27
  20. package/agents/fec-typescript-reviewer.md +88 -88
  21. package/agents/fec-ui-checker.md +74 -74
  22. package/commands/fec-debug.md +19 -19
  23. package/commands/fec-doc-sync.md +11 -11
  24. package/commands/fec-init.md +37 -38
  25. package/commands/fec-plan.md +58 -58
  26. package/commands/fec-refactor-clean.md +11 -11
  27. package/commands/fec-review.md +41 -41
  28. package/commands/fec-scaffold.md +41 -41
  29. package/commands/fec-tdd.md +13 -13
  30. package/dist/bin/frontend-craft.js +29 -27
  31. package/docs/example-prompts.md +84 -69
  32. package/docs/ja-JP/README.md +56 -52
  33. package/docs/ko-KR/README.md +45 -41
  34. package/docs/project-structure.md +19 -7
  35. package/docs/superpowers/plans/2026-05-29-fec-debug.md +491 -0
  36. package/docs/superpowers/specs/2026-05-29-fec-debug-design.md +340 -0
  37. package/docs/zh-CN/example-prompts.md +84 -69
  38. package/docs/zh-CN/project-structure.md +14 -5
  39. package/docs/zh-TW/README.md +33 -29
  40. package/localized/zh-CN/agents/fec-architect.md +125 -0
  41. package/localized/zh-CN/agents/fec-code-reviewer.md +152 -0
  42. package/localized/zh-CN/agents/fec-debugger.md +44 -0
  43. package/localized/zh-CN/agents/fec-design-token-mapper.md +75 -0
  44. package/localized/zh-CN/agents/fec-doc-updater.md +30 -0
  45. package/localized/zh-CN/agents/fec-e2e-runner.md +107 -0
  46. package/localized/zh-CN/agents/fec-figma-implementer.md +104 -0
  47. package/localized/zh-CN/agents/fec-performance-optimizer.md +293 -0
  48. package/localized/zh-CN/agents/fec-refactor-cleaner.md +32 -0
  49. package/localized/zh-CN/agents/fec-security-reviewer.md +116 -0
  50. package/localized/zh-CN/agents/fec-test-planner.md +50 -0
  51. package/localized/zh-CN/agents/fec-typescript-reviewer.md +142 -0
  52. package/localized/zh-CN/agents/fec-ui-checker.md +120 -0
  53. package/localized/zh-CN/commands/fec-debug.md +30 -0
  54. package/localized/zh-CN/commands/fec-doc-sync.md +19 -0
  55. package/localized/zh-CN/commands/fec-init.md +70 -0
  56. package/localized/zh-CN/commands/fec-plan.md +94 -0
  57. package/localized/zh-CN/commands/fec-refactor-clean.md +19 -0
  58. package/localized/zh-CN/commands/fec-review.md +66 -0
  59. package/localized/zh-CN/commands/fec-scaffold.md +205 -0
  60. package/localized/zh-CN/commands/fec-tdd.md +21 -0
  61. package/localized/zh-CN/skills/TEMPLATE.md +155 -0
  62. package/localized/zh-CN/skills/eval_queries.json +1013 -0
  63. package/localized/zh-CN/skills/fec-accessibility-check/SKILL.md +39 -0
  64. package/localized/zh-CN/skills/fec-accessibility-check/references/report-template.md +23 -0
  65. package/localized/zh-CN/skills/fec-accessibility-check/references/screen-reader-testing.md +33 -0
  66. package/localized/zh-CN/skills/fec-alchemy/SKILL.md +74 -0
  67. package/localized/zh-CN/skills/fec-alchemy/assets/absorption-plan-template.md +47 -0
  68. package/localized/zh-CN/skills/fec-alchemy/assets/intake-template.md +55 -0
  69. package/localized/zh-CN/skills/fec-alchemy/assets/review-checklist.md +31 -0
  70. package/localized/zh-CN/skills/fec-alchemy/references/methodology.md +94 -0
  71. package/localized/zh-CN/skills/fec-alchemy/references/originality-and-licensing.md +57 -0
  72. package/localized/zh-CN/skills/fec-api-integration/SKILL.md +78 -0
  73. package/localized/zh-CN/skills/fec-api-integration/references/integration-patterns.md +80 -0
  74. package/localized/zh-CN/skills/fec-backend-requirements-handoff/SKILL.md +45 -0
  75. package/localized/zh-CN/skills/fec-browser-storage/SKILL.md +34 -0
  76. package/localized/zh-CN/skills/fec-browser-storage/references/storage-patterns.md +65 -0
  77. package/localized/zh-CN/skills/fec-canvas-threejs/SKILL.md +66 -0
  78. package/localized/zh-CN/skills/fec-canvas-threejs/references/rendering-patterns.md +67 -0
  79. package/localized/zh-CN/skills/fec-canvas-threejs/references/shader-webgl-patterns.md +67 -0
  80. package/localized/zh-CN/skills/fec-code-review/SKILL.md +143 -0
  81. package/localized/zh-CN/skills/fec-code-review/references/report-template.md +29 -0
  82. package/localized/zh-CN/skills/fec-component-testing/SKILL.md +119 -0
  83. package/localized/zh-CN/skills/fec-data-fetching/SKILL.md +62 -0
  84. package/localized/zh-CN/skills/fec-data-fetching/references/query-patterns.md +103 -0
  85. package/localized/zh-CN/skills/fec-debug-framework/SKILL.md +157 -0
  86. package/localized/zh-CN/skills/fec-debug-framework/references/report-template.md +58 -0
  87. package/localized/zh-CN/skills/fec-dependency-upgrade/SKILL.md +34 -0
  88. package/localized/zh-CN/skills/fec-dependency-upgrade/references/dependency-upgrade-workflow.md +56 -0
  89. package/localized/zh-CN/skills/fec-doc-sync/SKILL.md +39 -0
  90. package/localized/zh-CN/skills/fec-drawio-studio/SKILL.md +73 -0
  91. package/localized/zh-CN/skills/fec-drawio-studio/data/THIRD_PARTY_NOTICES.md +10 -0
  92. package/localized/zh-CN/skills/fec-drawio-studio/data/brand-icons.json +878 -0
  93. package/localized/zh-CN/skills/fec-drawio-studio/data/shape-index.json +83570 -0
  94. package/localized/zh-CN/skills/fec-drawio-studio/references/data-residency.md +27 -0
  95. package/localized/zh-CN/skills/fec-drawio-studio/references/diagram-patterns.md +60 -0
  96. package/localized/zh-CN/skills/fec-drawio-studio/references/flowchart-quality.md +49 -0
  97. package/localized/zh-CN/skills/fec-drawio-studio/references/layout-and-export.md +72 -0
  98. package/localized/zh-CN/skills/fec-drawio-studio/references/troubleshooting.md +29 -0
  99. package/localized/zh-CN/skills/fec-drawio-studio/references/xml-and-mermaid.md +58 -0
  100. package/localized/zh-CN/skills/fec-drawio-studio/scripts/brand-symbols.mjs +99 -0
  101. package/localized/zh-CN/skills/fec-drawio-studio/scripts/diagram-lint.mjs +205 -0
  102. package/localized/zh-CN/skills/fec-drawio-studio/scripts/diagram-url.mjs +102 -0
  103. package/localized/zh-CN/skills/fec-drawio-studio/scripts/drawio-export.mjs +134 -0
  104. package/localized/zh-CN/skills/fec-drawio-studio/scripts/layout-graph.mjs +107 -0
  105. package/localized/zh-CN/skills/fec-drawio-studio/scripts/png-embed-fix.mjs +26 -0
  106. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-go-packages.mjs +36 -0
  107. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-js-modules.mjs +52 -0
  108. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-python-classes.mjs +30 -0
  109. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-python-modules.mjs +55 -0
  110. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-rust-modules.mjs +35 -0
  111. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-ts-modules.mjs +7 -0
  112. package/localized/zh-CN/skills/fec-drawio-studio/scripts/shape-query.mjs +121 -0
  113. package/localized/zh-CN/skills/fec-drawio-studio/scripts/studio-core.mjs +139 -0
  114. package/localized/zh-CN/skills/fec-drawio-studio/styles/built-in/corporate.json +49 -0
  115. package/localized/zh-CN/skills/fec-drawio-studio/styles/built-in/default.json +49 -0
  116. package/localized/zh-CN/skills/fec-drawio-studio/styles/built-in/handdrawn.json +49 -0
  117. package/localized/zh-CN/skills/fec-drawio-studio/styles/schema.json +112 -0
  118. package/localized/zh-CN/skills/fec-e2e-testing/SKILL.md +42 -0
  119. package/localized/zh-CN/skills/fec-e2e-testing/references/e2e-ci-reporting.md +62 -0
  120. package/localized/zh-CN/skills/fec-e2e-testing/references/e2e-special-scenarios.md +52 -0
  121. package/localized/zh-CN/skills/fec-e2e-testing/references/e2e-visual-regression.md +60 -0
  122. package/localized/zh-CN/skills/fec-e2e-testing/references/playwright-patterns.md +95 -0
  123. package/localized/zh-CN/skills/fec-form-handling/SKILL.md +76 -0
  124. package/localized/zh-CN/skills/fec-form-handling/references/advanced-form-patterns.md +101 -0
  125. package/localized/zh-CN/skills/fec-image-generation/SKILL.md +80 -0
  126. package/localized/zh-CN/skills/fec-image-generation/assets/interactive-diagram.html +371 -0
  127. package/localized/zh-CN/skills/fec-image-generation/references/artifact-routing.md +80 -0
  128. package/localized/zh-CN/skills/fec-image-generation/references/diagram-workflows.md +74 -0
  129. package/localized/zh-CN/skills/fec-image-generation/references/html-technical-diagrams.md +236 -0
  130. package/localized/zh-CN/skills/fec-image-generation/references/png-qa-autofix.md +30 -0
  131. package/localized/zh-CN/skills/fec-image-generation/scripts/export-diagram.mjs +364 -0
  132. package/localized/zh-CN/skills/fec-image-generation/scripts/interactive-diagram-server.mjs +654 -0
  133. package/localized/zh-CN/skills/fec-image-generation/scripts/png-qa.mjs +431 -0
  134. package/localized/zh-CN/skills/fec-image-generation/scripts/tech-diagram-render.mjs +1397 -0
  135. package/localized/zh-CN/skills/fec-implement-from-design/SKILL.md +129 -0
  136. package/localized/zh-CN/skills/fec-implement-from-design/references/design-plan-template.md +36 -0
  137. package/localized/zh-CN/skills/fec-legacy-to-modern-migration/SKILL.md +46 -0
  138. package/localized/zh-CN/skills/fec-legacy-to-modern-migration/references/migration-execution-checklist.md +110 -0
  139. package/localized/zh-CN/skills/fec-legacy-to-modern-migration/references/migration-report-template.md +41 -0
  140. package/localized/zh-CN/skills/fec-legacy-to-modern-migration/references/migration-strategy-and-mapping.md +48 -0
  141. package/localized/zh-CN/skills/fec-legacy-web-standard/SKILL.md +35 -0
  142. package/localized/zh-CN/skills/fec-legacy-web-standard/references/legacy-patterns.md +85 -0
  143. package/localized/zh-CN/skills/fec-list-virtualization/SKILL.md +34 -0
  144. package/localized/zh-CN/skills/fec-list-virtualization/references/virtualization-patterns.md +80 -0
  145. package/localized/zh-CN/skills/fec-monorepo-project-standard/SKILL.md +142 -0
  146. package/localized/zh-CN/skills/fec-motion-interaction/SKILL.md +73 -0
  147. package/localized/zh-CN/skills/fec-motion-interaction/references/motion-patterns.md +112 -0
  148. package/localized/zh-CN/skills/fec-nextjs-project-standard/SKILL.md +123 -0
  149. package/localized/zh-CN/skills/fec-nuxt-project-standard/SKILL.md +122 -0
  150. package/localized/zh-CN/skills/fec-performance-optimization/SKILL.md +80 -0
  151. package/localized/zh-CN/skills/fec-performance-optimization/references/framework-performance-patterns.md +38 -0
  152. package/localized/zh-CN/skills/fec-performance-optimization/references/report-template.md +59 -0
  153. package/localized/zh-CN/skills/fec-pwa-implementation/SKILL.md +35 -0
  154. package/localized/zh-CN/skills/fec-pwa-implementation/references/manifest-and-icons.md +53 -0
  155. package/localized/zh-CN/skills/fec-pwa-implementation/references/service-worker-workbox.md +68 -0
  156. package/localized/zh-CN/skills/fec-react-project-standard/SKILL.md +91 -0
  157. package/localized/zh-CN/skills/fec-react-project-standard/references/react-performance-patterns.md +35 -0
  158. package/localized/zh-CN/skills/fec-react-project-standard/references/react-project-structure.md +197 -0
  159. package/localized/zh-CN/skills/fec-react-project-standard/references/react-quality-patterns.md +131 -0
  160. package/localized/zh-CN/skills/fec-react-project-standard/references/react-runtime-patterns.md +293 -0
  161. package/localized/zh-CN/skills/fec-refactor-clean/SKILL.md +51 -0
  162. package/localized/zh-CN/skills/fec-refactor-clean/references/report-template.md +42 -0
  163. package/localized/zh-CN/skills/fec-responsive-layout/SKILL.md +34 -0
  164. package/localized/zh-CN/skills/fec-responsive-layout/references/responsive-layout-patterns.md +70 -0
  165. package/localized/zh-CN/skills/fec-route-protection/SKILL.md +135 -0
  166. package/localized/zh-CN/skills/fec-security-review/SKILL.md +38 -0
  167. package/localized/zh-CN/skills/fec-security-review/references/report-template.md +27 -0
  168. package/localized/zh-CN/skills/fec-security-review/references/security-checklist.md +64 -0
  169. package/localized/zh-CN/skills/fec-source-driven-development/SKILL.md +87 -0
  170. package/localized/zh-CN/skills/fec-state-management/SKILL.md +140 -0
  171. package/localized/zh-CN/skills/fec-state-management/references/state-patterns.md +109 -0
  172. package/localized/zh-CN/skills/fec-storybook-component-doc/SKILL.md +37 -0
  173. package/localized/zh-CN/skills/fec-storybook-component-doc/references/story-patterns.md +118 -0
  174. package/localized/zh-CN/skills/fec-svg-animation/SKILL.md +148 -0
  175. package/localized/zh-CN/skills/fec-tailwind-design-system/SKILL.md +34 -0
  176. package/localized/zh-CN/skills/fec-tailwind-design-system/references/tailwind-system-patterns.md +59 -0
  177. package/localized/zh-CN/skills/fec-tdd-workflow/SKILL.md +52 -0
  178. package/localized/zh-CN/skills/fec-testing-strategy/SKILL.md +45 -0
  179. package/localized/zh-CN/skills/fec-typescript-project-standard/SKILL.md +54 -0
  180. package/{skills/fec-typescript-type-safety → localized/zh-CN/skills/fec-typescript-project-standard}/references/type-safety-patterns.md +1 -1
  181. package/{skills/fec-typescript-type-safety/SKILL.md → localized/zh-CN/skills/fec-typescript-project-standard/references/type-safety.md} +5 -14
  182. package/localized/zh-CN/skills/fec-ui-design/SKILL.md +108 -0
  183. package/localized/zh-CN/skills/fec-ui-design/data/product-rules.json +231 -0
  184. package/localized/zh-CN/skills/fec-ui-design/data/stack-ui-rules.json +146 -0
  185. package/localized/zh-CN/skills/fec-ui-design/data/style-archetypes.json +373 -0
  186. package/localized/zh-CN/skills/fec-ui-design/data/ux-quality-rules.json +203 -0
  187. package/localized/zh-CN/skills/fec-ui-design/references/design-intelligence.md +97 -0
  188. package/localized/zh-CN/skills/fec-ui-design/references/master-page-overrides.md +30 -0
  189. package/localized/zh-CN/skills/fec-ui-design/references/pre-delivery-checklist.md +39 -0
  190. package/localized/zh-CN/skills/fec-ui-design/scripts/design-system.mjs +648 -0
  191. package/localized/zh-CN/skills/fec-validation-fix/SKILL.md +51 -0
  192. package/localized/zh-CN/skills/fec-validation-fix/references/report-template.md +43 -0
  193. package/localized/zh-CN/skills/fec-vite-project-standard/SKILL.md +83 -0
  194. package/localized/zh-CN/skills/fec-vue3-project-standard/SKILL.md +58 -0
  195. package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-composables-routing.md +162 -0
  196. package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-performance-patterns.md +13 -0
  197. package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-project-structure.md +176 -0
  198. package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-state-api-quality.md +216 -0
  199. package/localized/zh-CN/skills/fec-web-video-presentation/SKILL.md +61 -0
  200. package/localized/zh-CN/skills/fec-web-video-presentation/data/starter-themes.json +59 -0
  201. package/localized/zh-CN/skills/fec-web-video-presentation/references/chapter-craft.md +37 -0
  202. package/localized/zh-CN/skills/fec-web-video-presentation/references/content-plan.md +38 -0
  203. package/localized/zh-CN/skills/fec-web-video-presentation/references/recording-and-audio.md +33 -0
  204. package/localized/zh-CN/skills/fec-web-video-presentation/references/theme-system.md +36 -0
  205. package/localized/zh-CN/skills/fec-web-video-presentation/scripts/create-video-presentation.mjs +430 -0
  206. package/localized/zh-CN/skills/fec-web-workers/SKILL.md +35 -0
  207. package/localized/zh-CN/skills/fec-web-workers/references/advanced-workers.md +54 -0
  208. package/localized/zh-CN/skills/fec-web-workers/references/basic-worker.md +67 -0
  209. package/localized/zh-CN/skills/metadata.json +1646 -0
  210. package/localized/zh-CN/skills/relations.json +755 -0
  211. package/localized/zh-CN/templates/claude/CLAUDE.md +106 -0
  212. package/localized/zh-CN/templates/claude/settings.json +62 -0
  213. package/localized/zh-CN/templates/codex/AGENTS.md +105 -0
  214. package/localized/zh-CN/templates/codex/config.toml +32 -0
  215. package/localized/zh-CN/templates/openclaw/AGENTS.md +101 -0
  216. package/localized/zh-CN/templates/openclaw/OPENCLAW-CONFIG.md +12 -0
  217. package/localized/zh-CN/templates/shared/rules/fec-agent-workflow.md +54 -0
  218. package/localized/zh-CN/templates/shared/rules/fec-api-layer.md +99 -0
  219. package/localized/zh-CN/templates/shared/rules/fec-ci-cd.md +40 -0
  220. package/localized/zh-CN/templates/shared/rules/fec-code-comments.md +33 -0
  221. package/localized/zh-CN/templates/shared/rules/fec-design-system.md +72 -0
  222. package/localized/zh-CN/templates/shared/rules/fec-error-handling.md +56 -0
  223. package/localized/zh-CN/templates/shared/rules/fec-git-conventions.md +73 -0
  224. package/localized/zh-CN/templates/shared/rules/fec-i18n.md +64 -0
  225. package/localized/zh-CN/templates/shared/rules/fec-naming-conventions.md +120 -0
  226. package/localized/zh-CN/templates/shared/rules/fec-performance.md +101 -0
  227. package/localized/zh-CN/templates/shared/rules/fec-react.md +82 -0
  228. package/localized/zh-CN/templates/shared/rules/fec-refactoring.md +47 -0
  229. package/localized/zh-CN/templates/shared/rules/fec-rendering-patterns.md +40 -0
  230. package/localized/zh-CN/templates/shared/rules/fec-responsive-design.md +50 -0
  231. package/localized/zh-CN/templates/shared/rules/fec-source-driven-development.md +31 -0
  232. package/localized/zh-CN/templates/shared/rules/fec-state-management.md +60 -0
  233. package/localized/zh-CN/templates/shared/rules/fec-testing.md +98 -0
  234. package/localized/zh-CN/templates/shared/rules/fec-typescript.md +112 -0
  235. package/localized/zh-CN/templates/shared/rules/fec-vue.md +64 -0
  236. package/localized/zh-CN/templates/shared/rules/fec-working-modes.md +50 -0
  237. package/openclaw.plugin.json +1 -1
  238. package/package.json +4 -3
  239. package/skills/TEMPLATE.md +74 -74
  240. package/skills/eval_queries.json +717 -619
  241. package/skills/fec-accessibility-check/SKILL.md +21 -21
  242. package/skills/fec-accessibility-check/references/report-template.md +12 -12
  243. package/skills/fec-accessibility-check/references/screen-reader-testing.md +24 -24
  244. package/skills/fec-alchemy/SKILL.md +50 -50
  245. package/skills/fec-alchemy/assets/absorption-plan-template.md +32 -32
  246. package/skills/fec-alchemy/assets/intake-template.md +55 -55
  247. package/skills/fec-alchemy/assets/review-checklist.md +23 -23
  248. package/skills/fec-alchemy/references/methodology.md +66 -66
  249. package/skills/fec-alchemy/references/originality-and-licensing.md +42 -42
  250. package/skills/fec-api-integration/SKILL.md +61 -61
  251. package/skills/fec-api-integration/references/integration-patterns.md +30 -30
  252. package/skills/fec-backend-requirements-handoff/SKILL.md +45 -0
  253. package/skills/fec-browser-storage/SKILL.md +16 -16
  254. package/skills/fec-browser-storage/references/storage-patterns.md +16 -16
  255. package/skills/fec-canvas-threejs/SKILL.md +21 -21
  256. package/skills/fec-canvas-threejs/references/rendering-patterns.md +10 -10
  257. package/skills/fec-canvas-threejs/references/shader-webgl-patterns.md +37 -37
  258. package/skills/fec-code-review/SKILL.md +94 -94
  259. package/skills/fec-code-review/references/report-template.md +13 -13
  260. package/skills/fec-component-testing/SKILL.md +39 -39
  261. package/skills/fec-data-fetching/SKILL.md +16 -16
  262. package/skills/fec-data-fetching/references/query-patterns.md +27 -27
  263. package/skills/fec-debug-framework/SKILL.md +95 -95
  264. package/skills/fec-debug-framework/references/report-template.md +34 -34
  265. package/skills/fec-dependency-upgrade/SKILL.md +17 -17
  266. package/skills/fec-dependency-upgrade/references/dependency-upgrade-workflow.md +31 -31
  267. package/skills/fec-doc-sync/SKILL.md +23 -23
  268. package/skills/fec-drawio-studio/SKILL.md +73 -0
  269. package/skills/fec-drawio-studio/data/THIRD_PARTY_NOTICES.md +10 -0
  270. package/skills/fec-drawio-studio/data/brand-icons.json +878 -0
  271. package/skills/fec-drawio-studio/data/shape-index.json +83570 -0
  272. package/skills/fec-drawio-studio/references/data-residency.md +27 -0
  273. package/skills/fec-drawio-studio/references/diagram-patterns.md +60 -0
  274. package/skills/fec-drawio-studio/references/flowchart-quality.md +49 -0
  275. package/skills/fec-drawio-studio/references/layout-and-export.md +72 -0
  276. package/skills/fec-drawio-studio/references/troubleshooting.md +29 -0
  277. package/skills/fec-drawio-studio/references/xml-and-mermaid.md +58 -0
  278. package/skills/fec-drawio-studio/scripts/brand-symbols.mjs +99 -0
  279. package/skills/fec-drawio-studio/scripts/diagram-lint.mjs +205 -0
  280. package/skills/fec-drawio-studio/scripts/diagram-url.mjs +102 -0
  281. package/skills/fec-drawio-studio/scripts/drawio-export.mjs +134 -0
  282. package/skills/fec-drawio-studio/scripts/layout-graph.mjs +107 -0
  283. package/skills/fec-drawio-studio/scripts/png-embed-fix.mjs +26 -0
  284. package/skills/fec-drawio-studio/scripts/scan-go-packages.mjs +36 -0
  285. package/skills/fec-drawio-studio/scripts/scan-js-modules.mjs +52 -0
  286. package/skills/fec-drawio-studio/scripts/scan-python-classes.mjs +30 -0
  287. package/skills/fec-drawio-studio/scripts/scan-python-modules.mjs +55 -0
  288. package/skills/fec-drawio-studio/scripts/scan-rust-modules.mjs +35 -0
  289. package/skills/fec-drawio-studio/scripts/scan-ts-modules.mjs +7 -0
  290. package/skills/fec-drawio-studio/scripts/shape-query.mjs +121 -0
  291. package/skills/fec-drawio-studio/scripts/studio-core.mjs +139 -0
  292. package/skills/fec-drawio-studio/styles/built-in/corporate.json +49 -0
  293. package/skills/fec-drawio-studio/styles/built-in/default.json +49 -0
  294. package/skills/fec-drawio-studio/styles/built-in/handdrawn.json +49 -0
  295. package/skills/fec-drawio-studio/styles/schema.json +112 -0
  296. package/skills/fec-e2e-testing/SKILL.md +24 -22
  297. package/skills/fec-e2e-testing/references/e2e-ci-reporting.md +62 -0
  298. package/skills/fec-e2e-testing/references/e2e-special-scenarios.md +52 -0
  299. package/skills/fec-e2e-testing/references/e2e-visual-regression.md +60 -0
  300. package/skills/fec-e2e-testing/references/playwright-patterns.md +6 -6
  301. package/skills/fec-form-handling/SKILL.md +21 -21
  302. package/skills/fec-form-handling/references/advanced-form-patterns.md +41 -41
  303. package/skills/fec-image-generation/SKILL.md +81 -0
  304. package/skills/fec-image-generation/assets/interactive-diagram.html +371 -0
  305. package/skills/fec-image-generation/references/artifact-routing.md +80 -0
  306. package/skills/fec-image-generation/references/diagram-workflows.md +74 -0
  307. package/skills/fec-image-generation/references/html-technical-diagrams.md +236 -0
  308. package/skills/fec-image-generation/references/png-qa-autofix.md +30 -0
  309. package/skills/fec-image-generation/scripts/export-diagram.mjs +364 -0
  310. package/skills/fec-image-generation/scripts/interactive-diagram-server.mjs +654 -0
  311. package/skills/fec-image-generation/scripts/png-qa.mjs +431 -0
  312. package/skills/fec-image-generation/scripts/tech-diagram-render.mjs +1397 -0
  313. package/skills/fec-implement-from-design/SKILL.md +81 -74
  314. package/skills/fec-implement-from-design/references/design-plan-template.md +16 -16
  315. package/skills/fec-legacy-to-modern-migration/SKILL.md +29 -173
  316. package/skills/fec-legacy-to-modern-migration/references/migration-execution-checklist.md +110 -0
  317. package/skills/fec-legacy-to-modern-migration/references/migration-report-template.md +37 -37
  318. package/skills/fec-legacy-to-modern-migration/references/migration-strategy-and-mapping.md +48 -0
  319. package/skills/fec-legacy-web-standard/SKILL.md +17 -17
  320. package/skills/fec-legacy-web-standard/references/legacy-patterns.md +16 -16
  321. package/skills/fec-list-virtualization/SKILL.md +16 -16
  322. package/skills/fec-list-virtualization/references/virtualization-patterns.md +31 -31
  323. package/skills/fec-monorepo-project-standard/SKILL.md +52 -52
  324. package/skills/fec-motion-interaction/SKILL.md +51 -44
  325. package/skills/fec-motion-interaction/references/motion-patterns.md +11 -11
  326. package/skills/fec-nextjs-project-standard/SKILL.md +64 -58
  327. package/skills/fec-nuxt-project-standard/SKILL.md +57 -57
  328. package/skills/fec-performance-optimization/SKILL.md +54 -50
  329. package/skills/fec-performance-optimization/references/framework-performance-patterns.md +38 -0
  330. package/skills/fec-performance-optimization/references/report-template.md +34 -28
  331. package/skills/fec-pwa-implementation/SKILL.md +17 -17
  332. package/skills/fec-pwa-implementation/references/manifest-and-icons.md +12 -12
  333. package/skills/fec-pwa-implementation/references/service-worker-workbox.md +13 -13
  334. package/skills/fec-react-project-standard/SKILL.md +72 -64
  335. package/skills/fec-react-project-standard/references/react-performance-patterns.md +35 -0
  336. package/skills/fec-react-project-standard/references/react-project-structure.md +197 -0
  337. package/skills/fec-react-project-standard/references/react-quality-patterns.md +131 -0
  338. package/skills/fec-react-project-standard/references/react-runtime-patterns.md +293 -0
  339. package/skills/fec-refactor-clean/SKILL.md +30 -30
  340. package/skills/fec-refactor-clean/references/report-template.md +23 -23
  341. package/skills/fec-responsive-layout/SKILL.md +17 -17
  342. package/skills/fec-responsive-layout/references/responsive-layout-patterns.md +39 -28
  343. package/skills/fec-route-protection/SKILL.md +26 -26
  344. package/skills/fec-security-review/SKILL.md +20 -20
  345. package/skills/fec-security-review/references/report-template.md +12 -12
  346. package/skills/fec-security-review/references/security-checklist.md +27 -27
  347. package/skills/fec-source-driven-development/SKILL.md +66 -40
  348. package/skills/fec-state-management/SKILL.md +34 -34
  349. package/skills/fec-state-management/references/state-patterns.md +19 -19
  350. package/skills/fec-storybook-component-doc/SKILL.md +19 -19
  351. package/skills/fec-storybook-component-doc/references/story-patterns.md +12 -12
  352. package/skills/fec-svg-animation/SKILL.md +32 -32
  353. package/skills/fec-tailwind-design-system/SKILL.md +17 -17
  354. package/skills/fec-tailwind-design-system/references/tailwind-system-patterns.md +36 -32
  355. package/skills/fec-tdd-workflow/SKILL.md +28 -28
  356. package/skills/fec-testing-strategy/SKILL.md +29 -29
  357. package/skills/fec-typescript-project-standard/SKILL.md +54 -0
  358. package/skills/fec-typescript-project-standard/references/type-safety-patterns.md +102 -0
  359. package/skills/fec-typescript-project-standard/references/type-safety.md +148 -0
  360. package/skills/fec-ui-design/SKILL.md +90 -72
  361. package/skills/fec-ui-design/data/style-archetypes.json +40 -0
  362. package/skills/fec-ui-design/data/ux-quality-rules.json +35 -0
  363. package/skills/fec-ui-design/references/design-intelligence.md +81 -21
  364. package/skills/fec-ui-design/references/master-page-overrides.md +15 -15
  365. package/skills/fec-ui-design/references/pre-delivery-checklist.md +38 -32
  366. package/skills/fec-ui-design/scripts/design-system.mjs +119 -1
  367. package/skills/fec-validation-fix/SKILL.md +26 -26
  368. package/skills/fec-validation-fix/references/report-template.md +25 -25
  369. package/skills/fec-vite-project-standard/SKILL.md +39 -39
  370. package/skills/fec-vue3-project-standard/SKILL.md +39 -30
  371. package/skills/fec-vue3-project-standard/references/vue3-composables-routing.md +163 -0
  372. package/skills/fec-vue3-project-standard/references/vue3-performance-patterns.md +13 -0
  373. package/skills/fec-vue3-project-standard/references/vue3-project-structure.md +177 -0
  374. package/skills/fec-vue3-project-standard/references/vue3-state-api-quality.md +216 -0
  375. package/skills/fec-web-video-presentation/SKILL.md +61 -0
  376. package/skills/fec-web-video-presentation/data/starter-themes.json +59 -0
  377. package/skills/fec-web-video-presentation/references/chapter-craft.md +37 -0
  378. package/skills/fec-web-video-presentation/references/content-plan.md +38 -0
  379. package/skills/fec-web-video-presentation/references/recording-and-audio.md +33 -0
  380. package/skills/fec-web-video-presentation/references/theme-system.md +36 -0
  381. package/skills/fec-web-video-presentation/scripts/create-video-presentation.mjs +430 -0
  382. package/skills/fec-web-workers/SKILL.md +16 -16
  383. package/skills/fec-web-workers/references/advanced-workers.md +13 -13
  384. package/skills/fec-web-workers/references/basic-worker.md +8 -8
  385. package/skills/metadata.json +402 -220
  386. package/skills/relations.json +120 -25
  387. package/templates/claude/CLAUDE.md +60 -60
  388. package/templates/codex/AGENTS.md +76 -76
  389. package/templates/codex/config.toml +4 -4
  390. package/templates/openclaw/AGENTS.md +68 -68
  391. package/templates/openclaw/OPENCLAW-CONFIG.md +8 -8
  392. package/templates/shared/rules/fec-agent-workflow.md +40 -40
  393. package/templates/shared/rules/fec-api-layer.md +52 -52
  394. package/templates/shared/rules/fec-ci-cd.md +29 -117
  395. package/templates/shared/rules/fec-code-comments.md +22 -22
  396. package/templates/shared/rules/fec-design-system.md +65 -241
  397. package/templates/shared/rules/fec-error-handling.md +41 -185
  398. package/templates/shared/rules/fec-git-conventions.md +42 -42
  399. package/templates/shared/rules/fec-i18n.md +48 -96
  400. package/templates/shared/rules/fec-naming-conventions.md +91 -91
  401. package/templates/shared/rules/fec-performance.md +78 -78
  402. package/templates/shared/rules/fec-react.md +58 -58
  403. package/templates/shared/rules/fec-refactoring.md +34 -30
  404. package/templates/shared/rules/fec-rendering-patterns.md +40 -183
  405. package/templates/shared/rules/fec-responsive-design.md +37 -214
  406. package/templates/shared/rules/fec-source-driven-development.md +22 -22
  407. package/templates/shared/rules/fec-state-management.md +45 -148
  408. package/templates/shared/rules/fec-testing.md +64 -64
  409. package/templates/shared/rules/fec-typescript.md +98 -341
  410. package/templates/shared/rules/fec-vue.md +42 -42
  411. package/templates/shared/rules/fec-working-modes.md +34 -34
  412. package/skills/fec-e2e-testing/references/e2e-advanced.md +0 -176
  413. package/skills/fec-react-project-standard/references/react-project-details.md +0 -642
  414. package/skills/fec-vue3-project-standard/references/vue3-project-details.md +0 -547
@@ -1,33 +1,33 @@
1
- # 代码注释
1
+ # Code comments
2
2
 
3
- 编写或评审前端实现时应用本文件。
3
+ Use this document when writing or reviewing front-end implementations.
4
4
 
5
- ## 原则
5
+ ## Principles
6
6
 
7
- - 意图优先靠**命名、类型与结构**表达;注释用于说明**为什么**、**约束与背景**,而不是复述代码在做什么。
8
- - 避免「整文件零注释」:在**非显而易见**处用**简短**注释降低误改成本,与「不写废话注释」不矛盾。
7
+ - Intention is expressed first through **naming, type and structure**; comments are used to explain **why**, **constraints and background**, rather than reiterating what the code is doing.
8
+ - Avoid "zero comments in the entire file": Use **short** comments in **non-obvious** places to reduce the cost of accidental modifications, which is not inconsistent with "no nonsense comments".
9
9
 
10
- ## 应当注释的情况
10
+ ## Situations that should be commented
11
11
 
12
- - **业务或产品规则**:权限、展示条件、校验逻辑背后的依据(与需求或领域约定相关时)。
13
- - **非直观的实现或取舍**:为何选用当前写法(性能、兼容、与后端/第三方约定等)。
14
- - **外部契约**:与接口、设计稿、枚举或单位相关的字段含义、映射关系。
15
- - **临时方案与技术债**:`TODO` / `FIXME` 应写明预期收尾或关联工单(若有)。
16
- - **易踩坑点**:第三方库版本差异、必须满足的调用顺序、已知限制。
12
+ - **Business or product rules**: permissions, display conditions, and the basis behind the verification logic (when related to requirements or domain agreements).
13
+ - **Non-intuitive implementation or trade-offs**: Why choose the current writing method (performance, compatibility, agreement with backend/third party, etc.).
14
+ - **External Contract**: Field meanings and mapping relationships related to interfaces, design drafts, enumerations or units.
15
+ - **Interim Solutions and Technical Debt**: `TODO` / `FIXME` should indicate expected closure or associated work orders (if any).
16
+ - **Easy pitfalls**: Third-party library version differences, the calling sequence that must be met, and known limitations.
17
17
 
18
- ## 应避免的情况
18
+ ## Situations to avoid
19
19
 
20
- - 逐行翻译已能从代码直接看出的行为。
21
- - 注释与实现长期不一致;修改逻辑时同步更新或删除误导性注释。
22
- - 用大段注释代替应抽取的函数或应补全的类型。
20
+ - Line-by-line translation of behavior that can be seen directly from the code.
21
+ - Annotations are chronically inconsistent with the implementation; misleading annotations are updated or deleted synchronously when the logic is modified.
22
+ - Use large comments to replace functions that should be extracted or types that should be completed.
23
23
 
24
- ## 形式建议
24
+ ## Format Suggestions
25
25
 
26
- - 语言与仓库现有注释保持一致(中文或英文)。
27
- - 复杂模块或组件可在文件顶部用 **1~3 行** 说明职责与关键约束;跨包或对外导出的 API 宜用 **JSDoc** 说明参数、返回值与副作用。
28
- - 复杂条件分支或 `useEffect`:若依赖或触发条件不直观,用一行说明**触发条件**或**不变量**。
29
- - 临时规避、兼容旧系统或性能取舍必须说明原因和退出条件。
26
+ - The language is consistent with the existing comments in the warehouse (Chinese or English).
27
+ - Complex modules or components can use **1~3 lines** at the top of the file to describe responsibilities and key constraints; cross-package or externally exported APIs should use **JSDoc** to describe parameters, return values and side effects.
28
+ - Complex conditional branches or `useEffect`: If the dependency or triggering condition is not intuitive, use one line to describe the **triggering condition** or **invariant**.
29
+ - Temporary circumvention, compatibility with old systems or performance trade-offs must state reasons and exit conditions.
30
30
 
31
- ## 文档同步
31
+ ## Document synchronization
32
32
 
33
- 当修改公开命令、skill、agent、模板、报告命名或安装路径时,同步更新 README、runtime docs、项目结构文档和多语言说明。注释解释局部代码,公开文档解释团队如何使用能力,两者不要互相替代。
33
+ When modifying public commands, skills, agents, templates, report naming or installation paths, synchronize updates to README, runtime docs, project structure documents and multi-language instructions. Comments explain local code, and public documentation explains how the team uses capabilities. The two should not replace each other.
@@ -1,248 +1,72 @@
1
- # 设计系统规则
1
+ # Design system rules
2
2
 
3
- 凡是任务涉及 UI 实现、设计稿转代码、样式、设计 Token 或组件复用时,都应用本文件。
3
+ This document should be used whenever the task involves UI implementation, design draft conversion to code, style, design token, or component reuse. This article only retains the project's resident design constraints; product design direction, design system generation, page-level override, and UI QA details are handed over to `fec-ui-design`; Tailwind token, variant, dark mode and class management are handed over to `fec-tailwind-design-system`; responsive layout is handed over to `fec-responsive-layout`.
4
4
 
5
- ## 核心优先级
5
+ ## Core priority
6
6
 
7
- 按以下顺序优先处理:
7
+ 1. Reuse existing components.
8
+ 2. Expand on existing components.
9
+ 3. Create a new leaf component.
10
+ 4. Only create new shared base components if there is good reason, clear boundaries, and if they will be reused.
8
11
 
9
- 1. 复用已有组件
10
- 2. 在已有组件上扩展
11
- 3. 创建新的叶子组件
12
- 4. 只有在理由非常充分时,才创建新的共享基础组件
12
+ ## Product design direction
13
13
 
14
- ## 产品化设计方向
14
+ - Tool-type pages, SaaS backend, CRM, and operations desk: Prioritize quiet, dense, and scannable, and the core work area is directly displayed on the first screen.
15
+ - Brand page, portfolio, release page: It can be more expressive, but H1 should be the brand, product, object or category, and the description copy should be placed in the subtitle.
16
+ - Visualization, games, and creative tools: You can use stronger visual assets and animations, but you must keep the interaction controllable and the status clear.
17
+ - Every important interface should have a visual anchor that fits the business, such as real media, data form, industry material, font character, spatial organization or interaction rhythm.
18
+ - Bold design must serve the scene; high-frequency tools focus on efficiency and stability, and display-type pages focus on subject recognition and memory points.
15
19
 
16
- 开始 UI 实现前,先明确界面语气:
20
+ Avoid:
17
21
 
18
- - 工具型页面、SaaS 后台、CRM、运营台:优先安静、密集、可扫描,首屏直接呈现核心工作区
19
- - 品牌页、作品集、发布页:可以更有表现力,但 H1 应是品牌/产品/对象/品类,说明文案放在副标题
20
- - 可视化、游戏、创作工具:可以使用更强视觉资产和动效,但必须保持交互可控、状态清晰
21
- - 每个重要界面都应有一个贴合业务的视觉锚点:真实媒体、数据形态、行业材质、字体性格、空间组织或交互节奏
22
- - 大胆设计必须服务场景;高频工具重效率和稳定,展示型页面重主体识别和记忆点
23
-
24
- 避免:
25
-
26
- - 把日常高频工具做成营销落地页
27
- - 默认使用紫色渐变、装饰光斑、堆叠卡片或空泛 hero
28
- - 使用无语境默认字体、平均分布的弱对比配色、模板化双栏 hero 或重复圆角卡片作为通用答案
29
- - 页面区块大面积卡片化,尤其是卡片套卡片
30
- - 用可见说明文字解释常见控件本该表达的功能
31
- - 让整个界面只由一个色相的深浅变化组成
32
-
33
- ### 视觉语言基线
34
-
35
- - 字体:优先复用项目字体体系;新建方向时,标题和正文应形成性格与可读性的分工
36
- - 色彩:区分主色、强调色、状态色和中性色,关键动作与风险状态不能只靠透明度表达
37
- - 动效:只为入场、层级展开、状态确认、错误反馈和重点引导编排节奏,并尊重 `prefers-reduced-motion`
38
- - 空间:根据任务选择高密度、留白、非对称、分栏、画布式或编辑器式布局,不套用固定卡片模板
39
- - 质感:背景、纹理、阴影和透明度应解释层级或语境,不作为无内容装饰
40
-
41
- ### 设计系统生成与覆盖
42
-
43
- - 项目缺少设计方向时,可先生成轻量设计系统建议,再根据真实业务、组件库和数据校正
44
- - `design-system/<project>/MASTER.md` 记录跨页面共享的产品类型、视觉语言、token 方向、动效、图表和 QA 规则
45
- - `design-system/<project>/pages/<page>.md` 只记录页面差异:首屏结构、组件密度、图表选择、状态覆盖和局部 token 调整
46
- - 构建页面或检查 UI 时,先读取页面 override,再读取 Master;页面规则不能复制全量 Master
47
- - 产品类型推理要落到界面决策:行业风险、用户频率、数据密度、触摸/鼠标场景、图表任务和转化路径
48
- - 交付前 QA 至少覆盖可访问性、交互反馈、布局溢出、字体色彩、动效降级、表单、导航和图表可读性
49
-
50
- ## 设计稿转代码规则
51
-
52
- 当存在设计上下文时:
53
-
54
- - 先通过 MCP 读取设计上下文(Figma / MasterGo / Pixso / 墨刀 / Sketch,摹客则使用截图/标注)
55
- - 设计稿中的颜色/间距 token 必须从 design token 文件中引用
56
- - 如果已有设计上下文,不要靠猜测来决定布局、间距、字体、颜色或状态
57
- - 在创建新组件前,先检查现有组件,优先复用现有组件库中的组件
58
- - 响应式断点: mobile(375px) / tablet(768px) / desktop(1440px)
59
- - 像素还原精度要求: ≥ 95%
60
- - 在改文件前先给出简短实现计划
61
-
62
- 始终要考虑:
63
-
64
- - loading 状态
65
- - empty 状态
66
- - error 状态
67
- - disabled 状态
68
- - hover 状态
69
- - focus 状态
70
- - 在相关场景下的 selected 状态
71
- - 响应式行为
72
-
73
- ## 设计 Token 规则
74
-
75
- - 优先使用已有 design token、CSS 变量或主题变量
76
- - 当已有 Token 可用时,不要硬编码颜色、圆角、间距、阴影和字体取值
77
- - 如果缺少所需 Token,要明确指出,不要悄悄到处硬编码
78
- - Token 使用方式要与周边模块保持一致
79
- - Tailwind 项目中,token 应通过语义化 `theme.extend`、CSS 变量或组件 variant 承接;不要把 `blue-600`、`rounded-xl` 等具体值复制成事实标准
80
- - 组件 variant 应区分语义 tone、尺寸 size、密度 density 和状态 state;不要让一个字符串参数承载多种业务含义
81
- - 动态 Tailwind class 必须可被构建扫描识别;复杂映射使用显式对象、variant 工具或 safelist
82
-
83
- ## 样式规则
84
-
85
- - 优先使用局部、受控的样式,而不是大范围全局覆盖
86
- - 保持当前断点下的响应式行为
87
- - 与项目现有样式体系保持一致
88
- - 检查 hover、active、focus、disabled、selected 等状态
89
- - 除非没有合适 Token 或刻度值,否则不要使用 magic number
90
-
91
- ### 界面质感基线
92
-
93
- - 嵌套圆角保持光学关系:外层圆角约等于内层圆角 + 间距
94
- - 图标按钮、箭头、播放三角等非对称图形按视觉中心微调
95
- - 小控件命中区域至少 40x40px,空间允许时优先 44x44px
96
- - 标题和短文本可用 `text-wrap: balance`,短中正文可用 `text-wrap: pretty`
97
- - 计数器、价格、时间、表格数字使用 `font-variant-numeric: tabular-nums`
98
- - 图片在浅/深色背景上边缘不清时,使用中性 alpha 内描边,不使用品牌色描边
99
- - 动效只声明实际变化属性,禁止 `transition: all` 和 `will-change: all`
100
- - 进入/退出动效要克制,并尊重 `prefers-reduced-motion`
101
-
102
- ## 暗色模式
103
-
104
- 提供与系统主题同步的手动切换能力,减少视觉疲劳并满足可访问性要求。
105
-
106
- ### CSS 变量方案
107
-
108
- ```css
109
- :root {
110
- --color-bg-primary: #ffffff;
111
- --color-bg-secondary: #f5f5f5;
112
- --color-text-primary: #1a1a1a;
113
- --color-text-secondary: #666666;
114
- --color-border: #e0e0e0;
115
- }
116
-
117
- [data-theme="dark"] {
118
- --color-bg-primary: #1a1a1a;
119
- --color-bg-secondary: #2a2a2a;
120
- --color-text-primary: #f0f0f0;
121
- --color-text-secondary: #a0a0a0;
122
- --color-border: #404040;
123
- }
124
-
125
- body {
126
- background-color: var(--color-bg-primary);
127
- color: var(--color-text-primary);
128
- }
129
- ```
130
-
131
- ### Tailwind 方案
132
-
133
- ```js
134
- // tailwind.config.js
135
- module.exports = {
136
- darkMode: "class", // 通过 .dark 类控制,而非 prefers-color-scheme
137
- };
138
- ```
139
-
140
- ```html
141
- <div class="bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100">
142
- <!-- 内容 -->
143
- </div>
144
- ```
145
-
146
- ### 主题切换 Hook
147
-
148
- ```tsx
149
- import { useState, useEffect } from "react";
150
-
151
- function useTheme() {
152
- const [theme, setTheme] = useState<"light" | "dark">("light");
153
-
154
- useEffect(() => {
155
- // 1. 优先读取用户保存的偏好
156
- const saved = localStorage.getItem("theme") as "light" | "dark" | null;
157
- if (saved) {
158
- setTheme(saved);
159
- return;
160
- }
161
- // 2. 回退到系统偏好
162
- const prefersDark = window.matchMedia(
163
- "(prefers-color-scheme: dark)",
164
- ).matches;
165
- setTheme(prefersDark ? "dark" : "light");
166
- }, []);
167
-
168
- useEffect(() => {
169
- const root = document.documentElement;
170
- if (theme === "dark") {
171
- root.classList.add("dark");
172
- root.setAttribute("data-theme", "dark");
173
- } else {
174
- root.classList.remove("dark");
175
- root.setAttribute("data-theme", "light");
176
- }
177
- localStorage.setItem("theme", theme);
178
- }, [theme]);
179
-
180
- const toggle = () => setTheme((t) => (t === "light" ? "dark" : "light"));
181
-
182
- return { theme, toggle };
183
- }
184
- ```
185
-
186
- ### FOUC 防护(主题闪烁)
187
-
188
- 在 `<head>` 中同步执行主题初始化脚本(阻塞渲染),避免首次加载时出现错误的主题色:
189
-
190
- ```html
191
- <head>
192
- <script>
193
- // 同步执行 — 在 body 渲染前确定主题
194
- (function () {
195
- const theme =
196
- localStorage.getItem("theme") ||
197
- (window.matchMedia("(prefers-color-scheme: dark)").matches
198
- ? "dark"
199
- : "light");
200
- if (theme === "dark") {
201
- document.documentElement.classList.add("dark");
202
- document.documentElement.setAttribute("data-theme", "dark");
203
- }
204
- })();
205
- </script>
206
- </head>
207
- ```
208
-
209
- ### 暗色模式注意事项
210
-
211
- - **图片**: 亮色图片在暗色模式下刺眼,使用 `filter: brightness(0.8)` 降低亮度
212
- - **阴影**: 暗色模式下阴影不明显,改用 `box-shadow: 0 0 15px rgba(255,255,255,0.05)` 或边框替代
213
- - **颜色对比度**: 确保暗色模式下文本与背景的对比度 ≥ 4.5:1(WCAG AA)
214
- - **表单控件**: 输入框、下拉框、开关等原生控件在暗色模式下需要自定义样式
215
- - **第三方组件**: 检查 UI 组件库是否支持暗色模式,必要时用 CSS 变量覆盖
216
- - **Tailwind 组件**: 暗色模式下需复核 focus、disabled、selected、invalid、skeleton、chart 和阴影层级,不只补 `dark:` 背景色
217
-
218
- ---
219
-
220
- ## 可访问性基线
221
-
222
- 优先使用语义化 HTML。
223
-
224
- 确保:
225
-
226
- - 表单控件具备标签
227
- - 纯图标按钮具有可访问名称
228
- - 菜单、标签页、对话框和自定义控件支持键盘操作
229
- - 焦点样式可见
230
- - 编辑页面时标题层级正确
231
- - 真实表格数据使用正确表格语义
232
-
233
- ## UI 任务的输出要求
234
-
235
- 对于较复杂的设计类任务,开始时先给出:
236
-
237
- - 复用的组件
238
- - 新建的组件
239
- - 可能改动的文件
240
- - 响应式策略
241
- - Token 映射或样式策略
242
-
243
- 实现完成后,需要说明:
244
-
245
- - 复用了什么
246
- - 新建了什么
247
- - 与设计稿有哪些偏差
248
- - 缺少哪些 Token、资源或交互细节
22
+ - Turn daily high-frequency tools into marketing landing pages.
23
+ - Use purple gradient, decorative light spots, stacked cards, empty hero or non-contextual default font by default.
24
+ - Large areas of the page are card-based, especially card sets.
25
+ - Use visible explanatory text to explain the functions that common controls are supposed to express.
26
+ - Let the entire interface consist of only one shade of hue.
27
+
28
+ ## Design draft conversion code rules
29
+
30
+ - When given design context, read the source of truth first through MCP or screenshots/annotations, and don’t rely on guesswork to determine layout, spacing, fonts, colors, or status.
31
+ - Colors, spacing, rounded corners, shadows, and fonts in the design should be mapped to existing tokens, CSS variables, theme variables, or component variants.
32
+ - Check existing component libraries and business components before creating new components and prioritize reuse.
33
+ - Default verification is mobile(375px), tablet(768px), desktop(1440px).
34
+ - Pixel restoration requirements are subject to the project agreement; if there is no agreement, the core structure, spacing, fonts, status and interaction will take precedence over mechanical pursuit of screenshot overlap.
35
+ - Before implementing complex design tasks, a brief implementation plan is given, describing reused components, new components, possible changed files, responsive strategies and token mapping.
36
+
37
+ ## Design Token and style
38
+
39
+ - Prefer using existing design tokens, CSS variables, or theme variables; do not hard-code colors, rounded corners, spacing, shadows, and font values.
40
+ - When required tokens are missing, clearly point them out and centrally complete or record them, rather than scattering literals in multiple components.
41
+ - In the Tailwind project, tokens should be inherited through semantic `theme.extend`, CSS variables or component variants; do not copy specific values such as `blue-600` and `rounded-xl` into de facto standards.
42
+ - Component variants should distinguish semantic tone, size, density and state; do not let a string parameter carry multiple business meanings at the same time.
43
+ - Dynamic Tailwind classes must be recognized by build scans; use explicit objects, variant tools, or safelist for complex mappings.
44
+ - Prioritize the use of local, controlled styles instead of large-scale global coverage; be consistent with the project's existing CSS Modules, Tailwind, component libraries or style systems.
45
+
46
+ ## Interface texture baseline
47
+
48
+ - Nested fillets maintain an optical relationship: the outer fillet is approximately equal to the inner fillet + spacing.
49
+ - Asymmetric graphics such as icon buttons, arrows, and playback triangles are fine-tuned according to the visual center.
50
+ - The hit area of the small control should be at least 40x40px, and 44x44px is preferred if space allows.
51
+ - `text-wrap: balance` can be used for titles and short texts, and `text-wrap: pretty` can be used for short and medium text.
52
+ - Use `font-variant-numeric: tabular-nums` for counters, prices, times, and tabular numbers.
53
+ - Animation only declares actual change attributes, prohibits `transition: all` and `will-change: all`, and respects `prefers-reduced-motion`.
54
+
55
+ ## Dark mode
56
+
57
+ - Project-level dark mode only selects one main strategy: CSS variables, root node class, `data-theme` or component library theme.
58
+ - When supporting manual theme switching, user preferences must be initialized before the first screen is drawn to avoid theme flickering; the implementation details are left to Tailwind / design-system skill reference.
59
+ - Review disabled, focus, selected, invalid, skeleton, chart, form controls, third-party components and shadow levels for both light and dark colors.
60
+ - Don't just reduce the transparency to express disabled, don't just fill in the background color and ignore text, borders, charts and focus states.
61
+
62
+ ## Accessibility Baseline
63
+
64
+ - Prefer semantic HTML.
65
+ - Form controls have labels and pure icon buttons have accessible names.
66
+ - Menus, tabs, dialog boxes and custom controls support keyboard operation.
67
+ - Focus styles are visible, title levels are correct, and real table data uses table semantics.
68
+ - Color contrast, touch targets, reduced-motion and error prompts cannot be destroyed by visual polish.
69
+
70
+ ## UI task output
71
+
72
+ After the implementation is completed, explain what was reused, what was newly created, deviations from the design draft or project token, and what resources or interaction details are missing. Complex UIs should also account for state overrides, responsive validation, and remaining design risks.
@@ -1,200 +1,56 @@
1
- # 错误处理规范
1
+ # Error handling specifications
2
2
 
3
- ## 错误分层
3
+ This document agrees on the resident boundaries of front-end error handling. React/Vue component boundary details are handed over to the corresponding framework skill, API error mapping and authentication refresh are handed over to `fec-api-integration`, and security-sensitive errors are handed over to `fec-security-review`.
4
4
 
5
- | 层级 | 错误类型 | 处理方式 |
6
- |------|----------|----------|
7
- | 全局 | 未捕获异常、Promise rejection | 全局捕获 + 上报 + 降级 UI |
8
- | 路由/页面 | 页面级组件渲染错误 | Error Boundary + 页面级降级 |
9
- | 模块 | 功能模块内的运行时错误 | Error Boundary + 模块级降级 |
10
- | 组件 | 数据请求失败、操作失败 | 用户提示 + 重试机制 |
11
- | 表单 | 校验失败 | 字段级错误提示 |
5
+ ## Error layering
12
6
 
13
- ## 全局错误捕获
7
+ | Hierarchy | Error type | Default handling |
8
+ | ---- | -------- | -------- |
9
+ | Global | Uncaught exceptions, Promise rejection | Capture, reporting, global downgrade UI |
10
+ | Routing / Page | Page-level rendering exception | Error Boundary / Frame error boundary + Page-level degradation |
11
+ | Module | Function module runtime exception | Module-level boundary + local degradation |
12
+ | Component/Request | Data request failure, operation failure | User-understandable prompts + recoverable actions |
13
+ | Form | Validation failure | Field-level error prompts and correction entry |
14
14
 
15
- ### React
15
+ ## Global and module boundaries
16
16
 
17
- ```tsx
18
- // main.tsx — 未捕获的 Promise
19
- window.addEventListener("unhandledrejection", (event) => {
20
- reportError(event.reason);
21
- });
17
+ - Uncaught exception and Promise rejection monitoring should be registered at the application entrance and connected to the project error reporting platform.
18
+ - React uses the project's unified Error Boundary solution; business components remain functional and no new handwritten class component boundaries are added.
19
+ - Vue uses project-unified `app.config.errorHandler`, `onErrorCaptured` or framework-level error boundaries.
20
+ - Independent functional modules should have local downgrade capabilities, and module crashes should not cause the entire page to go blank.
21
+ - Error Boundary handles rendering exceptions; normal API failures should fall into the loading/error/empty/data state and recoverable operations.
22
22
 
23
- // 推荐:react-error-boundary,业务侧保持函数组件 + FallbackComponent
24
- import { ErrorBoundary } from "react-error-boundary";
23
+ ## API error handling
25
24
 
26
- function GlobalErrorFallback({
27
- error,
28
- resetErrorBoundary,
29
- }: {
30
- error: Error;
31
- resetErrorBoundary: () => void;
32
- }) {
33
- return (
34
- <div role="alert">
35
- <p>页面出现异常</p>
36
- <button type="button" onClick={resetErrorBoundary}>
37
- 重试
38
- </button>
39
- </div>
40
- );
41
- }
25
+ - The request layer uniformly normalizes error shapes, and components do not directly parse backend exceptions, token refresh or retry strategies.
26
+ - Each type of error should have a clear next step: retry, log in again, modify input, return to the previous level, refresh conflicting data, contact support, or try again later.
27
+ - `401`, `403`, `404`, `409`, `422`, `429`, `5xx` and network errors should have distinguishable user prompts and log semantics.
28
+ - The UI can display request id / trace id to facilitate support troubleshooting, but must not expose internal stacks, SQL, service names, keys or sensitive fields.
42
29
 
43
- // 根节点包裹示例(root 来自 createRoot(document.getElementById("root")!) 等)
44
- root.render(
45
- <ErrorBoundary
46
- FallbackComponent={GlobalErrorFallback}
47
- onError={(error, info) => {
48
- reportError(error, { componentStack: info.componentStack });
49
- }}
50
- >
51
- <App />
52
- </ErrorBoundary>,
53
- );
54
- ```
30
+ ## User experience
55
31
 
56
- ### Vue
32
+ - Each data display area handles four states: Loading, Error, Empty, and Success.
33
+ - Global-level error pages provide paths to return to the home page, refresh or retry; module-level downgrades only affect this module; operation-level errors provide the next step.
34
+ - The retry strategy must be restrained: users’ manual retries are given priority, and automatic retries must have upper limits, backoff and stop conditions.
35
+ - Error prompts should retain what the user has entered to avoid losing the form or context due to failure.
57
36
 
58
- ```typescript
59
- // main.ts
60
- app.config.errorHandler = (err, instance, info) => {
61
- reportError(err, {
62
- component: instance?.$options.name,
63
- lifecycleHook: info,
64
- });
65
- };
37
+ ## Error reporting
66
38
 
67
- window.addEventListener('unhandledrejection', (event) => {
68
- reportError(event.reason);
69
- });
70
- ```
39
+ The reported content should include the error stack, page URL, browser/device information, user or session ID, operation context, request ID, and version information. Clean tokens, passwords, personal sensitive fields and large payloads before reporting.
71
40
 
72
- ## Error Boundary 策略
41
+ ## Anti-pattern
73
42
 
74
- ```
75
- App (GlobalErrorBoundary)
76
- ├── Header
77
- ├── Main
78
- │ ├── Sidebar (ErrorBoundary)
79
- │ └── Content
80
- │ ├── Dashboard (ErrorBoundary)
81
- │ └── UserList (ErrorBoundary)
82
- └── Footer
83
- ```
43
+ - Empty `catch` blocks swallow errors.
44
+ - All errors are reported with `alert()` or a vague toast.
45
+ - When the interface fails, there is no feedback from the UI, or the original exception from the backend is directly displayed to the user.
46
+ - Error Boundary has no retry or return path.
47
+ - Write repeated `try/catch` everywhere in the component instead of uniformly encapsulating request boundaries.
48
+ - Use Error Boundary to handle common API errors, making it impossible for users to understand or recover.
84
49
 
85
- - 每个独立功能模块用 Error Boundary 包裹
86
- - 模块崩溃不应导致整个页面白屏
87
- - 降级 UI 应提供"重试"操作
50
+ ## Checklist
88
51
 
89
- ## API 错误处理
90
-
91
- ### 统一错误格式
92
-
93
- ```typescript
94
- interface ApiError {
95
- code: string;
96
- message: string;
97
- details?: Record<string, string[]>;
98
- }
99
- ```
100
-
101
- ### 错误分级处理
102
-
103
- ```typescript
104
- function handleApiError(error: ApiError) {
105
- switch (error.code) {
106
- case 'UNAUTHORIZED':
107
- redirectToLogin();
108
- break;
109
- case 'FORBIDDEN':
110
- showToast('无权限执行此操作');
111
- break;
112
- case 'VALIDATION_ERROR':
113
- return error.details; // 返回给表单显示字段级错误
114
- case 'NETWORK_ERROR':
115
- showToast('网络异常,请检查网络连接');
116
- break;
117
- default:
118
- showToast(error.message || '操作失败,请稍后重试');
119
- reportError(error);
120
- }
121
- }
122
- ```
123
-
124
- ### 请求拦截器
125
-
126
- 在 axios / fetch 封装层统一处理:
127
-
128
- - 401 → 跳转登录(或刷新 token)
129
- - 403 → 权限不足提示
130
- - 500 → 通用错误提示 + 上报
131
- - 网络超时 → 超时提示 + 可选重试
132
-
133
- ### 用户可恢复动作
134
-
135
- 每类错误都应对应明确下一步:
136
-
137
- - `401`:重新登录或静默刷新失败后跳转登录
138
- - `403`:说明无权限并提供返回或申请权限路径
139
- - `404`:返回列表、重新搜索或创建入口
140
- - `409`:展示冲突对象和刷新/覆盖/取消选择
141
- - `422`:字段级错误回填表单
142
- - `429`:告知等待时间或稍后重试
143
- - `5xx` / 网络错误:重试、离线提示或联系支持
144
-
145
- UI 可显示 request id / trace id 方便支持排查,但不得暴露内部堆栈、SQL、服务名或敏感字段。
146
-
147
- ## 用户体验
148
-
149
- ### 错误状态 UI
150
-
151
- 每个数据展示区域应处理四种状态:
152
-
153
- 1. **Loading** — 骨架屏或 spinner
154
- 2. **Error** — 错误描述 + 重试按钮
155
- 3. **Empty** — 空状态引导
156
- 4. **Success** — 正常数据展示
157
-
158
- ### 降级 UI 设计
159
-
160
- - 全局级:显示友好的错误页面,提供"返回首页"和"重试"
161
- - 模块级:显示该模块的占位错误卡片,页面其他部分正常
162
- - 操作级:Toast 提示 + 具体的下一步指引
163
-
164
- ### 重试策略
165
-
166
- - 用户手动重试(按钮)
167
- - 自动重试(指数退避,最多 3 次)
168
- - 数据请求库的内置重试(React Query retries 等)
169
-
170
- ## 错误上报
171
-
172
- <!-- 请根据项目实际的错误监控平台调整:Sentry / 自建 / 其他 -->
173
-
174
- 上报内容应包含:
175
-
176
- - 错误堆栈
177
- - 用户 ID / 会话 ID
178
- - 当前页面 URL
179
- - 浏览器/设备信息
180
- - 复现上下文(操作步骤、请求参数)
181
-
182
- ## 反模式
183
-
184
- - 空 catch 块吞掉错误
185
- - 所有错误统一用 `alert()` 提示
186
- - 接口失败时 UI 无任何反馈
187
- - Error Boundary 没有重试机制,用户只能刷新页面
188
- - 在组件中到处写重复的 try/catch 而不是统一封装
189
- - 不上报错误,依赖用户反馈来发现问题
190
- - 用 Error Boundary 承接普通 API 错误,导致用户无法理解或恢复
191
- - 把后端原始异常、内部错误码或敏感字段直接展示给用户
192
-
193
- ## 检查清单
194
-
195
- - [ ] 全局有未捕获异常和 Promise rejection 的监听
196
- - [ ] 关键功能模块有 Error Boundary(React)或 onErrorCaptured(Vue)包裹
197
- - [ ] API 请求有统一的错误拦截和分级处理
198
- - [ ] 所有数据展示区域处理了 Loading / Error / Empty / Success 四种状态
199
- - [ ] 降级 UI 提供了"重试"操作
200
- - [ ] 错误信息上报到监控平台
52
+ - [ ] Global uncaught exceptions and Promise rejections are listened to.
53
+ - [ ] Critical pages or modules have frame error boundaries and partially degraded UI.
54
+ - [ ] API requests have unified error normalization, hierarchical processing and recoverable actions.
55
+ - [ ] Data area override Loading / Error / Empty / Success.
56
+ - [ ] Error reports contain sufficient location information and do not leak sensitive data.