@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
@@ -0,0 +1,99 @@
1
+ # 重构目录索引
2
+
3
+ 以下 61 个稳定 ID 对应用户资料第 6~12 章的完整重构目录。详细机制放在各 family Reference 中,按需加载。
4
+
5
+ ## Functions — 11
6
+
7
+ | ID | 中文标准名 | English | Family | Detail |
8
+ | --- | --- | --- | --- | --- |
9
+ | `RF-EXTRACT-FUNCTION` | 提炼函数 | Extract Function | `functions` | [Detail](../../fec-refactoring-functions/references/function-refactorings.md) |
10
+ | `RF-INLINE-FUNCTION` | 内联函数 | Inline Function | `functions` | [Detail](../../fec-refactoring-functions/references/function-refactorings.md) |
11
+ | `RF-EXTRACT-VARIABLE` | 提炼变量 | Extract Variable | `functions` | [Detail](../../fec-refactoring-functions/references/function-refactorings.md) |
12
+ | `RF-INLINE-VARIABLE` | 内联变量 | Inline Variable | `functions` | [Detail](../../fec-refactoring-functions/references/function-refactorings.md) |
13
+ | `RF-CHANGE-FUNCTION-DECLARATION` | 改变函数声明 | Change Function Declaration | `functions` | [Detail](../../fec-refactoring-functions/references/function-refactorings.md) |
14
+ | `RF-ENCAPSULATE-VARIABLE` | 封装变量 | Encapsulate Variable | `functions` | [Detail](../../fec-refactoring-functions/references/function-refactorings.md) |
15
+ | `RF-RENAME-VARIABLE` | 变量改名 | Rename Variable | `functions` | [Detail](../../fec-refactoring-functions/references/function-refactorings.md) |
16
+ | `RF-INTRODUCE-PARAMETER-OBJECT` | 引入参数对象 | Introduce Parameter Object | `functions` | [Detail](../../fec-refactoring-functions/references/function-refactorings.md) |
17
+ | `RF-COMBINE-FUNCTIONS-INTO-CLASS` | 函数组合成类 | Combine Functions into Class | `functions` | [Detail](../../fec-refactoring-functions/references/function-refactorings.md) |
18
+ | `RF-COMBINE-FUNCTIONS-INTO-TRANSFORM` | 函数组合成变换 | Combine Functions into Transform | `functions` | [Detail](../../fec-refactoring-functions/references/function-refactorings.md) |
19
+ | `RF-SPLIT-PHASE` | 拆分阶段 | Split Phase | `functions` | [Detail](../../fec-refactoring-functions/references/function-refactorings.md) |
20
+
21
+ ## Encapsulation — 9
22
+
23
+ | ID | 中文标准名 | English | Family | Detail |
24
+ | --- | --- | --- | --- | --- |
25
+ | `RF-ENCAPSULATE-RECORD` | 封装记录 | Encapsulate Record | `encapsulation` | [Detail](../../fec-refactoring-encapsulation/references/encapsulation-refactorings.md) |
26
+ | `RF-ENCAPSULATE-COLLECTION` | 封装集合 | Encapsulate Collection | `encapsulation` | [Detail](../../fec-refactoring-encapsulation/references/encapsulation-refactorings.md) |
27
+ | `RF-REPLACE-PRIMITIVE-WITH-OBJECT` | 以对象取代基本类型 | Replace Primitive with Object | `encapsulation` | [Detail](../../fec-refactoring-encapsulation/references/encapsulation-refactorings.md) |
28
+ | `RF-REPLACE-TEMP-WITH-QUERY` | 以查询取代临时变量 | Replace Temp with Query | `encapsulation` | [Detail](../../fec-refactoring-encapsulation/references/encapsulation-refactorings.md) |
29
+ | `RF-EXTRACT-CLASS` | 提炼类 | Extract Class | `encapsulation` | [Detail](../../fec-refactoring-encapsulation/references/encapsulation-refactorings.md) |
30
+ | `RF-INLINE-CLASS` | 内联类 | Inline Class | `encapsulation` | [Detail](../../fec-refactoring-encapsulation/references/encapsulation-refactorings.md) |
31
+ | `RF-HIDE-DELEGATE` | 隐藏委托关系 | Hide Delegate | `encapsulation` | [Detail](../../fec-refactoring-encapsulation/references/encapsulation-refactorings.md) |
32
+ | `RF-REMOVE-MIDDLE-MAN` | 移除中间人 | Remove Middle Man | `encapsulation` | [Detail](../../fec-refactoring-encapsulation/references/encapsulation-refactorings.md) |
33
+ | `RF-SUBSTITUTE-ALGORITHM` | 替换算法 | Substitute Algorithm | `encapsulation` | [Detail](../../fec-refactoring-encapsulation/references/encapsulation-refactorings.md) |
34
+
35
+ ## Moving Features — 9
36
+
37
+ | ID | 中文标准名 | English | Family | Detail |
38
+ | --- | --- | --- | --- | --- |
39
+ | `RF-MOVE-FUNCTION` | 搬移函数 | Move Function | `move-features` | [Detail](../../fec-refactoring-move-features/references/moving-refactorings.md) |
40
+ | `RF-MOVE-FIELD` | 搬移字段 | Move Field | `move-features` | [Detail](../../fec-refactoring-move-features/references/moving-refactorings.md) |
41
+ | `RF-MOVE-STATEMENTS-INTO-FUNCTION` | 搬移语句到函数 | Move Statements into Function | `move-features` | [Detail](../../fec-refactoring-move-features/references/moving-refactorings.md) |
42
+ | `RF-MOVE-STATEMENTS-TO-CALLERS` | 搬移语句到调用者 | Move Statements to Callers | `move-features` | [Detail](../../fec-refactoring-move-features/references/moving-refactorings.md) |
43
+ | `RF-REPLACE-INLINE-CODE-WITH-FUNCTION-CALL` | 以函数调用取代内联代码 | Replace Inline Code with Function Call | `move-features` | [Detail](../../fec-refactoring-move-features/references/moving-refactorings.md) |
44
+ | `RF-SLIDE-STATEMENTS` | 移动语句 | Slide Statements | `move-features` | [Detail](../../fec-refactoring-move-features/references/moving-refactorings.md) |
45
+ | `RF-SPLIT-LOOP` | 拆分循环 | Split Loop | `move-features` | [Detail](../../fec-refactoring-move-features/references/moving-refactorings.md) |
46
+ | `RF-REPLACE-LOOP-WITH-PIPELINE` | 以管道取代循环 | Replace Loop with Pipeline | `move-features` | [Detail](../../fec-refactoring-move-features/references/moving-refactorings.md) |
47
+ | `RF-REMOVE-DEAD-CODE` | 移除死代码 | Remove Dead Code | `move-features` | [Detail](../../fec-refactoring-move-features/references/moving-refactorings.md) |
48
+
49
+ ## Data — 5
50
+
51
+ | ID | 中文标准名 | English | Family | Detail |
52
+ | --- | --- | --- | --- | --- |
53
+ | `RF-SPLIT-VARIABLE` | 拆分变量 | Split Variable | `data` | [Detail](../../fec-refactoring-data/references/data-refactorings.md) |
54
+ | `RF-RENAME-FIELD` | 字段改名 | Rename Field | `data` | [Detail](../../fec-refactoring-data/references/data-refactorings.md) |
55
+ | `RF-REPLACE-DERIVED-VARIABLE-WITH-QUERY` | 以查询取代派生变量 | Replace Derived Variable with Query | `data` | [Detail](../../fec-refactoring-data/references/data-refactorings.md) |
56
+ | `RF-CHANGE-REFERENCE-TO-VALUE` | 将引用对象改为值对象 | Change Reference to Value | `data` | [Detail](../../fec-refactoring-data/references/data-refactorings.md) |
57
+ | `RF-CHANGE-VALUE-TO-REFERENCE` | 将值对象改为引用对象 | Change Value to Reference | `data` | [Detail](../../fec-refactoring-data/references/data-refactorings.md) |
58
+
59
+ ## Conditional Logic — 6
60
+
61
+ | ID | 中文标准名 | English | Family | Detail |
62
+ | --- | --- | --- | --- | --- |
63
+ | `RF-DECOMPOSE-CONDITIONAL` | 分解条件表达式 | Decompose Conditional | `control` | [Detail](../../fec-refactoring-control/references/conditional-refactorings.md) |
64
+ | `RF-CONSOLIDATE-CONDITIONAL-EXPRESSION` | 合并条件表达式 | Consolidate Conditional Expression | `control` | [Detail](../../fec-refactoring-control/references/conditional-refactorings.md) |
65
+ | `RF-REPLACE-NESTED-CONDITIONAL-WITH-GUARD-CLAUSES` | 以卫语句取代嵌套条件表达式 | Replace Nested Conditional with Guard Clauses | `control` | [Detail](../../fec-refactoring-control/references/conditional-refactorings.md) |
66
+ | `RF-REPLACE-CONDITIONAL-WITH-POLYMORPHISM` | 以多态取代条件表达式 | Replace Conditional with Polymorphism | `control` | [Detail](../../fec-refactoring-control/references/conditional-refactorings.md) |
67
+ | `RF-INTRODUCE-SPECIAL-CASE` | 引入特例 | Introduce Special Case | `control` | [Detail](../../fec-refactoring-control/references/conditional-refactorings.md) |
68
+ | `RF-INTRODUCE-ASSERTION` | 引入断言 | Introduce Assertion | `control` | [Detail](../../fec-refactoring-control/references/conditional-refactorings.md) |
69
+
70
+ ## API — 10
71
+
72
+ | ID | 中文标准名 | English | Family | Detail |
73
+ | --- | --- | --- | --- | --- |
74
+ | `RF-SEPARATE-QUERY-FROM-MODIFIER` | 将查询函数和修改函数分离 | Separate Query from Modifier | `api` | [Detail](../../fec-refactoring-api/references/api-refactorings.md) |
75
+ | `RF-PARAMETERIZE-FUNCTION` | 函数参数化 | Parameterize Function | `api` | [Detail](../../fec-refactoring-api/references/api-refactorings.md) |
76
+ | `RF-REMOVE-FLAG-ARGUMENT` | 移除标记参数 | Remove Flag Argument | `api` | [Detail](../../fec-refactoring-api/references/api-refactorings.md) |
77
+ | `RF-PRESERVE-WHOLE-OBJECT` | 保持对象完整 | Preserve Whole Object | `api` | [Detail](../../fec-refactoring-api/references/api-refactorings.md) |
78
+ | `RF-REPLACE-PARAMETER-WITH-QUERY` | 以查询取代参数 | Replace Parameter with Query | `api` | [Detail](../../fec-refactoring-api/references/api-refactorings.md) |
79
+ | `RF-REPLACE-QUERY-WITH-PARAMETER` | 以参数取代查询 | Replace Query with Parameter | `api` | [Detail](../../fec-refactoring-api/references/api-refactorings.md) |
80
+ | `RF-REMOVE-SETTING-METHOD` | 移除设值函数 | Remove Setting Method | `api` | [Detail](../../fec-refactoring-api/references/api-refactorings.md) |
81
+ | `RF-REPLACE-CONSTRUCTOR-WITH-FACTORY-FUNCTION` | 以工厂函数取代构造函数 | Replace Constructor with Factory Function | `api` | [Detail](../../fec-refactoring-api/references/api-refactorings.md) |
82
+ | `RF-REPLACE-FUNCTION-WITH-COMMAND` | 以命令取代函数 | Replace Function with Command | `api` | [Detail](../../fec-refactoring-api/references/api-refactorings.md) |
83
+ | `RF-REPLACE-COMMAND-WITH-FUNCTION` | 以函数取代命令 | Replace Command with Function | `api` | [Detail](../../fec-refactoring-api/references/api-refactorings.md) |
84
+
85
+ ## Inheritance — 11
86
+
87
+ | ID | 中文标准名 | English | Family | Detail |
88
+ | --- | --- | --- | --- | --- |
89
+ | `RF-PULL-UP-METHOD` | 函数上移 | Pull Up Method | `inheritance` | [Detail](../../fec-refactoring-inheritance/references/inheritance-refactorings.md) |
90
+ | `RF-PULL-UP-FIELD` | 字段上移 | Pull Up Field | `inheritance` | [Detail](../../fec-refactoring-inheritance/references/inheritance-refactorings.md) |
91
+ | `RF-PULL-UP-CONSTRUCTOR-BODY` | 构造函数本体上移 | Pull Up Constructor Body | `inheritance` | [Detail](../../fec-refactoring-inheritance/references/inheritance-refactorings.md) |
92
+ | `RF-PUSH-DOWN-METHOD` | 函数下移 | Push Down Method | `inheritance` | [Detail](../../fec-refactoring-inheritance/references/inheritance-refactorings.md) |
93
+ | `RF-PUSH-DOWN-FIELD` | 字段下移 | Push Down Field | `inheritance` | [Detail](../../fec-refactoring-inheritance/references/inheritance-refactorings.md) |
94
+ | `RF-REPLACE-TYPE-CODE-WITH-SUBCLASSES` | 以子类取代类型码 | Replace Type Code with Subclasses | `inheritance` | [Detail](../../fec-refactoring-inheritance/references/inheritance-refactorings.md) |
95
+ | `RF-REMOVE-SUBCLASS` | 移除子类 | Remove Subclass | `inheritance` | [Detail](../../fec-refactoring-inheritance/references/inheritance-refactorings.md) |
96
+ | `RF-EXTRACT-SUPERCLASS` | 提炼超类 | Extract Superclass | `inheritance` | [Detail](../../fec-refactoring-inheritance/references/inheritance-refactorings.md) |
97
+ | `RF-COLLAPSE-HIERARCHY` | 折叠继承体系 | Collapse Hierarchy | `inheritance` | [Detail](../../fec-refactoring-inheritance/references/inheritance-refactorings.md) |
98
+ | `RF-REPLACE-SUBCLASS-WITH-DELEGATE` | 以委托取代子类 | Replace Subclass with Delegate | `inheritance` | [Detail](../../fec-refactoring-inheritance/references/inheritance-refactorings.md) |
99
+ | `RF-REPLACE-SUPERCLASS-WITH-DELEGATE` | 以委托取代超类 | Replace Superclass with Delegate | `inheritance` | [Detail](../../fec-refactoring-inheritance/references/inheritance-refactorings.md) |
@@ -0,0 +1,49 @@
1
+ # 重构组合指南
2
+
3
+ 这里的关系都有前置条件,不是无条件 pipeline。每个中间状态都必须保持行为并立即验证。
4
+
5
+ ## 相反方向 / 权衡
6
+ - `RF-EXTRACT-FUNCTION` ↔ `RF-INLINE-FUNCTION`:建立有意义边界,或移除已经没有价值的间接层。
7
+ - `RF-EXTRACT-VARIABLE` ↔ `RF-INLINE-VARIABLE`:为重要表达式命名,或移除反而遮蔽含义的中间名。
8
+ - `RF-PULL-UP-METHOD` ↔ `RF-PUSH-DOWN-METHOD`:把行为放到真正共享或真正专有的层级。
9
+ - `RF-PULL-UP-FIELD` ↔ `RF-PUSH-DOWN-FIELD`:把数据放到准确且尽量窄的继承层级。
10
+ - `RF-HIDE-DELEGATE` ↔ `RF-REMOVE-MIDDLE-MAN`:在客户端耦合与过度转发之间取舍。
11
+
12
+ ## 常见有条件序列
13
+ ### 提炼后再搬移
14
+ `RF-EXTRACT-FUNCTION` → `RF-MOVE-FUNCTION`
15
+
16
+ 当大函数中只有一部分明显依恋另一个数据所有者时,先提炼成可独立验证的函数,再搬到更合适的位置。
17
+
18
+ ### 查询化后更容易提炼
19
+ `RF-REPLACE-TEMP-WITH-QUERY` → `RF-EXTRACT-FUNCTION`
20
+
21
+ 临时变量妨碍边界时使用;需要先确认查询可安全重复计算或有正确缓存。
22
+
23
+ ### 类型拆分后再做变体分派
24
+ `RF-REPLACE-TYPE-CODE-WITH-SUBCLASSES` → `RF-REPLACE-CONDITIONAL-WITH-POLYMORPHISM`
25
+
26
+ 适用于真实 OO/domain hierarchy;现代前端可使用 discriminated union + strategy/component map 表达同一意图。
27
+
28
+ ### 先聚拢再重新提炼
29
+ `RF-INLINE-FUNCTION` / `RF-INLINE-CLASS` → 聚拢分散逻辑 → `RF-EXTRACT-FUNCTION` / `RF-EXTRACT-CLASS`
30
+
31
+ 适合由不合理小抽象造成的霰弹式修改。暂时变大的中间单元仍必须验证。
32
+
33
+ ### 拆分流程并重新安置职责
34
+ `RF-SPLIT-PHASE` → `RF-EXTRACT-FUNCTION` → `RF-MOVE-FUNCTION`
35
+
36
+ 流程存在独立阶段,且阶段提炼后拥有更清晰数据所有者时使用。
37
+
38
+ ### 先控制共享变量再改结构
39
+ `RF-ENCAPSULATE-VARIABLE` → `RF-RENAME-VARIABLE` / `RF-MOVE-FUNCTION`
40
+
41
+ 共享变量需要先形成访问边界,再进行命名或所有权调整时使用。
42
+
43
+ ### 先封装记录再封装集合
44
+ `RF-ENCAPSULATE-RECORD` → `RF-ENCAPSULATE-COLLECTION`
45
+
46
+ 当调用者同时直接操作记录字段和集合修改时使用。
47
+
48
+ ## 停止条件
49
+ 当前步骤验证失败、超出差异预算、意外改变公共契约,或下一步前置条件已不成立时,立即停止组合序列并重新评估。
@@ -0,0 +1,41 @@
1
+ # 重构选择指南
2
+
3
+ 必须按真实成因选择,同一种坏味道可能需要不同手法。
4
+
5
+ ## 过长函数(Long Function)
6
+ - 多个可命名意图混在一起 → `RF-EXTRACT-FUNCTION`。
7
+ - 临时变量阻碍提炼 → `RF-REPLACE-TEMP-WITH-QUERY`,但需检查重复计算和副作用。
8
+ - 多个输入总是共同出现 → `RF-INTRODUCE-PARAMETER-OBJECT` 或 `RF-PRESERVE-WHOLE-OBJECT`。
9
+ - 按类型/变体存在大型条件 → 先考虑 `RF-DECOMPOSE-CONDITIONAL`;只有重复变体行为确实需要分派时再考虑 `RF-REPLACE-CONDITIONAL-WITH-POLYMORPHISM`。
10
+ - 单个循环承担多个目的 → 在顺序和性能允许时使用 `RF-SPLIT-LOOP`。
11
+
12
+ ## 过长参数列表(Long Parameter List)
13
+ - 参数可由其他稳定输入查询得到 → `RF-REPLACE-PARAMETER-WITH-QUERY`。
14
+ - 调用者从一个现有对象拆出大量字段 → `RF-PRESERVE-WHOLE-OBJECT`。
15
+ - 一组值反复共同出现 → `RF-INTRODUCE-PARAMETER-OBJECT`。
16
+ - boolean/enum 用于选择行为 → `RF-REMOVE-FLAG-ARGUMENT`;普通领域数据不属于这种情况。
17
+ - 多个函数共享同一数据上下文 → `RF-COMBINE-FUNCTIONS-INTO-CLASS`,前端可对应 module/hook/composable/service,并不强制 class。
18
+
19
+ ## 可变数据(Mutable Data)
20
+ - 共享写入无边界 → `RF-ENCAPSULATE-VARIABLE`。
21
+ - 一个变量承担多个含义 → `RF-SPLIT-VARIABLE`。
22
+ - 查询同时修改状态 → `RF-SEPARATE-QUERY-FROM-MODIFIER`。
23
+ - 派生值被存储后容易漂移 → `RF-REPLACE-DERIVED-VARIABLE-WITH-QUERY`,同时评估计算成本与 memoization。
24
+ - React/Vue 的引用身份、响应式、订阅和持久化都属于行为验证范围。
25
+
26
+ ## 发散式变化(Divergent Change)
27
+ - 一个流程包含可分阶段关注点 → `RF-SPLIT-PHASE` 或 `RF-EXTRACT-FUNCTION`。
28
+ - 行为主要依赖另一数据所有者 → `RF-MOVE-FUNCTION`。
29
+ - 一组状态和规则构成独立职责 → `RF-EXTRACT-CLASS`,在前端可落为 module/service/hook/composable。
30
+
31
+ ## 霰弹式修改(Shotgun Surgery)
32
+ - 应共同变化的行为/数据散落各处 → `RF-MOVE-FUNCTION` / `RF-MOVE-FIELD`。
33
+ - 多个函数共享同一上下文 → `RF-COMBINE-FUNCTIONS-INTO-CLASS` / `RF-COMBINE-FUNCTIONS-INTO-TRANSFORM`。
34
+ - 流程阶段可分离 → `RF-SPLIT-PHASE`。
35
+ - 过早的小抽象造成分散 → 可先 `RF-INLINE-FUNCTION` / `RF-INLINE-CLASS` 聚拢,再重新提炼;每个中间状态都必须验证。
36
+
37
+ ## 基本类型偏执(Primitive Obsession)
38
+ - 基本类型承载不变量、格式化或领域行为 → `RF-REPLACE-PRIMITIVE-WITH-OBJECT`;仅 TypeScript type alias 不等于运行时封装。
39
+ - 类型码驱动重复变体行为 → `RF-REPLACE-TYPE-CODE-WITH-SUBCLASSES` 或更适合前端的 discriminated union/strategy。
40
+ - 真正问题是重复条件分派 → `RF-REPLACE-CONDITIONAL-WITH-POLYMORPHISM`,选择最符合项目范式的分派方式。
41
+ - 多个基本值共同构成概念 → `RF-EXTRACT-CLASS` 或 `RF-INTRODUCE-PARAMETER-OBJECT`。
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: fec-refactoring-control
3
+ description: 保持行为的前端重构主要涉及条件控制类重构,已经选定或正在评估对应手法,需要查询该 family 的操作步骤、风险与 JavaScript/TypeScript/React/Vue 适配时。
4
+ ---
5
+
6
+ # 条件控制类重构
7
+
8
+ ## 概览
9
+ 只有在证据和前置条件支持时才使用对应手法。一次只执行一个主要结构变换,并在完成后立即验证。
10
+
11
+ ## 执行流程
12
+ 1. 在[条件控制类重构详细卡片](references/conditional-refactorings.md)确认手法和前置条件。
13
+ 2. 记录受影响行为与差异预算。
14
+ 3. 只执行该手法最小可行的一步。
15
+ 4. 在组合下一手法之前验证当前步骤。
16
+ 5. 公共契约、生命周期、状态身份或实际范围超出预期时停止并重新评估。
17
+
18
+ ## 快速索引
19
+ 详细 Reference 包含本 family 的 6 个标准手法,每项均包括意图、信号、不适用条件、操作步骤、行为保持检查、相关坏味道、组合关系、JS/TS/React/Vue 注意事项、前端适配和原创示例。
20
+
21
+ ## 常见错误
22
+ - 只根据手法名称套用,不核对前置条件。
23
+ - 一个 diff 同时混入多个结构目标。
24
+ - 把经典 class 形式机械套进现代 React/Vue。
25
+ - 相关行为没有覆盖时,仅凭“测试通过”就声称行为已得到证明。
@@ -0,0 +1,299 @@
1
+ # 条件控制类重构
2
+
3
+ 这些卡片以用户提供的标准重构目录为知识基线,转换为面向前端 Agent 的操作指南。保留标准 ID/中英文名称,框架适配和示例为项目原创内容。
4
+
5
+ ## RF-DECOMPOSE-CONDITIONAL — 分解条件表达式(Decompose Conditional)
6
+
7
+ ### 意图
8
+ 把复杂条件、then/else 分支提炼为命名明确的判断和操作。
9
+
10
+ ### 典型信号
11
+ - 当前结构出现与本手法目标一致的重复、耦合、命名、职责、数据所有权或控制流问题,并有具体代码证据。
12
+
13
+ ### 不适用条件
14
+ - 当前结构已经清晰,或该变换会制造更强耦合、隐藏依赖、破坏公共契约且没有兼容方案时,不使用。
15
+
16
+ ### 前置条件
17
+ - 已明确当前可观察行为、受影响调用者和公共契约。
18
+ - 目标位于声明的差异预算内,并且这个单一主要变换完成后能够立即验证。
19
+
20
+ ### 操作步骤
21
+ 1. 确认当前行为、调用者和边界,并锁定本步骤只处理这一项主要结构意图。
22
+ 2. 创建最小的新结构/位置/接口,让旧行为可以逐步迁移而不是一次性大改。
23
+ 3. 一次迁移一个调用点或职责片段,并保持兼容边界。
24
+ 4. 运行窄范围验证;若变红,先回滚本步骤,再缩小变换。
25
+
26
+ ### 行为保持检查点
27
+ - 对比输入、输出、异常、副作用、执行顺序和公共契约。
28
+ - 前端还要核对 UI 状态、事件、焦点、网络请求、生命周期/状态迁移,以及相关对象身份语义。
29
+
30
+ ### 相关坏味道
31
+ - `SMELL-LONG-FUNCTION`
32
+
33
+ ### 常见组合
34
+ - 不建立固定流水线;下一步必须重新依据证据选择。
35
+
36
+ ### JavaScript 注意事项
37
+ - 保持短路求值、异常时机、副作用顺序和 default/fallthrough 行为。
38
+
39
+ ### TypeScript 注意事项
40
+ - discriminated union 与 `never` 可用于清晰表达穷尽性;assertion 不替代运行时校验。
41
+
42
+ ### React 注意事项
43
+ - 卫语句不能跳过 loading 清理/effect teardown;变体渲染通常更适合 strategy/component registry。
44
+
45
+ ### Vue 注意事项
46
+ - 保持 `finally`、pending/error 状态、watch/effect 行为和组件分支生命周期。
47
+
48
+ ### Frontend-Craft 前端适配
49
+ - “多态”包含 strategy、discriminated-union dispatch、handler/component registry 和 delegation;class hierarchy 只是可选形式。
50
+
51
+ ### 原创前端变换示例
52
+ - 把“Decompose Conditional”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
53
+
54
+ ## RF-CONSOLIDATE-CONDITIONAL-EXPRESSION — 合并条件表达式(Consolidate Conditional Expression)
55
+
56
+ ### 意图
57
+ 把产生相同结果的一组条件合并成一个概念清晰的判断。
58
+
59
+ ### 典型信号
60
+ - 当前结构出现与本手法目标一致的重复、耦合、命名、职责、数据所有权或控制流问题,并有具体代码证据。
61
+
62
+ ### 不适用条件
63
+ - 当前结构已经清晰,或该变换会制造更强耦合、隐藏依赖、破坏公共契约且没有兼容方案时,不使用。
64
+
65
+ ### 前置条件
66
+ - 已明确当前可观察行为、受影响调用者和公共契约。
67
+ - 目标位于声明的差异预算内,并且这个单一主要变换完成后能够立即验证。
68
+
69
+ ### 操作步骤
70
+ 1. 确认当前行为、调用者和边界,并锁定本步骤只处理这一项主要结构意图。
71
+ 2. 创建最小的新结构/位置/接口,让旧行为可以逐步迁移而不是一次性大改。
72
+ 3. 一次迁移一个调用点或职责片段,并保持兼容边界。
73
+ 4. 运行窄范围验证;若变红,先回滚本步骤,再缩小变换。
74
+
75
+ ### 行为保持检查点
76
+ - 对比输入、输出、异常、副作用、执行顺序和公共契约。
77
+ - 前端还要核对 UI 状态、事件、焦点、网络请求、生命周期/状态迁移,以及相关对象身份语义。
78
+
79
+ ### 相关坏味道
80
+ - 不要求先存在某一种固定坏味道;以具体结构证据为准。
81
+
82
+ ### 常见组合
83
+ - 不建立固定流水线;下一步必须重新依据证据选择。
84
+
85
+ ### JavaScript 注意事项
86
+ - 保持短路求值、异常时机、副作用顺序和 default/fallthrough 行为。
87
+
88
+ ### TypeScript 注意事项
89
+ - discriminated union 与 `never` 可用于清晰表达穷尽性;assertion 不替代运行时校验。
90
+
91
+ ### React 注意事项
92
+ - 卫语句不能跳过 loading 清理/effect teardown;变体渲染通常更适合 strategy/component registry。
93
+
94
+ ### Vue 注意事项
95
+ - 保持 `finally`、pending/error 状态、watch/effect 行为和组件分支生命周期。
96
+
97
+ ### Frontend-Craft 前端适配
98
+ - “多态”包含 strategy、discriminated-union dispatch、handler/component registry 和 delegation;class hierarchy 只是可选形式。
99
+
100
+ ### 原创前端变换示例
101
+ - 把“Consolidate Conditional Expression”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
102
+
103
+ ## RF-REPLACE-NESTED-CONDITIONAL-WITH-GUARD-CLAUSES — 以卫语句取代嵌套条件表达式(Replace Nested Conditional with Guard Clauses)
104
+
105
+ ### 意图
106
+ 用卫语句处理特殊/异常路径,突出正常主流程,同时保证 cleanup/finally/loading 不被跳过。
107
+
108
+ ### 典型信号
109
+ - 当前结构出现与本手法目标一致的重复、耦合、命名、职责、数据所有权或控制流问题,并有具体代码证据。
110
+
111
+ ### 不适用条件
112
+ - 当前结构已经清晰,或该变换会制造更强耦合、隐藏依赖、破坏公共契约且没有兼容方案时,不使用。
113
+
114
+ ### 前置条件
115
+ - 已明确当前可观察行为、受影响调用者和公共契约。
116
+ - 目标位于声明的差异预算内,并且这个单一主要变换完成后能够立即验证。
117
+
118
+ ### 操作步骤
119
+ 1. 确认当前行为、调用者和边界,并锁定本步骤只处理这一项主要结构意图。
120
+ 2. 创建最小的新结构/位置/接口,让旧行为可以逐步迁移而不是一次性大改。
121
+ 3. 一次迁移一个调用点或职责片段,并保持兼容边界。
122
+ 4. 运行窄范围验证;若变红,先回滚本步骤,再缩小变换。
123
+
124
+ ### 行为保持检查点
125
+ - 对比输入、输出、异常、副作用、执行顺序和公共契约。
126
+ - 前端还要核对 UI 状态、事件、焦点、网络请求、生命周期/状态迁移,以及相关对象身份语义。
127
+
128
+ ### 相关坏味道
129
+ - 不要求先存在某一种固定坏味道;以具体结构证据为准。
130
+
131
+ ### 常见组合
132
+ - 不建立固定流水线;下一步必须重新依据证据选择。
133
+
134
+ ### JavaScript 注意事项
135
+ - 保持短路求值、异常时机、副作用顺序和 default/fallthrough 行为。
136
+
137
+ ### TypeScript 注意事项
138
+ - discriminated union 与 `never` 可用于清晰表达穷尽性;assertion 不替代运行时校验。
139
+
140
+ ### React 注意事项
141
+ - 卫语句不能跳过 loading 清理/effect teardown;变体渲染通常更适合 strategy/component registry。
142
+
143
+ ### Vue 注意事项
144
+ - 保持 `finally`、pending/error 状态、watch/effect 行为和组件分支生命周期。
145
+
146
+ ### Frontend-Craft 前端适配
147
+ - “多态”包含 strategy、discriminated-union dispatch、handler/component registry 和 delegation;class hierarchy 只是可选形式。
148
+
149
+ ### 原创前端变换示例
150
+ - 提交逻辑从多层 auth/draft/recipient 嵌套改为卫语句,但必须保留 `finally` 中 loading 复位。
151
+
152
+ ## RF-REPLACE-CONDITIONAL-WITH-POLYMORPHISM — 以多态取代条件表达式(Replace Conditional with Polymorphism)
153
+
154
+ ### 意图
155
+ 把重复的变体行为放入分派边界;前端可用 discriminated union、strategy map、handler/component registry、delegation,而非强制类继承。
156
+
157
+ ### 典型信号
158
+ - 同一 type/status/variant 在多个位置重复驱动不同处理方式。
159
+
160
+ ### 不适用条件
161
+ - 只有一个清晰条件分支时,不为了“多态”强行引入 class hierarchy。
162
+
163
+ ### 前置条件
164
+ - 已明确当前可观察行为、受影响调用者和公共契约。
165
+ - 目标位于声明的差异预算内,并且这个单一主要变换完成后能够立即验证。
166
+
167
+ ### 操作步骤
168
+ 1. 确认当前行为、调用者和边界,并锁定本步骤只处理这一项主要结构意图。
169
+ 2. 创建最小的新结构/位置/接口,让旧行为可以逐步迁移而不是一次性大改。
170
+ 3. 一次迁移一个调用点或职责片段,并保持兼容边界。
171
+ 4. 运行窄范围验证;若变红,先回滚本步骤,再缩小变换。
172
+
173
+ ### 行为保持检查点
174
+ - 对比输入、输出、异常、副作用、执行顺序和公共契约。
175
+ - 前端还要核对 UI 状态、事件、焦点、网络请求、生命周期/状态迁移,以及相关对象身份语义。
176
+
177
+ ### 相关坏味道
178
+ - `SMELL-LONG-FUNCTION`
179
+ - `SMELL-PRIMITIVE-OBSESSION`
180
+ - `SMELL-REPEATED-SWITCHES`
181
+
182
+ ### 常见组合
183
+ - 不建立固定流水线;下一步必须重新依据证据选择。
184
+
185
+ ### JavaScript 注意事项
186
+ - 保持短路求值、异常时机、副作用顺序和 default/fallthrough 行为。
187
+
188
+ ### TypeScript 注意事项
189
+ - discriminated union 与 `never` 可用于清晰表达穷尽性;assertion 不替代运行时校验。
190
+
191
+ ### React 注意事项
192
+ - 卫语句不能跳过 loading 清理/effect teardown;变体渲染通常更适合 strategy/component registry。
193
+
194
+ ### Vue 注意事项
195
+ - 保持 `finally`、pending/error 状态、watch/effect 行为和组件分支生命周期。
196
+
197
+ ### Frontend-Craft 前端适配
198
+ - “多态”包含 strategy、discriminated-union dispatch、handler/component registry 和 delegation;class hierarchy 只是可选形式。
199
+
200
+ ### 原创前端变换示例
201
+ - 邮件类型在渲染和操作中反复 switch,可改为类型安全的 handler/component registry 或 discriminated union 分派。
202
+
203
+ ## RF-INTRODUCE-SPECIAL-CASE — 引入特例(Introduce Special Case)
204
+
205
+ ### 意图
206
+ 为反复出现的 null/unknown/sentinel 情况建立统一特例表示,减少散落检查。
207
+
208
+ ### 典型信号
209
+ - 当前结构出现与本手法目标一致的重复、耦合、命名、职责、数据所有权或控制流问题,并有具体代码证据。
210
+
211
+ ### 不适用条件
212
+ - 当前结构已经清晰,或该变换会制造更强耦合、隐藏依赖、破坏公共契约且没有兼容方案时,不使用。
213
+
214
+ ### 前置条件
215
+ - 已明确当前可观察行为、受影响调用者和公共契约。
216
+ - 目标位于声明的差异预算内,并且这个单一主要变换完成后能够立即验证。
217
+
218
+ ### 操作步骤
219
+ 1. 确认当前行为、调用者和边界,并锁定本步骤只处理这一项主要结构意图。
220
+ 2. 创建最小的新结构/位置/接口,让旧行为可以逐步迁移而不是一次性大改。
221
+ 3. 一次迁移一个调用点或职责片段,并保持兼容边界。
222
+ 4. 运行窄范围验证;若变红,先回滚本步骤,再缩小变换。
223
+
224
+ ### 行为保持检查点
225
+ - 对比输入、输出、异常、副作用、执行顺序和公共契约。
226
+ - 前端还要核对 UI 状态、事件、焦点、网络请求、生命周期/状态迁移,以及相关对象身份语义。
227
+
228
+ ### 相关坏味道
229
+ - `SMELL-TEMPORARY-FIELD`
230
+
231
+ ### 常见组合
232
+ - 不建立固定流水线;下一步必须重新依据证据选择。
233
+
234
+ ### JavaScript 注意事项
235
+ - 保持短路求值、异常时机、副作用顺序和 default/fallthrough 行为。
236
+
237
+ ### TypeScript 注意事项
238
+ - discriminated union 与 `never` 可用于清晰表达穷尽性;assertion 不替代运行时校验。
239
+
240
+ ### React 注意事项
241
+ - 卫语句不能跳过 loading 清理/effect teardown;变体渲染通常更适合 strategy/component registry。
242
+
243
+ ### Vue 注意事项
244
+ - 保持 `finally`、pending/error 状态、watch/effect 行为和组件分支生命周期。
245
+
246
+ ### Frontend-Craft 前端适配
247
+ - “多态”包含 strategy、discriminated-union dispatch、handler/component registry 和 delegation;class hierarchy 只是可选形式。
248
+
249
+ ### 原创前端变换示例
250
+ - 把“Introduce Special Case”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
251
+
252
+ ## RF-INTRODUCE-ASSERTION — 引入断言(Introduce Assertion)
253
+
254
+ ### 意图
255
+ 把只应在程序错误时被违反的内部不变量显式化;不能替代用户输入校验和正常错误处理。
256
+
257
+ ### 典型信号
258
+ - 内部流程依赖一个“若违反即代表程序错误”的不变量,但代码未显式表达。
259
+
260
+ ### 不适用条件
261
+ - 输入无效、网络失败、权限不足等预期错误不能用 assertion 代替正常校验和错误处理。
262
+
263
+ ### 前置条件
264
+ - 已明确当前可观察行为、受影响调用者和公共契约。
265
+ - 目标位于声明的差异预算内,并且这个单一主要变换完成后能够立即验证。
266
+
267
+ ### 操作步骤
268
+ 1. 确认当前行为、调用者和边界,并锁定本步骤只处理这一项主要结构意图。
269
+ 2. 创建最小的新结构/位置/接口,让旧行为可以逐步迁移而不是一次性大改。
270
+ 3. 一次迁移一个调用点或职责片段,并保持兼容边界。
271
+ 4. 运行窄范围验证;若变红,先回滚本步骤,再缩小变换。
272
+
273
+ ### 行为保持检查点
274
+ - 对比输入、输出、异常、副作用、执行顺序和公共契约。
275
+ - 前端还要核对 UI 状态、事件、焦点、网络请求、生命周期/状态迁移,以及相关对象身份语义。
276
+
277
+ ### 相关坏味道
278
+ - `SMELL-COMMENTS`
279
+
280
+ ### 常见组合
281
+ - 不建立固定流水线;下一步必须重新依据证据选择。
282
+
283
+ ### JavaScript 注意事项
284
+ - 保持短路求值、异常时机、副作用顺序和 default/fallthrough 行为。
285
+
286
+ ### TypeScript 注意事项
287
+ - discriminated union 与 `never` 可用于清晰表达穷尽性;assertion 不替代运行时校验。
288
+
289
+ ### React 注意事项
290
+ - 卫语句不能跳过 loading 清理/effect teardown;变体渲染通常更适合 strategy/component registry。
291
+
292
+ ### Vue 注意事项
293
+ - 保持 `finally`、pending/error 状态、watch/effect 行为和组件分支生命周期。
294
+
295
+ ### Frontend-Craft 前端适配
296
+ - “多态”包含 strategy、discriminated-union dispatch、handler/component registry 和 delegation;class hierarchy 只是可选形式。
297
+
298
+ ### 原创前端变换示例
299
+ - 把“Introduce Assertion”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: fec-refactoring-data
3
+ description: 保持行为的前端重构主要涉及数据重组类重构,已经选定或正在评估对应手法,需要查询该 family 的操作步骤、风险与 JavaScript/TypeScript/React/Vue 适配时。
4
+ ---
5
+
6
+ # 数据重组类重构
7
+
8
+ ## 概览
9
+ 只有在证据和前置条件支持时才使用对应手法。一次只执行一个主要结构变换,并在完成后立即验证。
10
+
11
+ ## 执行流程
12
+ 1. 在[数据重组类重构详细卡片](references/data-refactorings.md)确认手法和前置条件。
13
+ 2. 记录受影响行为与差异预算。
14
+ 3. 只执行该手法最小可行的一步。
15
+ 4. 在组合下一手法之前验证当前步骤。
16
+ 5. 公共契约、生命周期、状态身份或实际范围超出预期时停止并重新评估。
17
+
18
+ ## 快速索引
19
+ 详细 Reference 包含本 family 的 5 个标准手法,每项均包括意图、信号、不适用条件、操作步骤、行为保持检查、相关坏味道、组合关系、JS/TS/React/Vue 注意事项、前端适配和原创示例。
20
+
21
+ ## 常见错误
22
+ - 只根据手法名称套用,不核对前置条件。
23
+ - 一个 diff 同时混入多个结构目标。
24
+ - 把经典 class 形式机械套进现代 React/Vue。
25
+ - 相关行为没有覆盖时,仅凭“测试通过”就声称行为已得到证明。