@bovinphang/frontend-craft 2.7.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 (380) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +34 -0
  4. package/CHANGELOG.zh-CN.md +34 -0
  5. package/README.md +1 -1
  6. package/README.openclaw.md +99 -43
  7. package/README.openclaw.zh-CN.md +99 -43
  8. package/README.zh-CN.md +1 -1
  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 +87 -87
  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 +3 -0
  32. package/docs/ja-JP/README.md +1 -1
  33. package/docs/ko-KR/README.md +1 -1
  34. package/docs/project-structure.md +13 -5
  35. package/docs/zh-CN/example-prompts.md +3 -0
  36. package/docs/zh-CN/project-structure.md +6 -1
  37. package/docs/zh-TW/README.md +1 -1
  38. package/localized/zh-CN/agents/fec-architect.md +125 -0
  39. package/localized/zh-CN/agents/fec-code-reviewer.md +152 -0
  40. package/localized/zh-CN/agents/fec-debugger.md +44 -0
  41. package/localized/zh-CN/agents/fec-design-token-mapper.md +75 -0
  42. package/localized/zh-CN/agents/fec-doc-updater.md +30 -0
  43. package/localized/zh-CN/agents/fec-e2e-runner.md +107 -0
  44. package/localized/zh-CN/agents/fec-figma-implementer.md +104 -0
  45. package/localized/zh-CN/agents/fec-performance-optimizer.md +293 -0
  46. package/localized/zh-CN/agents/fec-refactor-cleaner.md +32 -0
  47. package/localized/zh-CN/agents/fec-security-reviewer.md +116 -0
  48. package/localized/zh-CN/agents/fec-test-planner.md +50 -0
  49. package/localized/zh-CN/agents/fec-typescript-reviewer.md +142 -0
  50. package/localized/zh-CN/agents/fec-ui-checker.md +120 -0
  51. package/localized/zh-CN/commands/fec-debug.md +30 -0
  52. package/localized/zh-CN/commands/fec-doc-sync.md +19 -0
  53. package/localized/zh-CN/commands/fec-init.md +70 -0
  54. package/localized/zh-CN/commands/fec-plan.md +94 -0
  55. package/localized/zh-CN/commands/fec-refactor-clean.md +19 -0
  56. package/localized/zh-CN/commands/fec-review.md +66 -0
  57. package/localized/zh-CN/commands/fec-scaffold.md +205 -0
  58. package/localized/zh-CN/commands/fec-tdd.md +21 -0
  59. package/localized/zh-CN/skills/TEMPLATE.md +155 -0
  60. package/localized/zh-CN/skills/eval_queries.json +1013 -0
  61. package/localized/zh-CN/skills/fec-accessibility-check/SKILL.md +39 -0
  62. package/localized/zh-CN/skills/fec-accessibility-check/references/report-template.md +23 -0
  63. package/localized/zh-CN/skills/fec-accessibility-check/references/screen-reader-testing.md +33 -0
  64. package/localized/zh-CN/skills/fec-alchemy/SKILL.md +74 -0
  65. package/localized/zh-CN/skills/fec-alchemy/assets/absorption-plan-template.md +47 -0
  66. package/localized/zh-CN/skills/fec-alchemy/assets/intake-template.md +55 -0
  67. package/localized/zh-CN/skills/fec-alchemy/assets/review-checklist.md +31 -0
  68. package/localized/zh-CN/skills/fec-alchemy/references/methodology.md +94 -0
  69. package/localized/zh-CN/skills/fec-alchemy/references/originality-and-licensing.md +57 -0
  70. package/localized/zh-CN/skills/fec-api-integration/SKILL.md +78 -0
  71. package/localized/zh-CN/skills/fec-api-integration/references/integration-patterns.md +80 -0
  72. package/localized/zh-CN/skills/fec-backend-requirements-handoff/SKILL.md +45 -0
  73. package/localized/zh-CN/skills/fec-browser-storage/SKILL.md +34 -0
  74. package/localized/zh-CN/skills/fec-browser-storage/references/storage-patterns.md +65 -0
  75. package/localized/zh-CN/skills/fec-canvas-threejs/SKILL.md +66 -0
  76. package/localized/zh-CN/skills/fec-canvas-threejs/references/rendering-patterns.md +67 -0
  77. package/localized/zh-CN/skills/fec-canvas-threejs/references/shader-webgl-patterns.md +67 -0
  78. package/localized/zh-CN/skills/fec-code-review/SKILL.md +143 -0
  79. package/localized/zh-CN/skills/fec-code-review/references/report-template.md +29 -0
  80. package/localized/zh-CN/skills/fec-component-testing/SKILL.md +119 -0
  81. package/localized/zh-CN/skills/fec-data-fetching/SKILL.md +62 -0
  82. package/localized/zh-CN/skills/fec-data-fetching/references/query-patterns.md +103 -0
  83. package/localized/zh-CN/skills/fec-debug-framework/SKILL.md +157 -0
  84. package/localized/zh-CN/skills/fec-debug-framework/references/report-template.md +58 -0
  85. package/localized/zh-CN/skills/fec-dependency-upgrade/SKILL.md +34 -0
  86. package/localized/zh-CN/skills/fec-dependency-upgrade/references/dependency-upgrade-workflow.md +56 -0
  87. package/localized/zh-CN/skills/fec-doc-sync/SKILL.md +39 -0
  88. package/localized/zh-CN/skills/fec-drawio-studio/SKILL.md +73 -0
  89. package/localized/zh-CN/skills/fec-drawio-studio/data/THIRD_PARTY_NOTICES.md +10 -0
  90. package/localized/zh-CN/skills/fec-drawio-studio/data/brand-icons.json +878 -0
  91. package/localized/zh-CN/skills/fec-drawio-studio/data/shape-index.json +83570 -0
  92. package/localized/zh-CN/skills/fec-drawio-studio/references/data-residency.md +27 -0
  93. package/localized/zh-CN/skills/fec-drawio-studio/references/diagram-patterns.md +60 -0
  94. package/localized/zh-CN/skills/fec-drawio-studio/references/flowchart-quality.md +49 -0
  95. package/localized/zh-CN/skills/fec-drawio-studio/references/layout-and-export.md +72 -0
  96. package/localized/zh-CN/skills/fec-drawio-studio/references/troubleshooting.md +29 -0
  97. package/localized/zh-CN/skills/fec-drawio-studio/references/xml-and-mermaid.md +58 -0
  98. package/localized/zh-CN/skills/fec-drawio-studio/scripts/brand-symbols.mjs +99 -0
  99. package/localized/zh-CN/skills/fec-drawio-studio/scripts/diagram-lint.mjs +205 -0
  100. package/localized/zh-CN/skills/fec-drawio-studio/scripts/diagram-url.mjs +102 -0
  101. package/localized/zh-CN/skills/fec-drawio-studio/scripts/drawio-export.mjs +134 -0
  102. package/localized/zh-CN/skills/fec-drawio-studio/scripts/layout-graph.mjs +107 -0
  103. package/localized/zh-CN/skills/fec-drawio-studio/scripts/png-embed-fix.mjs +26 -0
  104. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-go-packages.mjs +36 -0
  105. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-js-modules.mjs +52 -0
  106. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-python-classes.mjs +30 -0
  107. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-python-modules.mjs +55 -0
  108. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-rust-modules.mjs +35 -0
  109. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-ts-modules.mjs +7 -0
  110. package/localized/zh-CN/skills/fec-drawio-studio/scripts/shape-query.mjs +121 -0
  111. package/localized/zh-CN/skills/fec-drawio-studio/scripts/studio-core.mjs +139 -0
  112. package/localized/zh-CN/skills/fec-drawio-studio/styles/built-in/corporate.json +49 -0
  113. package/localized/zh-CN/skills/fec-drawio-studio/styles/built-in/default.json +49 -0
  114. package/localized/zh-CN/skills/fec-drawio-studio/styles/built-in/handdrawn.json +49 -0
  115. package/localized/zh-CN/skills/fec-drawio-studio/styles/schema.json +112 -0
  116. package/localized/zh-CN/skills/fec-e2e-testing/SKILL.md +42 -0
  117. package/localized/zh-CN/skills/fec-e2e-testing/references/e2e-ci-reporting.md +62 -0
  118. package/localized/zh-CN/skills/fec-e2e-testing/references/e2e-special-scenarios.md +52 -0
  119. package/localized/zh-CN/skills/fec-e2e-testing/references/e2e-visual-regression.md +60 -0
  120. package/localized/zh-CN/skills/fec-e2e-testing/references/playwright-patterns.md +95 -0
  121. package/localized/zh-CN/skills/fec-form-handling/SKILL.md +76 -0
  122. package/localized/zh-CN/skills/fec-form-handling/references/advanced-form-patterns.md +101 -0
  123. package/localized/zh-CN/skills/fec-image-generation/SKILL.md +80 -0
  124. package/localized/zh-CN/skills/fec-image-generation/assets/interactive-diagram.html +371 -0
  125. package/localized/zh-CN/skills/fec-image-generation/references/artifact-routing.md +80 -0
  126. package/localized/zh-CN/skills/fec-image-generation/references/diagram-workflows.md +74 -0
  127. package/localized/zh-CN/skills/fec-image-generation/references/html-technical-diagrams.md +236 -0
  128. package/localized/zh-CN/skills/fec-image-generation/references/png-qa-autofix.md +30 -0
  129. package/localized/zh-CN/skills/fec-image-generation/scripts/export-diagram.mjs +364 -0
  130. package/localized/zh-CN/skills/fec-image-generation/scripts/interactive-diagram-server.mjs +654 -0
  131. package/localized/zh-CN/skills/fec-image-generation/scripts/png-qa.mjs +431 -0
  132. package/localized/zh-CN/skills/fec-image-generation/scripts/tech-diagram-render.mjs +1397 -0
  133. package/localized/zh-CN/skills/fec-implement-from-design/SKILL.md +129 -0
  134. package/localized/zh-CN/skills/fec-implement-from-design/references/design-plan-template.md +36 -0
  135. package/localized/zh-CN/skills/fec-legacy-to-modern-migration/SKILL.md +46 -0
  136. package/localized/zh-CN/skills/fec-legacy-to-modern-migration/references/migration-execution-checklist.md +110 -0
  137. package/localized/zh-CN/skills/fec-legacy-to-modern-migration/references/migration-report-template.md +41 -0
  138. package/localized/zh-CN/skills/fec-legacy-to-modern-migration/references/migration-strategy-and-mapping.md +48 -0
  139. package/localized/zh-CN/skills/fec-legacy-web-standard/SKILL.md +35 -0
  140. package/localized/zh-CN/skills/fec-legacy-web-standard/references/legacy-patterns.md +85 -0
  141. package/localized/zh-CN/skills/fec-list-virtualization/SKILL.md +34 -0
  142. package/localized/zh-CN/skills/fec-list-virtualization/references/virtualization-patterns.md +80 -0
  143. package/localized/zh-CN/skills/fec-monorepo-project-standard/SKILL.md +142 -0
  144. package/localized/zh-CN/skills/fec-motion-interaction/SKILL.md +73 -0
  145. package/localized/zh-CN/skills/fec-motion-interaction/references/motion-patterns.md +112 -0
  146. package/localized/zh-CN/skills/fec-nextjs-project-standard/SKILL.md +123 -0
  147. package/localized/zh-CN/skills/fec-nuxt-project-standard/SKILL.md +122 -0
  148. package/localized/zh-CN/skills/fec-performance-optimization/SKILL.md +80 -0
  149. package/localized/zh-CN/skills/fec-performance-optimization/references/framework-performance-patterns.md +38 -0
  150. package/localized/zh-CN/skills/fec-performance-optimization/references/report-template.md +59 -0
  151. package/localized/zh-CN/skills/fec-pwa-implementation/SKILL.md +35 -0
  152. package/localized/zh-CN/skills/fec-pwa-implementation/references/manifest-and-icons.md +53 -0
  153. package/localized/zh-CN/skills/fec-pwa-implementation/references/service-worker-workbox.md +68 -0
  154. package/localized/zh-CN/skills/fec-react-project-standard/SKILL.md +91 -0
  155. package/localized/zh-CN/skills/fec-react-project-standard/references/react-performance-patterns.md +35 -0
  156. package/localized/zh-CN/skills/fec-react-project-standard/references/react-project-structure.md +197 -0
  157. package/localized/zh-CN/skills/fec-react-project-standard/references/react-quality-patterns.md +131 -0
  158. package/localized/zh-CN/skills/fec-react-project-standard/references/react-runtime-patterns.md +293 -0
  159. package/localized/zh-CN/skills/fec-refactor-clean/SKILL.md +51 -0
  160. package/localized/zh-CN/skills/fec-refactor-clean/references/report-template.md +42 -0
  161. package/localized/zh-CN/skills/fec-responsive-layout/SKILL.md +34 -0
  162. package/localized/zh-CN/skills/fec-responsive-layout/references/responsive-layout-patterns.md +70 -0
  163. package/localized/zh-CN/skills/fec-route-protection/SKILL.md +135 -0
  164. package/localized/zh-CN/skills/fec-security-review/SKILL.md +38 -0
  165. package/localized/zh-CN/skills/fec-security-review/references/report-template.md +27 -0
  166. package/localized/zh-CN/skills/fec-security-review/references/security-checklist.md +64 -0
  167. package/localized/zh-CN/skills/fec-source-driven-development/SKILL.md +87 -0
  168. package/localized/zh-CN/skills/fec-state-management/SKILL.md +140 -0
  169. package/localized/zh-CN/skills/fec-state-management/references/state-patterns.md +109 -0
  170. package/localized/zh-CN/skills/fec-storybook-component-doc/SKILL.md +37 -0
  171. package/localized/zh-CN/skills/fec-storybook-component-doc/references/story-patterns.md +118 -0
  172. package/localized/zh-CN/skills/fec-svg-animation/SKILL.md +148 -0
  173. package/localized/zh-CN/skills/fec-tailwind-design-system/SKILL.md +34 -0
  174. package/localized/zh-CN/skills/fec-tailwind-design-system/references/tailwind-system-patterns.md +59 -0
  175. package/localized/zh-CN/skills/fec-tdd-workflow/SKILL.md +52 -0
  176. package/localized/zh-CN/skills/fec-testing-strategy/SKILL.md +45 -0
  177. package/localized/zh-CN/skills/fec-typescript-project-standard/SKILL.md +54 -0
  178. package/localized/zh-CN/skills/fec-typescript-project-standard/references/type-safety-patterns.md +102 -0
  179. package/localized/zh-CN/skills/fec-typescript-project-standard/references/type-safety.md +148 -0
  180. package/localized/zh-CN/skills/fec-ui-design/SKILL.md +108 -0
  181. package/localized/zh-CN/skills/fec-ui-design/data/product-rules.json +231 -0
  182. package/localized/zh-CN/skills/fec-ui-design/data/stack-ui-rules.json +146 -0
  183. package/localized/zh-CN/skills/fec-ui-design/data/style-archetypes.json +373 -0
  184. package/localized/zh-CN/skills/fec-ui-design/data/ux-quality-rules.json +203 -0
  185. package/localized/zh-CN/skills/fec-ui-design/references/design-intelligence.md +97 -0
  186. package/localized/zh-CN/skills/fec-ui-design/references/master-page-overrides.md +30 -0
  187. package/localized/zh-CN/skills/fec-ui-design/references/pre-delivery-checklist.md +39 -0
  188. package/localized/zh-CN/skills/fec-ui-design/scripts/design-system.mjs +648 -0
  189. package/localized/zh-CN/skills/fec-validation-fix/SKILL.md +51 -0
  190. package/localized/zh-CN/skills/fec-validation-fix/references/report-template.md +43 -0
  191. package/localized/zh-CN/skills/fec-vite-project-standard/SKILL.md +83 -0
  192. package/localized/zh-CN/skills/fec-vue3-project-standard/SKILL.md +58 -0
  193. package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-composables-routing.md +162 -0
  194. package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-performance-patterns.md +13 -0
  195. package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-project-structure.md +176 -0
  196. package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-state-api-quality.md +216 -0
  197. package/localized/zh-CN/skills/fec-web-video-presentation/SKILL.md +61 -0
  198. package/localized/zh-CN/skills/fec-web-video-presentation/data/starter-themes.json +59 -0
  199. package/localized/zh-CN/skills/fec-web-video-presentation/references/chapter-craft.md +37 -0
  200. package/localized/zh-CN/skills/fec-web-video-presentation/references/content-plan.md +38 -0
  201. package/localized/zh-CN/skills/fec-web-video-presentation/references/recording-and-audio.md +33 -0
  202. package/localized/zh-CN/skills/fec-web-video-presentation/references/theme-system.md +36 -0
  203. package/localized/zh-CN/skills/fec-web-video-presentation/scripts/create-video-presentation.mjs +430 -0
  204. package/localized/zh-CN/skills/fec-web-workers/SKILL.md +35 -0
  205. package/localized/zh-CN/skills/fec-web-workers/references/advanced-workers.md +54 -0
  206. package/localized/zh-CN/skills/fec-web-workers/references/basic-worker.md +67 -0
  207. package/localized/zh-CN/skills/metadata.json +1646 -0
  208. package/localized/zh-CN/skills/relations.json +755 -0
  209. package/localized/zh-CN/templates/claude/CLAUDE.md +106 -0
  210. package/localized/zh-CN/templates/claude/settings.json +62 -0
  211. package/localized/zh-CN/templates/codex/AGENTS.md +105 -0
  212. package/localized/zh-CN/templates/codex/config.toml +32 -0
  213. package/localized/zh-CN/templates/openclaw/AGENTS.md +101 -0
  214. package/localized/zh-CN/templates/openclaw/OPENCLAW-CONFIG.md +12 -0
  215. package/localized/zh-CN/templates/shared/rules/fec-agent-workflow.md +54 -0
  216. package/localized/zh-CN/templates/shared/rules/fec-api-layer.md +99 -0
  217. package/localized/zh-CN/templates/shared/rules/fec-ci-cd.md +40 -0
  218. package/localized/zh-CN/templates/shared/rules/fec-code-comments.md +33 -0
  219. package/localized/zh-CN/templates/shared/rules/fec-design-system.md +72 -0
  220. package/localized/zh-CN/templates/shared/rules/fec-error-handling.md +56 -0
  221. package/localized/zh-CN/templates/shared/rules/fec-git-conventions.md +73 -0
  222. package/localized/zh-CN/templates/shared/rules/fec-i18n.md +64 -0
  223. package/localized/zh-CN/templates/shared/rules/fec-naming-conventions.md +120 -0
  224. package/localized/zh-CN/templates/shared/rules/fec-performance.md +101 -0
  225. package/localized/zh-CN/templates/shared/rules/fec-react.md +82 -0
  226. package/localized/zh-CN/templates/shared/rules/fec-refactoring.md +47 -0
  227. package/localized/zh-CN/templates/shared/rules/fec-rendering-patterns.md +40 -0
  228. package/localized/zh-CN/templates/shared/rules/fec-responsive-design.md +50 -0
  229. package/localized/zh-CN/templates/shared/rules/fec-source-driven-development.md +31 -0
  230. package/localized/zh-CN/templates/shared/rules/fec-state-management.md +60 -0
  231. package/localized/zh-CN/templates/shared/rules/fec-testing.md +98 -0
  232. package/localized/zh-CN/templates/shared/rules/fec-typescript.md +112 -0
  233. package/localized/zh-CN/templates/shared/rules/fec-vue.md +64 -0
  234. package/localized/zh-CN/templates/shared/rules/fec-working-modes.md +50 -0
  235. package/openclaw.plugin.json +1 -1
  236. package/package.json +3 -2
  237. package/skills/TEMPLATE.md +74 -74
  238. package/skills/eval_queries.json +678 -678
  239. package/skills/fec-accessibility-check/SKILL.md +21 -21
  240. package/skills/fec-accessibility-check/references/report-template.md +12 -12
  241. package/skills/fec-accessibility-check/references/screen-reader-testing.md +24 -24
  242. package/skills/fec-alchemy/SKILL.md +50 -50
  243. package/skills/fec-alchemy/assets/absorption-plan-template.md +32 -32
  244. package/skills/fec-alchemy/assets/intake-template.md +55 -55
  245. package/skills/fec-alchemy/assets/review-checklist.md +23 -23
  246. package/skills/fec-alchemy/references/methodology.md +66 -66
  247. package/skills/fec-alchemy/references/originality-and-licensing.md +42 -42
  248. package/skills/fec-api-integration/SKILL.md +61 -61
  249. package/skills/fec-api-integration/references/integration-patterns.md +30 -30
  250. package/skills/fec-backend-requirements-handoff/SKILL.md +25 -25
  251. package/skills/fec-browser-storage/SKILL.md +16 -16
  252. package/skills/fec-browser-storage/references/storage-patterns.md +16 -16
  253. package/skills/fec-canvas-threejs/SKILL.md +21 -21
  254. package/skills/fec-canvas-threejs/references/rendering-patterns.md +10 -10
  255. package/skills/fec-canvas-threejs/references/shader-webgl-patterns.md +37 -37
  256. package/skills/fec-code-review/SKILL.md +94 -94
  257. package/skills/fec-code-review/references/report-template.md +13 -13
  258. package/skills/fec-component-testing/SKILL.md +39 -39
  259. package/skills/fec-data-fetching/SKILL.md +16 -16
  260. package/skills/fec-data-fetching/references/query-patterns.md +27 -27
  261. package/skills/fec-debug-framework/SKILL.md +95 -95
  262. package/skills/fec-debug-framework/references/report-template.md +34 -34
  263. package/skills/fec-dependency-upgrade/SKILL.md +17 -17
  264. package/skills/fec-dependency-upgrade/references/dependency-upgrade-workflow.md +31 -31
  265. package/skills/fec-doc-sync/SKILL.md +23 -23
  266. package/skills/fec-drawio-studio/SKILL.md +42 -38
  267. package/skills/fec-drawio-studio/data/THIRD_PARTY_NOTICES.md +1 -1
  268. package/skills/fec-drawio-studio/data/shape-index.json +83570 -0
  269. package/skills/fec-drawio-studio/references/diagram-patterns.md +19 -0
  270. package/skills/fec-drawio-studio/references/flowchart-quality.md +49 -0
  271. package/skills/fec-drawio-studio/references/layout-and-export.md +18 -3
  272. package/skills/fec-drawio-studio/references/xml-and-mermaid.md +5 -1
  273. package/skills/fec-drawio-studio/scripts/diagram-lint.mjs +62 -0
  274. package/skills/fec-drawio-studio/scripts/drawio-export.mjs +134 -0
  275. package/skills/fec-drawio-studio/scripts/shape-query.mjs +55 -15
  276. package/skills/fec-e2e-testing/SKILL.md +24 -24
  277. package/skills/fec-e2e-testing/references/e2e-ci-reporting.md +20 -20
  278. package/skills/fec-e2e-testing/references/e2e-special-scenarios.md +10 -10
  279. package/skills/fec-e2e-testing/references/e2e-visual-regression.md +17 -17
  280. package/skills/fec-e2e-testing/references/playwright-patterns.md +6 -6
  281. package/skills/fec-form-handling/SKILL.md +21 -21
  282. package/skills/fec-form-handling/references/advanced-form-patterns.md +41 -41
  283. package/skills/fec-image-generation/SKILL.md +54 -29
  284. package/skills/fec-image-generation/assets/interactive-diagram.html +371 -0
  285. package/skills/fec-image-generation/references/diagram-workflows.md +33 -2
  286. package/skills/fec-image-generation/references/html-technical-diagrams.md +236 -0
  287. package/skills/fec-image-generation/scripts/export-diagram.mjs +364 -0
  288. package/skills/fec-image-generation/scripts/interactive-diagram-server.mjs +654 -0
  289. package/skills/fec-image-generation/scripts/tech-diagram-render.mjs +1397 -0
  290. package/skills/fec-implement-from-design/SKILL.md +81 -81
  291. package/skills/fec-implement-from-design/references/design-plan-template.md +16 -16
  292. package/skills/fec-legacy-to-modern-migration/SKILL.md +29 -29
  293. package/skills/fec-legacy-to-modern-migration/references/migration-execution-checklist.md +81 -81
  294. package/skills/fec-legacy-to-modern-migration/references/migration-report-template.md +37 -37
  295. package/skills/fec-legacy-to-modern-migration/references/migration-strategy-and-mapping.md +31 -31
  296. package/skills/fec-legacy-web-standard/SKILL.md +17 -17
  297. package/skills/fec-legacy-web-standard/references/legacy-patterns.md +16 -16
  298. package/skills/fec-list-virtualization/SKILL.md +16 -16
  299. package/skills/fec-list-virtualization/references/virtualization-patterns.md +31 -31
  300. package/skills/fec-monorepo-project-standard/SKILL.md +52 -52
  301. package/skills/fec-motion-interaction/SKILL.md +51 -51
  302. package/skills/fec-motion-interaction/references/motion-patterns.md +11 -11
  303. package/skills/fec-nextjs-project-standard/SKILL.md +64 -64
  304. package/skills/fec-nuxt-project-standard/SKILL.md +57 -57
  305. package/skills/fec-performance-optimization/SKILL.md +54 -54
  306. package/skills/fec-performance-optimization/references/framework-performance-patterns.md +23 -23
  307. package/skills/fec-performance-optimization/references/report-template.md +31 -31
  308. package/skills/fec-pwa-implementation/SKILL.md +17 -17
  309. package/skills/fec-pwa-implementation/references/manifest-and-icons.md +12 -12
  310. package/skills/fec-pwa-implementation/references/service-worker-workbox.md +13 -13
  311. package/skills/fec-react-project-standard/SKILL.md +72 -72
  312. package/skills/fec-react-project-standard/references/react-performance-patterns.md +28 -28
  313. package/skills/fec-react-project-standard/references/react-project-structure.md +112 -112
  314. package/skills/fec-react-project-standard/references/react-quality-patterns.md +72 -72
  315. package/skills/fec-react-project-standard/references/react-runtime-patterns.md +94 -94
  316. package/skills/fec-refactor-clean/SKILL.md +30 -30
  317. package/skills/fec-refactor-clean/references/report-template.md +23 -23
  318. package/skills/fec-responsive-layout/SKILL.md +17 -17
  319. package/skills/fec-responsive-layout/references/responsive-layout-patterns.md +37 -37
  320. package/skills/fec-route-protection/SKILL.md +26 -26
  321. package/skills/fec-security-review/SKILL.md +20 -20
  322. package/skills/fec-security-review/references/report-template.md +12 -12
  323. package/skills/fec-security-review/references/security-checklist.md +27 -27
  324. package/skills/fec-source-driven-development/SKILL.md +59 -59
  325. package/skills/fec-state-management/SKILL.md +34 -34
  326. package/skills/fec-state-management/references/state-patterns.md +19 -19
  327. package/skills/fec-storybook-component-doc/SKILL.md +19 -19
  328. package/skills/fec-storybook-component-doc/references/story-patterns.md +12 -12
  329. package/skills/fec-svg-animation/SKILL.md +32 -32
  330. package/skills/fec-tailwind-design-system/SKILL.md +17 -17
  331. package/skills/fec-tailwind-design-system/references/tailwind-system-patterns.md +36 -36
  332. package/skills/fec-tdd-workflow/SKILL.md +28 -28
  333. package/skills/fec-testing-strategy/SKILL.md +29 -29
  334. package/skills/fec-typescript-project-standard/SKILL.md +38 -38
  335. package/skills/fec-typescript-project-standard/references/type-safety-patterns.md +20 -20
  336. package/skills/fec-typescript-project-standard/references/type-safety.md +18 -18
  337. package/skills/fec-ui-design/SKILL.md +90 -90
  338. package/skills/fec-ui-design/references/design-intelligence.md +61 -61
  339. package/skills/fec-ui-design/references/master-page-overrides.md +15 -15
  340. package/skills/fec-ui-design/references/pre-delivery-checklist.md +38 -38
  341. package/skills/fec-validation-fix/SKILL.md +26 -26
  342. package/skills/fec-validation-fix/references/report-template.md +25 -25
  343. package/skills/fec-vite-project-standard/SKILL.md +39 -39
  344. package/skills/fec-vue3-project-standard/SKILL.md +38 -38
  345. package/skills/fec-vue3-project-standard/references/vue3-composables-routing.md +36 -36
  346. package/skills/fec-vue3-project-standard/references/vue3-performance-patterns.md +8 -8
  347. package/skills/fec-vue3-project-standard/references/vue3-project-structure.md +112 -112
  348. package/skills/fec-vue3-project-standard/references/vue3-state-api-quality.md +74 -74
  349. package/skills/fec-web-video-presentation/SKILL.md +33 -33
  350. package/skills/fec-web-workers/SKILL.md +16 -16
  351. package/skills/fec-web-workers/references/advanced-workers.md +13 -13
  352. package/skills/fec-web-workers/references/basic-worker.md +8 -8
  353. package/skills/metadata.json +121 -115
  354. package/skills/relations.json +4 -0
  355. package/templates/claude/CLAUDE.md +60 -60
  356. package/templates/codex/AGENTS.md +76 -76
  357. package/templates/codex/config.toml +4 -4
  358. package/templates/openclaw/AGENTS.md +68 -68
  359. package/templates/openclaw/OPENCLAW-CONFIG.md +8 -8
  360. package/templates/shared/rules/fec-agent-workflow.md +40 -40
  361. package/templates/shared/rules/fec-api-layer.md +52 -52
  362. package/templates/shared/rules/fec-ci-cd.md +29 -29
  363. package/templates/shared/rules/fec-code-comments.md +22 -22
  364. package/templates/shared/rules/fec-design-system.md +53 -53
  365. package/templates/shared/rules/fec-error-handling.md +40 -40
  366. package/templates/shared/rules/fec-git-conventions.md +42 -42
  367. package/templates/shared/rules/fec-i18n.md +48 -48
  368. package/templates/shared/rules/fec-naming-conventions.md +91 -91
  369. package/templates/shared/rules/fec-performance.md +78 -78
  370. package/templates/shared/rules/fec-react.md +58 -58
  371. package/templates/shared/rules/fec-refactoring.md +34 -34
  372. package/templates/shared/rules/fec-rendering-patterns.md +36 -36
  373. package/templates/shared/rules/fec-responsive-design.md +37 -37
  374. package/templates/shared/rules/fec-source-driven-development.md +22 -22
  375. package/templates/shared/rules/fec-state-management.md +56 -56
  376. package/templates/shared/rules/fec-testing.md +64 -64
  377. package/templates/shared/rules/fec-typescript.md +75 -75
  378. package/templates/shared/rules/fec-vue.md +42 -42
  379. package/templates/shared/rules/fec-working-modes.md +34 -34
  380. package/skills/fec-drawio-studio/data/shape-index.json.gz +0 -0
