@bovinphang/frontend-craft 2.7.0 → 2.9.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 (502) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +378 -305
  4. package/CHANGELOG.zh-CN.md +377 -304
  5. package/CONTRIBUTING.md +371 -361
  6. package/CONTRIBUTING.zh-CN.md +371 -361
  7. package/README.md +545 -493
  8. package/README.openclaw.md +359 -264
  9. package/README.openclaw.zh-CN.md +359 -264
  10. package/README.zh-CN.md +545 -493
  11. package/agents/fec-architect.md +70 -70
  12. package/agents/fec-code-reviewer.md +103 -82
  13. package/agents/fec-debugger.md +20 -20
  14. package/agents/fec-design-token-mapper.md +36 -36
  15. package/agents/fec-doc-updater.md +13 -13
  16. package/agents/fec-e2e-runner.md +45 -45
  17. package/agents/fec-figma-implementer.md +59 -59
  18. package/agents/fec-performance-optimizer.md +128 -128
  19. package/agents/fec-refactor-cleaner.md +17 -14
  20. package/agents/fec-refactoring-expert.md +81 -0
  21. package/agents/fec-security-reviewer.md +82 -67
  22. package/agents/fec-test-planner.md +27 -27
  23. package/agents/fec-typescript-reviewer.md +103 -87
  24. package/agents/fec-ui-checker.md +64 -64
  25. package/commands/fec-debug.md +19 -19
  26. package/commands/fec-doc-sync.md +11 -11
  27. package/commands/fec-init.md +37 -38
  28. package/commands/fec-plan.md +58 -58
  29. package/commands/fec-refactor-clean.md +11 -11
  30. package/commands/fec-refactor-plan.md +17 -0
  31. package/commands/fec-refactor.md +18 -0
  32. package/commands/fec-review.md +71 -41
  33. package/commands/fec-scaffold.md +41 -41
  34. package/commands/fec-smell.md +17 -0
  35. package/commands/fec-tdd.md +17 -13
  36. package/dist/bin/frontend-craft.js +190 -36
  37. package/dist/hooks/fec-run-tests.js +5 -1
  38. package/dist/hooks/fec-session-start.js +1 -1
  39. package/docs/example-prompts.md +157 -137
  40. package/docs/ja-JP/README.md +534 -493
  41. package/docs/ko-KR/README.md +534 -493
  42. package/docs/project-structure.md +151 -123
  43. package/docs/refactoring/README.md +50 -0
  44. package/docs/refactoring/catalog.md +105 -0
  45. package/docs/refactoring/smell-refactoring-matrix.md +41 -0
  46. package/docs/review-and-diagram-workflows.md +39 -0
  47. package/docs/runtimes/antigravity.md +18 -10
  48. package/docs/runtimes/augment.md +18 -10
  49. package/docs/runtimes/claude.md +191 -177
  50. package/docs/runtimes/claude.zh-CN.md +189 -175
  51. package/docs/runtimes/cline.md +18 -10
  52. package/docs/runtimes/codebuddy.md +18 -10
  53. package/docs/runtimes/codex.md +18 -10
  54. package/docs/runtimes/compatibility.md +27 -0
  55. package/docs/runtimes/copilot.md +18 -10
  56. package/docs/runtimes/cursor.md +18 -10
  57. package/docs/runtimes/gemini.md +18 -10
  58. package/docs/runtimes/kilo.md +18 -10
  59. package/docs/runtimes/openclaw.md +18 -10
  60. package/docs/runtimes/opencode.md +18 -10
  61. package/docs/runtimes/qoder.md +18 -19
  62. package/docs/runtimes/trae.md +18 -10
  63. package/docs/runtimes/windsurf.md +18 -10
  64. package/docs/superpowers/plans/2026-09-26-content-integrity.md +145 -0
  65. package/docs/superpowers/plans/2026-09-26-diagram-quality.md +170 -0
  66. package/docs/superpowers/specs/2026-09-26-diagram-quality-design.md +77 -0
  67. package/docs/superpowers/specs/2026-09-26-project-optimization-design.md +95 -0
  68. package/docs/zh-CN/example-prompts.md +157 -137
  69. package/docs/zh-CN/project-structure.md +148 -123
  70. package/docs/zh-CN/review-and-diagram-workflows.md +39 -0
  71. package/docs/zh-TW/README.md +534 -493
  72. package/localized/zh-CN/agents/fec-architect.md +125 -0
  73. package/localized/zh-CN/agents/fec-code-reviewer.md +171 -0
  74. package/localized/zh-CN/agents/fec-debugger.md +44 -0
  75. package/localized/zh-CN/agents/fec-design-token-mapper.md +75 -0
  76. package/localized/zh-CN/agents/fec-doc-updater.md +30 -0
  77. package/localized/zh-CN/agents/fec-e2e-runner.md +107 -0
  78. package/localized/zh-CN/agents/fec-figma-implementer.md +104 -0
  79. package/localized/zh-CN/agents/fec-performance-optimizer.md +293 -0
  80. package/localized/zh-CN/agents/fec-refactor-cleaner.md +35 -0
  81. package/localized/zh-CN/agents/fec-refactoring-expert.md +53 -0
  82. package/localized/zh-CN/agents/fec-security-reviewer.md +132 -0
  83. package/localized/zh-CN/agents/fec-test-planner.md +50 -0
  84. package/localized/zh-CN/agents/fec-typescript-reviewer.md +158 -0
  85. package/localized/zh-CN/agents/fec-ui-checker.md +120 -0
  86. package/localized/zh-CN/commands/fec-debug.md +30 -0
  87. package/localized/zh-CN/commands/fec-doc-sync.md +19 -0
  88. package/localized/zh-CN/commands/fec-init.md +70 -0
  89. package/localized/zh-CN/commands/fec-plan.md +94 -0
  90. package/localized/zh-CN/commands/fec-refactor-clean.md +19 -0
  91. package/localized/zh-CN/commands/fec-refactor-plan.md +15 -0
  92. package/localized/zh-CN/commands/fec-refactor.md +14 -0
  93. package/localized/zh-CN/commands/fec-review.md +97 -0
  94. package/localized/zh-CN/commands/fec-scaffold.md +205 -0
  95. package/localized/zh-CN/commands/fec-smell.md +13 -0
  96. package/localized/zh-CN/commands/fec-tdd.md +25 -0
  97. package/localized/zh-CN/skills/TEMPLATE.md +155 -0
  98. package/localized/zh-CN/skills/eval_queries.json +1257 -0
  99. package/localized/zh-CN/skills/fec-accessibility-check/SKILL.md +39 -0
  100. package/localized/zh-CN/skills/fec-accessibility-check/references/report-template.md +23 -0
  101. package/localized/zh-CN/skills/fec-accessibility-check/references/screen-reader-testing.md +33 -0
  102. package/localized/zh-CN/skills/fec-alchemy/SKILL.md +74 -0
  103. package/localized/zh-CN/skills/fec-alchemy/assets/absorption-plan-template.md +47 -0
  104. package/localized/zh-CN/skills/fec-alchemy/assets/intake-template.md +55 -0
  105. package/localized/zh-CN/skills/fec-alchemy/assets/review-checklist.md +31 -0
  106. package/localized/zh-CN/skills/fec-alchemy/references/methodology.md +94 -0
  107. package/localized/zh-CN/skills/fec-alchemy/references/originality-and-licensing.md +57 -0
  108. package/localized/zh-CN/skills/fec-api-integration/SKILL.md +78 -0
  109. package/localized/zh-CN/skills/fec-api-integration/references/integration-patterns.md +80 -0
  110. package/localized/zh-CN/skills/fec-backend-requirements-handoff/SKILL.md +45 -0
  111. package/localized/zh-CN/skills/fec-browser-storage/SKILL.md +34 -0
  112. package/localized/zh-CN/skills/fec-browser-storage/references/storage-patterns.md +65 -0
  113. package/localized/zh-CN/skills/fec-canvas-threejs/SKILL.md +66 -0
  114. package/localized/zh-CN/skills/fec-canvas-threejs/references/rendering-patterns.md +67 -0
  115. package/localized/zh-CN/skills/fec-canvas-threejs/references/shader-webgl-patterns.md +67 -0
  116. package/localized/zh-CN/skills/fec-code-review/SKILL.md +162 -0
  117. package/localized/zh-CN/skills/fec-code-review/references/report-template.md +39 -0
  118. package/localized/zh-CN/skills/fec-code-smells/SKILL.md +33 -0
  119. package/localized/zh-CN/skills/fec-code-smells/references/detection-guide.md +25 -0
  120. package/localized/zh-CN/skills/fec-code-smells/references/smell-catalog.md +817 -0
  121. package/localized/zh-CN/skills/fec-code-smells/references/smell-to-refactoring-map.md +265 -0
  122. package/localized/zh-CN/skills/fec-component-testing/SKILL.md +119 -0
  123. package/localized/zh-CN/skills/fec-data-fetching/SKILL.md +62 -0
  124. package/localized/zh-CN/skills/fec-data-fetching/references/query-patterns.md +103 -0
  125. package/localized/zh-CN/skills/fec-debug-framework/SKILL.md +157 -0
  126. package/localized/zh-CN/skills/fec-debug-framework/references/report-template.md +58 -0
  127. package/localized/zh-CN/skills/fec-dependency-upgrade/SKILL.md +34 -0
  128. package/localized/zh-CN/skills/fec-dependency-upgrade/references/dependency-upgrade-workflow.md +56 -0
  129. package/localized/zh-CN/skills/fec-doc-sync/SKILL.md +39 -0
  130. package/localized/zh-CN/skills/fec-drawio-studio/SKILL.md +73 -0
  131. package/localized/zh-CN/skills/fec-drawio-studio/data/THIRD_PARTY_NOTICES.md +10 -0
  132. package/localized/zh-CN/skills/fec-drawio-studio/data/brand-icons.json +878 -0
  133. package/localized/zh-CN/skills/fec-drawio-studio/data/shape-index.json +83570 -0
  134. package/localized/zh-CN/skills/fec-drawio-studio/references/data-residency.md +27 -0
  135. package/localized/zh-CN/skills/fec-drawio-studio/references/diagram-patterns.md +60 -0
  136. package/localized/zh-CN/skills/fec-drawio-studio/references/flowchart-quality.md +49 -0
  137. package/localized/zh-CN/skills/fec-drawio-studio/references/layout-and-export.md +72 -0
  138. package/localized/zh-CN/skills/fec-drawio-studio/references/troubleshooting.md +29 -0
  139. package/localized/zh-CN/skills/fec-drawio-studio/references/xml-and-mermaid.md +58 -0
  140. package/localized/zh-CN/skills/fec-drawio-studio/scripts/brand-symbols.mjs +99 -0
  141. package/localized/zh-CN/skills/fec-drawio-studio/scripts/diagram-lint.mjs +205 -0
  142. package/localized/zh-CN/skills/fec-drawio-studio/scripts/diagram-url.mjs +102 -0
  143. package/localized/zh-CN/skills/fec-drawio-studio/scripts/drawio-export.mjs +134 -0
  144. package/localized/zh-CN/skills/fec-drawio-studio/scripts/layout-graph.mjs +107 -0
  145. package/localized/zh-CN/skills/fec-drawio-studio/scripts/png-embed-fix.mjs +26 -0
  146. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-go-packages.mjs +36 -0
  147. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-js-modules.mjs +52 -0
  148. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-python-classes.mjs +30 -0
  149. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-python-modules.mjs +55 -0
  150. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-rust-modules.mjs +35 -0
  151. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-ts-modules.mjs +7 -0
  152. package/localized/zh-CN/skills/fec-drawio-studio/scripts/shape-query.mjs +121 -0
  153. package/localized/zh-CN/skills/fec-drawio-studio/scripts/studio-core.mjs +139 -0
  154. package/localized/zh-CN/skills/fec-drawio-studio/styles/built-in/corporate.json +49 -0
  155. package/localized/zh-CN/skills/fec-drawio-studio/styles/built-in/default.json +49 -0
  156. package/localized/zh-CN/skills/fec-drawio-studio/styles/built-in/handdrawn.json +49 -0
  157. package/localized/zh-CN/skills/fec-drawio-studio/styles/schema.json +112 -0
  158. package/localized/zh-CN/skills/fec-e2e-testing/SKILL.md +42 -0
  159. package/localized/zh-CN/skills/fec-e2e-testing/references/e2e-ci-reporting.md +62 -0
  160. package/localized/zh-CN/skills/fec-e2e-testing/references/e2e-special-scenarios.md +52 -0
  161. package/localized/zh-CN/skills/fec-e2e-testing/references/e2e-visual-regression.md +60 -0
  162. package/localized/zh-CN/skills/fec-e2e-testing/references/playwright-patterns.md +95 -0
  163. package/localized/zh-CN/skills/fec-form-handling/SKILL.md +76 -0
  164. package/localized/zh-CN/skills/fec-form-handling/references/advanced-form-patterns.md +101 -0
  165. package/localized/zh-CN/skills/fec-image-generation/SKILL.md +110 -0
  166. package/localized/zh-CN/skills/fec-image-generation/assets/interactive-diagram.html +371 -0
  167. package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/README.md +14 -0
  168. package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/architecture.json +121 -0
  169. package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/invalid-explicit.json +41 -0
  170. package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/sequence.json +53 -0
  171. package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/sequence.mmd +21 -0
  172. package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/workflow.json +98 -0
  173. package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/workflow.mmd +7 -0
  174. package/localized/zh-CN/skills/fec-image-generation/references/artifact-routing.md +80 -0
  175. package/localized/zh-CN/skills/fec-image-generation/references/diagram-workflows.md +81 -0
  176. package/localized/zh-CN/skills/fec-image-generation/references/html-technical-diagrams.md +243 -0
  177. package/localized/zh-CN/skills/fec-image-generation/references/png-qa-autofix.md +37 -0
  178. package/localized/zh-CN/skills/fec-image-generation/scripts/diagram-browser.mjs +90 -0
  179. package/localized/zh-CN/skills/fec-image-generation/scripts/diagram-layout.mjs +176 -0
  180. package/localized/zh-CN/skills/fec-image-generation/scripts/export-diagram.mjs +332 -0
  181. package/localized/zh-CN/skills/fec-image-generation/scripts/interactive-diagram-server.mjs +654 -0
  182. package/localized/zh-CN/skills/fec-image-generation/scripts/mermaid-render.mjs +64 -0
  183. package/localized/zh-CN/skills/fec-image-generation/scripts/png-qa.mjs +462 -0
  184. package/localized/zh-CN/skills/fec-image-generation/scripts/tech-diagram-render.mjs +1537 -0
  185. package/localized/zh-CN/skills/fec-implement-from-design/SKILL.md +129 -0
  186. package/localized/zh-CN/skills/fec-implement-from-design/references/design-plan-template.md +36 -0
  187. package/localized/zh-CN/skills/fec-legacy-to-modern-migration/SKILL.md +46 -0
  188. package/localized/zh-CN/skills/fec-legacy-to-modern-migration/references/migration-execution-checklist.md +110 -0
  189. package/localized/zh-CN/skills/fec-legacy-to-modern-migration/references/migration-report-template.md +41 -0
  190. package/localized/zh-CN/skills/fec-legacy-to-modern-migration/references/migration-strategy-and-mapping.md +48 -0
  191. package/localized/zh-CN/skills/fec-legacy-web-standard/SKILL.md +35 -0
  192. package/localized/zh-CN/skills/fec-legacy-web-standard/references/legacy-patterns.md +85 -0
  193. package/localized/zh-CN/skills/fec-list-virtualization/SKILL.md +34 -0
  194. package/localized/zh-CN/skills/fec-list-virtualization/references/virtualization-patterns.md +80 -0
  195. package/localized/zh-CN/skills/fec-monorepo-project-standard/SKILL.md +142 -0
  196. package/localized/zh-CN/skills/fec-motion-interaction/SKILL.md +73 -0
  197. package/localized/zh-CN/skills/fec-motion-interaction/references/motion-patterns.md +112 -0
  198. package/localized/zh-CN/skills/fec-nextjs-project-standard/SKILL.md +123 -0
  199. package/localized/zh-CN/skills/fec-nuxt-project-standard/SKILL.md +122 -0
  200. package/localized/zh-CN/skills/fec-performance-optimization/SKILL.md +80 -0
  201. package/localized/zh-CN/skills/fec-performance-optimization/references/framework-performance-patterns.md +38 -0
  202. package/localized/zh-CN/skills/fec-performance-optimization/references/report-template.md +59 -0
  203. package/localized/zh-CN/skills/fec-pwa-implementation/SKILL.md +35 -0
  204. package/localized/zh-CN/skills/fec-pwa-implementation/references/manifest-and-icons.md +53 -0
  205. package/localized/zh-CN/skills/fec-pwa-implementation/references/service-worker-workbox.md +68 -0
  206. package/localized/zh-CN/skills/fec-react-project-standard/SKILL.md +91 -0
  207. package/localized/zh-CN/skills/fec-react-project-standard/references/react-performance-patterns.md +35 -0
  208. package/localized/zh-CN/skills/fec-react-project-standard/references/react-project-structure.md +197 -0
  209. package/localized/zh-CN/skills/fec-react-project-standard/references/react-quality-patterns.md +131 -0
  210. package/localized/zh-CN/skills/fec-react-project-standard/references/react-runtime-patterns.md +293 -0
  211. package/localized/zh-CN/skills/fec-refactor-clean/SKILL.md +54 -0
  212. package/localized/zh-CN/skills/fec-refactor-clean/references/report-template.md +42 -0
  213. package/localized/zh-CN/skills/fec-refactoring/SKILL.md +83 -0
  214. package/localized/zh-CN/skills/fec-refactoring/references/principles.md +43 -0
  215. package/localized/zh-CN/skills/fec-refactoring/references/refactoring-vs-feature-change.md +25 -0
  216. package/localized/zh-CN/skills/fec-refactoring/references/when-to-refactor.md +17 -0
  217. package/localized/zh-CN/skills/fec-refactoring/references/workflow.md +59 -0
  218. package/localized/zh-CN/skills/fec-refactoring-api/SKILL.md +25 -0
  219. package/localized/zh-CN/skills/fec-refactoring-api/references/api-refactorings.md +496 -0
  220. package/localized/zh-CN/skills/fec-refactoring-catalog/SKILL.md +21 -0
  221. package/localized/zh-CN/skills/fec-refactoring-catalog/references/catalog-index.md +99 -0
  222. package/localized/zh-CN/skills/fec-refactoring-catalog/references/composition-guide.md +49 -0
  223. package/localized/zh-CN/skills/fec-refactoring-catalog/references/selection-guide.md +41 -0
  224. package/localized/zh-CN/skills/fec-refactoring-control/SKILL.md +25 -0
  225. package/localized/zh-CN/skills/fec-refactoring-control/references/conditional-refactorings.md +299 -0
  226. package/localized/zh-CN/skills/fec-refactoring-data/SKILL.md +25 -0
  227. package/localized/zh-CN/skills/fec-refactoring-data/references/data-refactorings.md +248 -0
  228. package/localized/zh-CN/skills/fec-refactoring-encapsulation/SKILL.md +25 -0
  229. package/localized/zh-CN/skills/fec-refactoring-encapsulation/references/encapsulation-refactorings.md +452 -0
  230. package/localized/zh-CN/skills/fec-refactoring-functions/SKILL.md +25 -0
  231. package/localized/zh-CN/skills/fec-refactoring-functions/references/function-refactorings.md +567 -0
  232. package/localized/zh-CN/skills/fec-refactoring-inheritance/SKILL.md +25 -0
  233. package/localized/zh-CN/skills/fec-refactoring-inheritance/references/inheritance-refactorings.md +550 -0
  234. package/localized/zh-CN/skills/fec-refactoring-move-features/SKILL.md +25 -0
  235. package/localized/zh-CN/skills/fec-refactoring-move-features/references/moving-refactorings.md +453 -0
  236. package/localized/zh-CN/skills/fec-refactoring-validation/SKILL.md +52 -0
  237. package/localized/zh-CN/skills/fec-refactoring-validation/references/behavior-preservation.md +15 -0
  238. package/localized/zh-CN/skills/fec-refactoring-validation/references/refactoring-test-checklist.md +25 -0
  239. package/localized/zh-CN/skills/fec-responsive-layout/SKILL.md +34 -0
  240. package/localized/zh-CN/skills/fec-responsive-layout/references/responsive-layout-patterns.md +70 -0
  241. package/localized/zh-CN/skills/fec-route-protection/SKILL.md +135 -0
  242. package/localized/zh-CN/skills/fec-security-review/SKILL.md +54 -0
  243. package/localized/zh-CN/skills/fec-security-review/references/report-template.md +37 -0
  244. package/localized/zh-CN/skills/fec-security-review/references/security-checklist.md +64 -0
  245. package/localized/zh-CN/skills/fec-source-driven-development/SKILL.md +87 -0
  246. package/localized/zh-CN/skills/fec-state-management/SKILL.md +140 -0
  247. package/localized/zh-CN/skills/fec-state-management/references/state-patterns.md +109 -0
  248. package/localized/zh-CN/skills/fec-storybook-component-doc/SKILL.md +37 -0
  249. package/localized/zh-CN/skills/fec-storybook-component-doc/references/story-patterns.md +118 -0
  250. package/localized/zh-CN/skills/fec-svg-animation/SKILL.md +148 -0
  251. package/localized/zh-CN/skills/fec-tailwind-design-system/SKILL.md +34 -0
  252. package/localized/zh-CN/skills/fec-tailwind-design-system/references/tailwind-system-patterns.md +59 -0
  253. package/localized/zh-CN/skills/fec-tdd-workflow/SKILL.md +55 -0
  254. package/localized/zh-CN/skills/fec-testing-strategy/SKILL.md +45 -0
  255. package/localized/zh-CN/skills/fec-typescript-project-standard/SKILL.md +54 -0
  256. package/localized/zh-CN/skills/fec-typescript-project-standard/references/type-safety-patterns.md +102 -0
  257. package/localized/zh-CN/skills/fec-typescript-project-standard/references/type-safety.md +148 -0
  258. package/localized/zh-CN/skills/fec-ui-design/SKILL.md +108 -0
  259. package/localized/zh-CN/skills/fec-ui-design/data/product-rules.json +231 -0
  260. package/localized/zh-CN/skills/fec-ui-design/data/stack-ui-rules.json +146 -0
  261. package/localized/zh-CN/skills/fec-ui-design/data/style-archetypes.json +373 -0
  262. package/localized/zh-CN/skills/fec-ui-design/data/ux-quality-rules.json +203 -0
  263. package/localized/zh-CN/skills/fec-ui-design/references/design-intelligence.md +97 -0
  264. package/localized/zh-CN/skills/fec-ui-design/references/master-page-overrides.md +30 -0
  265. package/localized/zh-CN/skills/fec-ui-design/references/pre-delivery-checklist.md +39 -0
  266. package/localized/zh-CN/skills/fec-ui-design/scripts/design-system.mjs +648 -0
  267. package/localized/zh-CN/skills/fec-validation-fix/SKILL.md +51 -0
  268. package/localized/zh-CN/skills/fec-validation-fix/references/report-template.md +43 -0
  269. package/localized/zh-CN/skills/fec-vite-project-standard/SKILL.md +83 -0
  270. package/localized/zh-CN/skills/fec-vue3-project-standard/SKILL.md +58 -0
  271. package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-composables-routing.md +162 -0
  272. package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-performance-patterns.md +13 -0
  273. package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-project-structure.md +176 -0
  274. package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-state-api-quality.md +216 -0
  275. package/localized/zh-CN/skills/fec-web-video-presentation/SKILL.md +61 -0
  276. package/localized/zh-CN/skills/fec-web-video-presentation/data/starter-themes.json +59 -0
  277. package/localized/zh-CN/skills/fec-web-video-presentation/references/chapter-craft.md +37 -0
  278. package/localized/zh-CN/skills/fec-web-video-presentation/references/content-plan.md +38 -0
  279. package/localized/zh-CN/skills/fec-web-video-presentation/references/recording-and-audio.md +33 -0
  280. package/localized/zh-CN/skills/fec-web-video-presentation/references/theme-system.md +36 -0
  281. package/localized/zh-CN/skills/fec-web-video-presentation/scripts/create-video-presentation.mjs +430 -0
  282. package/localized/zh-CN/skills/fec-web-workers/SKILL.md +35 -0
  283. package/localized/zh-CN/skills/fec-web-workers/references/advanced-workers.md +54 -0
  284. package/localized/zh-CN/skills/fec-web-workers/references/basic-worker.md +67 -0
  285. package/localized/zh-CN/skills/metadata.json +2004 -0
  286. package/localized/zh-CN/skills/relations.json +1023 -0
  287. package/localized/zh-CN/templates/claude/CLAUDE.md +106 -0
  288. package/localized/zh-CN/templates/claude/settings.json +62 -0
  289. package/localized/zh-CN/templates/codex/AGENTS.md +105 -0
  290. package/localized/zh-CN/templates/codex/config.toml +32 -0
  291. package/localized/zh-CN/templates/openclaw/AGENTS.md +101 -0
  292. package/localized/zh-CN/templates/openclaw/OPENCLAW-CONFIG.md +12 -0
  293. package/localized/zh-CN/templates/shared/rules/fec-agent-workflow.md +55 -0
  294. package/localized/zh-CN/templates/shared/rules/fec-api-layer.md +99 -0
  295. package/localized/zh-CN/templates/shared/rules/fec-ci-cd.md +40 -0
  296. package/localized/zh-CN/templates/shared/rules/fec-code-comments.md +33 -0
  297. package/localized/zh-CN/templates/shared/rules/fec-design-system.md +72 -0
  298. package/localized/zh-CN/templates/shared/rules/fec-error-handling.md +56 -0
  299. package/localized/zh-CN/templates/shared/rules/fec-git-conventions.md +73 -0
  300. package/localized/zh-CN/templates/shared/rules/fec-i18n.md +64 -0
  301. package/localized/zh-CN/templates/shared/rules/fec-naming-conventions.md +120 -0
  302. package/localized/zh-CN/templates/shared/rules/fec-performance.md +101 -0
  303. package/localized/zh-CN/templates/shared/rules/fec-react.md +82 -0
  304. package/localized/zh-CN/templates/shared/rules/fec-refactoring.md +47 -0
  305. package/localized/zh-CN/templates/shared/rules/fec-rendering-patterns.md +40 -0
  306. package/localized/zh-CN/templates/shared/rules/fec-responsive-design.md +50 -0
  307. package/localized/zh-CN/templates/shared/rules/fec-source-driven-development.md +31 -0
  308. package/localized/zh-CN/templates/shared/rules/fec-state-management.md +60 -0
  309. package/localized/zh-CN/templates/shared/rules/fec-testing.md +98 -0
  310. package/localized/zh-CN/templates/shared/rules/fec-typescript.md +112 -0
  311. package/localized/zh-CN/templates/shared/rules/fec-vue.md +64 -0
  312. package/localized/zh-CN/templates/shared/rules/fec-working-modes.md +50 -0
  313. package/openclaw.plugin.json +2 -3
  314. package/package.json +28 -17
  315. package/skills/TEMPLATE.md +74 -74
  316. package/skills/eval_queries.json +922 -678
  317. package/skills/fec-accessibility-check/SKILL.md +21 -21
  318. package/skills/fec-accessibility-check/references/report-template.md +12 -12
  319. package/skills/fec-accessibility-check/references/screen-reader-testing.md +24 -24
  320. package/skills/fec-alchemy/SKILL.md +50 -50
  321. package/skills/fec-alchemy/assets/absorption-plan-template.md +32 -32
  322. package/skills/fec-alchemy/assets/intake-template.md +55 -55
  323. package/skills/fec-alchemy/assets/review-checklist.md +23 -23
  324. package/skills/fec-alchemy/references/methodology.md +66 -66
  325. package/skills/fec-alchemy/references/originality-and-licensing.md +42 -42
  326. package/skills/fec-api-integration/SKILL.md +61 -61
  327. package/skills/fec-api-integration/references/integration-patterns.md +30 -30
  328. package/skills/fec-backend-requirements-handoff/SKILL.md +25 -25
  329. package/skills/fec-browser-storage/SKILL.md +16 -16
  330. package/skills/fec-browser-storage/references/storage-patterns.md +16 -16
  331. package/skills/fec-canvas-threejs/SKILL.md +21 -21
  332. package/skills/fec-canvas-threejs/references/rendering-patterns.md +10 -10
  333. package/skills/fec-canvas-threejs/references/shader-webgl-patterns.md +37 -37
  334. package/skills/fec-code-review/SKILL.md +113 -94
  335. package/skills/fec-code-review/references/report-template.md +23 -13
  336. package/skills/fec-code-smells/SKILL.md +33 -0
  337. package/skills/fec-code-smells/references/detection-guide.md +25 -0
  338. package/skills/fec-code-smells/references/smell-catalog.md +861 -0
  339. package/skills/fec-code-smells/references/smell-to-refactoring-map.md +265 -0
  340. package/skills/fec-component-testing/SKILL.md +39 -39
  341. package/skills/fec-data-fetching/SKILL.md +16 -16
  342. package/skills/fec-data-fetching/references/query-patterns.md +27 -27
  343. package/skills/fec-debug-framework/SKILL.md +95 -95
  344. package/skills/fec-debug-framework/references/report-template.md +34 -34
  345. package/skills/fec-dependency-upgrade/SKILL.md +17 -17
  346. package/skills/fec-dependency-upgrade/references/dependency-upgrade-workflow.md +31 -31
  347. package/skills/fec-doc-sync/SKILL.md +23 -23
  348. package/skills/fec-drawio-studio/SKILL.md +42 -38
  349. package/skills/fec-drawio-studio/data/THIRD_PARTY_NOTICES.md +1 -1
  350. package/skills/fec-drawio-studio/data/shape-index.json +83570 -0
  351. package/skills/fec-drawio-studio/references/diagram-patterns.md +19 -0
  352. package/skills/fec-drawio-studio/references/flowchart-quality.md +49 -0
  353. package/skills/fec-drawio-studio/references/layout-and-export.md +18 -3
  354. package/skills/fec-drawio-studio/references/xml-and-mermaid.md +5 -1
  355. package/skills/fec-drawio-studio/scripts/diagram-lint.mjs +62 -0
  356. package/skills/fec-drawio-studio/scripts/drawio-export.mjs +134 -0
  357. package/skills/fec-drawio-studio/scripts/shape-query.mjs +55 -15
  358. package/skills/fec-e2e-testing/SKILL.md +24 -24
  359. package/skills/fec-e2e-testing/references/e2e-ci-reporting.md +20 -20
  360. package/skills/fec-e2e-testing/references/e2e-special-scenarios.md +10 -10
  361. package/skills/fec-e2e-testing/references/e2e-visual-regression.md +17 -17
  362. package/skills/fec-e2e-testing/references/playwright-patterns.md +6 -6
  363. package/skills/fec-form-handling/SKILL.md +21 -21
  364. package/skills/fec-form-handling/references/advanced-form-patterns.md +41 -41
  365. package/skills/fec-image-generation/SKILL.md +84 -29
  366. package/skills/fec-image-generation/assets/interactive-diagram.html +371 -0
  367. package/skills/fec-image-generation/assets/quality-examples/README.md +14 -0
  368. package/skills/fec-image-generation/assets/quality-examples/architecture.json +121 -0
  369. package/skills/fec-image-generation/assets/quality-examples/invalid-explicit.json +41 -0
  370. package/skills/fec-image-generation/assets/quality-examples/sequence.json +53 -0
  371. package/skills/fec-image-generation/assets/quality-examples/sequence.mmd +21 -0
  372. package/skills/fec-image-generation/assets/quality-examples/workflow.json +98 -0
  373. package/skills/fec-image-generation/assets/quality-examples/workflow.mmd +7 -0
  374. package/skills/fec-image-generation/references/diagram-workflows.md +41 -3
  375. package/skills/fec-image-generation/references/html-technical-diagrams.md +243 -0
  376. package/skills/fec-image-generation/references/png-qa-autofix.md +9 -2
  377. package/skills/fec-image-generation/scripts/diagram-browser.mjs +90 -0
  378. package/skills/fec-image-generation/scripts/diagram-layout.mjs +176 -0
  379. package/skills/fec-image-generation/scripts/export-diagram.mjs +332 -0
  380. package/skills/fec-image-generation/scripts/interactive-diagram-server.mjs +654 -0
  381. package/skills/fec-image-generation/scripts/mermaid-render.mjs +64 -0
  382. package/skills/fec-image-generation/scripts/png-qa.mjs +35 -4
  383. package/skills/fec-image-generation/scripts/tech-diagram-render.mjs +1537 -0
  384. package/skills/fec-implement-from-design/SKILL.md +81 -81
  385. package/skills/fec-implement-from-design/references/design-plan-template.md +16 -16
  386. package/skills/fec-legacy-to-modern-migration/SKILL.md +29 -29
  387. package/skills/fec-legacy-to-modern-migration/references/migration-execution-checklist.md +81 -81
  388. package/skills/fec-legacy-to-modern-migration/references/migration-report-template.md +37 -37
  389. package/skills/fec-legacy-to-modern-migration/references/migration-strategy-and-mapping.md +31 -31
  390. package/skills/fec-legacy-web-standard/SKILL.md +17 -17
  391. package/skills/fec-legacy-web-standard/references/legacy-patterns.md +16 -16
  392. package/skills/fec-list-virtualization/SKILL.md +16 -16
  393. package/skills/fec-list-virtualization/references/virtualization-patterns.md +31 -31
  394. package/skills/fec-monorepo-project-standard/SKILL.md +52 -52
  395. package/skills/fec-motion-interaction/SKILL.md +51 -51
  396. package/skills/fec-motion-interaction/references/motion-patterns.md +11 -11
  397. package/skills/fec-nextjs-project-standard/SKILL.md +64 -64
  398. package/skills/fec-nuxt-project-standard/SKILL.md +57 -57
  399. package/skills/fec-performance-optimization/SKILL.md +54 -54
  400. package/skills/fec-performance-optimization/references/framework-performance-patterns.md +23 -23
  401. package/skills/fec-performance-optimization/references/report-template.md +31 -31
  402. package/skills/fec-pwa-implementation/SKILL.md +17 -17
  403. package/skills/fec-pwa-implementation/references/manifest-and-icons.md +12 -12
  404. package/skills/fec-pwa-implementation/references/service-worker-workbox.md +13 -13
  405. package/skills/fec-react-project-standard/SKILL.md +72 -72
  406. package/skills/fec-react-project-standard/references/react-performance-patterns.md +28 -28
  407. package/skills/fec-react-project-standard/references/react-project-structure.md +112 -112
  408. package/skills/fec-react-project-standard/references/react-quality-patterns.md +72 -72
  409. package/skills/fec-react-project-standard/references/react-runtime-patterns.md +94 -94
  410. package/skills/fec-refactor-clean/SKILL.md +33 -30
  411. package/skills/fec-refactor-clean/references/report-template.md +23 -23
  412. package/skills/fec-refactoring/SKILL.md +83 -0
  413. package/skills/fec-refactoring/references/principles.md +60 -0
  414. package/skills/fec-refactoring/references/refactoring-vs-feature-change.md +27 -0
  415. package/skills/fec-refactoring/references/when-to-refactor.md +31 -0
  416. package/skills/fec-refactoring/references/workflow.md +90 -0
  417. package/skills/fec-refactoring-api/SKILL.md +25 -0
  418. package/skills/fec-refactoring-api/references/api-refactorings.md +496 -0
  419. package/skills/fec-refactoring-catalog/SKILL.md +28 -0
  420. package/skills/fec-refactoring-catalog/references/catalog-index.md +99 -0
  421. package/skills/fec-refactoring-catalog/references/composition-guide.md +49 -0
  422. package/skills/fec-refactoring-catalog/references/selection-guide.md +47 -0
  423. package/skills/fec-refactoring-control/SKILL.md +25 -0
  424. package/skills/fec-refactoring-control/references/conditional-refactorings.md +299 -0
  425. package/skills/fec-refactoring-data/SKILL.md +25 -0
  426. package/skills/fec-refactoring-data/references/data-refactorings.md +248 -0
  427. package/skills/fec-refactoring-encapsulation/SKILL.md +25 -0
  428. package/skills/fec-refactoring-encapsulation/references/encapsulation-refactorings.md +452 -0
  429. package/skills/fec-refactoring-functions/SKILL.md +25 -0
  430. package/skills/fec-refactoring-functions/references/function-refactorings.md +567 -0
  431. package/skills/fec-refactoring-inheritance/SKILL.md +25 -0
  432. package/skills/fec-refactoring-inheritance/references/inheritance-refactorings.md +550 -0
  433. package/skills/fec-refactoring-move-features/SKILL.md +25 -0
  434. package/skills/fec-refactoring-move-features/references/moving-refactorings.md +453 -0
  435. package/skills/fec-refactoring-validation/SKILL.md +59 -0
  436. package/skills/fec-refactoring-validation/references/behavior-preservation.md +53 -0
  437. package/skills/fec-refactoring-validation/references/refactoring-test-checklist.md +42 -0
  438. package/skills/fec-responsive-layout/SKILL.md +17 -17
  439. package/skills/fec-responsive-layout/references/responsive-layout-patterns.md +37 -37
  440. package/skills/fec-route-protection/SKILL.md +26 -26
  441. package/skills/fec-security-review/SKILL.md +36 -20
  442. package/skills/fec-security-review/references/report-template.md +22 -12
  443. package/skills/fec-security-review/references/security-checklist.md +27 -27
  444. package/skills/fec-source-driven-development/SKILL.md +59 -59
  445. package/skills/fec-state-management/SKILL.md +34 -34
  446. package/skills/fec-state-management/references/state-patterns.md +19 -19
  447. package/skills/fec-storybook-component-doc/SKILL.md +19 -19
  448. package/skills/fec-storybook-component-doc/references/story-patterns.md +12 -12
  449. package/skills/fec-svg-animation/SKILL.md +32 -32
  450. package/skills/fec-tailwind-design-system/SKILL.md +17 -17
  451. package/skills/fec-tailwind-design-system/references/tailwind-system-patterns.md +36 -36
  452. package/skills/fec-tdd-workflow/SKILL.md +32 -28
  453. package/skills/fec-testing-strategy/SKILL.md +29 -29
  454. package/skills/fec-typescript-project-standard/SKILL.md +38 -38
  455. package/skills/fec-typescript-project-standard/references/type-safety-patterns.md +20 -20
  456. package/skills/fec-typescript-project-standard/references/type-safety.md +18 -18
  457. package/skills/fec-ui-design/SKILL.md +90 -90
  458. package/skills/fec-ui-design/references/design-intelligence.md +61 -61
  459. package/skills/fec-ui-design/references/master-page-overrides.md +15 -15
  460. package/skills/fec-ui-design/references/pre-delivery-checklist.md +38 -38
  461. package/skills/fec-validation-fix/SKILL.md +26 -26
  462. package/skills/fec-validation-fix/references/report-template.md +25 -25
  463. package/skills/fec-vite-project-standard/SKILL.md +39 -39
  464. package/skills/fec-vue3-project-standard/SKILL.md +38 -38
  465. package/skills/fec-vue3-project-standard/references/vue3-composables-routing.md +36 -36
  466. package/skills/fec-vue3-project-standard/references/vue3-performance-patterns.md +8 -8
  467. package/skills/fec-vue3-project-standard/references/vue3-project-structure.md +112 -112
  468. package/skills/fec-vue3-project-standard/references/vue3-state-api-quality.md +74 -74
  469. package/skills/fec-web-video-presentation/SKILL.md +33 -33
  470. package/skills/fec-web-workers/SKILL.md +16 -16
  471. package/skills/fec-web-workers/references/advanced-workers.md +13 -13
  472. package/skills/fec-web-workers/references/basic-worker.md +8 -8
  473. package/skills/metadata.json +485 -116
  474. package/skills/relations.json +268 -0
  475. package/templates/claude/CLAUDE.md +60 -60
  476. package/templates/codex/AGENTS.md +76 -76
  477. package/templates/codex/config.toml +4 -4
  478. package/templates/openclaw/AGENTS.md +68 -68
  479. package/templates/openclaw/OPENCLAW-CONFIG.md +8 -8
  480. package/templates/shared/rules/fec-agent-workflow.md +41 -40
  481. package/templates/shared/rules/fec-api-layer.md +52 -52
  482. package/templates/shared/rules/fec-ci-cd.md +29 -29
  483. package/templates/shared/rules/fec-code-comments.md +22 -22
  484. package/templates/shared/rules/fec-design-system.md +53 -53
  485. package/templates/shared/rules/fec-error-handling.md +40 -40
  486. package/templates/shared/rules/fec-git-conventions.md +42 -42
  487. package/templates/shared/rules/fec-i18n.md +48 -48
  488. package/templates/shared/rules/fec-naming-conventions.md +91 -91
  489. package/templates/shared/rules/fec-performance.md +78 -78
  490. package/templates/shared/rules/fec-react.md +58 -58
  491. package/templates/shared/rules/fec-refactoring.md +34 -34
  492. package/templates/shared/rules/fec-rendering-patterns.md +36 -36
  493. package/templates/shared/rules/fec-responsive-design.md +37 -37
  494. package/templates/shared/rules/fec-source-driven-development.md +22 -22
  495. package/templates/shared/rules/fec-state-management.md +56 -56
  496. package/templates/shared/rules/fec-testing.md +64 -64
  497. package/templates/shared/rules/fec-typescript.md +75 -75
  498. package/templates/shared/rules/fec-vue.md +42 -42
  499. package/templates/shared/rules/fec-working-modes.md +34 -34
  500. package/docs/superpowers/plans/2026-05-29-fec-debug.md +0 -491
  501. package/docs/superpowers/specs/2026-05-29-fec-debug-design.md +0 -340
  502. package/skills/fec-drawio-studio/data/shape-index.json.gz +0 -0
