@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.
- package/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +378 -305
- package/CHANGELOG.zh-CN.md +377 -304
- package/CONTRIBUTING.md +371 -361
- package/CONTRIBUTING.zh-CN.md +371 -361
- package/README.md +545 -493
- package/README.openclaw.md +359 -264
- package/README.openclaw.zh-CN.md +359 -264
- package/README.zh-CN.md +545 -493
- package/agents/fec-architect.md +70 -70
- package/agents/fec-code-reviewer.md +103 -82
- package/agents/fec-debugger.md +20 -20
- package/agents/fec-design-token-mapper.md +36 -36
- package/agents/fec-doc-updater.md +13 -13
- package/agents/fec-e2e-runner.md +45 -45
- package/agents/fec-figma-implementer.md +59 -59
- package/agents/fec-performance-optimizer.md +128 -128
- package/agents/fec-refactor-cleaner.md +17 -14
- package/agents/fec-refactoring-expert.md +81 -0
- package/agents/fec-security-reviewer.md +82 -67
- package/agents/fec-test-planner.md +27 -27
- package/agents/fec-typescript-reviewer.md +103 -87
- package/agents/fec-ui-checker.md +64 -64
- package/commands/fec-debug.md +19 -19
- package/commands/fec-doc-sync.md +11 -11
- package/commands/fec-init.md +37 -38
- package/commands/fec-plan.md +58 -58
- package/commands/fec-refactor-clean.md +11 -11
- package/commands/fec-refactor-plan.md +17 -0
- package/commands/fec-refactor.md +18 -0
- package/commands/fec-review.md +71 -41
- package/commands/fec-scaffold.md +41 -41
- package/commands/fec-smell.md +17 -0
- package/commands/fec-tdd.md +17 -13
- package/dist/bin/frontend-craft.js +190 -36
- package/dist/hooks/fec-run-tests.js +5 -1
- package/dist/hooks/fec-session-start.js +1 -1
- package/docs/example-prompts.md +157 -137
- package/docs/ja-JP/README.md +534 -493
- package/docs/ko-KR/README.md +534 -493
- package/docs/project-structure.md +151 -123
- package/docs/refactoring/README.md +50 -0
- package/docs/refactoring/catalog.md +105 -0
- package/docs/refactoring/smell-refactoring-matrix.md +41 -0
- package/docs/review-and-diagram-workflows.md +39 -0
- package/docs/runtimes/antigravity.md +18 -10
- package/docs/runtimes/augment.md +18 -10
- package/docs/runtimes/claude.md +191 -177
- package/docs/runtimes/claude.zh-CN.md +189 -175
- package/docs/runtimes/cline.md +18 -10
- package/docs/runtimes/codebuddy.md +18 -10
- package/docs/runtimes/codex.md +18 -10
- package/docs/runtimes/compatibility.md +27 -0
- package/docs/runtimes/copilot.md +18 -10
- package/docs/runtimes/cursor.md +18 -10
- package/docs/runtimes/gemini.md +18 -10
- package/docs/runtimes/kilo.md +18 -10
- package/docs/runtimes/openclaw.md +18 -10
- package/docs/runtimes/opencode.md +18 -10
- package/docs/runtimes/qoder.md +18 -19
- package/docs/runtimes/trae.md +18 -10
- package/docs/runtimes/windsurf.md +18 -10
- package/docs/superpowers/plans/2026-09-26-content-integrity.md +145 -0
- package/docs/superpowers/plans/2026-09-26-diagram-quality.md +170 -0
- package/docs/superpowers/specs/2026-09-26-diagram-quality-design.md +77 -0
- package/docs/superpowers/specs/2026-09-26-project-optimization-design.md +95 -0
- package/docs/zh-CN/example-prompts.md +157 -137
- package/docs/zh-CN/project-structure.md +148 -123
- package/docs/zh-CN/review-and-diagram-workflows.md +39 -0
- package/docs/zh-TW/README.md +534 -493
- package/localized/zh-CN/agents/fec-architect.md +125 -0
- package/localized/zh-CN/agents/fec-code-reviewer.md +171 -0
- package/localized/zh-CN/agents/fec-debugger.md +44 -0
- package/localized/zh-CN/agents/fec-design-token-mapper.md +75 -0
- package/localized/zh-CN/agents/fec-doc-updater.md +30 -0
- package/localized/zh-CN/agents/fec-e2e-runner.md +107 -0
- package/localized/zh-CN/agents/fec-figma-implementer.md +104 -0
- package/localized/zh-CN/agents/fec-performance-optimizer.md +293 -0
- package/localized/zh-CN/agents/fec-refactor-cleaner.md +35 -0
- package/localized/zh-CN/agents/fec-refactoring-expert.md +53 -0
- package/localized/zh-CN/agents/fec-security-reviewer.md +132 -0
- package/localized/zh-CN/agents/fec-test-planner.md +50 -0
- package/localized/zh-CN/agents/fec-typescript-reviewer.md +158 -0
- package/localized/zh-CN/agents/fec-ui-checker.md +120 -0
- package/localized/zh-CN/commands/fec-debug.md +30 -0
- package/localized/zh-CN/commands/fec-doc-sync.md +19 -0
- package/localized/zh-CN/commands/fec-init.md +70 -0
- package/localized/zh-CN/commands/fec-plan.md +94 -0
- package/localized/zh-CN/commands/fec-refactor-clean.md +19 -0
- package/localized/zh-CN/commands/fec-refactor-plan.md +15 -0
- package/localized/zh-CN/commands/fec-refactor.md +14 -0
- package/localized/zh-CN/commands/fec-review.md +97 -0
- package/localized/zh-CN/commands/fec-scaffold.md +205 -0
- package/localized/zh-CN/commands/fec-smell.md +13 -0
- package/localized/zh-CN/commands/fec-tdd.md +25 -0
- package/localized/zh-CN/skills/TEMPLATE.md +155 -0
- package/localized/zh-CN/skills/eval_queries.json +1257 -0
- package/localized/zh-CN/skills/fec-accessibility-check/SKILL.md +39 -0
- package/localized/zh-CN/skills/fec-accessibility-check/references/report-template.md +23 -0
- package/localized/zh-CN/skills/fec-accessibility-check/references/screen-reader-testing.md +33 -0
- package/localized/zh-CN/skills/fec-alchemy/SKILL.md +74 -0
- package/localized/zh-CN/skills/fec-alchemy/assets/absorption-plan-template.md +47 -0
- package/localized/zh-CN/skills/fec-alchemy/assets/intake-template.md +55 -0
- package/localized/zh-CN/skills/fec-alchemy/assets/review-checklist.md +31 -0
- package/localized/zh-CN/skills/fec-alchemy/references/methodology.md +94 -0
- package/localized/zh-CN/skills/fec-alchemy/references/originality-and-licensing.md +57 -0
- package/localized/zh-CN/skills/fec-api-integration/SKILL.md +78 -0
- package/localized/zh-CN/skills/fec-api-integration/references/integration-patterns.md +80 -0
- package/localized/zh-CN/skills/fec-backend-requirements-handoff/SKILL.md +45 -0
- package/localized/zh-CN/skills/fec-browser-storage/SKILL.md +34 -0
- package/localized/zh-CN/skills/fec-browser-storage/references/storage-patterns.md +65 -0
- package/localized/zh-CN/skills/fec-canvas-threejs/SKILL.md +66 -0
- package/localized/zh-CN/skills/fec-canvas-threejs/references/rendering-patterns.md +67 -0
- package/localized/zh-CN/skills/fec-canvas-threejs/references/shader-webgl-patterns.md +67 -0
- package/localized/zh-CN/skills/fec-code-review/SKILL.md +162 -0
- package/localized/zh-CN/skills/fec-code-review/references/report-template.md +39 -0
- package/localized/zh-CN/skills/fec-code-smells/SKILL.md +33 -0
- package/localized/zh-CN/skills/fec-code-smells/references/detection-guide.md +25 -0
- package/localized/zh-CN/skills/fec-code-smells/references/smell-catalog.md +817 -0
- package/localized/zh-CN/skills/fec-code-smells/references/smell-to-refactoring-map.md +265 -0
- package/localized/zh-CN/skills/fec-component-testing/SKILL.md +119 -0
- package/localized/zh-CN/skills/fec-data-fetching/SKILL.md +62 -0
- package/localized/zh-CN/skills/fec-data-fetching/references/query-patterns.md +103 -0
- package/localized/zh-CN/skills/fec-debug-framework/SKILL.md +157 -0
- package/localized/zh-CN/skills/fec-debug-framework/references/report-template.md +58 -0
- package/localized/zh-CN/skills/fec-dependency-upgrade/SKILL.md +34 -0
- package/localized/zh-CN/skills/fec-dependency-upgrade/references/dependency-upgrade-workflow.md +56 -0
- package/localized/zh-CN/skills/fec-doc-sync/SKILL.md +39 -0
- package/localized/zh-CN/skills/fec-drawio-studio/SKILL.md +73 -0
- package/localized/zh-CN/skills/fec-drawio-studio/data/THIRD_PARTY_NOTICES.md +10 -0
- package/localized/zh-CN/skills/fec-drawio-studio/data/brand-icons.json +878 -0
- package/localized/zh-CN/skills/fec-drawio-studio/data/shape-index.json +83570 -0
- package/localized/zh-CN/skills/fec-drawio-studio/references/data-residency.md +27 -0
- package/localized/zh-CN/skills/fec-drawio-studio/references/diagram-patterns.md +60 -0
- package/localized/zh-CN/skills/fec-drawio-studio/references/flowchart-quality.md +49 -0
- package/localized/zh-CN/skills/fec-drawio-studio/references/layout-and-export.md +72 -0
- package/localized/zh-CN/skills/fec-drawio-studio/references/troubleshooting.md +29 -0
- package/localized/zh-CN/skills/fec-drawio-studio/references/xml-and-mermaid.md +58 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/brand-symbols.mjs +99 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/diagram-lint.mjs +205 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/diagram-url.mjs +102 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/drawio-export.mjs +134 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/layout-graph.mjs +107 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/png-embed-fix.mjs +26 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-go-packages.mjs +36 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-js-modules.mjs +52 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-python-classes.mjs +30 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-python-modules.mjs +55 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-rust-modules.mjs +35 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-ts-modules.mjs +7 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/shape-query.mjs +121 -0
- package/localized/zh-CN/skills/fec-drawio-studio/scripts/studio-core.mjs +139 -0
- package/localized/zh-CN/skills/fec-drawio-studio/styles/built-in/corporate.json +49 -0
- package/localized/zh-CN/skills/fec-drawio-studio/styles/built-in/default.json +49 -0
- package/localized/zh-CN/skills/fec-drawio-studio/styles/built-in/handdrawn.json +49 -0
- package/localized/zh-CN/skills/fec-drawio-studio/styles/schema.json +112 -0
- package/localized/zh-CN/skills/fec-e2e-testing/SKILL.md +42 -0
- package/localized/zh-CN/skills/fec-e2e-testing/references/e2e-ci-reporting.md +62 -0
- package/localized/zh-CN/skills/fec-e2e-testing/references/e2e-special-scenarios.md +52 -0
- package/localized/zh-CN/skills/fec-e2e-testing/references/e2e-visual-regression.md +60 -0
- package/localized/zh-CN/skills/fec-e2e-testing/references/playwright-patterns.md +95 -0
- package/localized/zh-CN/skills/fec-form-handling/SKILL.md +76 -0
- package/localized/zh-CN/skills/fec-form-handling/references/advanced-form-patterns.md +101 -0
- package/localized/zh-CN/skills/fec-image-generation/SKILL.md +110 -0
- package/localized/zh-CN/skills/fec-image-generation/assets/interactive-diagram.html +371 -0
- package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/README.md +14 -0
- package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/architecture.json +121 -0
- package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/invalid-explicit.json +41 -0
- package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/sequence.json +53 -0
- package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/sequence.mmd +21 -0
- package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/workflow.json +98 -0
- package/localized/zh-CN/skills/fec-image-generation/assets/quality-examples/workflow.mmd +7 -0
- package/localized/zh-CN/skills/fec-image-generation/references/artifact-routing.md +80 -0
- package/localized/zh-CN/skills/fec-image-generation/references/diagram-workflows.md +81 -0
- package/localized/zh-CN/skills/fec-image-generation/references/html-technical-diagrams.md +243 -0
- package/localized/zh-CN/skills/fec-image-generation/references/png-qa-autofix.md +37 -0
- package/localized/zh-CN/skills/fec-image-generation/scripts/diagram-browser.mjs +90 -0
- package/localized/zh-CN/skills/fec-image-generation/scripts/diagram-layout.mjs +176 -0
- package/localized/zh-CN/skills/fec-image-generation/scripts/export-diagram.mjs +332 -0
- package/localized/zh-CN/skills/fec-image-generation/scripts/interactive-diagram-server.mjs +654 -0
- package/localized/zh-CN/skills/fec-image-generation/scripts/mermaid-render.mjs +64 -0
- package/localized/zh-CN/skills/fec-image-generation/scripts/png-qa.mjs +462 -0
- package/localized/zh-CN/skills/fec-image-generation/scripts/tech-diagram-render.mjs +1537 -0
- package/localized/zh-CN/skills/fec-implement-from-design/SKILL.md +129 -0
- package/localized/zh-CN/skills/fec-implement-from-design/references/design-plan-template.md +36 -0
- package/localized/zh-CN/skills/fec-legacy-to-modern-migration/SKILL.md +46 -0
- package/localized/zh-CN/skills/fec-legacy-to-modern-migration/references/migration-execution-checklist.md +110 -0
- package/localized/zh-CN/skills/fec-legacy-to-modern-migration/references/migration-report-template.md +41 -0
- package/localized/zh-CN/skills/fec-legacy-to-modern-migration/references/migration-strategy-and-mapping.md +48 -0
- package/localized/zh-CN/skills/fec-legacy-web-standard/SKILL.md +35 -0
- package/localized/zh-CN/skills/fec-legacy-web-standard/references/legacy-patterns.md +85 -0
- package/localized/zh-CN/skills/fec-list-virtualization/SKILL.md +34 -0
- package/localized/zh-CN/skills/fec-list-virtualization/references/virtualization-patterns.md +80 -0
- package/localized/zh-CN/skills/fec-monorepo-project-standard/SKILL.md +142 -0
- package/localized/zh-CN/skills/fec-motion-interaction/SKILL.md +73 -0
- package/localized/zh-CN/skills/fec-motion-interaction/references/motion-patterns.md +112 -0
- package/localized/zh-CN/skills/fec-nextjs-project-standard/SKILL.md +123 -0
- package/localized/zh-CN/skills/fec-nuxt-project-standard/SKILL.md +122 -0
- package/localized/zh-CN/skills/fec-performance-optimization/SKILL.md +80 -0
- package/localized/zh-CN/skills/fec-performance-optimization/references/framework-performance-patterns.md +38 -0
- package/localized/zh-CN/skills/fec-performance-optimization/references/report-template.md +59 -0
- package/localized/zh-CN/skills/fec-pwa-implementation/SKILL.md +35 -0
- package/localized/zh-CN/skills/fec-pwa-implementation/references/manifest-and-icons.md +53 -0
- package/localized/zh-CN/skills/fec-pwa-implementation/references/service-worker-workbox.md +68 -0
- package/localized/zh-CN/skills/fec-react-project-standard/SKILL.md +91 -0
- package/localized/zh-CN/skills/fec-react-project-standard/references/react-performance-patterns.md +35 -0
- package/localized/zh-CN/skills/fec-react-project-standard/references/react-project-structure.md +197 -0
- package/localized/zh-CN/skills/fec-react-project-standard/references/react-quality-patterns.md +131 -0
- package/localized/zh-CN/skills/fec-react-project-standard/references/react-runtime-patterns.md +293 -0
- package/localized/zh-CN/skills/fec-refactor-clean/SKILL.md +54 -0
- package/localized/zh-CN/skills/fec-refactor-clean/references/report-template.md +42 -0
- package/localized/zh-CN/skills/fec-refactoring/SKILL.md +83 -0
- package/localized/zh-CN/skills/fec-refactoring/references/principles.md +43 -0
- package/localized/zh-CN/skills/fec-refactoring/references/refactoring-vs-feature-change.md +25 -0
- package/localized/zh-CN/skills/fec-refactoring/references/when-to-refactor.md +17 -0
- package/localized/zh-CN/skills/fec-refactoring/references/workflow.md +59 -0
- package/localized/zh-CN/skills/fec-refactoring-api/SKILL.md +25 -0
- package/localized/zh-CN/skills/fec-refactoring-api/references/api-refactorings.md +496 -0
- package/localized/zh-CN/skills/fec-refactoring-catalog/SKILL.md +21 -0
- package/localized/zh-CN/skills/fec-refactoring-catalog/references/catalog-index.md +99 -0
- package/localized/zh-CN/skills/fec-refactoring-catalog/references/composition-guide.md +49 -0
- package/localized/zh-CN/skills/fec-refactoring-catalog/references/selection-guide.md +41 -0
- package/localized/zh-CN/skills/fec-refactoring-control/SKILL.md +25 -0
- package/localized/zh-CN/skills/fec-refactoring-control/references/conditional-refactorings.md +299 -0
- package/localized/zh-CN/skills/fec-refactoring-data/SKILL.md +25 -0
- package/localized/zh-CN/skills/fec-refactoring-data/references/data-refactorings.md +248 -0
- package/localized/zh-CN/skills/fec-refactoring-encapsulation/SKILL.md +25 -0
- package/localized/zh-CN/skills/fec-refactoring-encapsulation/references/encapsulation-refactorings.md +452 -0
- package/localized/zh-CN/skills/fec-refactoring-functions/SKILL.md +25 -0
- package/localized/zh-CN/skills/fec-refactoring-functions/references/function-refactorings.md +567 -0
- package/localized/zh-CN/skills/fec-refactoring-inheritance/SKILL.md +25 -0
- package/localized/zh-CN/skills/fec-refactoring-inheritance/references/inheritance-refactorings.md +550 -0
- package/localized/zh-CN/skills/fec-refactoring-move-features/SKILL.md +25 -0
- package/localized/zh-CN/skills/fec-refactoring-move-features/references/moving-refactorings.md +453 -0
- package/localized/zh-CN/skills/fec-refactoring-validation/SKILL.md +52 -0
- package/localized/zh-CN/skills/fec-refactoring-validation/references/behavior-preservation.md +15 -0
- package/localized/zh-CN/skills/fec-refactoring-validation/references/refactoring-test-checklist.md +25 -0
- package/localized/zh-CN/skills/fec-responsive-layout/SKILL.md +34 -0
- package/localized/zh-CN/skills/fec-responsive-layout/references/responsive-layout-patterns.md +70 -0
- package/localized/zh-CN/skills/fec-route-protection/SKILL.md +135 -0
- package/localized/zh-CN/skills/fec-security-review/SKILL.md +54 -0
- package/localized/zh-CN/skills/fec-security-review/references/report-template.md +37 -0
- package/localized/zh-CN/skills/fec-security-review/references/security-checklist.md +64 -0
- package/localized/zh-CN/skills/fec-source-driven-development/SKILL.md +87 -0
- package/localized/zh-CN/skills/fec-state-management/SKILL.md +140 -0
- package/localized/zh-CN/skills/fec-state-management/references/state-patterns.md +109 -0
- package/localized/zh-CN/skills/fec-storybook-component-doc/SKILL.md +37 -0
- package/localized/zh-CN/skills/fec-storybook-component-doc/references/story-patterns.md +118 -0
- package/localized/zh-CN/skills/fec-svg-animation/SKILL.md +148 -0
- package/localized/zh-CN/skills/fec-tailwind-design-system/SKILL.md +34 -0
- package/localized/zh-CN/skills/fec-tailwind-design-system/references/tailwind-system-patterns.md +59 -0
- package/localized/zh-CN/skills/fec-tdd-workflow/SKILL.md +55 -0
- package/localized/zh-CN/skills/fec-testing-strategy/SKILL.md +45 -0
- package/localized/zh-CN/skills/fec-typescript-project-standard/SKILL.md +54 -0
- package/localized/zh-CN/skills/fec-typescript-project-standard/references/type-safety-patterns.md +102 -0
- package/localized/zh-CN/skills/fec-typescript-project-standard/references/type-safety.md +148 -0
- package/localized/zh-CN/skills/fec-ui-design/SKILL.md +108 -0
- package/localized/zh-CN/skills/fec-ui-design/data/product-rules.json +231 -0
- package/localized/zh-CN/skills/fec-ui-design/data/stack-ui-rules.json +146 -0
- package/localized/zh-CN/skills/fec-ui-design/data/style-archetypes.json +373 -0
- package/localized/zh-CN/skills/fec-ui-design/data/ux-quality-rules.json +203 -0
- package/localized/zh-CN/skills/fec-ui-design/references/design-intelligence.md +97 -0
- package/localized/zh-CN/skills/fec-ui-design/references/master-page-overrides.md +30 -0
- package/localized/zh-CN/skills/fec-ui-design/references/pre-delivery-checklist.md +39 -0
- package/localized/zh-CN/skills/fec-ui-design/scripts/design-system.mjs +648 -0
- package/localized/zh-CN/skills/fec-validation-fix/SKILL.md +51 -0
- package/localized/zh-CN/skills/fec-validation-fix/references/report-template.md +43 -0
- package/localized/zh-CN/skills/fec-vite-project-standard/SKILL.md +83 -0
- package/localized/zh-CN/skills/fec-vue3-project-standard/SKILL.md +58 -0
- package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-composables-routing.md +162 -0
- package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-performance-patterns.md +13 -0
- package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-project-structure.md +176 -0
- package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-state-api-quality.md +216 -0
- package/localized/zh-CN/skills/fec-web-video-presentation/SKILL.md +61 -0
- package/localized/zh-CN/skills/fec-web-video-presentation/data/starter-themes.json +59 -0
- package/localized/zh-CN/skills/fec-web-video-presentation/references/chapter-craft.md +37 -0
- package/localized/zh-CN/skills/fec-web-video-presentation/references/content-plan.md +38 -0
- package/localized/zh-CN/skills/fec-web-video-presentation/references/recording-and-audio.md +33 -0
- package/localized/zh-CN/skills/fec-web-video-presentation/references/theme-system.md +36 -0
- package/localized/zh-CN/skills/fec-web-video-presentation/scripts/create-video-presentation.mjs +430 -0
- package/localized/zh-CN/skills/fec-web-workers/SKILL.md +35 -0
- package/localized/zh-CN/skills/fec-web-workers/references/advanced-workers.md +54 -0
- package/localized/zh-CN/skills/fec-web-workers/references/basic-worker.md +67 -0
- package/localized/zh-CN/skills/metadata.json +2004 -0
- package/localized/zh-CN/skills/relations.json +1023 -0
- package/localized/zh-CN/templates/claude/CLAUDE.md +106 -0
- package/localized/zh-CN/templates/claude/settings.json +62 -0
- package/localized/zh-CN/templates/codex/AGENTS.md +105 -0
- package/localized/zh-CN/templates/codex/config.toml +32 -0
- package/localized/zh-CN/templates/openclaw/AGENTS.md +101 -0
- package/localized/zh-CN/templates/openclaw/OPENCLAW-CONFIG.md +12 -0
- package/localized/zh-CN/templates/shared/rules/fec-agent-workflow.md +55 -0
- package/localized/zh-CN/templates/shared/rules/fec-api-layer.md +99 -0
- package/localized/zh-CN/templates/shared/rules/fec-ci-cd.md +40 -0
- package/localized/zh-CN/templates/shared/rules/fec-code-comments.md +33 -0
- package/localized/zh-CN/templates/shared/rules/fec-design-system.md +72 -0
- package/localized/zh-CN/templates/shared/rules/fec-error-handling.md +56 -0
- package/localized/zh-CN/templates/shared/rules/fec-git-conventions.md +73 -0
- package/localized/zh-CN/templates/shared/rules/fec-i18n.md +64 -0
- package/localized/zh-CN/templates/shared/rules/fec-naming-conventions.md +120 -0
- package/localized/zh-CN/templates/shared/rules/fec-performance.md +101 -0
- package/localized/zh-CN/templates/shared/rules/fec-react.md +82 -0
- package/localized/zh-CN/templates/shared/rules/fec-refactoring.md +47 -0
- package/localized/zh-CN/templates/shared/rules/fec-rendering-patterns.md +40 -0
- package/localized/zh-CN/templates/shared/rules/fec-responsive-design.md +50 -0
- package/localized/zh-CN/templates/shared/rules/fec-source-driven-development.md +31 -0
- package/localized/zh-CN/templates/shared/rules/fec-state-management.md +60 -0
- package/localized/zh-CN/templates/shared/rules/fec-testing.md +98 -0
- package/localized/zh-CN/templates/shared/rules/fec-typescript.md +112 -0
- package/localized/zh-CN/templates/shared/rules/fec-vue.md +64 -0
- package/localized/zh-CN/templates/shared/rules/fec-working-modes.md +50 -0
- package/openclaw.plugin.json +2 -3
- package/package.json +28 -17
- package/skills/TEMPLATE.md +74 -74
- package/skills/eval_queries.json +922 -678
- package/skills/fec-accessibility-check/SKILL.md +21 -21
- package/skills/fec-accessibility-check/references/report-template.md +12 -12
- package/skills/fec-accessibility-check/references/screen-reader-testing.md +24 -24
- package/skills/fec-alchemy/SKILL.md +50 -50
- package/skills/fec-alchemy/assets/absorption-plan-template.md +32 -32
- package/skills/fec-alchemy/assets/intake-template.md +55 -55
- package/skills/fec-alchemy/assets/review-checklist.md +23 -23
- package/skills/fec-alchemy/references/methodology.md +66 -66
- package/skills/fec-alchemy/references/originality-and-licensing.md +42 -42
- package/skills/fec-api-integration/SKILL.md +61 -61
- package/skills/fec-api-integration/references/integration-patterns.md +30 -30
- package/skills/fec-backend-requirements-handoff/SKILL.md +25 -25
- package/skills/fec-browser-storage/SKILL.md +16 -16
- package/skills/fec-browser-storage/references/storage-patterns.md +16 -16
- package/skills/fec-canvas-threejs/SKILL.md +21 -21
- package/skills/fec-canvas-threejs/references/rendering-patterns.md +10 -10
- package/skills/fec-canvas-threejs/references/shader-webgl-patterns.md +37 -37
- package/skills/fec-code-review/SKILL.md +113 -94
- package/skills/fec-code-review/references/report-template.md +23 -13
- package/skills/fec-code-smells/SKILL.md +33 -0
- package/skills/fec-code-smells/references/detection-guide.md +25 -0
- package/skills/fec-code-smells/references/smell-catalog.md +861 -0
- package/skills/fec-code-smells/references/smell-to-refactoring-map.md +265 -0
- package/skills/fec-component-testing/SKILL.md +39 -39
- package/skills/fec-data-fetching/SKILL.md +16 -16
- package/skills/fec-data-fetching/references/query-patterns.md +27 -27
- package/skills/fec-debug-framework/SKILL.md +95 -95
- package/skills/fec-debug-framework/references/report-template.md +34 -34
- package/skills/fec-dependency-upgrade/SKILL.md +17 -17
- package/skills/fec-dependency-upgrade/references/dependency-upgrade-workflow.md +31 -31
- package/skills/fec-doc-sync/SKILL.md +23 -23
- package/skills/fec-drawio-studio/SKILL.md +42 -38
- package/skills/fec-drawio-studio/data/THIRD_PARTY_NOTICES.md +1 -1
- package/skills/fec-drawio-studio/data/shape-index.json +83570 -0
- package/skills/fec-drawio-studio/references/diagram-patterns.md +19 -0
- package/skills/fec-drawio-studio/references/flowchart-quality.md +49 -0
- package/skills/fec-drawio-studio/references/layout-and-export.md +18 -3
- package/skills/fec-drawio-studio/references/xml-and-mermaid.md +5 -1
- package/skills/fec-drawio-studio/scripts/diagram-lint.mjs +62 -0
- package/skills/fec-drawio-studio/scripts/drawio-export.mjs +134 -0
- package/skills/fec-drawio-studio/scripts/shape-query.mjs +55 -15
- package/skills/fec-e2e-testing/SKILL.md +24 -24
- package/skills/fec-e2e-testing/references/e2e-ci-reporting.md +20 -20
- package/skills/fec-e2e-testing/references/e2e-special-scenarios.md +10 -10
- package/skills/fec-e2e-testing/references/e2e-visual-regression.md +17 -17
- package/skills/fec-e2e-testing/references/playwright-patterns.md +6 -6
- package/skills/fec-form-handling/SKILL.md +21 -21
- package/skills/fec-form-handling/references/advanced-form-patterns.md +41 -41
- package/skills/fec-image-generation/SKILL.md +84 -29
- package/skills/fec-image-generation/assets/interactive-diagram.html +371 -0
- package/skills/fec-image-generation/assets/quality-examples/README.md +14 -0
- package/skills/fec-image-generation/assets/quality-examples/architecture.json +121 -0
- package/skills/fec-image-generation/assets/quality-examples/invalid-explicit.json +41 -0
- package/skills/fec-image-generation/assets/quality-examples/sequence.json +53 -0
- package/skills/fec-image-generation/assets/quality-examples/sequence.mmd +21 -0
- package/skills/fec-image-generation/assets/quality-examples/workflow.json +98 -0
- package/skills/fec-image-generation/assets/quality-examples/workflow.mmd +7 -0
- package/skills/fec-image-generation/references/diagram-workflows.md +41 -3
- package/skills/fec-image-generation/references/html-technical-diagrams.md +243 -0
- package/skills/fec-image-generation/references/png-qa-autofix.md +9 -2
- package/skills/fec-image-generation/scripts/diagram-browser.mjs +90 -0
- package/skills/fec-image-generation/scripts/diagram-layout.mjs +176 -0
- package/skills/fec-image-generation/scripts/export-diagram.mjs +332 -0
- package/skills/fec-image-generation/scripts/interactive-diagram-server.mjs +654 -0
- package/skills/fec-image-generation/scripts/mermaid-render.mjs +64 -0
- package/skills/fec-image-generation/scripts/png-qa.mjs +35 -4
- package/skills/fec-image-generation/scripts/tech-diagram-render.mjs +1537 -0
- package/skills/fec-implement-from-design/SKILL.md +81 -81
- package/skills/fec-implement-from-design/references/design-plan-template.md +16 -16
- package/skills/fec-legacy-to-modern-migration/SKILL.md +29 -29
- package/skills/fec-legacy-to-modern-migration/references/migration-execution-checklist.md +81 -81
- package/skills/fec-legacy-to-modern-migration/references/migration-report-template.md +37 -37
- package/skills/fec-legacy-to-modern-migration/references/migration-strategy-and-mapping.md +31 -31
- package/skills/fec-legacy-web-standard/SKILL.md +17 -17
- package/skills/fec-legacy-web-standard/references/legacy-patterns.md +16 -16
- package/skills/fec-list-virtualization/SKILL.md +16 -16
- package/skills/fec-list-virtualization/references/virtualization-patterns.md +31 -31
- package/skills/fec-monorepo-project-standard/SKILL.md +52 -52
- package/skills/fec-motion-interaction/SKILL.md +51 -51
- package/skills/fec-motion-interaction/references/motion-patterns.md +11 -11
- package/skills/fec-nextjs-project-standard/SKILL.md +64 -64
- package/skills/fec-nuxt-project-standard/SKILL.md +57 -57
- package/skills/fec-performance-optimization/SKILL.md +54 -54
- package/skills/fec-performance-optimization/references/framework-performance-patterns.md +23 -23
- package/skills/fec-performance-optimization/references/report-template.md +31 -31
- package/skills/fec-pwa-implementation/SKILL.md +17 -17
- package/skills/fec-pwa-implementation/references/manifest-and-icons.md +12 -12
- package/skills/fec-pwa-implementation/references/service-worker-workbox.md +13 -13
- package/skills/fec-react-project-standard/SKILL.md +72 -72
- package/skills/fec-react-project-standard/references/react-performance-patterns.md +28 -28
- package/skills/fec-react-project-standard/references/react-project-structure.md +112 -112
- package/skills/fec-react-project-standard/references/react-quality-patterns.md +72 -72
- package/skills/fec-react-project-standard/references/react-runtime-patterns.md +94 -94
- package/skills/fec-refactor-clean/SKILL.md +33 -30
- package/skills/fec-refactor-clean/references/report-template.md +23 -23
- package/skills/fec-refactoring/SKILL.md +83 -0
- package/skills/fec-refactoring/references/principles.md +60 -0
- package/skills/fec-refactoring/references/refactoring-vs-feature-change.md +27 -0
- package/skills/fec-refactoring/references/when-to-refactor.md +31 -0
- package/skills/fec-refactoring/references/workflow.md +90 -0
- package/skills/fec-refactoring-api/SKILL.md +25 -0
- package/skills/fec-refactoring-api/references/api-refactorings.md +496 -0
- package/skills/fec-refactoring-catalog/SKILL.md +28 -0
- package/skills/fec-refactoring-catalog/references/catalog-index.md +99 -0
- package/skills/fec-refactoring-catalog/references/composition-guide.md +49 -0
- package/skills/fec-refactoring-catalog/references/selection-guide.md +47 -0
- package/skills/fec-refactoring-control/SKILL.md +25 -0
- package/skills/fec-refactoring-control/references/conditional-refactorings.md +299 -0
- package/skills/fec-refactoring-data/SKILL.md +25 -0
- package/skills/fec-refactoring-data/references/data-refactorings.md +248 -0
- package/skills/fec-refactoring-encapsulation/SKILL.md +25 -0
- package/skills/fec-refactoring-encapsulation/references/encapsulation-refactorings.md +452 -0
- package/skills/fec-refactoring-functions/SKILL.md +25 -0
- package/skills/fec-refactoring-functions/references/function-refactorings.md +567 -0
- package/skills/fec-refactoring-inheritance/SKILL.md +25 -0
- package/skills/fec-refactoring-inheritance/references/inheritance-refactorings.md +550 -0
- package/skills/fec-refactoring-move-features/SKILL.md +25 -0
- package/skills/fec-refactoring-move-features/references/moving-refactorings.md +453 -0
- package/skills/fec-refactoring-validation/SKILL.md +59 -0
- package/skills/fec-refactoring-validation/references/behavior-preservation.md +53 -0
- package/skills/fec-refactoring-validation/references/refactoring-test-checklist.md +42 -0
- package/skills/fec-responsive-layout/SKILL.md +17 -17
- package/skills/fec-responsive-layout/references/responsive-layout-patterns.md +37 -37
- package/skills/fec-route-protection/SKILL.md +26 -26
- package/skills/fec-security-review/SKILL.md +36 -20
- package/skills/fec-security-review/references/report-template.md +22 -12
- package/skills/fec-security-review/references/security-checklist.md +27 -27
- package/skills/fec-source-driven-development/SKILL.md +59 -59
- package/skills/fec-state-management/SKILL.md +34 -34
- package/skills/fec-state-management/references/state-patterns.md +19 -19
- package/skills/fec-storybook-component-doc/SKILL.md +19 -19
- package/skills/fec-storybook-component-doc/references/story-patterns.md +12 -12
- package/skills/fec-svg-animation/SKILL.md +32 -32
- package/skills/fec-tailwind-design-system/SKILL.md +17 -17
- package/skills/fec-tailwind-design-system/references/tailwind-system-patterns.md +36 -36
- package/skills/fec-tdd-workflow/SKILL.md +32 -28
- package/skills/fec-testing-strategy/SKILL.md +29 -29
- package/skills/fec-typescript-project-standard/SKILL.md +38 -38
- package/skills/fec-typescript-project-standard/references/type-safety-patterns.md +20 -20
- package/skills/fec-typescript-project-standard/references/type-safety.md +18 -18
- package/skills/fec-ui-design/SKILL.md +90 -90
- package/skills/fec-ui-design/references/design-intelligence.md +61 -61
- package/skills/fec-ui-design/references/master-page-overrides.md +15 -15
- package/skills/fec-ui-design/references/pre-delivery-checklist.md +38 -38
- package/skills/fec-validation-fix/SKILL.md +26 -26
- package/skills/fec-validation-fix/references/report-template.md +25 -25
- package/skills/fec-vite-project-standard/SKILL.md +39 -39
- package/skills/fec-vue3-project-standard/SKILL.md +38 -38
- package/skills/fec-vue3-project-standard/references/vue3-composables-routing.md +36 -36
- package/skills/fec-vue3-project-standard/references/vue3-performance-patterns.md +8 -8
- package/skills/fec-vue3-project-standard/references/vue3-project-structure.md +112 -112
- package/skills/fec-vue3-project-standard/references/vue3-state-api-quality.md +74 -74
- package/skills/fec-web-video-presentation/SKILL.md +33 -33
- package/skills/fec-web-workers/SKILL.md +16 -16
- package/skills/fec-web-workers/references/advanced-workers.md +13 -13
- package/skills/fec-web-workers/references/basic-worker.md +8 -8
- package/skills/metadata.json +485 -116
- package/skills/relations.json +268 -0
- package/templates/claude/CLAUDE.md +60 -60
- package/templates/codex/AGENTS.md +76 -76
- package/templates/codex/config.toml +4 -4
- package/templates/openclaw/AGENTS.md +68 -68
- package/templates/openclaw/OPENCLAW-CONFIG.md +8 -8
- package/templates/shared/rules/fec-agent-workflow.md +41 -40
- package/templates/shared/rules/fec-api-layer.md +52 -52
- package/templates/shared/rules/fec-ci-cd.md +29 -29
- package/templates/shared/rules/fec-code-comments.md +22 -22
- package/templates/shared/rules/fec-design-system.md +53 -53
- package/templates/shared/rules/fec-error-handling.md +40 -40
- package/templates/shared/rules/fec-git-conventions.md +42 -42
- package/templates/shared/rules/fec-i18n.md +48 -48
- package/templates/shared/rules/fec-naming-conventions.md +91 -91
- package/templates/shared/rules/fec-performance.md +78 -78
- package/templates/shared/rules/fec-react.md +58 -58
- package/templates/shared/rules/fec-refactoring.md +34 -34
- package/templates/shared/rules/fec-rendering-patterns.md +36 -36
- package/templates/shared/rules/fec-responsive-design.md +37 -37
- package/templates/shared/rules/fec-source-driven-development.md +22 -22
- package/templates/shared/rules/fec-state-management.md +56 -56
- package/templates/shared/rules/fec-testing.md +64 -64
- package/templates/shared/rules/fec-typescript.md +75 -75
- package/templates/shared/rules/fec-vue.md +42 -42
- package/templates/shared/rules/fec-working-modes.md +34 -34
- package/docs/superpowers/plans/2026-05-29-fec-debug.md +0 -491
- package/docs/superpowers/specs/2026-05-29-fec-debug-design.md +0 -340
- package/skills/fec-drawio-studio/data/shape-index.json.gz +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# 何时进行重构
|
|
2
|
+
|
|
3
|
+
## 现在就重构
|
|
4
|
+
|
|
5
|
+
当结构问题直接增加当前工作的修改成本或风险,并且能够保持行为稳定时值得立即处理,例如职责纠缠让一个小改动波及多处、同一概念重复编辑且已开始漂移、状态/数据所有权混乱、测试难以隔离目标行为等。
|
|
6
|
+
|
|
7
|
+
## 记录后延后
|
|
8
|
+
|
|
9
|
+
坏味道真实存在但与当前目标无关、安全网不足以支撑高风险变换、兼容工作量明显超过即时收益时,记录证据和候选顺序,不进行顺手的大范围重新设计。
|
|
10
|
+
|
|
11
|
+
## 停止重构
|
|
12
|
+
|
|
13
|
+
出现以下情况应停止:结构目标已经达成;下一步会改变可观察行为;下一步跨越公开契约但没有兼容方案;差异预算持续扩大;验证无法区分基线与新回归;剩余动机只来自个人审美而非修改成本或正确性风险。
|
|
14
|
+
|
|
15
|
+
## 实用判断
|
|
16
|
+
|
|
17
|
+
好的重构应让下一个真实需求更容易理解、局部化、验证或回滚。如果没有改善这些属性,应要求更强证据再继续。
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# 重构执行工作流
|
|
2
|
+
|
|
3
|
+
## 状态机
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
分类请求
|
|
7
|
+
→ 发现上下文
|
|
8
|
+
→ 建立基线
|
|
9
|
+
→ 诊断结构证据
|
|
10
|
+
→ 建立安全网
|
|
11
|
+
→ 构建有序计划
|
|
12
|
+
→ 风险检查
|
|
13
|
+
→ 执行一个重构步骤
|
|
14
|
+
→ 立即验证
|
|
15
|
+
通过:检查 diff 后进入下一步
|
|
16
|
+
失败:回滚当前步骤,确认基线,再缩小或重排
|
|
17
|
+
→ 最终验证
|
|
18
|
+
→ 报告
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 上下文发现
|
|
22
|
+
|
|
23
|
+
按需读取 `package.json`、工作区清单、TypeScript/ESLint 配置、测试脚本、受影响模块和调用点、barrel 导出、路由和注册点、store/持久化边界、生命周期敏感逻辑、异步副作用以及当前 Git diff。
|
|
24
|
+
|
|
25
|
+
## 基线处理
|
|
26
|
+
|
|
27
|
+
基线为绿时,当前步骤之后新出现的相关失败应优先视为该步骤可能引入的回归。基线已经为红时,要记录精确失败,不能没有比较证据就把后续失败归因于重构;安全证明不足时不要继续高风险变换。
|
|
28
|
+
|
|
29
|
+
## 单步计划契约
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
目标:
|
|
33
|
+
手法:
|
|
34
|
+
意图:
|
|
35
|
+
前置条件:
|
|
36
|
+
风险:SAFE | CAUTION | DANGER
|
|
37
|
+
预期文件数:
|
|
38
|
+
预期函数/组件数:
|
|
39
|
+
预期公开 API 变化:0
|
|
40
|
+
预期行为变化:0
|
|
41
|
+
验证:
|
|
42
|
+
回滚边界:
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 单步失败协议
|
|
46
|
+
|
|
47
|
+
修改前为绿、当前步骤后变红时:停止;只回滚当前步骤;重跑相关检查确认基线恢复;判断失败源于行为、身份、生命周期、顺序、类型还是依赖假设;缩小步骤或增加前置重构;证据恢复后才能重试。
|
|
48
|
+
|
|
49
|
+
不要为了“修绿”把改动扩散到不相关模块。
|
|
50
|
+
|
|
51
|
+
## 最终验证
|
|
52
|
+
|
|
53
|
+
按由窄到宽的顺序运行:最近的语法/类型检查、目标单元或组件测试、受影响集成测试、lint + 全量 typecheck、更广测试、构建,以及实际受影响时的 SSR、E2E、视觉、无障碍、性能等门禁。
|
|
54
|
+
|
|
55
|
+
## 证明结论
|
|
56
|
+
|
|
57
|
+
- **PASS**:相关可观察契约覆盖充分,要求的检查全部通过。
|
|
58
|
+
- **PARTIAL**:已执行检查通过,但重要行为覆盖仍不完整。
|
|
59
|
+
- **NOT PROVEN**:依赖、环境、基线或安全网不足,无法可信证明行为保持。
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fec-refactoring-api
|
|
3
|
+
description: 保持行为的前端重构主要涉及API 类重构,已经选定或正在评估对应手法,需要查询该 family 的操作步骤、风险与 JavaScript/TypeScript/React/Vue 适配时。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# API 类重构
|
|
7
|
+
|
|
8
|
+
## 概览
|
|
9
|
+
只有在证据和前置条件支持时才使用对应手法。一次只执行一个主要结构变换,并在完成后立即验证。
|
|
10
|
+
|
|
11
|
+
## 执行流程
|
|
12
|
+
1. 在[API 类重构详细卡片](references/api-refactorings.md)确认手法和前置条件。
|
|
13
|
+
2. 记录受影响行为与差异预算。
|
|
14
|
+
3. 只执行该手法最小可行的一步。
|
|
15
|
+
4. 在组合下一手法之前验证当前步骤。
|
|
16
|
+
5. 公共契约、生命周期、状态身份或实际范围超出预期时停止并重新评估。
|
|
17
|
+
|
|
18
|
+
## 快速索引
|
|
19
|
+
详细 Reference 包含本 family 的 10 个标准手法,每项均包括意图、信号、不适用条件、操作步骤、行为保持检查、相关坏味道、组合关系、JS/TS/React/Vue 注意事项、前端适配和原创示例。
|
|
20
|
+
|
|
21
|
+
## 常见错误
|
|
22
|
+
- 只根据手法名称套用,不核对前置条件。
|
|
23
|
+
- 一个 diff 同时混入多个结构目标。
|
|
24
|
+
- 把经典 class 形式机械套进现代 React/Vue。
|
|
25
|
+
- 相关行为没有覆盖时,仅凭“测试通过”就声称行为已得到证明。
|
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
# API 类重构
|
|
2
|
+
|
|
3
|
+
这些卡片以用户提供的标准重构目录为知识基线,转换为面向前端 Agent 的操作指南。保留标准 ID/中英文名称,框架适配和示例为项目原创内容。
|
|
4
|
+
|
|
5
|
+
## RF-SEPARATE-QUERY-FROM-MODIFIER — 将查询函数和修改函数分离(Separate Query from Modifier)
|
|
6
|
+
|
|
7
|
+
### 意图
|
|
8
|
+
把“获取信息”和“修改状态”拆开,让读取不再隐式触发副作用。
|
|
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-MUTABLE-DATA`
|
|
32
|
+
|
|
33
|
+
### 常见组合
|
|
34
|
+
- 不建立固定流水线;下一步必须重新依据证据选择。
|
|
35
|
+
|
|
36
|
+
### JavaScript 注意事项
|
|
37
|
+
- 保持回调 arity、`this`、默认值、异常和副作用时序。
|
|
38
|
+
|
|
39
|
+
### TypeScript 注意事项
|
|
40
|
+
- 导出函数签名、泛型、overload、DTO 和公共类型都属于兼容契约。
|
|
41
|
+
|
|
42
|
+
### React 注意事项
|
|
43
|
+
- Props/callback、Hook、loader/action、router 和 context API 可能是公共边界。
|
|
44
|
+
|
|
45
|
+
### Vue 注意事项
|
|
46
|
+
- props/emits、composable 返回、Pinia action、route contract 和 injection key 可能是公共边界。
|
|
47
|
+
|
|
48
|
+
### Frontend-Craft 前端适配
|
|
49
|
+
- 优先显式、可测试依赖;Command 只有在 undo/queue/retry/audit/复杂生命周期有价值时才值得引入。
|
|
50
|
+
|
|
51
|
+
### 原创前端变换示例
|
|
52
|
+
- 把“Separate Query from Modifier”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
|
|
53
|
+
|
|
54
|
+
## RF-PARAMETERIZE-FUNCTION — 函数参数化(Parameterize Function)
|
|
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
|
+
- 保持回调 arity、`this`、默认值、异常和副作用时序。
|
|
87
|
+
|
|
88
|
+
### TypeScript 注意事项
|
|
89
|
+
- 导出函数签名、泛型、overload、DTO 和公共类型都属于兼容契约。
|
|
90
|
+
|
|
91
|
+
### React 注意事项
|
|
92
|
+
- Props/callback、Hook、loader/action、router 和 context API 可能是公共边界。
|
|
93
|
+
|
|
94
|
+
### Vue 注意事项
|
|
95
|
+
- props/emits、composable 返回、Pinia action、route contract 和 injection key 可能是公共边界。
|
|
96
|
+
|
|
97
|
+
### Frontend-Craft 前端适配
|
|
98
|
+
- 优先显式、可测试依赖;Command 只有在 undo/queue/retry/audit/复杂生命周期有价值时才值得引入。
|
|
99
|
+
|
|
100
|
+
### 原创前端变换示例
|
|
101
|
+
- 把“Parameterize Function”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
|
|
102
|
+
|
|
103
|
+
## RF-REMOVE-FLAG-ARGUMENT — 移除标记参数(Remove Flag Argument)
|
|
104
|
+
|
|
105
|
+
### 意图
|
|
106
|
+
把用于选择行为的 flag 参数替换为意图明确的操作;普通领域 boolean 不属于行为 flag。
|
|
107
|
+
|
|
108
|
+
### 典型信号
|
|
109
|
+
- boolean/enum 参数并非普通数据,而是在指挥函数选择不同业务行为。
|
|
110
|
+
|
|
111
|
+
### 不适用条件
|
|
112
|
+
- 参数只是领域数据,而不是选择函数行为的控制指令时,不应机械拆 API。
|
|
113
|
+
|
|
114
|
+
### 前置条件
|
|
115
|
+
- 已明确当前可观察行为、受影响调用者和公共契约。
|
|
116
|
+
- 目标位于声明的差异预算内,并且这个单一主要变换完成后能够立即验证。
|
|
117
|
+
|
|
118
|
+
### 操作步骤
|
|
119
|
+
1. 确认当前行为、调用者和边界,并锁定本步骤只处理这一项主要结构意图。
|
|
120
|
+
2. 创建最小的新结构/位置/接口,让旧行为可以逐步迁移而不是一次性大改。
|
|
121
|
+
3. 一次迁移一个调用点或职责片段,并保持兼容边界。
|
|
122
|
+
4. 运行窄范围验证;若变红,先回滚本步骤,再缩小变换。
|
|
123
|
+
|
|
124
|
+
### 行为保持检查点
|
|
125
|
+
- 对比输入、输出、异常、副作用、执行顺序和公共契约。
|
|
126
|
+
- 前端还要核对 UI 状态、事件、焦点、网络请求、生命周期/状态迁移,以及相关对象身份语义。
|
|
127
|
+
|
|
128
|
+
### 相关坏味道
|
|
129
|
+
- `SMELL-LONG-PARAMETER-LIST`
|
|
130
|
+
|
|
131
|
+
### 常见组合
|
|
132
|
+
- 不建立固定流水线;下一步必须重新依据证据选择。
|
|
133
|
+
|
|
134
|
+
### JavaScript 注意事项
|
|
135
|
+
- 保持回调 arity、`this`、默认值、异常和副作用时序。
|
|
136
|
+
|
|
137
|
+
### TypeScript 注意事项
|
|
138
|
+
- 导出函数签名、泛型、overload、DTO 和公共类型都属于兼容契约。
|
|
139
|
+
|
|
140
|
+
### React 注意事项
|
|
141
|
+
- Props/callback、Hook、loader/action、router 和 context API 可能是公共边界。
|
|
142
|
+
|
|
143
|
+
### Vue 注意事项
|
|
144
|
+
- props/emits、composable 返回、Pinia action、route contract 和 injection key 可能是公共边界。
|
|
145
|
+
|
|
146
|
+
### Frontend-Craft 前端适配
|
|
147
|
+
- 优先显式、可测试依赖;Command 只有在 undo/queue/retry/audit/复杂生命周期有价值时才值得引入。
|
|
148
|
+
|
|
149
|
+
### 原创前端变换示例
|
|
150
|
+
- 把“Remove Flag Argument”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
|
|
151
|
+
|
|
152
|
+
## RF-PRESERVE-WHOLE-OBJECT — 保持对象完整(Preserve Whole Object)
|
|
153
|
+
|
|
154
|
+
### 意图
|
|
155
|
+
当多个参数本就来自同一对象时,传递对象或窄接口,而不是先拆字段再传入。
|
|
156
|
+
|
|
157
|
+
### 典型信号
|
|
158
|
+
- 当前结构出现与本手法目标一致的重复、耦合、命名、职责、数据所有权或控制流问题,并有具体代码证据。
|
|
159
|
+
|
|
160
|
+
### 不适用条件
|
|
161
|
+
- 当前结构已经清晰,或该变换会制造更强耦合、隐藏依赖、破坏公共契约且没有兼容方案时,不使用。
|
|
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-LONG-PARAMETER-LIST`
|
|
180
|
+
- `SMELL-DATA-CLUMPS`
|
|
181
|
+
|
|
182
|
+
### 常见组合
|
|
183
|
+
- 不建立固定流水线;下一步必须重新依据证据选择。
|
|
184
|
+
|
|
185
|
+
### JavaScript 注意事项
|
|
186
|
+
- 保持回调 arity、`this`、默认值、异常和副作用时序。
|
|
187
|
+
|
|
188
|
+
### TypeScript 注意事项
|
|
189
|
+
- 导出函数签名、泛型、overload、DTO 和公共类型都属于兼容契约。
|
|
190
|
+
|
|
191
|
+
### React 注意事项
|
|
192
|
+
- Props/callback、Hook、loader/action、router 和 context API 可能是公共边界。
|
|
193
|
+
|
|
194
|
+
### Vue 注意事项
|
|
195
|
+
- props/emits、composable 返回、Pinia action、route contract 和 injection key 可能是公共边界。
|
|
196
|
+
|
|
197
|
+
### Frontend-Craft 前端适配
|
|
198
|
+
- 优先显式、可测试依赖;Command 只有在 undo/queue/retry/audit/复杂生命周期有价值时才值得引入。
|
|
199
|
+
|
|
200
|
+
### 原创前端变换示例
|
|
201
|
+
- 把“Preserve Whole Object”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
|
|
202
|
+
|
|
203
|
+
## RF-REPLACE-PARAMETER-WITH-QUERY — 以查询取代参数(Replace Parameter with Query)
|
|
204
|
+
|
|
205
|
+
### 意图
|
|
206
|
+
当函数可以从恰当且稳定的来源获得同一值时,去掉冗余参数。
|
|
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-LONG-PARAMETER-LIST`
|
|
230
|
+
|
|
231
|
+
### 常见组合
|
|
232
|
+
- 不建立固定流水线;下一步必须重新依据证据选择。
|
|
233
|
+
|
|
234
|
+
### JavaScript 注意事项
|
|
235
|
+
- 保持回调 arity、`this`、默认值、异常和副作用时序。
|
|
236
|
+
|
|
237
|
+
### TypeScript 注意事项
|
|
238
|
+
- 导出函数签名、泛型、overload、DTO 和公共类型都属于兼容契约。
|
|
239
|
+
|
|
240
|
+
### React 注意事项
|
|
241
|
+
- Props/callback、Hook、loader/action、router 和 context API 可能是公共边界。
|
|
242
|
+
|
|
243
|
+
### Vue 注意事项
|
|
244
|
+
- props/emits、composable 返回、Pinia action、route contract 和 injection key 可能是公共边界。
|
|
245
|
+
|
|
246
|
+
### Frontend-Craft 前端适配
|
|
247
|
+
- 优先显式、可测试依赖;Command 只有在 undo/queue/retry/audit/复杂生命周期有价值时才值得引入。
|
|
248
|
+
|
|
249
|
+
### 原创前端变换示例
|
|
250
|
+
- 把“Replace Parameter with Query”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
|
|
251
|
+
|
|
252
|
+
## RF-REPLACE-QUERY-WITH-PARAMETER — 以参数取代查询(Replace Query with Parameter)
|
|
253
|
+
|
|
254
|
+
### 意图
|
|
255
|
+
把隐藏查询依赖变为显式参数,提高纯度、可复用性和可测试性。
|
|
256
|
+
|
|
257
|
+
### 典型信号
|
|
258
|
+
- 当前结构出现与本手法目标一致的重复、耦合、命名、职责、数据所有权或控制流问题,并有具体代码证据。
|
|
259
|
+
|
|
260
|
+
### 不适用条件
|
|
261
|
+
- 当前结构已经清晰,或该变换会制造更强耦合、隐藏依赖、破坏公共契约且没有兼容方案时,不使用。
|
|
262
|
+
|
|
263
|
+
### 前置条件
|
|
264
|
+
- 已明确当前可观察行为、受影响调用者和公共契约。
|
|
265
|
+
- 目标位于声明的差异预算内,并且这个单一主要变换完成后能够立即验证。
|
|
266
|
+
|
|
267
|
+
### 操作步骤
|
|
268
|
+
1. 确认当前行为、调用者和边界,并锁定本步骤只处理这一项主要结构意图。
|
|
269
|
+
2. 创建最小的新结构/位置/接口,让旧行为可以逐步迁移而不是一次性大改。
|
|
270
|
+
3. 一次迁移一个调用点或职责片段,并保持兼容边界。
|
|
271
|
+
4. 运行窄范围验证;若变红,先回滚本步骤,再缩小变换。
|
|
272
|
+
|
|
273
|
+
### 行为保持检查点
|
|
274
|
+
- 对比输入、输出、异常、副作用、执行顺序和公共契约。
|
|
275
|
+
- 前端还要核对 UI 状态、事件、焦点、网络请求、生命周期/状态迁移,以及相关对象身份语义。
|
|
276
|
+
|
|
277
|
+
### 相关坏味道
|
|
278
|
+
- 不要求先存在某一种固定坏味道;以具体结构证据为准。
|
|
279
|
+
|
|
280
|
+
### 常见组合
|
|
281
|
+
- 不建立固定流水线;下一步必须重新依据证据选择。
|
|
282
|
+
|
|
283
|
+
### JavaScript 注意事项
|
|
284
|
+
- 保持回调 arity、`this`、默认值、异常和副作用时序。
|
|
285
|
+
|
|
286
|
+
### TypeScript 注意事项
|
|
287
|
+
- 导出函数签名、泛型、overload、DTO 和公共类型都属于兼容契约。
|
|
288
|
+
|
|
289
|
+
### React 注意事项
|
|
290
|
+
- Props/callback、Hook、loader/action、router 和 context API 可能是公共边界。
|
|
291
|
+
|
|
292
|
+
### Vue 注意事项
|
|
293
|
+
- props/emits、composable 返回、Pinia action、route contract 和 injection key 可能是公共边界。
|
|
294
|
+
|
|
295
|
+
### Frontend-Craft 前端适配
|
|
296
|
+
- 优先显式、可测试依赖;Command 只有在 undo/queue/retry/audit/复杂生命周期有价值时才值得引入。
|
|
297
|
+
|
|
298
|
+
### 原创前端变换示例
|
|
299
|
+
- 把“Replace Query with Parameter”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
|
|
300
|
+
|
|
301
|
+
## RF-REMOVE-SETTING-METHOD — 移除设值函数(Remove Setting Method)
|
|
302
|
+
|
|
303
|
+
### 意图
|
|
304
|
+
对于创建后不应再改变的状态,移除 setter 并把初始化放到构造/工厂阶段。
|
|
305
|
+
|
|
306
|
+
### 典型信号
|
|
307
|
+
- 当前结构出现与本手法目标一致的重复、耦合、命名、职责、数据所有权或控制流问题,并有具体代码证据。
|
|
308
|
+
|
|
309
|
+
### 不适用条件
|
|
310
|
+
- 当前结构已经清晰,或该变换会制造更强耦合、隐藏依赖、破坏公共契约且没有兼容方案时,不使用。
|
|
311
|
+
|
|
312
|
+
### 前置条件
|
|
313
|
+
- 已明确当前可观察行为、受影响调用者和公共契约。
|
|
314
|
+
- 目标位于声明的差异预算内,并且这个单一主要变换完成后能够立即验证。
|
|
315
|
+
|
|
316
|
+
### 操作步骤
|
|
317
|
+
1. 确认当前行为、调用者和边界,并锁定本步骤只处理这一项主要结构意图。
|
|
318
|
+
2. 创建最小的新结构/位置/接口,让旧行为可以逐步迁移而不是一次性大改。
|
|
319
|
+
3. 一次迁移一个调用点或职责片段,并保持兼容边界。
|
|
320
|
+
4. 运行窄范围验证;若变红,先回滚本步骤,再缩小变换。
|
|
321
|
+
|
|
322
|
+
### 行为保持检查点
|
|
323
|
+
- 对比输入、输出、异常、副作用、执行顺序和公共契约。
|
|
324
|
+
- 前端还要核对 UI 状态、事件、焦点、网络请求、生命周期/状态迁移,以及相关对象身份语义。
|
|
325
|
+
|
|
326
|
+
### 相关坏味道
|
|
327
|
+
- `SMELL-MUTABLE-DATA`
|
|
328
|
+
- `SMELL-DATA-CLASS`
|
|
329
|
+
|
|
330
|
+
### 常见组合
|
|
331
|
+
- 不建立固定流水线;下一步必须重新依据证据选择。
|
|
332
|
+
|
|
333
|
+
### JavaScript 注意事项
|
|
334
|
+
- 保持回调 arity、`this`、默认值、异常和副作用时序。
|
|
335
|
+
|
|
336
|
+
### TypeScript 注意事项
|
|
337
|
+
- 导出函数签名、泛型、overload、DTO 和公共类型都属于兼容契约。
|
|
338
|
+
|
|
339
|
+
### React 注意事项
|
|
340
|
+
- Props/callback、Hook、loader/action、router 和 context API 可能是公共边界。
|
|
341
|
+
|
|
342
|
+
### Vue 注意事项
|
|
343
|
+
- props/emits、composable 返回、Pinia action、route contract 和 injection key 可能是公共边界。
|
|
344
|
+
|
|
345
|
+
### Frontend-Craft 前端适配
|
|
346
|
+
- 优先显式、可测试依赖;Command 只有在 undo/queue/retry/audit/复杂生命周期有价值时才值得引入。
|
|
347
|
+
|
|
348
|
+
### 原创前端变换示例
|
|
349
|
+
- 把“Remove Setting Method”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
|
|
350
|
+
|
|
351
|
+
## RF-REPLACE-CONSTRUCTOR-WITH-FACTORY-FUNCTION — 以工厂函数取代构造函数(Replace Constructor with Factory Function)
|
|
352
|
+
|
|
353
|
+
### 意图
|
|
354
|
+
当创建过程包含选择、规范化、缓存或需要更明确名称时,用工厂函数表达创建策略。
|
|
355
|
+
|
|
356
|
+
### 典型信号
|
|
357
|
+
- 当前结构出现与本手法目标一致的重复、耦合、命名、职责、数据所有权或控制流问题,并有具体代码证据。
|
|
358
|
+
|
|
359
|
+
### 不适用条件
|
|
360
|
+
- 当前结构已经清晰,或该变换会制造更强耦合、隐藏依赖、破坏公共契约且没有兼容方案时,不使用。
|
|
361
|
+
|
|
362
|
+
### 前置条件
|
|
363
|
+
- 已明确当前可观察行为、受影响调用者和公共契约。
|
|
364
|
+
- 目标位于声明的差异预算内,并且这个单一主要变换完成后能够立即验证。
|
|
365
|
+
|
|
366
|
+
### 操作步骤
|
|
367
|
+
1. 确认当前行为、调用者和边界,并锁定本步骤只处理这一项主要结构意图。
|
|
368
|
+
2. 创建最小的新结构/位置/接口,让旧行为可以逐步迁移而不是一次性大改。
|
|
369
|
+
3. 一次迁移一个调用点或职责片段,并保持兼容边界。
|
|
370
|
+
4. 运行窄范围验证;若变红,先回滚本步骤,再缩小变换。
|
|
371
|
+
|
|
372
|
+
### 行为保持检查点
|
|
373
|
+
- 对比输入、输出、异常、副作用、执行顺序和公共契约。
|
|
374
|
+
- 前端还要核对 UI 状态、事件、焦点、网络请求、生命周期/状态迁移,以及相关对象身份语义。
|
|
375
|
+
|
|
376
|
+
### 相关坏味道
|
|
377
|
+
- 不要求先存在某一种固定坏味道;以具体结构证据为准。
|
|
378
|
+
|
|
379
|
+
### 常见组合
|
|
380
|
+
- 不建立固定流水线;下一步必须重新依据证据选择。
|
|
381
|
+
|
|
382
|
+
### JavaScript 注意事项
|
|
383
|
+
- 保持回调 arity、`this`、默认值、异常和副作用时序。
|
|
384
|
+
|
|
385
|
+
### TypeScript 注意事项
|
|
386
|
+
- 导出函数签名、泛型、overload、DTO 和公共类型都属于兼容契约。
|
|
387
|
+
|
|
388
|
+
### React 注意事项
|
|
389
|
+
- Props/callback、Hook、loader/action、router 和 context API 可能是公共边界。
|
|
390
|
+
|
|
391
|
+
### Vue 注意事项
|
|
392
|
+
- props/emits、composable 返回、Pinia action、route contract 和 injection key 可能是公共边界。
|
|
393
|
+
|
|
394
|
+
### Frontend-Craft 前端适配
|
|
395
|
+
- 优先显式、可测试依赖;Command 只有在 undo/queue/retry/audit/复杂生命周期有价值时才值得引入。
|
|
396
|
+
|
|
397
|
+
### 原创前端变换示例
|
|
398
|
+
- 把“Replace Constructor with Factory Function”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
|
|
399
|
+
|
|
400
|
+
## RF-REPLACE-FUNCTION-WITH-COMMAND — 以命令取代函数(Replace Function with Command)
|
|
401
|
+
|
|
402
|
+
### 意图
|
|
403
|
+
只有当操作确实需要状态、undo、queue、retry、audit 或复杂生命周期时,才把函数提升为命令/执行上下文。
|
|
404
|
+
|
|
405
|
+
### 典型信号
|
|
406
|
+
- 一个操作确实需要持有跨步骤状态,或需要 undo、queue、retry、audit、取消/进度等生命周期。
|
|
407
|
+
|
|
408
|
+
### 不适用条件
|
|
409
|
+
- 简单纯函数没有状态或生命周期价值时,不引入命令对象。
|
|
410
|
+
|
|
411
|
+
### 前置条件
|
|
412
|
+
- 已明确当前可观察行为、受影响调用者和公共契约。
|
|
413
|
+
- 目标位于声明的差异预算内,并且这个单一主要变换完成后能够立即验证。
|
|
414
|
+
|
|
415
|
+
### 操作步骤
|
|
416
|
+
1. 确认当前行为、调用者和边界,并锁定本步骤只处理这一项主要结构意图。
|
|
417
|
+
2. 创建最小的新结构/位置/接口,让旧行为可以逐步迁移而不是一次性大改。
|
|
418
|
+
3. 一次迁移一个调用点或职责片段,并保持兼容边界。
|
|
419
|
+
4. 运行窄范围验证;若变红,先回滚本步骤,再缩小变换。
|
|
420
|
+
|
|
421
|
+
### 行为保持检查点
|
|
422
|
+
- 对比输入、输出、异常、副作用、执行顺序和公共契约。
|
|
423
|
+
- 前端还要核对 UI 状态、事件、焦点、网络请求、生命周期/状态迁移,以及相关对象身份语义。
|
|
424
|
+
|
|
425
|
+
### 相关坏味道
|
|
426
|
+
- `SMELL-LONG-FUNCTION`
|
|
427
|
+
|
|
428
|
+
### 常见组合
|
|
429
|
+
- 不建立固定流水线;下一步必须重新依据证据选择。
|
|
430
|
+
|
|
431
|
+
### JavaScript 注意事项
|
|
432
|
+
- 保持回调 arity、`this`、默认值、异常和副作用时序。
|
|
433
|
+
|
|
434
|
+
### TypeScript 注意事项
|
|
435
|
+
- 导出函数签名、泛型、overload、DTO 和公共类型都属于兼容契约。
|
|
436
|
+
|
|
437
|
+
### React 注意事项
|
|
438
|
+
- Props/callback、Hook、loader/action、router 和 context API 可能是公共边界。
|
|
439
|
+
|
|
440
|
+
### Vue 注意事项
|
|
441
|
+
- props/emits、composable 返回、Pinia action、route contract 和 injection key 可能是公共边界。
|
|
442
|
+
|
|
443
|
+
### Frontend-Craft 前端适配
|
|
444
|
+
- 优先显式、可测试依赖;Command 只有在 undo/queue/retry/audit/复杂生命周期有价值时才值得引入。
|
|
445
|
+
|
|
446
|
+
### 原创前端变换示例
|
|
447
|
+
- 复杂上传流程包含 retry、progress、cancel、audit 时,可由上传命令/会话对象持有生命周期状态。
|
|
448
|
+
|
|
449
|
+
## RF-REPLACE-COMMAND-WITH-FUNCTION — 以函数取代命令(Replace Command with Function)
|
|
450
|
+
|
|
451
|
+
### 意图
|
|
452
|
+
当命令对象已经没有值得保留的状态或生命周期时,将其收敛为普通函数。
|
|
453
|
+
|
|
454
|
+
### 典型信号
|
|
455
|
+
- 当前结构出现与本手法目标一致的重复、耦合、命名、职责、数据所有权或控制流问题,并有具体代码证据。
|
|
456
|
+
|
|
457
|
+
### 不适用条件
|
|
458
|
+
- 当前结构已经清晰,或该变换会制造更强耦合、隐藏依赖、破坏公共契约且没有兼容方案时,不使用。
|
|
459
|
+
|
|
460
|
+
### 前置条件
|
|
461
|
+
- 已明确当前可观察行为、受影响调用者和公共契约。
|
|
462
|
+
- 目标位于声明的差异预算内,并且这个单一主要变换完成后能够立即验证。
|
|
463
|
+
|
|
464
|
+
### 操作步骤
|
|
465
|
+
1. 确认当前行为、调用者和边界,并锁定本步骤只处理这一项主要结构意图。
|
|
466
|
+
2. 创建最小的新结构/位置/接口,让旧行为可以逐步迁移而不是一次性大改。
|
|
467
|
+
3. 一次迁移一个调用点或职责片段,并保持兼容边界。
|
|
468
|
+
4. 运行窄范围验证;若变红,先回滚本步骤,再缩小变换。
|
|
469
|
+
|
|
470
|
+
### 行为保持检查点
|
|
471
|
+
- 对比输入、输出、异常、副作用、执行顺序和公共契约。
|
|
472
|
+
- 前端还要核对 UI 状态、事件、焦点、网络请求、生命周期/状态迁移,以及相关对象身份语义。
|
|
473
|
+
|
|
474
|
+
### 相关坏味道
|
|
475
|
+
- 不要求先存在某一种固定坏味道;以具体结构证据为准。
|
|
476
|
+
|
|
477
|
+
### 常见组合
|
|
478
|
+
- 不建立固定流水线;下一步必须重新依据证据选择。
|
|
479
|
+
|
|
480
|
+
### JavaScript 注意事项
|
|
481
|
+
- 保持回调 arity、`this`、默认值、异常和副作用时序。
|
|
482
|
+
|
|
483
|
+
### TypeScript 注意事项
|
|
484
|
+
- 导出函数签名、泛型、overload、DTO 和公共类型都属于兼容契约。
|
|
485
|
+
|
|
486
|
+
### React 注意事项
|
|
487
|
+
- Props/callback、Hook、loader/action、router 和 context API 可能是公共边界。
|
|
488
|
+
|
|
489
|
+
### Vue 注意事项
|
|
490
|
+
- props/emits、composable 返回、Pinia action、route contract 和 injection key 可能是公共边界。
|
|
491
|
+
|
|
492
|
+
### Frontend-Craft 前端适配
|
|
493
|
+
- 优先显式、可测试依赖;Command 只有在 undo/queue/retry/audit/复杂生命周期有价值时才值得引入。
|
|
494
|
+
|
|
495
|
+
### 原创前端变换示例
|
|
496
|
+
- 把“Replace Command with Function”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fec-refactoring-catalog
|
|
3
|
+
description: 已经有结构问题证据,需要在多种保持行为的重构手法之间比较前置条件、选择最小安全方案,或决定多个重构步骤的合理先后关系时。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 重构目录选择
|
|
7
|
+
|
|
8
|
+
## 概览
|
|
9
|
+
把完整重构目录作为决策辅助,而不是自动套用的配方。只有当证据、前置条件和行为契约匹配时,才选择最小可验证的手法。
|
|
10
|
+
|
|
11
|
+
## 工作流
|
|
12
|
+
1. 在[重构目录索引](references/catalog-index.md)定位标准手法。
|
|
13
|
+
2. 若从坏味道或症状出发,使用[选择指南](references/selection-guide.md)比较成因和候选手法。
|
|
14
|
+
3. 若需要多个步骤,使用[组合指南](references/composition-guide.md)只安排当前代码真正需要的前置关系。
|
|
15
|
+
4. 确定手法后再按需加载对应 family 的详细资料。
|
|
16
|
+
|
|
17
|
+
## 选择规则
|
|
18
|
+
- 一个坏味道可能对应多个候选,先确认真实成因。
|
|
19
|
+
- 优先可回滚、局部、小范围的变换,而不是直接大改架构。
|
|
20
|
+
- 执行前检查公共 API、路由、状态所有权、异步/生命周期、持久化和 SSR 边界。
|
|
21
|
+
- 组合关系都是有条件的,不是强制流水线。
|