@@ -1,43 +1,43 @@
1
1
  # React quality patterns
2
2
 
3
- ## 样式接入
3
+ ## Style access
4
4
 
5
- 本 skill 不强制具体样式方案,默认遵循仓库现状。
5
+ This skill does not enforce a specific style scheme and follows the current status of the warehouse by default.
6
6
 
7
- 适配时注意:
7
+ Please note when adapting:
8
8
 
9
- - Tailwind 项目继续使用 Tailwind
10
- - CSS Modules 项目保持命名与文件组织一致
11
- - styled-components 项目继续沿用其模式
12
- - 主题、颜色、字号、间距等优先复用仓库 token / CSS 变量
13
- - 避免在组件内硬编码大量视觉常量
14
- - 禁止内联样式(除动态值外)
15
- - 响应式处理需与项目断点约定一致
9
+ - Tailwind project continues to use Tailwind
10
+ - CSS Modules projects keep naming consistent with file organization
11
+ - The styled-components project continues to follow its pattern
12
+ - Theme, color, font size, spacing, etc. give priority to reusing warehouse token / CSS variables
13
+ - Avoid hardcoding a large number of visual constants within the component
14
+ - Disable inline styles (except dynamic values)
15
+ - Responsive processing must be consistent with the project breakpoint agreement
16
16
 