@@ -1,33 +1,33 @@
1
- # 命名规范
1
+ # Naming convention
2
2
 
3
- ## 文件与目录命名
3
+ ## File and directory naming
4
4
 
5
- | 类型 | 命名风格 | 示例 |
5
+ | Type | Naming Style | Example |
6
6
  |------|----------|------|
7
- | 页面组件 | PascalCase + `Page` 后缀 | `UserDetailPage.tsx` / `UserDetailPage.vue` |
8
- | 布局组件 | PascalCase + `Layout` 后缀 | `MainLayout.tsx` / `MainLayout.vue` |
9
- | 通用组件 | PascalCase | `DataTable.tsx` / `AppButton.vue` |
10
- | Hooks / Composables | camelCase + `use` 前缀 | `useAuth.ts`、`useDebounce.ts` |
11
- | Store 文件 | camelCase + `Store` 后缀 | `authStore.ts`、`uiStore.ts` |
12
- | API 文件 | camelCase | `api.ts` 或按领域命名 `userApi.ts` |
13
- | 工具函数 | camelCase | `format.ts`、`validators.ts` |
14
- | 类型文件 | camelCase | `types.ts`、`models.ts` |
15
- | 常量文件 | camelCase | `constants.ts`、`config.ts` |
16
- | 测试文件 | 与源文件同名 + `.spec` / `.test` | `Button.spec.tsx`、`useAuth.spec.ts` |
17
- | 样式文件 | 组件名 + `.styles` + 扩展名 | `Button.styles.css`、`DataTable.styles.scss`;使用 styled-components 时为 `ComponentName.styles.ts` |
18
- | 语言包 | 语言代码(BCP 47) | `zh-CN.json`、`en-US.json` |
19
- | 目录名 | PascalCase(组件/页面)或 kebab-case(功能模块) | `UserDetail/`、`auth/`、`order/` |
20
-
21
- ## 组件命名
7
+ | Page component | PascalCase + `Page` suffix | `UserDetailPage.tsx` / `UserDetailPage.vue` |
8
+ | Layout component | PascalCase + `Layout` suffix | `MainLayout.tsx` / `MainLayout.vue` |
9
+ | Common components | PascalCase | `DataTable.tsx` / `AppButton.vue` |
10
+ | Hooks / Composables | camelCase + `use` prefix | `useAuth.ts`, `useDebounce.ts` |
11
+ | Store file | camelCase + `Store` suffix | `authStore.ts`, `uiStore.ts` |
12
+ | API documentation | camelCase | `api.ts` or by domain `userApi.ts` |
13
+ | Utility functions | camelCase | `format.ts`, `validators.ts` |
14
+ | Type files | camelCase | `types.ts`, `models.ts` |
15
+ | Constant files | camelCase | `constants.ts`, `config.ts` |
16
+ | Test file | Same name as source file + `.spec` / `.test` | `Button.spec.tsx`, `useAuth.spec.ts` |
17
+ | Style file | Component name + `.styles` + extension | `Button.styles.css`, `DataTable.styles.scss`; `ComponentName.styles.ts` when using styled-components |
18
+ | Language pack | Language code (BCP 47) | `zh-CN.json`, `en-US.json` |
19
+ | Directory name | PascalCase (component/page) or kebab-case (function module) | `UserDetail/`, `auth/`, `order/` |
20
+
21
+ ## Component naming
22
22
 
