@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
@@ -0,0 +1,197 @@
1
+ # React project structure and component boundaries
2
+
3
+ ## Project structure (recommended reference)
4
+
5
+ The following is the industry's best practice structure for medium and large React projects, tailored according to the actual situation of the project:
6
+
7
+ ```text
8
+ src/
9
+ ├── app/ # Application entry and global configuration
10
+ │ ├── App.tsx # Root component (Provider combination)
11
+ │ ├── routes.tsx # Routing configuration
12
+ │ └── providers.tsx # Global Provider assembly
13
+ │
14
+ ├── pages/ # Page components (one-to-one correspondence with routing)
15
+ │ ├── Dashboard/
16
+ │ │ ├── DashboardPage.tsx
17
+ │ │ ├── components/ # Page private components
18
+ │ │ └── hooks/ # Page private hooks
19
+ │ ├── UserList/
20
+ │ └── Settings/
21
+ │
22
+ ├── layouts/ # Layout component
23
+ │ ├── MainLayout.tsx # Main layout (sidebar + top bar + content area)
24
+ │ ├── AuthLayout.tsx # Login/registration page layout
25
+ │ └── BlankLayout.tsx # Blank layout (error page, etc.)
26
+ │
27
+ ├── features/ # Function modules (divided by business areas)
28
+ │ ├── auth/
29
+ │ │ ├── components/ # Module components
30
+ │ │ ├── hooks/ # module hooks
31
+ │ │ ├── api.ts # Module API call
32
+ │ │ ├── types.ts # Module type definition
33
+ │ │ ├── constants.ts # Module constants
34
+ │ │ └── index.ts # Module publicly exported
35
+ │ └── order/
36
+ │
37
+ ├── components/ # Globally shared UI components
38
+ │ ├── Button/
39
+ │ │ ├── Button.tsx
40
+ │ │ ├── Button.styles.css
41
+ │ │ └── __tests__/
42
+ │ ├── Modal/
43
+ │ ├── Form/
44
+ │ └── ErrorBoundary/ # Thin wrapper (function component) for react-error-boundary etc.
45
+ │
46
+ ├── hooks/ # Global shared hooks
47
+ │ ├── useAuth.ts
48
+ │ ├── useDebounce.ts
49
+ │ └── useMediaQuery.ts
50
+ │
51
+ ├── services/ # API base layer
52
+ │ ├── request.ts # Axios/fetch instance and interceptor
53
+ │ └── endpoints/ # API endpoint definition (such as split by field)
54
+ │
55
+ ├── stores/ # Global status management
56
+ │ ├── authStore.ts
57
+ │ └── uiStore.ts
58
+ │
59
+ ├── locales/ # International language pack
60
+ │ ├── zh-CN.json # Simplified Chinese
61
+ │ ├── en-US.json # English
62
+ │ └── index.ts # i18n instance initialization (i18next / react-intl)
63
+ │
64
+ ├── assets/ # Static resources
65
+ │ ├── images/ # Pictures (PNG, JPG, WebP)
66
+ │ ├── icons/ # SVG icon
67
+ │ └── fonts/ # Custom fonts
68
+ │
69
+ ├── config/ # Application configuration
70
+ │ ├── env.ts # Typed encapsulation of environment variables
71
+ │ └── features.ts # Feature Flags Management
72
+ │
73
+ ├── types/ # Global shared types
74
+ │ ├── api.ts # API response/request common type
75
+ │ ├── models.ts #Business entity type
76
+ │ └── global.d.ts # Global type extension (picture module declaration, etc.)
77
+ │
78
+ ├── utils/ # Pure utility function
79
+ │ ├── format.ts # Date, number, currency formatting
80
+ │ ├── validators.ts # Form validation rules
81
+ │ └── storage.ts # LocalStorage / SessionStorage package
82
+ │
83
+ ├── styles/ # Global styles and themes
84
+ │ ├── global.css # Global basic style (reset/normalize)
85
+ │ ├── variables.css # CSS variables (color, spacing, font size)
86
+ │ ├── breakpoints.ts # Responsive breakpoint constants
87
+ │ └── themes/ # theme definition
88
+ │ ├── light.css # Light theme variable
89
+ │ ├── dark.css # Dark theme variable
90
+ │ └── index.ts # theme switching logic
91
+ │
92
+ └── constants/ # Global constants
93
+ ├── routes.ts #Routing path constants
94
+ └── config.ts #Business constants (paging size, timeout, etc.)
95
+ ```
96
+
97
+ ### Key Principles
98
+
99
+ - `pages/` does route mapping and page arrangement, and does not carry large pieces of reusable business logic.
100
+ - `layouts/` is responsible for the page skeleton and layout container, referenced by the routing configuration
101
+ - `features/` is divided according to business areas, and the module should be as self-contained as possible
102
+ - `components/` only contains common components that are reused across pages and modules
103
+ - `hooks/` only puts global general hooks; business hooks are put back to the corresponding feature or page first
104
+ - `locales/` stores language pack JSON files, use `t('key')` in the component instead of hard-coded copy
105
+ - `assets/` stores static resources, SVG is preferred for icons, and WebP/AVIF is preferred for images.
106
+ - `services/` is responsible for requesting infrastructure and does not stack business details
107
+ - `config/` uniformly encapsulates environment variables and feature switches, prohibiting direct reading of `import.meta.env` in components
108
+ - `styles/` and theme variables are managed uniformly to avoid colors and sizes being scattered in business code
109
+ - Each module controls the public API through `index.ts` to avoid deep path imports
110
+
111
+ ---
112
+
113
+ ## Component and module layering
114
+
115
+ Recommended layering:
116
+
117
+ ```text
118
+ Page components (Pages) → route mapping, layout combination, page arrangement
119
+ └── Container/orchestration layer → data acquisition, status organization, event orchestration
120
+ └── Business components → Domain logic display
121
+ └── Common components → No business coupling, reusable across modules
122
+ ```
123
+
124
+ ### When to put it in `pages/`
125
+
126
+ Suitable for:
127
+
128
+ - Routing entry component
129
+ - Page level layout combination
130
+ - Page private lightweight orchestration logic
131
+
132
+ Not suitable for:
133
+
134
+ - A lot of domain logic
135
+ - Complex business blocks that can be reused on multiple pages
136
+ - API/hooks/types that are strongly bound to a certain business domain
137
+
138
+ ### When to put it in `features/`
139
+
140
+ Suitable for:
141
+
142
+ - Components, hooks, apis, and types of a certain business domain
143
+ - Logic that can be shared by multiple pages but has business semantics
144
+ - Self-contained implementation of a complete business unit
145
+
146
+ ### When to put it in `components/`
147
+
148
+ Suitable for:
149
+
150
+ - Common UI such as buttons, pop-up windows, form items, table shells, empty states, error states, etc.
151
+ - Components that have nothing to do with specific business and can be reused across modules
152
+
153
+ ---
154
+
155
+ ## Component design specifications
156
+
157
+ - Use **Functional Components**, Hooks and TypeScript; **Do not** add new class components (Error Boundary uses libraries such as `react-error-boundary`, see below)
158
+ - **Single file size** and splitting principles can be found in `templates/shared/rules/fec-react.md` "**Component file size**" (approximately 300 lines is preferred, if it exceeds 500 lines or is too complex, sub-components, Hooks, utils, and types will be split)
159
+ - Keep components with single responsibilities and composable
160
+ - Extract reusable logic into hooks
161
+ - Prioritize the use of controlled component APIs in appropriate scenarios
162
+ - props are clearly defined and typed
163
+ - Prioritize reuse of existing design system components
164
+ - Maintain accessibility with keyboard interaction
165
+ - Avoid deep JSX nesting and duplicate branches
166
+ - Do not store additional state for deducible values
167
+
168
+ ---
169
+
170
+
171
+ ## Component directory suggestions
172
+
173
+ When the component complexity is low, only one file can be kept.
174
+ When a component contains styles, subcomponents, hooks, and tests, it is recommended to use the following structure:
175
+
176
+ ```text
177
+ ComponentName/
178
+ ├── ComponentName.tsx
179
+ ├── ComponentName.types.ts
180
+ ├── ComponentName.styles.css
181
+ ├── hooks/
182
+ │ └── useComponentLogic.ts
183
+ ├── components/
184
+ │ └── SubComponent.tsx
185
+ └── __tests__/
186
+ └── ComponentName.spec.tsx
187
+ ```
188
+
189
+ Description:
190
+
191
+ - Split `ComponentName.types.ts` when the type is complex
192
+ - Split `hooks/` when there is local logic reuse
193
+ - When the subcomponent is only used inside the current component, it is placed in the current directory `components/`
194
+ - Whether the test should be placed nearby should follow the existing protocols of the warehouse
195
+
196
+ ---
197
+
@@ -0,0 +1,131 @@
1
+ # React quality patterns
2
+
3
+ ## Style access
4
+
5
+ This skill does not enforce a specific style scheme and follows the current status of the warehouse by default.
6
+
7
+ Please note when adapting:
8
+
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
+
17
+ ---
18
+
19
+ ## Comment specifications
20
+
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
+
26
+ ---
27
+
28
+ ## TypeScript Specification
29
+
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
+
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
+
34
+ ### React project supplementary conventions
35
+
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
+
42
+ ```tsx
43
+ interface TableProps<T extends Record<string, unknown>> {
44
+ data: T[];
45
+ columns: ColumnDef<T>[];
46
+ onRowClick?: (row: T) => void;
47
+ }
48
+ ```
49
+
50
+ ---
51
+
52
+ ## Test specifications
53
+
54
+ ### Content that should be covered first
55
+
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
+
61
+ ### Recommended style
62
+
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
+
68
+ ### Example
69
+
70
+ ```tsx
71
+ describe("UserForm", () => {
72
+ it("should submit with valid data", async () => {
73
+ const onSubmit = vi.fn();
74
+ render(<UserForm onSubmit={onSubmit} />);
75
+
76
+ await userEvent.type(screen.getByLabelText("username"), "test");
77
+ await userEvent.click(screen.getByRole("button", { name: "Submit" }));
78
+
79
+ expect(onSubmit).toHaveBeenCalledWith({ username: "test" });
80
+ });
81
+
82
+ it("should show error on invalid input", async () => {
83
+ render(<UserForm onSubmit={vi.fn()} />);
84
+ await userEvent.click(screen.getByRole("button", { name: "Submit" }));
85
+ expect(screen.getByText("Username cannot be empty")).toBeInTheDocument();
86
+ });
87
+ });
88
+ ```
89
+
90
+ ---
91
+
92
+
93
+ ## Common anti-patterns
94
+
95
+ Avoid:
96
+
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
+
108
+ ---
109
+
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
+
131
+ ---
@@ -0,0 +1,293 @@
1
+ # React runtime patterns
2
+
3
+ ## Common UI and status mode
4
+
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
+
7
+ ### Composition is better than inheritance
8
+
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
+
12
+ ### Compound Components
13
+
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
+
18
+ ### Render Props/Functionator
19
+
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
+
23
+ ### Context + useReducer
24
+
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
+
29
+ ### Form
30
+
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
+
34
+ ### Error Boundary
35
+
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
+
39
+
40
+ ### Animation and Transition
41
+
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
+
44
+ ### Accessibility and Focus
45
+
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
+
49
+ ### Next.js and server-side components
50
+
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
+
53
+ ---
54
+
55
+
56
+ ## Hooks design pattern
57
+
58
+ ### Suitable for scenarios where custom Hooks are drawn
59
+
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
+
66
+ ### Recommended principles
67
+
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
+
74
+ ### Example
75
+
76
+ ```tsx
77
+ function useUserList(params: QueryParams) {
78
+ const [data, setData] = useState<User[]>([]);
79
+ const [loading, setLoading] = useState(false);
80
+ const [error, setError] = useState<Error | null>(null);
81
+
82
+ const fetch = useCallback(async () => {
83
+ setLoading(true);
84
+ setError(null);
85
+ try {
86
+ const res = await getUserList(params);
87
+ setData(res.list);
88
+ } catch (e) {
89
+ setError(e as Error);
90
+ } finally {
91
+ setLoading(false);
92
+ }
93
+ }, [params]);
94
+
95
+ useEffect(() => {
96
+ fetch();
97
+ }, [fetch]);
98
+
99
+ return { data, loading, error, refetch: fetch };
100
+ }
101
+ ```
102
+
103
+ ### Hook usage principles
104
+
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
+
110
+ ---
111
+
112
+ ## Routing organization
113
+
114
+ ### Recommended method
115
+
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
+
122
+ ### Example
123
+
124
+ ```tsx
125
+ const routes: RouteObject[] = [
126
+ {
127
+ path: "/",
128
+ element: <MainLayout />,
129
+ children: [
130
+ { index: true, element: <DashboardPage /> },
131
+ { path: "users", element: <UserListPage /> },
132
+ { path: "users/:id", element: <UserDetailPage /> },
133
+ { path: "settings", element: <SettingsPage /> },
134
+ ],
135
+ },
136
+ { path: "/login", element: <LoginPage /> },
137
+ { path: "*", element: <NotFoundPage /> },
138
+ ];
139
+ ```
140
+
141
+ ```tsx
142
+ const UserListPage = lazy(() => import("@/pages/UserList/UserListPage"));
143
+
144
+ function ProtectedRoute({ children }: { children: React.ReactNode }) {
145
+ const { isAuthenticated } = useAuth();
146
+ if (!isAuthenticated) return <Navigate to="/login" replace />;
147
+ return <>{children}</>;
148
+ }
149
+ ```
150
+
151
+ ---
152
+
153
+ ## Status management selection
154
+
155
+ | Status type | Recommended solution |
156
+ | ------------------ | ------------------------------------------------- |
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
+
163
+ ### Core Principles
164
+
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
+
171
+ ---
172
+
173
+ ## API layer specification
174
+
175
+ ### Design principles
176
+
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
+
183
+ ### Example
184
+
185
+ ```ts
186
+ // services/request.ts
187
+ const request = axios.create({
188
+ baseURL: import.meta.env.VITE_API_BASE_URL,
189
+ timeout: 10000,
190
+ });
191
+
192
+ request.interceptors.response.use(
193
+ (res) => res.data,
194
+ (error) => {
195
+ if (error.response?.status === 401) {
196
+ redirectToLogin();
197
+ }
198
+ return Promise.reject(normalizeError(error));
199
+ },
200
+ );
201
+ ```
202
+
203
+ ```ts
204
+ // features/user/api.ts
205
+ export function getUserList(
206
+ params: UserQueryParams,
207
+ ): Promise<PageResult<User>> {
208
+ return request.get("/users", { params });
209
+ }
210
+
211
+ export function updateUser(id: string, data: UpdateUserDTO): Promise<User> {
212
+ return request.put(`/users/${id}`, data);
213
+ }
214
+ ```
215
+
216
+ ---
217
+
218
+ ## Error handling
219
+
220
+ ### Status that must be overridden
221
+
222
+ - Loading
223
+ - Error
224
+ - Empty
225
+ - Data
226
+
227
+ ### Recommended practices
228
+
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
+
234
+ ### Example (`react-error-boundary`, functional Fallback)
235
+
236
+ ```tsx
237
+ import { ErrorBoundary } from "react-error-boundary";
238
+
239
+ function ModuleErrorFallback({
240
+ resetErrorBoundary,
241
+ }: {
242
+ resetErrorBoundary: () => void;
243
+ }) {
244
+ return (
245
+ <div>
246
+ Module loading failed
247
+ <button type="button" onClick={resetErrorBoundary}>
248
+ Try again
249
+ </button>
250
+ </div>
251
+ );
252
+ }
253
+
254
+ export function UserDashboardSection() {
255
+ return (
256
+ <ErrorBoundary FallbackComponent={ModuleErrorFallback}>
257
+ <UserDashboard />
258
+ </ErrorBoundary>
259
+ );
260
+ }
261
+ ```
262
+
263
+ ---
264
+
265
+ ## Suspense and lazy loading
266
+
267
+ Applicable scenarios:
268
+
269
+ - Routing level page
270
+ - Large components such as charts, rich text editors, maps, heavy tables, etc.
271
+ - Modules with higher initialization costs
272
+
273
+ Example:
274
+
275
+ ```tsx
276
+ const HeavyChart = lazy(() => import("./components/HeavyChart"));
277
+
278
+ function Dashboard() {
279
+ return (
280
+ <Suspense fallback={<ChartSkeleton />}>
281
+ <HeavyChart data={chartData} />
282
+ </Suspense>
283
+ );
284
+ }
285
+ ```
286
+
287
+ Suggestions:
288
+
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
+
292
+ ---
293
+