17
17
  ---
18
18
 
19
- ## 注释规范
19
+ ## Comment specifications
20
20
 
21
- - **优先使用中文**:解释「为什么这样做」、业务约束、边界情况、非显而易见的权衡时,优先用中文撰写注释,便于团队与业务方阅读。
22
- - **与代码语言一致时的例外**:对接第三方协议字段名、HTTP 头、规范中的英文术语时,注释里可保留英文专有名词,必要时中英文并列说明。
23
- - **少而精**:能通过清晰命名与类型表达清楚的逻辑不写废话注释;复杂分支、临时兼容、性能取舍必须写清意图。
24
- - **公开 API**:模块或 hooks 的对外契约可用 JSDoc(`@param` / `@returns` / `@example`),说明用中文即可,除非仓库统一要求英文。
21
+ - **Prefer using Chinese**: When explaining "why this is done", business constraints, boundary conditions, and non-obvious trade-offs, give priority to writing comments in Chinese to make it easier for the team and business parties to read.
22
+ - **Exception when consistent with the code language**: When connecting third-party protocol field names, HTTP headers, and English terms in specifications, English proper nouns can be retained in the comments, and Chinese and English descriptions can be given when necessary.
23
+ - **Less but more precise**: Can express clear logic through clear naming and types without writing nonsense comments; complex branches, temporary compatibility, and performance trade-offs must be clearly stated.
24
+ - **Public API**: The external contract of modules or hooks can use JSDoc (`@param` / `@returns` / `@example`). The instructions can be in Chinese, unless the warehouse requires English.
25
25
 