23
23
  ### React
24
24
 
25
25
  ```tsx
26
- // 文件名与组件名一致
26
+ //The file name is consistent with the component name
27
27
  // src/components/DataTable/DataTable.tsx
28
28
  export function DataTable({ data, columns }: DataTableProps) { ... }
29
29
 
30
- // 页面组件加 Page 后缀
30
+ //Add Page suffix to page component
31
31
  // src/pages/UserDetail/UserDetailPage.tsx
32
32
  export default function UserDetailPage() { ... }
33
33
  ```
@@ -35,86 +35,86 @@ export default function UserDetailPage() { ... }
35
35
  ### Vue
36
36
 
37
37
  ```vue
38
- <!-- 文件名与组件名一致 -->
38
+ <!-- The file name is consistent with the component name -->
39
39
  <!-- src/components/AppButton/AppButton.vue -->
40
40
  <script setup lang="ts">
41
- // 无需 defineOptions,文件名即组件名
41
+ // No need for defineOptions, the file name is the component name
42
42
  </script>
43
43
  ```
44
44
 
45
- - 多词组件名(避免与 HTML 原生标签冲突)
46
- - Vue 全局组件推荐使用 `App` 前缀(`AppButton`、`AppModal`)
47
- - 模板中使用 PascalCase 引用:`<AppButton>` 而非 `<app-button>`
45
+ - Multi-word component names (to avoid conflicts with HTML native tags)
46
+ - Vue global components are recommended to use the `App` prefix (`AppButton`, `AppModal`)
47
+ - Use PascalCase reference in template: `<AppButton>` instead of `<app-button>`
48
48
 