26
26
  ---
27
27
 
28
- ## TypeScript 规范
28
+ ## TypeScript Specification
29
29
 
30
- 通用 TypeScript 工程规则由 `fec-typescript-project-standard` 负责,包括 `tsconfig`、strictness、DTO / view model 边界、`unknown` 收窄、public API 类型、声明产物和类型测试。
30
+ Common TypeScript project rules are taken care of by `fec-typescript-project-standard`, including `tsconfig`, strictness, DTO / view model boundaries, `unknown` narrowing, public API types, declared artifacts, and type tests.
31
31
 
32
- React 规范只补充组件、Props、事件和 TSX 泛型写法;复杂类型建模或跨框架类型契约先分流到 `fec-typescript-project-standard`。
32
+ The React specification only supplements components, Props, events and TSX generic writing; complex type modeling or cross-framework type contracts are first offloaded to `fec-typescript-project-standard`.
33
33
 
34
- ### React 项目补充约定
34
+ ### React project supplementary conventions
35
35
 
36
- - Props interface 命名: `ComponentNameProps`
37
- - 事件处理函数: `handle` 前缀(如 `handleClick`)
38
- - 回调 Props: `on` 前缀(如 `onChange`、`onSubmit`)
39
- - 组件优先写显式 props 与返回值类型(`JSX.Element` / `React.ReactElement`),避免依赖 `React.FC` 的隐式 `children` 等行为差异
40
- - 泛型组件使用 `<T>` 约束,保持调用处类型推导;回调与事件类型优先使用 DOM / React 自带类型(如 `React.ChangeEvent<HTMLInputElement>`)
36
+ - Props interface naming: `ComponentNameProps`
37
+ - Event handling function: `handle` prefix (such as `handleClick`)
38
+ - Callback Props: `on` prefix (such as `onChange`, `onSubmit`)
39
+ - Components give priority to writing explicit props and return value types (`JSX.Element` / `React.ReactElement`) to avoid behavioral differences such as relying on the implicit `children` of `React.FC`
40
+ - Generic components use `<T>` constraints to maintain call-site type derivation; callback and event types preferentially use DOM/React’s own types (such as `React.ChangeEvent<HTMLInputElement>`)
41
41
 