49
- ## 变量与函数命名
49
+ ## Variable and function naming
50
50
 
51
- | 类型 | 命名风格 | 示例 |
51
+ | Type | Naming Style | Example |
52
52
  |------|----------|------|
53
- | 普通变量 | camelCase | `userName`、`isLoading`、`pageSize` |
54
- | 常量 | UPPER_SNAKE_CASE | `MAX_RETRY_COUNT`、`DEFAULT_PAGE_SIZE` |
55
- | 布尔值 | `is` / `has` / `should` / `can` 前缀 | `isVisible`、`hasPermission`、`canEdit` |
56
- | 事件处理(组件内) | `handle` 前缀 | `handleClick`、`handleSubmit` |
57
- | 回调 Props | `on` 前缀 | `onClick`、`onSubmit`、`onChange` |
58
- | 数组 | 复数名词 | `users`、`orderItems`、`selectedIds` |
59
- | Map / Record | `xxxMap` 或 `xxxByYyy` | `userMap`、`permissionsById` |
60
- | Ref (Vue) | 不加 `Ref` 后缀 | `count`(不用 `countRef`) |
61
- | 接口 | PascalCase,不加 `I` 前缀 | `UserProfile`(不用 `IUserProfile`) |
62
- | Props 接口 | 组件名 + `Props` | `DataTableProps`、`UserFormProps` |
63
- | Emits 接口 | 组件名 + `Emits` | `UserFormEmits` |
64
- | 枚举 | PascalCase,成员用 PascalCase | `OrderStatus.Pending` |
65
- | 泛型参数 | 单字母大写或语义化 | `T`、`TData`、`TItem` |
66
-
67
- ## CSS 类命名
68
-
69
- - 与项目约定保持一致(BEM / CSS Modules / Tailwind / Atomic CSS)
70
- - 如果使用 CSS Modules,类名用 camelCase:`.headerTitle`、`.cardBody`
71
- - 如果使用 BEM,遵循 `block__element--modifier` 格式
72
- - CSS 变量使用 kebab-case:`--color-primary`、`--spacing-md`
73
-
74
- ## 路由命名
75
-
76
- | 类型 | 命名风格 | 示例 |
53
+ | Ordinary variables | camelCase | `userName`, `isLoading`, `pageSize` |
54
+ | Constants | UPPER_SNAKE_CASE | `MAX_RETRY_COUNT`, `DEFAULT_PAGE_SIZE` |
55
+ | Boolean value | `is` / `has` / `should` / `can` prefix | `isVisible`, `hasPermission`, `canEdit` |
56
+ | Event handling (inside component) | `handle` prefix | `handleClick`, `handleSubmit` |
57
+ | Callback Props | `on` prefix | `onClick`, `onSubmit`, `onChange` |
58
+ | Array | Plural noun | `users`, `orderItems`, `selectedIds` |
59
+ | Map / Record | `xxxMap` or `xxxByYyy` | `userMap`, `permissionsById` |
60
+ | Ref (Vue) | Without `Ref` suffix | `count` (without `countRef`) |
61
+ | Interface | PascalCase, without `I` prefix | `UserProfile` (without `IUserProfile`) |
62
+ | Props interface | component name + `Props` | `DataTableProps`, `UserFormProps` |
63
+ | Emits interface | component name + `Emits` | `UserFormEmits` |
64
+ | Enum | PascalCase, members use PascalCase | `OrderStatus.Pending` |
65
+ | Generic parameters | Single letter capitalization or semantic | `T`, `TData`, `TItem` |
66
+
67
+ ## CSS class naming
68
+
69
+ - Aligned with project conventions (BEM/CSS Modules/Tailwind/Atomic CSS)
70
+ - If using CSS Modules, use camelCase for class names: `.headerTitle`, `.cardBody`
71
+ - If using BEM, follow the `block__element--modifier` format
72
+ - CSS variables use kebab-case: `--color-primary`, `--spacing-md`
73
+
74
+ ## Route naming
75
+
76
+ | Type | Naming Style | Example |
77
77
  |------|----------|------|
78
- | 路由路径 | kebab-case | `/user-detail`、`/order-list` |
79
- | 路由名称 | PascalCase | `UserDetail`、`OrderList` |
80
- | 路由参数 | camelCase | `:userId`、`:orderId` |
81
- | 查询参数 | camelCase | `?pageSize=10&sortBy=name` |
82
- | 路径常量 | UPPER_SNAKE_CASE | `ROUTE_USER_DETAIL = '/user-detail'` |
78
+ | routing path | kebab-case | `/user-detail`, `/order-list` |
79
+ | Route name | PascalCase | `UserDetail`, `OrderList` |
80
+ | Routing parameters | camelCase | `:userId`, `:orderId` |
81
+ | Query parameters | camelCase | `?pageSize=10&sortBy=name` |
82
+ | Path constants | UPPER_SNAKE_CASE | `ROUTE_USER_DETAIL = '/user-detail'` |
83
83
 
84
- ## API 命名
84
+ ## API naming
85
85
 
86
- | 类型 | 命名风格 | 示例 |
86
+ | Type | Naming Style | Example |
87
87
  |------|----------|------|
88
- | GET 列表 | `getXxxList` | `getUserList(params)` |
89
- | GET 单条 | `getXxxDetail` / `getXxxById` | `getUserDetail(id)` |
90
- | POST 创建 | `createXxx` | `createOrder(data)` |
91
- | PUT 更新 | `updateXxx` | `updateUser(id, data)` |
92
- | DELETE 删除 | `deleteXxx` | `deleteOrder(id)` |
93
- | DTO 类型 | 动词 + 名词 + `DTO` | `CreateOrderDTO`、`UpdateUserDTO` |
94
- | 响应类型 | 名词 | `User`、`Order`、`PageResult<User>` |
95
-
96
- ## i18n Key 命名
97
-
98
- - 使用点分命名空间:`module.section.label`
99
- - 示例:`user.form.username`、`common.button.submit`、`error.network.timeout`
100
- - 不使用中文 / 拼音作为 key
101
-
102
- ## 反模式
103
-
104
- - 文件名和组件名不一致(`user-table.tsx` 导出 `DataGrid`)
105
- - 同一项目混用多种命名风格(有的 kebab-case 有的 PascalCase)
106
- - 使用缩写或不明确的名称(`btn`、`usr`、`tmp`、`handleA`)
107
- - 布尔值没有语义前缀(`visible` → 应为 `isVisible`)
108
- - 常量不用大写(`maxRetry` → 应为 `MAX_RETRY`)
109
- - CSS 变量硬编码在组件中而非使用统一变量
110
-
111
- ## 检查清单
112
-
113
- - [ ] 文件名与导出的组件/函数名一致
114
- - [ ] 页面组件有 `Page` 后缀,布局组件有 `Layout` 后缀
115
- - [ ] 布尔变量使用 `is` / `has` / `can` / `should` 前缀
116
- - [ ] 事件处理用 `handle` 前缀,回调 Props 用 `on` 前缀
117
- - [ ] 常量使用 UPPER_SNAKE_CASE
118
- - [ ] 路由路径使用 kebab-case,路由名使用 PascalCase
119
- - [ ] API 函数命名与 HTTP 方法语义一致
120
- - [ ] i18n key 使用点分命名空间,无硬编码文案
88
+ | GET list | `getXxxList` | `getUserList(params)` |
89
+ | GET single item | `getXxxDetail` / `getXxxById` | `getUserDetail(id)` |
90
+ | POST Create | `createXxx` | `createOrder(data)` |
91
+ | PUT update | `updateXxx` | `updateUser(id, data)` |
92
+ | DELETE delete | `deleteXxx` | `deleteOrder(id)` |
93
+ | DTO type | Verb + Noun + `DTO` | `CreateOrderDTO`, `UpdateUserDTO` |
94
+ | Response type | Noun | `User`, `Order`, `PageResult<User>` |
95
+
96
+ ## i18n Key naming
97
+
98
+ - Use dotted namespace: `module.section.label`
99
+ - Examples: `user.form.username`, `common.button.submit`, `error.network.timeout`
100
+ - Do not use Chinese/Pinyin as key
101
+
102
+ ## Anti-pattern
103
+
104
+ - File name and component name are inconsistent (`user-table.tsx` exports `DataGrid`)
105
+ - Mixing multiple naming styles (some kebab-case, some PascalCase) in the same project
106
+ - Use abbreviated or ambiguous names (`btn`, `usr`, `tmp`, `handleA`)
107
+ - Boolean values have no semantic prefix (`visible` → should be `isVisible`)
108
+ - Constants do not need to be capitalized (`maxRetry` → should be `MAX_RETRY`)
109
+ - CSS variables are hardcoded in components instead of using uniform variables
110
+
111
+ ## Checklist
112
+
113
+ - [ ] The file name is consistent with the exported component/function name
114
+ - [ ] Page components have the `Page` suffix, and layout components have the `Layout` suffix.
115
+ - [ ] Boolean variables use `is` / `has` / `can` / `should` prefixes
116
+ - [ ] Event handling is prefixed with `handle`, callback Props are prefixed with `on`
117
+ - [ ] constant using UPPER_SNAKE_CASE
118
+ - [ ] Use kebab-case for the routing path and PascalCase for the routing name.
119
+ - [ ] API function naming is consistent with HTTP method semantics
120
+ - [ ] i18n key uses dotted namespace, no hardcoded copy
@@ -1,21 +1,21 @@
1
- # 前端性能规则
1
+ # Front-end performance rules
2
2
 