42
42
  ```tsx
43
43
  interface TableProps<T extends Record<string, unknown>> {
@@ -49,23 +49,23 @@ interface TableProps<T extends Record<string, unknown>> {
49
49
 
50
50
  ---
51
51
 
52
- ## 测试规范
52
+ ## Test specifications
53
53
 
54
- ### 应优先覆盖的内容
54
+ ### Content that should be covered first
55
55
 
56
- - 核心交互行为(点击、输入、提交)
57
- - 条件渲染(loading / error / empty / data)
58
- - 关键 hooks 的返回值和副作用
59
- - API 调用 mock 与模块级集成测试
56
+ - Core interaction behaviors (click, input, submit)
57
+ - Conditional rendering (loading/error/empty/data)
58
+ - Return values and side effects of key hooks
59
+ - API call mock and module-level integration testing
60
60
 
61
- ### 推荐风格
61
+ ### Recommended style
62
62
 
63
- - 测试用户行为,而不是实现细节
64
- - 优先使用 `screen.getByRole`、`getByLabelText`
65
- - 避免围绕内部 state 写脆弱测试
66
- - 只测关键行为,不机械追求覆盖率数字
63
+ - Test user behavior, not implementation details
64
+ - Prioritize using `screen.getByRole`, `getByLabelText`
65
+ - Avoid writing brittle tests around internal state
66
+ - Only measure key behaviors and do not mechanically pursue coverage figures
67
67
 
68
- ### 示例
68
+ ### Example
69
69
 
70
70
  ```tsx
71
71
  describe("UserForm", () => {
@@ -73,16 +73,16 @@ describe("UserForm", () => {
73
73
  const onSubmit = vi.fn();
74
74
  render(<UserForm onSubmit={onSubmit} />);
75
75
 
76
- await userEvent.type(screen.getByLabelText("用户名"), "test");
77
- await userEvent.click(screen.getByRole("button", { name: "提交" }));
76
+ await userEvent.type(screen.getByLabelText("username"), "test");
77
+ await userEvent.click(screen.getByRole("button", { name: "Submit" }));
78
78
 
79
79
  expect(onSubmit).toHaveBeenCalledWith({ username: "test" });
80
80
  });
81
81
 
82
82
  it("should show error on invalid input", async () => {
83
83
  render(<UserForm onSubmit={vi.fn()} />);
84
- await userEvent.click(screen.getByRole("button", { name: "提交" }));
85
- expect(screen.getByText("用户名不能为空")).toBeInTheDocument();
84
+ await userEvent.click(screen.getByRole("button", { name: "Submit" }));
85
+ expect(screen.getByText("Username cannot be empty")).toBeInTheDocument();
86
86
  });
87
87
  });