3
- 凡是新增页面、组件、资源加载或数据请求时,都应用本文件。
3
+ This document will be used whenever new pages, components, resource loading or data requests are added.
4
4
 
5
- ## 核心原则
5
+ ## Core Principles
6
6
 
7
- - 默认懒加载,按需加载
8
- - 减少首屏关键资源
9
- - 避免不必要的重渲染
10
- - 关注 Core Web Vitals
11
- - 前端构建必须同时验证开发体验和生产产物,不能只看 dev server 正常
12
- - 在上下文或任务边界不清时,不启动大规模性能重构;先定位瓶颈再改代码
13
- - 对长时间运行的命令保留可回看日志,必要时使用终端会话、CI artifact 或测试报告
14
- - 每项性能建议都要绑定证据、影响范围、验证方式和回退风险
7
+ - Lazy loading by default, loading on demand
8
+ - Reduce key resources on the first screen
9
+ - Avoid unnecessary re-rendering
10
+ - Follow Core Web Vitals
11
+ - The front-end build must verify the development experience and production products at the same time. You cannot just check whether the dev server is normal.
12
+ - Do not initiate large-scale performance refactoring when the context or task boundaries are unclear; locate bottlenecks first and then change the code
13
+ - Keep reviewable logs of long-running commands, using terminal sessions, CI artifacts, or test reports when necessary
14
+ - Each performance recommendation must be bound with evidence, scope of impact, verification methods and rollback risks
15
15
 
16
- ## 代码分割与懒加载
16
+ ## Code splitting and lazy loading
17
17
 
18
- ### 路由级分割
18
+ ### Routing level segmentation
19
19
 
20
20
  ```tsx
21
21
  // React
@@ -25,77 +25,77 @@ const Dashboard = lazy(() => import('./pages/Dashboard'));
25
25
  const Dashboard = () => import('./pages/Dashboard.vue');
26
26
  ```
27
27
 
28
- ### 组件级分割
28
+ ### Component level segmentation
29
29
 
30
- 仅在以下场景使用组件级懒加载:
30
+ Only use component-level lazy loading in the following scenarios:
31
31
 
32
- - 重型第三方库(图表、编辑器、地图)
33
- - 条件渲染的大型模块(如设置面板、高级筛选)
34
- - 不在首屏可视区域的内容
32
+ - Heavy-duty third-party libraries (charts, editors, maps)
33
+ - Large modules for conditional rendering (such as settings panel, advanced filtering)
34
+ - Content that is not in the visible area of the first screen
35
35
 
36
- ## 渲染性能
36
+ ## Rendering performance
37
37
 
38
38
  ### React
39
39
 
40
- - 合理使用 `React.memo` 避免不必要的重渲染
41
- - `useMemo` / `useCallback` 仅在依赖稳定且子组件使用 memo 时才有意义
42
- - 列表渲染必须使用稳定的 `key`
43
- - 避免在渲染函数内创建新对象、数组或函数
40
+ - Use `React.memo` wisely to avoid unnecessary re-rendering
41
+ - `useMemo` / `useCallback` only makes sense if the dependency is stable and the subcomponent uses memo
42
+ - List rendering must use a stable `key`
43
+ - Avoid creating new objects, arrays or functions inside render functions
44
44
 
45
45
  ### Vue
46
46
 
47
- - 使用 `computed` 而非 `watch` + 手动赋值
48
- - 大列表使用虚拟滚动
49
- - 避免在 `v-for` 中使用 `v-if`
50
- - 使用 `shallowRef` / `shallowReactive` 优化大型对象
51
-
52
- ## 资源优化
53
-
54
- - 图片使用 WebP/AVIF 格式,提供适当尺寸
55
- - 图标优先使用 SVG sprite 或 icon font,避免大量独立图片请求
56
- - 字体按需加载,使用 `font-display: swap`
57
- - 第三方依赖按需导入(如 `import { Button } from 'antd'` 而非 `import antd from 'antd'`)
58
-
59
- ## Vite 构建与开发性能
60
-
61
- 使用 Vite 时额外遵守:
62
-
63
- - `vite build` 不做类型检查,CI 必须单独执行 `tsc --noEmit` 或接入 `vite-plugin-checker`
64
- - 慢启动先用 `vite --profile` 定位插件、解析或预构建瓶颈
65
- - 大项目可使用 `server.warmup.clientFiles` 预热核心入口
66
- - CJS/UMD 依赖互操作问题优先通过 `optimizeDeps.include` 处理
67
- - 手动分包优先使用稳定对象形式,不要把每个 `node_modules` 包拆成独立 chunk
68
- - 组件库模式必须 externalize peer dependencies,并单独产出类型声明
69
- - `vite preview` 只用于本地构建烟测,不是生产服务器
70
-
71
- ## 数据请求
72
-
73
- - 避免瀑布式请求(串行依赖),尽可能并行
74
- - 合理使用缓存策略(SWR / React Query / VueQuery)
75
- - 分页加载或虚拟滚动处理大数据集
76
- - 防抖/节流处理高频触发的请求(搜索、滚动)
77
-
78
- ## 检查清单
79
-
80
- - [ ] 是否记录核心路由、设备、网络和当前指标
81
- - [ ] 路由是否按需加载
82
- - [ ] 重型组件是否懒加载
83
- - [ ] 大列表是否使用虚拟滚动或分页
84
- - [ ] 图片是否使用现代格式和合理尺寸
85
- - [ ] 第三方库是否按需导入
86
- - [ ] 是否存在不必要的重渲染
87
- - [ ] Vite 项目是否单独执行 typecheck
88
- - [ ] Vite 构建产物是否经过 `vite build` 和本地预览烟测
89
- - [ ] 是否复查 loading、error、empty、disabled 和移动端状态没有被优化破坏
90
-
91
- ## 反模式
92
-
93
- - 将所有路由打包在一个 chunk 中
94
- - 在首屏加载整个图表库或编辑器
95
- - 在组件内重复创建相同的 API 请求
96
- - 大列表不做虚拟化直接渲染数千行 DOM
97
- - 频繁操作(如输入、滚动)不做防抖/节流
98
- - 认为 `vite build` 通过就代表 TypeScript 没有错误
99
- - 设置 `envPrefix: ""` 或把服务端密钥注入客户端 bundle
100
- - 未先复现卡顿、包体积或 Web Vitals 指标,就做大范围“性能优化”
101
- - 为追求实验室分数删除状态反馈、降低可访问性或牺牲主路径可维护性
47
+ - Use `computed` instead of `watch` + manual assignment
48
+ - Use virtual scrolling for large lists
49
+ - Avoid using `v-if` inside `v-for`
50
+ - Use `shallowRef` / `shallowReactive` to optimize large objects
51
+
52
+ ## Resource optimization
53
+
54
+ - Images use WebP/AVIF format and provide appropriate sizes
55
+ - For icons, use SVG sprite or icon font first to avoid a large number of independent image requests
56
+ - Fonts are loaded on demand, use `font-display: swap`
57
+ - Third-party dependencies are imported on demand (such as `import { Button } from 'antd'` instead of `import antd from 'antd'`)
58
+
59
+ ## Vite build and development performance
60
+
61
+ Additional compliance when using Vite:
62
+
63
+ - `vite build` does not do type checking, CI must execute `tsc --noEmit` separately or access `vite-plugin-checker`
64
+ - Use `vite --profile` to locate plug-in, parsing or pre-built bottlenecks before slow start
65
+ - Large projects can use `server.warmup.clientFiles` to warm up the core entrance
66
+ - CJS/UMD dependency interoperability issues are first handled through `optimizeDeps.include`
67
+ - For manual sub-packaging, use stable object form first, do not split each `node_modules` package into independent chunks
68
+ - Component library mode must externalize peer dependencies and produce type declarations separately
69
+ - `vite preview` is only used for local build smoke tests, not production servers
70
+
71
+ ## Data request
72
+
73
+ - Avoid waterfall requests (serial dependencies), parallelize as much as possible
74
+ - Proper use of caching strategies (SWR/React Query/VueQuery)
75
+ - Paged loading or virtual scrolling for processing large data sets
76
+ - Anti-shake/throttle processing of high-frequency triggered requests (search, scrolling)
77
+
78
+ ## Checklist
79
+
80
+ - [ ] Whether to record core routing, device, network and current metrics
81
+ - [ ] Whether the route is loaded on demand
82
+ - [ ] Whether heavy components are lazy loaded
83
+ - [ ] Whether to use virtual scrolling or paging for large lists
84
+ - [ ] Whether the image uses a modern format and reasonable size
85
+ - [ ] Whether third-party libraries are imported on demand
86
+ - [ ] Whether there is unnecessary re-rendering
87
+ - [ ] Whether the Vite project executes typecheck separately
88
+ - [ ] Whether the Vite build product has passed the `vite build` and local preview smoke tests
89
+ - [ ] Whether to review loading, error, empty, disabled and mobile status are not destroyed by optimization
90
+
91
+ ## Anti-pattern
92
+
93
+ - Pack all routes in one chunk
94
+ - Load the entire chart library or editor on the first screen
95
+ - Create the same API request repeatedly within the component
96
+ - Large lists directly render thousands of lines of DOM without virtualization
97
+ - No anti-shake/throttling for frequent operations (such as input, scrolling)
98
+ - It is considered that passing `vite build` means that TypeScript has no errors
99
+ - Set `envPrefix: ""` or inject the server key into the client bundle
100
+ - Doing extensive “performance optimization” without first reproducing lag, packet size or Web Vitals indicators
101
+ - Remove status feedback, reduce accessibility, or sacrifice main path maintainability in pursuit of lab scores
@@ -1,82 +1,82 @@
1
- # React 规则
1
+ # React rules
2
2
 
3
- 当仓库或目标模块使用 React 时,应用本文件。
3
+ This file applies when the repository or target module uses React.
4
4
 
5
- ## 技术栈
5
+ ## Technology stack
6
6
 
7
- <!-- 请根据项目实际情况修改 -->
7
+ <!-- Please modify according to the actual situation of the project -->
8
8
 