88
88
  ```
@@ -90,42 +90,42 @@ describe("UserForm", () => {
90
90
  ---
91
91
 
92
92
 
93
- ## 常见反模式
93
+ ## Common anti-patterns
94
94
 
95
- 避免:
95
+ Avoid:
96
96
 
97
- - prop drilling 过深却不考虑组合或局部封装
98
- - 对局部问题过度使用 context
99
- - 把数据请求、视图渲染、命令式 DOM 操作全塞进一个文件
100
- - 在 useEffect 中做可以在事件处理函数中完成的事
101
- - 用 `useEffect + setState` 模拟本可直接计算的派生值
102
- - 将所有状态都推进全局 store
103
- - 在 `components/` 中放业务耦合组件
104
- - 直接绕过模块出口,从 feature 深层路径导入
105
- - 没有明显收益却提前做复杂优化
106
- - **新增类组件**或手写类式 Error Boundary(应函数组件 + `react-error-boundary` 等)
97
+ - prop drilling is too deep without considering combination or partial encapsulation
98
+ - Excessive use of context for local issues
99
+ - Stuff data requests, view rendering, and imperative DOM operations into one file
100
+ - Do things in useEffect that can be done in event handlers
101
+ - Use `useEffect + setState` to simulate derived values that could be calculated directly
102
+ - Push all states to the global store
103
+ - Put business coupling components in `components/`
104
+ - Directly bypass the module export and import from the feature deep path
105
+ - There is no obvious benefit but complex optimization is done in advance
106
+ - **New class component** or handwritten class Error Boundary (should function component + `react-error-boundary`, etc.)
107
107
 
108
108
  ---
109
109
 
110
- ## 输出检查清单
111
-
112
- 输出 React 代码或方案时,至少检查:
113
-
114
- - [ ] 是否先对齐了仓库现有约定
115
- - [ ] 页面 / feature / 通用组件边界是否清晰
116
- - [ ] 目录结构是否与模块复杂度匹配
117
- - [ ] Props 类型完整且明确
118
- - [ ] 解释性注释是否优先使用中文且点到要害
119
- - [ ] 可复用逻辑是否已提取为 hooks
120
- - [ ] loading / error / empty / data 状态是否齐全
121
- - [ ] API 层是否具备类型约束和统一错误处理
122
- - [ ] 复杂 DTO、外部数据收窄、公共类型或 `tsconfig` 问题是否已分流到 `fec-typescript-project-standard`
123
- - [ ] 状态管理是否符合就近原则
124
- - [ ] 路由级或重型模块是否考虑懒加载
125
- - [ ] 样式方案是否与仓库保持一致
126
- - [ ] 关键行为是否有测试覆盖
127
- - [ ] 关键模块已用 **`react-error-boundary`**(等)包裹,且未手写类组件式 Boundary
128
- - [ ] 超长列表是否评估虚拟化;弹窗/复合组件是否具备键盘与焦点约定
129
- - [ ] 是否引入了不必要的新依赖或新范式
110
+ ## Output checklist
111
+
112
+ When outputting React code or solutions, at least check:
113
+
114
+ - [ ] Whether to align the existing contracts of the warehouse first
115
+ - [ ] Page / feature / Is the boundary of common components clear?
116
+ - [ ] Whether the directory structure matches the module complexity
117
+ - [ ] Props type is complete and clear
118
+ - [ ] Whether explanatory comments should be given priority in Chinese and to the point
119
+ - [ ] Whether reusable logic has been extracted into hooks
120
+ - [ ] loading / error / empty / data status is complete
121
+ - [ ] Whether the API layer has type constraints and unified error handling
122
+ - [ ] Whether complex DTO, external data narrowing, public types or `tsconfig` issues have been offloaded to `fec-typescript-project-standard`
123
+ - [ ] Whether status management complies with the proximity principle
124
+ - [ ] Whether lazy loading is considered for routing-level or heavy-duty modules
125
+ - [ ] Whether the style scheme is consistent with the warehouse
126
+ - [ ] Whether key behaviors are covered by tests
127
+ - [ ] Key modules have been wrapped with **`react-error-boundary`** (etc.), and no hand-written class component Boundary
128
+ - [ ] Whether the long list evaluates virtualization; whether the pop-up window/composite component has keyboard and focus conventions
129
+ - [ ] Whether unnecessary new dependencies or new paradigms are introduced
130
130
 
131
131
  ---
@@ -1,77 +1,77 @@
1
1
  # React runtime patterns
2
2
 
3
- ## 常用 UI 与状态模式
3
+ ## Common UI and status mode
4
4
 
5
- 以下模式可与本 skill 其他章节(Hooks、状态管理、性能优化、错误处理)对照使用;**按业务复杂度与团队熟悉度选用**,避免为模式而模式。思路参考业界常见的 React 前端模式实践(如组件组合、复合组件、性能与无障碍等)。
5
+ The following patterns can be used in comparison with other chapters of this skill (Hooks, state management, performance optimization, error handling); **Select based on business complexity and team familiarity** to avoid patterns for pattern's sake. The ideas refer to common React front-end pattern practices in the industry (such as component combination, composite components, performance and accessibility, etc.).
6
6
 
7
- ### 组合优于继承
7
+ ### Composition is better than inheritance
8
8
 
9
- - 用**小颗粒子组件** + `children` / 显式 props 拼装界面,而不是在 React 中搭建类继承层次。
10
- - 示例:`Card` + `CardHeader` + `CardBody`,由使用方组合,而不是一个巨型 `Card` 用大量布尔 props 分支。
9
+ - Use **small subcomponents** + `children` / explicit props to assemble the interface instead of building a class inheritance hierarchy in React.
10
+ - Example: `Card` + `CardHeader` + `CardBody`, composed by the consumer, rather than one giant `Card` branched with a lot of boolean props.
11
11
 
12
- ### 复合组件(Compound Components)
12
+ ### Compound Components
13
13
 
14
- - 根组件通过 **Context** 向子组件提供内部状态(如当前 Tab、打开/关闭)。
15
- - 子组件在 `useContext` 为空时**抛错或断言**,明确「必须在 Provider 树内使用」。
16
- - API 表面保持可读:`<Tabs><TabList><Tab /></TabList></Tabs>`。
14
+ - The root component provides internal state (such as current Tab, open/closed) to child components through **Context**.
15
+ - The subcomponent **throws an error or asserts** when `useContext` is empty, making it clear that it "must be used within the Provider tree".
16
+ - API surfaces remain readable: `<Tabs><TabList><Tab /></TabList></Tabs>`.
17
17
 
18
- ### Render Props / 函数子
18
+ ### Render Props/Functionator
19
19
 
20
- - 适用:封装**数据获取与三态**(loading / error / data),把**渲染决策**交给父级。
21
- - 与 **自定义 Hook** 二选一即可:多数场景 `useXxx()` + 普通组件更直观;仅在需要强约束「同层渲染逻辑」时保留 Render Props。
20
+ - Applicable: Encapsulate **data acquisition and three-state** (loading / error / data), and hand over **rendering decision** to the parent.
21
+ - Choose one of the two with **Custom Hook**: `useXxx()` + ordinary components are more intuitive in most scenarios; only keep Render Props when strong constraints on "same-layer rendering logic" are required.
22
22
 
23
23
  ### Context + useReducer
24
24
 
25
- - 适合**中等复杂度、多子树共享**的客户端状态,且更新可归约为明确 `action`。
26
- - 避免把高频变化的大对象塞进顶层 Context;服务端数据仍优先 **React Query / SWR**。
27
- - 大型全局业务状态继续用仓库已选的 **Zustand / Redux Toolkit / Jotai**。
25
+ - Suitable for **moderate complexity, multi-subtree sharing** client state, and updates can be reduced to explicit `action`.
26
+ - Avoid stuffing large objects that change frequently into the top-level Context; server-side data still takes priority **React Query / SWR**.
27
+ - Large global business status continues to use the **Zusand / Redux Toolkit / Jotai** selected by the warehouse.
28
28
 
29
- ### 表单
29
+ ### Form
30
30
 
31
- - 受控字段 + 校验错误对象是一类可行实现;中大型表单优先 **React Hook Form**(或 Formik)+ **Zod**,复杂表单值、DTO 和校验类型契约分流到 `fec-typescript-project-standard`。
32
- - 避免单组件内巨型 `useState` 表单对象与重复校验逻辑,可拆字段子组件或抽 `useFormSchema`。
31
+ - Controlled fields + validation error objects are a feasible implementation; medium and large forms are given priority **React Hook Form** (or Formik) + **Zod**, and complex form values, DTO and validation type contracts are offloaded to `fec-typescript-project-standard`.
32
+ - Avoid huge `useState` form objects and repeated validation logic in a single component, detachable field subcomponents or extract `useFormSchema`.
33
33
 
34
34
  ### Error Boundary
35
35
 
36
- - **不要**在业务代码中手写 React **类组件**形式的 Error Boundary;统一使用 **`react-error-boundary`**(或团队认可的同类库)在**模块边界**兜底渲染失败(与本章「错误处理」、`error-handling.md` 一致)。
37
- - 用 `FallbackComponent` 与 `resetErrorBoundary` 提供「重试」;**日志上报**放在库的 **`onError`**(等回调)中,生产代码避免长期依赖 `console.log`(见 TypeScript 规则)。
36
+ - **Don't** handwrite Error Boundary in the form of React **class component** in business code; uniformly use **`react-error-boundary`** (or a similar library recognized by the team) to render failure at the **module boundary** (consistent with "Error Handling" and `error-handling.md` in this chapter).
37
+ - Use `FallbackComponent` and `resetErrorBoundary` to provide "retry"; **log reporting** is placed in the library's **`onError`** (waiting for callbacks), and production code avoids long-term dependence on `console.log` (see TypeScript rules).
38
38
 
39
39
 
40
- ### 动画与过渡
40
+ ### Animation and Transition
41
41
 
42
- - 列表进出场可用 **Framer Motion** 的 `AnimatePresence` + `key`,或 CSS `transition`;注意减少布局抖动与 `prefers-reduced-motion`(与无障碍策略一致时)。
42
+ - List entry and exit can be done using **Framer Motion**'s `AnimatePresence` + `key`, or CSS `transition`; note that reduced layout jitter and `prefers-reduced-motion` (when consistent with accessibility policies).
43
43
 
44
- ### 无障碍与焦点
44
+ ### Accessibility and Focus
45
45
 
46
- - 自定义下拉、标签页等:**`role` / `aria-*`**、**方向键 / Enter / Escape** 行为与焦点环可见。
47
- - 弹窗:打开时将焦点移入对话框,关闭时**恢复**触发元素焦点;可用 **`focus-trap-react`** 或类似方案,与 `fec-accessibility-check` skill 互补。
46
+ - Customized drop-downs, tabs, etc.: **`role` / `aria-*`**, **Direction keys / Enter / Escape** Behavior and focus rings are visible.
47
+ - Pop-up window: Move the focus into the dialog box when it is opened, and **restore** when it is closed to trigger the element focus; **`focus-trap-react`** or similar solutions can be used to complement the `fec-accessibility-check` skill.
48
48
 
49
- ### Next.js 与服务端组件
49
+ ### Next.js and server-side components
50
50
 
51
- - **App Router、Server Components、服务端数据获取与缓存**见 **`fec-nextjs-project-standard`**;客户端交互模式仍以本章与 Hooks 规范为准。
51
+ - **App Router, Server Components, server-side data acquisition and caching** see **`fec-nextjs-project-standard`**; the client interaction mode is still subject to this chapter and the Hooks specification.
52
52
 
53
53
  ---
54
54
 
55
55
 
56
- ## Hooks 设计模式
56
+ ## Hooks design pattern
57
57
 
58
- ### 适合抽为自定义 Hook 的场景
58
+ ### Suitable for scenarios where custom Hooks are drawn
59
59
 
60
- - 数据获取与三态管理
61
- - 表单状态逻辑
62
- - 分页、筛选、排序编排
63
- - 事件监听与副作用清理
64
- - 可在多个组件复用的交互逻辑
60
+ - Data acquisition and three-state management
61
+ - Form status logic
62
+ - Paging, filtering, sorting and arrangement
63
+ - Event monitoring and side effect cleanup
64
+ - Interaction logic that can be reused in multiple components
65
65
 
66
- ### 推荐原则
66
+ ### Recommended principles
67
67
 
68
- - 统一使用 `use` 前缀命名
69
- - 返回对象而非数组,方便按需解构,增强可读性和扩展性
70
- - 状态和行为封装在一起
71
- - Hook 内部处理 `loading / error / data`
72
- - 对外暴露清晰的最小接口,不泄漏无关内部细节
68
+ - Uniformly use `use` prefix naming
69
+ - Return objects instead of arrays to facilitate on-demand destructuring and enhance readability and scalability
70
+ - State and behavior are encapsulated together
71
+ - Hook internal processing `loading/error/data`
72
+ - Expose a clear minimal interface to the outside world without leaking irrelevant internal details
73
73
 
74
- ### 示例
74
+ ### Example
75
75
 
76
76
  ```tsx