9
- - 框架: React + TypeScript
10
- - 样式: Tailwind CSS + CSS Modules
11
- - 状态管理: Zustand / Redux Toolkit / Jotai(按项目实际选择)
12
- - UI 组件库: 按项目实际选择(如 Ant Design、Material UI 或内部 Design System)
13
- - 版本与依赖:新建模块、补充 `package.json` 或更新本节前,优先采用彼此兼容的主流稳定版本(对齐官方文档、脚手架默认值或包管理器推荐),避免混用已停止维护或与仓库主线 major 不匹配的依赖。
9
+ - Framework: React + TypeScript
10
+ - Style: Tailwind CSS + CSS Modules
11
+ - Status management: Zustand / Redux Toolkit / Jotai (select according to the actual project)
12
+ - UI component library: actual selection by project (such as Ant Design, Material UI or internal Design System)
13
+ - Versions and dependencies: Before creating a new module, supplementing `package.json` or updating this section, give priority to using mainstream stable versions that are compatible with each other (align with official documents, scaffolding defaults or package manager recommendations) to avoid mixing dependencies that have stopped maintaining or do not match the major of the mainline of the warehouse.
14
14
 
15
- ## React 组件规范
15
+ ## React component specification
16
16
 
17
- - 使用**函数组件**、Hooks 与 TypeScript;**不要**新增类组件(含手写 Error Boundary,统一用 `react-error-boundary` 等库)
18
- - 保持组件小而可组合
19
- - 将可复用逻辑提取到 hooks
20
- - props 保持明确且类型清晰
21
- - 保持可访问性与键盘交互
22
- - 优先使用可推导状态,避免重复维护 state
23
- - 在创建新基础组件前,先复用现有设计系统
24
- - 禁止使用 any,优先使用 unknown
25
- - CSS 命名遵循 BEM(CSS Modules 场景)
17
+ - Use **Function Components**, Hooks and TypeScript; **Do not** add new class components (including handwritten Error Boundary, use `react-error-boundary` and other libraries)
18
+ - Keep components small and composable
19
+ - Extract reusable logic into hooks
20
+ - Keep props explicit and clearly typed
21
+ - Maintain accessibility with keyboard interaction
22
+ - Prioritize the use of deducible state to avoid repeated state maintenance
23
+ - Reuse existing design systems before creating new base components
24
+ - It is forbidden to use any, prefer unknown
25
+ - CSS naming follows BEM (CSS Modules scenario)
26
26
 
27
- ## 模式与最佳实践(React)
27
+ ## Patterns and Best Practices (React)
28
28
 
29
- - **组合**:用小组件 + `children`/props 拼装;避免宽布尔 props 与假「继承」。
30
- - **复合组件**:根组件用 Context 向子组件暴露状态;子组件在缺少 Context 时明确报错。
31
- - **Render Props**:仅在需要封装数据态并把渲染交给上层时考虑;多数场景优先自定义 Hook + 普通组件。
32
- - **Context + useReducer**:中等复杂度的多子树客户端状态;勿把高频变化大对象放在顶层 Context;服务端数据用 React Query / SWR。
33
- - **表单**:中大型表单优先 React Hook Form + Zod;避免单文件巨型受控 state。
34
- - **Error Boundary**:关键模块用 **`react-error-boundary`**(或团队统一的同类库)在模块边界兜底;业务组件一律函数式,不手写类组件 Error Boundary。
35
- - **性能**:`useMemo`/`useCallback`/`React.memo` 按需使用;长列表用虚拟列表(如 TanStack Virtual、react-window);昂贵计算注意不可变派生(勿原地 `sort` 原数组)。
36
- - **动效**:Framer Motion 或 CSS transition;尊重 `prefers-reduced-motion`。
37
- - **无障碍**:复合控件补齐 `role`/`aria-*` 与键盘操作;弹窗管理焦点落入与关闭后恢复。
38
- - **Next.js**:App Router 与 Server Components 相关约定以项目 Next 规则为准。
29
+ - **Composition**: Use widgets + `children`/props to assemble; avoid wide boolean props and fake "inheritance".
30
+ - **Composite component**: The root component uses Context to expose state to sub-components; sub-components explicitly report an error when Context is missing.
31
+ - **Render Props**: Only considered when it is necessary to encapsulate the data state and hand over the rendering to the upper layer; in most scenarios, custom Hook + ordinary components are given priority.
32
+ - **Context + useReducer**: Medium complexity multi-subtree client state; do not put high-frequency changing large objects in the top-level Context; use React Query / SWR for server-side data.
33
+ - **Form**: Prioritize medium and large forms with React Hook Form + Zod; avoid single-file giant controlled state.
34
+ - **Error Boundary**: Key modules use **`react-error-boundary`** (or a similar library unified by the team) to cover the module boundaries; business components must be functional, and no handwritten class components Error Boundary.
35
+ - **Performance**: Use `useMemo`/`useCallback`/`React.memo` on demand; use virtual lists for long lists (such as TanStack Virtual, react-window); pay attention to immutable derivation for expensive calculations (do not `sort` the original array in place).
36
+ - **Motion**: Framer Motion or CSS transition; respect `prefers-reduced-motion`.
37
+ - **Accessibility**: Compound controls complement `role`/`aria-*` and keyboard operations; pop-up window management focus is dropped and restored after closing.
38
+ - **Next.js**: The relevant agreements between App Router and Server Components are subject to the project Next rules.
39
39
 
40
- ## React 实现指导
40
+ ## React Implementation Guide
41
41
 
42
- 创建新组件前:
42
+ Before creating a new component:
43
43
 
44
- 1. 先搜索是否已存在等价组件
45
- 2. 判断逻辑是否应该放入自定义 hook
46
- 3. 与项目当前样式方案保持一致
44
+ 1. First search whether equivalent components already exist
45
+ 2. Determine whether the logic should be put into a custom hook
46
+ 3. Be consistent with the current style scheme of the project
47
47
 
48
- 编辑 React 组件时:
48
+ When editing a React component:
49
49
 
50
- - 避免在同一个文件里混合数据请求、重业务逻辑和展示逻辑
51
- - 避免设计过宽或语义不清的 props API
52
- - 对局部问题避免滥用 context
53
- - 保持条件渲染可读,必要时提取重复分支
50
+ - Avoid mixing data requests, heavy business logic and presentation logic in the same file
51
+ - Avoid designing props APIs that are too broad or have unclear semantics
52
+ - Avoid abusing context for local problems
53
+ - Keep conditional rendering readable and extract duplicate branches if necessary
54
54
 
55
- ## React 文件组织
55
+ ## React file organization
56
56
 
57
- 优先遵循仓库已有约定。
58
- 常见输出可能包括:
57
+ Priority is given to following existing agreements in the warehouse.
58
+ Common output may include:
59
59
 
60
60
  - `Component.tsx`
61
61
  - `Component.types.ts`
62
62
  - `hooks/useComponentLogic.ts`
63
- - `ComponentName.styles.css`(普通 CSS / CSS Modules;使用 styled-components 时为 `ComponentName.styles.ts`)
64
- - 如果仓库采用就近测试,则补充测试文件,如:`__tests__/Component.spec.tsx`
63
+ - `ComponentName.styles.css` (plain CSS / CSS Modules; `ComponentName.styles.ts` when using styled-components)
64
+ - If the warehouse uses nearby testing, add test files, such as: `__tests__/Component.spec.tsx`
65
65
 
66
- ## 组件文件规模
66
+ ## Component file size
67
67
 
68
- - 单个组件文件保持**职责单一**、语义清晰、易于维护。
69
- - **行数参考**:优先将单文件控制在约 **300 行**以内;超过 **500 行**应视为**强烈拆分信号**。
70
- - **未到 500 行也应拆分**的情形:同时存在**复杂状态交织**、**过多副作用**、**JSX 嵌套过深**、**密集条件分支**、数据获取与 UI 长期混在同一文件等,使单文件难以一眼把握时,应拆为**子组件**、**自定义 Hooks**、**工具函数**、**常量**与**类型定义**等独立单元(目录与命名仍遵循上文「React 文件组织」)。
68
+ - A single component file maintains a single responsibility, clear semantics, and is easy to maintain.
69
+ - **Line number reference**: Prioritize the single file to be controlled within about **300 lines**; more than **500 lines** should be regarded as a **strong splitting signal**.
70
+ - **Situations that should be split even if it is less than 500 lines**: There are **complex state interleaving**, **too many side effects**, **JSX too deep nesting**, **dense conditional branches**, data acquisition and UI are mixed in the same file for a long time, etc., making it difficult to grasp a single file at a glance. It should be split into independent units such as **subcomponents**, **custom Hooks**, **tool functions**, **constants** and **type definitions** (the directory and naming still follow the "React file organization" above).
71
71
 
72
- ## React 反模式
72
+ ## React anti-patterns
73
73
 
74
- 避免:
74
+ Avoid:
75
75
 
76
- - 新建**类组件**或手写类式 Error Boundary(应使用函数组件 + `react-error-boundary` 等)
77
- - 对可推导值使用多余 state
78
- - 大段 JSX 不拆成子组件
79
- - 单文件堆叠过多职责与行数,**逾 500 行或复杂度已高**仍拒不拆分(参见上文「组件文件规模」)
80
- - 使用不稳定 key
81
- - 在 props 和 hooks 中无理由使用 `any`
82
- - 没有充分理由时引入第二套样式体系
76
+ - Create a new **class component** or handwritten class Error Boundary (function component + `react-error-boundary`, etc. should be used)
77
+ - Use redundant state for derivable values
78
+ - Large sections of JSX are not broken into subcomponents
79
+ - A single file is stacked with too many responsibilities and lines. It exceeds 500 lines or has high complexity and still refuses to be split (see "Component file size" above)
80
+ - Use unstable keys
81
+ - Use `any` in props and hooks without reason
82
+ - Introduce a second style system when there is no good reason