77
77
  function useUserList(params: QueryParams) {
@@ -100,26 +100,26 @@ function useUserList(params: QueryParams) {
100
100
  }
101
101
  ```
102
102
 
103
- ### Hook 使用原则
103
+ ### Hook usage principles
104
104
 
105
- - `useEffect` 必须有正确依赖和清理逻辑
106
- - `useMemo` / `useCallback` 不要滥用,只有在稳定引用确实重要时再加
107
- - 不在条件分支或循环中调用 hooks
108
- - 已引入 React Query / SWR 时,数据请求优先走这些库,而不是自己重复造一套缓存层
105
+ - `useEffect` must have correct dependencies and cleanup logic
106
+ - `useMemo` / `useCallback` Don’t overuse it, add it only when stable references are really important
107
+ - Don't call hooks in conditional branches or loops
108
+ - When React Query / SWR has been introduced, data requests go through these libraries first instead of recreating a cache layer yourself.
109
109
 
110
110
  ---
111
111
 
112
- ## 路由组织
112
+ ## Routing organization
113
113
 
114
- ### 推荐方式
114
+ ### Recommended method
115
115
 
116
- - 路由配置集中管理
117
- - 路径常量化
118
- - 页面组件按需懒加载
119
- - 权限控制放在 guard 层,而不是散落在页面组件内
120
- - 分页、筛选、排序等 URL 驱动状态优先与地址栏同步
116
+ - Centralized management of routing configuration
117
+ - Path constantization
118
+ - Lazy loading of page components on demand
119
+ - Permission control is placed in the guard layer instead of scattered within the page components
120
+ - Paging, filtering, sorting, etc. URL driver status is synchronized with the address bar first
121
121
 
122
- ### 示例
122
+ ### Example
123
123
 
124
124
  ```tsx
125
125
  const routes: RouteObject[] = [
@@ -150,37 +150,37 @@ function ProtectedRoute({ children }: { children: React.ReactNode }) {
150
150
 
151
151
  ---
152
152
 
153
- ## 状态管理选型
153
+ ## Status management selection
154
154
 
155
- | 状态类型 | 推荐方案 |
155
+ | Status type | Recommended solution |
156
156
  | ------------------ | ------------------------------------------------- |
157
- | 组件内临时 UI 状态 | `useState` / `useReducer` |
158
- | 跨组件共享业务状态 | Zustand / Redux Toolkit / Jotai(按仓库实际选择) |
159
- | 服务端数据缓存 | React Query / SWR |
160
- | URL 驱动状态 | 路由参数 / `useSearchParams` |
161
- | 表单状态 | React Hook Form / Formik |
157
+ | Temporary UI state within the component | `useState` / `useReducer` |
158
+ | Sharing business status across components | Zustand / Redux Toolkit / Jotai (actual selection by warehouse) |
159
+ | Server-side data caching | React Query / SWR |
160
+ | URL driver status | Route parameters / `useSearchParams` |
161
+ | Form State | React Hook Form / Formik |
162
162
 
163
- ### 核心原则
163
+ ### Core Principles
164
164
 
165
- - 就近管理:状态尽量放在最近的公共祖先
166
- - 单一数据源:同一份数据不要维护多份
167
- - 派生优于同步:可计算值优先在渲染期计算
168
- - 服务端数据优先交给请求库管理,不手动塞进全局 store
169
- - 不要因为“以后可能会用到”就把局部状态提前升级为全局状态
165
+ - Proximity management: try to place the state on the nearest common ancestor
166
+ -Single data source: Do not maintain multiple copies of the same data
167
+ - Derived over synchronized: computable values are calculated first at render time
168
+ - The server-side data is given priority to the request library management and is not manually inserted into the global store.
169
+ - Don’t upgrade local state to global state in advance just because it “may be used in the future”
170
170
 
171
171
  ---
172
172
 
173
- ## API 层规范
173
+ ## API layer specification
174
174
 
175
- ### 设计原则
175
+ ### Design principles
176
176
 
177
- - 请求基础设施集中在 `services/`
178
- - 业务 API 按 feature 拆分,而不是全部堆在一个文件
179
- - 请求参数和响应结果都应有明确类型
180
- - 认证、错误格式化、通用拦截放在请求层统一处理
181
- - 页面和组件不要直接散落拼接请求细节
177
+ - Request infrastructure is centralized in `services/`
178
+ -Business APIs are split by feature instead of stacking them all in one file
179
+ - Both request parameters and response results should have clear types
180
+ - Authentication, error formatting, and universal interception are handled uniformly at the request layer
181
+ - Do not directly scatter splicing request details on pages and components
182
182
 
183
- ### 示例
183
+ ### Example
184
184
 
185
185
  ```ts
186
186
  // services/request.ts
@@ -215,23 +215,23 @@ export function updateUser(id: string, data: UpdateUserDTO): Promise<User> {
215
215
 
216
216
  ---
217
217
 
218
- ## 错误处理
218
+ ## Error handling
219
219
 
220
- ### 必须覆盖的状态
220
+ ### Status that must be overridden
221
221
 
222
222
  - Loading
223
223
  - Error
224
224
  - Empty
225
225
  - Data
226
226
 
227
- ### 推荐做法
227
+ ### Recommended practices
228
228
 
229
- - 关键功能模块使用 Error Boundary 包裹,避免局部异常导致全页白屏
230
- - 异步请求失败时必须给用户可见反馈
231
- - 重要操作提供重试能力
232
- - 不要吞错,不写空 `catch`
229
+ - Use Error Boundary to wrap key functional modules to avoid local exceptions causing a full-page white screen
230
+ - Visible feedback must be given to the user when an asynchronous request fails
231
+ - Provide retry capability for important operations
232
+ - Don’t catch mistakes, don’t write empty `catch`
233
233
 
234
- ### 示例(`react-error-boundary`,函数式 Fallback)
234
+ ### Example (`react-error-boundary`, functional Fallback)
235
235
 
236
236
  ```tsx
237
237
  import { ErrorBoundary } from "react-error-boundary";
@@ -243,9 +243,9 @@ function ModuleErrorFallback({
243
243
  }) {
244
244
  return (
245
245
  <div>
246
- 模块加载失败
246
+ Module loading failed
247
247
  <button type="button" onClick={resetErrorBoundary}>
248
- 重试
248
+ Try again
249
249
  </button>
250
250
  </div>
251
251
  );
@@ -262,15 +262,15 @@ export function UserDashboardSection() {
262
262
 
263
263
  ---
264
264
 
265
- ## Suspense 与懒加载
265
+ ## Suspense and lazy loading
266
266
 
267
- 适用场景:
267
+ Applicable scenarios:
268
268
 
269
- - 路由级页面
270
- - 图表、富文本编辑器、地图、重型表格等大体积组件
271
- - 初始化成本较高的模块
269
+ - Routing level page
270
+ - Large components such as charts, rich text editors, maps, heavy tables, etc.
271
+ - Modules with higher initialization costs
272
272
 
273
- 示例:
273
+ Example:
274
274
 
275
275
  ```tsx
276
276
  const HeavyChart = lazy(() => import("./components/HeavyChart"));
@@ -284,10 +284,10 @@ function Dashboard() {
284
284
  }
285
285
  ```
286
286
 
287
- 建议:
287
+ Suggestions:
288
288
 
289
- - 路由级优先 `lazy + Suspense`
290
- - `fallback` 优先使用 Skeleton 或更贴近内容的占位态,而不是纯 spinner
289
+ - Route level priority `lazy + Suspense`
290
+ - `fallback` gives priority to using Skeleton or a placeholder state closer to the content instead of a pure spinner
291
291
 
292
292
  ---
293
293
 
@@ -1,51 +1,51 @@
1
1
  ---
2
2
  name: fec-refactor-clean
3
- description: Use when safely removing dead frontend code, unused exports, stale components, obsolete routes, unused dependencies, or cleanup targets found by tools such as knip, depcheck, ts-prune, TypeScript, ESLint, or manual review. Do not use for feature rewrites that change behavior; Chinese triggers include 死代码, 清理未使用, refactor clean, 依赖清理, 删除无用代码.
3
+ description: Use when safely removing dead frontend code, unused exports, stale components, obsolete routes, unused dependencies, or cleanup targets found by tools such as knip, depcheck, ts-prune, TypeScript, ESLint, or manual review. Do not use for feature rewrites that change behavior; Chinese triggers include dead code, clean up unused, refactor clean, dependency cleanup, delete useless code.
4
4
  ---
5
5
 
6
- # 重构清理
6
+ # Refactoring and cleaning
7
7
 
8
8
  ## Purpose
9
9
 
10
- 在验证保护下识别并清理无用前端代码,减少技术债,同时避免误删动态引用、路由入口、配置文件和运行时约定。
10
+ Identify and clean up unused front-end code under validation protection, reducing technical debt while avoiding accidentally deleting dynamic references, routing entries, configuration files, and runtime conventions.
11
11
 
12
12
  ## Procedure
13
13
 
14
- 1. 先建立基线:运行或确认当前 lint、type-check、test、build 的状态。
15
- 2. 收集候选项:
16
- - 优先使用仓库已有工具,如 knip、depcheck、ts-prune、eslint、TypeScript。
17
- - 没有工具时,用 `rg` 检查引用、导出、路由、注册点和文档入口。
18
- 3. 按风险分类:
19
- - SAFE:测试夹具、未引用工具函数、明确未导出的私有组件。
20
- - CAUTION:共享组件、feature 入口、样式文件、Storybook stories。
21
- - DANGER:路由、配置、package scripts、运行时模板、动态 import、插件元数据。
22
- - UPGRADE:过期依赖、重复依赖、未使用依赖和安全告警先进入依赖升级或依赖清理评估,不与死代码删除混做。
23
- 4. 只自动处理 SAFE 项;CAUTION 和 DANGER 需输出建议和证据,不直接删除。
24
- 5. 每批清理后运行受影响验证命令。
25
- 6. 若验证失败,停止扩大清理范围,先定位该批次。
26
- 7. 清理结束后做行为等价复核:公开 API、路由、命令、模板、metadata、文档示例和报告输出仍可被引用。
27
- 8. 对技术债排序:优先清理有验证保护、影响开发效率或阻塞升级的项目;低证据的大范围重写只输出建议。
14
+ 1. Establish a baseline first: run or confirm the current status of lint, type-check, test, and build.
15
+ 2. Collect candidates:
16
+ - Prioritize the use of existing tools in the warehouse, such as knip, depcheck, ts-prune, eslint, and TypeScript.
17
+ - When tools are not available, use `rg` to check references, exports, routes, registration points and document entries.
18
+ 3. Classification by risk:
19
+ - SAFE: test fixtures, unreferenced tool functions, explicitly unexported private components.
20
+ - CAUTION: Shared components, feature entries, style files, Storybook stories.
21
+ - DANGER: routing, configuration, package scripts, runtime templates, dynamic import, plug-in metadata.
22
+ - UPGRADE: Expired dependencies, duplicate dependencies, unused dependencies and security alarms will be evaluated first for dependency upgrade or dependency cleanup, and will not be mixed with dead code deletion.
23
+ 4. Only SAFE items are automatically processed; CAUTION and DANGER need to output suggestions and evidence and are not deleted directly.
24
+ 5. Run the affected verification command after each batch cleanup.
25
+ 6. If the verification fails, stop expanding the cleaning scope and locate the batch first.
26
+ 7. Conduct behavioral equivalence review after cleaning: public APIs, routes, commands, templates, metadata, documentation examples, and report outputs can still be referenced.
27
+ 8. Sort technical debt: Prioritize projects that have verification protection, affect development efficiency, or block upgrades; only output suggestions for large-scale rewrites with low evidence.
28
28
 
29
29
  ## Frontend-Specific Checks
30
30
 
31
- - 检查 JSX/模板字符串、路由配置、barrel export、Storybook、测试、文档示例和动态组件注册。
32
- - 样式文件需检查 className、CSS Modules、Tailwind safelist、全局选择器和主题变量。
33
- - 依赖清理需检查构建插件、运行时模板、CLI scripts、monorepo 子包和 peer dependency。
31
+ - Check JSX/template strings, route configuration, barrel export, Storybook, tests, documentation examples and dynamic component registration.
32
+ - Style files need to check className, CSS Modules, Tailwind safelist, global selectors and theme variables.
33
+ - Dependency cleanup checks build plugins, runtime templates, CLI scripts, monorepo subpackages, and peer dependencies.
34
34
 
35
35
  ## Constraints
36
36
 
37
- - 不改变用户可见行为。
38
- - 不删除无法证明无引用的公开 API、路由、模板或配置。
39
- - 不用“一次大删除”替代可验证的小批次清理。
40
- - 不把格式化、重命名或架构重写混入死代码清理。
41
- - 不用“看起来没人用”作为证据;必须有搜索、工具输出、类型错误消失或测试保护。
42
- - 不把依赖大版本升级伪装成清理;升级风险、release notes 和 lockfile 变更应分流到依赖升级工作流。
37
+ - Does not change user-visible behavior.
38
+ - Do not remove public APIs, routes, templates, or configurations that cannot be proven referenceless.
39
+ - No "one big delete" replacement for verifiable small batch cleanups.
40
+ - Don't mix formatting, renaming or schema rewriting into dead code cleanup.
41
+ - No evidence that "no one seems to be using it" is needed; there must be search, tool output, type error disappearance, or test protection.
42
+ - Don’t disguise major dependency version upgrades as cleanup; upgrade risks, release notes, and lockfile changes should be offloaded to the dependency upgrade workflow.
43
43
 
44
- ## 详细参考
44
+ ## Detailed reference
45
45
 
46
- 撰写清理报告时,加载 [references/report-template.md](references/report-template.md)。
46
+ When writing a cleanup report, load [references/report-template.md](references/report-template.md).
47
47
 
48
48
  ## Expected Output
49
49
 
50
- - 清理报告保存为 `reports/refactor-clean-YYYY-MM-DD-HHmmss.md`。
51
- - 代码清理后相关验证命令通过,或明确说明阻塞原因。
50
+ - Clean reports are saved as `reports/refactor-clean-YYYY-MM-DD-HHmmss.md`.
51
+ - After the code is cleaned, the relevant verification commands pass, or the cause of the blocking is clearly stated.