@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
package/localized/zh-CN/skills/fec-refactoring-inheritance/references/inheritance-refactorings.md
ADDED
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
# 继承关系类重构
|
|
2
|
+
|
|
3
|
+
这些卡片以用户提供的标准重构目录为知识基线,转换为面向前端 Agent 的操作指南。保留标准 ID/中英文名称,框架适配和示例为项目原创内容。
|
|
4
|
+
|
|
5
|
+
## RF-PULL-UP-METHOD — 函数上移(Pull Up Method)
|
|
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-DUPLICATED-CODE`
|
|
32
|
+
|
|
33
|
+
### 常见组合
|
|
34
|
+
- `RF-PUSH-DOWN-METHOD`:仅当下一手法自身前置条件也成立时组合。
|
|
35
|
+
|
|
36
|
+
### JavaScript 注意事项
|
|
37
|
+
- legacy OO 中保持原型行为、构造顺序、`instanceof`、方法绑定和 `super` 调用。
|
|
38
|
+
|
|
39
|
+
### TypeScript 注意事项
|
|
40
|
+
- 检查结构类型、discriminated union、abstract contract、可见性和公共 subtype API。
|
|
41
|
+
|
|
42
|
+
### React 注意事项
|
|
43
|
+
- React 组件通常优先 composition、Hook、render props 或 delegate,而不是类继承。
|
|
44
|
+
|
|
45
|
+
### Vue 注意事项
|
|
46
|
+
- Vue 组件通常优先 composition、composable、slot 和 delegation,而不是继承。
|
|
47
|
+
|
|
48
|
+
### Frontend-Craft 前端适配
|
|
49
|
+
- 这些手法主要服务真实的 legacy OO JS/TS、domain model、SDK、editor engine;组合优先的前端代码应转换其设计意图而不是照搬继承。
|
|
50
|
+
|
|
51
|
+
### 原创前端变换示例
|
|
52
|
+
- 把“Pull Up Method”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
|
|
53
|
+
|
|
54
|
+
## RF-PULL-UP-FIELD — 字段上移(Pull Up Field)
|
|
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
|
+
- `RF-PUSH-DOWN-FIELD`:仅当下一手法自身前置条件也成立时组合。
|
|
84
|
+
|
|
85
|
+
### JavaScript 注意事项
|
|
86
|
+
- legacy OO 中保持原型行为、构造顺序、`instanceof`、方法绑定和 `super` 调用。
|
|
87
|
+
|
|
88
|
+
### TypeScript 注意事项
|
|
89
|
+
- 检查结构类型、discriminated union、abstract contract、可见性和公共 subtype API。
|
|
90
|
+
|
|
91
|
+
### React 注意事项
|
|
92
|
+
- React 组件通常优先 composition、Hook、render props 或 delegate,而不是类继承。
|
|
93
|
+
|
|
94
|
+
### Vue 注意事项
|
|
95
|
+
- Vue 组件通常优先 composition、composable、slot 和 delegation,而不是继承。
|
|
96
|
+
|
|
97
|
+
### Frontend-Craft 前端适配
|
|
98
|
+
- 这些手法主要服务真实的 legacy OO JS/TS、domain model、SDK、editor engine;组合优先的前端代码应转换其设计意图而不是照搬继承。
|
|
99
|
+
|
|
100
|
+
### 原创前端变换示例
|
|
101
|
+
- 把“Pull Up Field”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
|
|
102
|
+
|
|
103
|
+
## RF-PULL-UP-CONSTRUCTOR-BODY — 构造函数本体上移(Pull Up Constructor Body)
|
|
104
|
+
|
|
105
|
+
### 意图
|
|
106
|
+
把子类构造函数中重复且安全的公共初始化上移到超类。
|
|
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
|
+
- legacy OO 中保持原型行为、构造顺序、`instanceof`、方法绑定和 `super` 调用。
|
|
136
|
+
|
|
137
|
+
### TypeScript 注意事项
|
|
138
|
+
- 检查结构类型、discriminated union、abstract contract、可见性和公共 subtype API。
|
|
139
|
+
|
|
140
|
+
### React 注意事项
|
|
141
|
+
- React 组件通常优先 composition、Hook、render props 或 delegate,而不是类继承。
|
|
142
|
+
|
|
143
|
+
### Vue 注意事项
|
|
144
|
+
- Vue 组件通常优先 composition、composable、slot 和 delegation,而不是继承。
|
|
145
|
+
|
|
146
|
+
### Frontend-Craft 前端适配
|
|
147
|
+
- 这些手法主要服务真实的 legacy OO JS/TS、domain model、SDK、editor engine;组合优先的前端代码应转换其设计意图而不是照搬继承。
|
|
148
|
+
|
|
149
|
+
### 原创前端变换示例
|
|
150
|
+
- 把“Pull Up Constructor Body”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
|
|
151
|
+
|
|
152
|
+
## RF-PUSH-DOWN-METHOD — 函数下移(Push Down Method)
|
|
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-REFUSED-BEQUEST`
|
|
179
|
+
|
|
180
|
+
### 常见组合
|
|
181
|
+
- `RF-PULL-UP-METHOD`:仅当下一手法自身前置条件也成立时组合。
|
|
182
|
+
|
|
183
|
+
### JavaScript 注意事项
|
|
184
|
+
- legacy OO 中保持原型行为、构造顺序、`instanceof`、方法绑定和 `super` 调用。
|
|
185
|
+
|
|
186
|
+
### TypeScript 注意事项
|
|
187
|
+
- 检查结构类型、discriminated union、abstract contract、可见性和公共 subtype API。
|
|
188
|
+
|
|
189
|
+
### React 注意事项
|
|
190
|
+
- React 组件通常优先 composition、Hook、render props 或 delegate,而不是类继承。
|
|
191
|
+
|
|
192
|
+
### Vue 注意事项
|
|
193
|
+
- Vue 组件通常优先 composition、composable、slot 和 delegation,而不是继承。
|
|
194
|
+
|
|
195
|
+
### Frontend-Craft 前端适配
|
|
196
|
+
- 这些手法主要服务真实的 legacy OO JS/TS、domain model、SDK、editor engine;组合优先的前端代码应转换其设计意图而不是照搬继承。
|
|
197
|
+
|
|
198
|
+
### 原创前端变换示例
|
|
199
|
+
- 把“Push Down Method”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
|
|
200
|
+
|
|
201
|
+
## RF-PUSH-DOWN-FIELD — 字段下移(Push Down Field)
|
|
202
|
+
|
|
203
|
+
### 意图
|
|
204
|
+
当超类字段只属于部分子类时,把它下移到真正的数据所有者。
|
|
205
|
+
|
|
206
|
+
### 典型信号
|
|
207
|
+
- 当前结构出现与本手法目标一致的重复、耦合、命名、职责、数据所有权或控制流问题,并有具体代码证据。
|
|
208
|
+
|
|
209
|
+
### 不适用条件
|
|
210
|
+
- 当前结构已经清晰,或该变换会制造更强耦合、隐藏依赖、破坏公共契约且没有兼容方案时,不使用。
|
|
211
|
+
|
|
212
|
+
### 前置条件
|
|
213
|
+
- 已明确当前可观察行为、受影响调用者和公共契约。
|
|
214
|
+
- 目标位于声明的差异预算内,并且这个单一主要变换完成后能够立即验证。
|
|
215
|
+
|
|
216
|
+
### 操作步骤
|
|
217
|
+
1. 确认当前行为、调用者和边界,并锁定本步骤只处理这一项主要结构意图。
|
|
218
|
+
2. 创建最小的新结构/位置/接口,让旧行为可以逐步迁移而不是一次性大改。
|
|
219
|
+
3. 一次迁移一个调用点或职责片段,并保持兼容边界。
|
|
220
|
+
4. 运行窄范围验证;若变红,先回滚本步骤,再缩小变换。
|
|
221
|
+
|
|
222
|
+
### 行为保持检查点
|
|
223
|
+
- 对比输入、输出、异常、副作用、执行顺序和公共契约。
|
|
224
|
+
- 前端还要核对 UI 状态、事件、焦点、网络请求、生命周期/状态迁移,以及相关对象身份语义。
|
|
225
|
+
|
|
226
|
+
### 相关坏味道
|
|
227
|
+
- `SMELL-REFUSED-BEQUEST`
|
|
228
|
+
|
|
229
|
+
### 常见组合
|
|
230
|
+
- `RF-PULL-UP-FIELD`:仅当下一手法自身前置条件也成立时组合。
|
|
231
|
+
|
|
232
|
+
### JavaScript 注意事项
|
|
233
|
+
- legacy OO 中保持原型行为、构造顺序、`instanceof`、方法绑定和 `super` 调用。
|
|
234
|
+
|
|
235
|
+
### TypeScript 注意事项
|
|
236
|
+
- 检查结构类型、discriminated union、abstract contract、可见性和公共 subtype API。
|
|
237
|
+
|
|
238
|
+
### React 注意事项
|
|
239
|
+
- React 组件通常优先 composition、Hook、render props 或 delegate,而不是类继承。
|
|
240
|
+
|
|
241
|
+
### Vue 注意事项
|
|
242
|
+
- Vue 组件通常优先 composition、composable、slot 和 delegation,而不是继承。
|
|
243
|
+
|
|
244
|
+
### Frontend-Craft 前端适配
|
|
245
|
+
- 这些手法主要服务真实的 legacy OO JS/TS、domain model、SDK、editor engine;组合优先的前端代码应转换其设计意图而不是照搬继承。
|
|
246
|
+
|
|
247
|
+
### 原创前端变换示例
|
|
248
|
+
- 把“Push Down Field”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
|
|
249
|
+
|
|
250
|
+
## RF-REPLACE-TYPE-CODE-WITH-SUBCLASSES — 以子类取代类型码(Replace Type Code with Subclasses)
|
|
251
|
+
|
|
252
|
+
### 意图
|
|
253
|
+
让稳定变体拥有自己的行为边界;现代前端优先考虑 discriminated union/strategy dispatch,不机械建立继承树。
|
|
254
|
+
|
|
255
|
+
### 典型信号
|
|
256
|
+
- 当前结构出现与本手法目标一致的重复、耦合、命名、职责、数据所有权或控制流问题,并有具体代码证据。
|
|
257
|
+
|
|
258
|
+
### 不适用条件
|
|
259
|
+
- 当前结构已经清晰,或该变换会制造更强耦合、隐藏依赖、破坏公共契约且没有兼容方案时,不使用。
|
|
260
|
+
|
|
261
|
+
### 前置条件
|
|
262
|
+
- 已明确当前可观察行为、受影响调用者和公共契约。
|
|
263
|
+
- 目标位于声明的差异预算内,并且这个单一主要变换完成后能够立即验证。
|
|
264
|
+
|
|
265
|
+
### 操作步骤
|
|
266
|
+
1. 确认当前行为、调用者和边界,并锁定本步骤只处理这一项主要结构意图。
|
|
267
|
+
2. 创建最小的新结构/位置/接口,让旧行为可以逐步迁移而不是一次性大改。
|
|
268
|
+
3. 一次迁移一个调用点或职责片段,并保持兼容边界。
|
|
269
|
+
4. 运行窄范围验证;若变红,先回滚本步骤,再缩小变换。
|
|
270
|
+
|
|
271
|
+
### 行为保持检查点
|
|
272
|
+
- 对比输入、输出、异常、副作用、执行顺序和公共契约。
|
|
273
|
+
- 前端还要核对 UI 状态、事件、焦点、网络请求、生命周期/状态迁移,以及相关对象身份语义。
|
|
274
|
+
|
|
275
|
+
### 相关坏味道
|
|
276
|
+
- `SMELL-PRIMITIVE-OBSESSION`
|
|
277
|
+
- `SMELL-LARGE-CLASS`
|
|
278
|
+
|
|
279
|
+
### 常见组合
|
|
280
|
+
- 以多态取代条件表达式(Replace Conditional with Polymorphism):仅当下一手法自身前置条件也成立时组合。
|
|
281
|
+
- `RF-REMOVE-SUBCLASS`:仅当下一手法自身前置条件也成立时组合。
|
|
282
|
+
|
|
283
|
+
### JavaScript 注意事项
|
|
284
|
+
- legacy OO 中保持原型行为、构造顺序、`instanceof`、方法绑定和 `super` 调用。
|
|
285
|
+
|
|
286
|
+
### TypeScript 注意事项
|
|
287
|
+
- 检查结构类型、discriminated union、abstract contract、可见性和公共 subtype API。
|
|
288
|
+
|
|
289
|
+
### React 注意事项
|
|
290
|
+
- React 组件通常优先 composition、Hook、render props 或 delegate,而不是类继承。
|
|
291
|
+
|
|
292
|
+
### Vue 注意事项
|
|
293
|
+
- Vue 组件通常优先 composition、composable、slot 和 delegation,而不是继承。
|
|
294
|
+
|
|
295
|
+
### Frontend-Craft 前端适配
|
|
296
|
+
- 这些手法主要服务真实的 legacy OO JS/TS、domain model、SDK、editor engine;组合优先的前端代码应转换其设计意图而不是照搬继承。
|
|
297
|
+
|
|
298
|
+
### 原创前端变换示例
|
|
299
|
+
- 编辑器 mode string 驱动多个 switch 时,现代前端可用 discriminated union + strategy registry;只有真实 OO 模型才使用子类。
|
|
300
|
+
|
|
301
|
+
## RF-REMOVE-SUBCLASS — 移除子类(Remove Subclass)
|
|
302
|
+
|
|
303
|
+
### 意图
|
|
304
|
+
当子类差异已经没有独立类型价值时,将差异收回数据或更简单的行为表示并移除子类。
|
|
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
|
+
- 不要求先存在某一种固定坏味道;以具体结构证据为准。
|
|
328
|
+
|
|
329
|
+
### 常见组合
|
|
330
|
+
- 不建立固定流水线;下一步必须重新依据证据选择。
|
|
331
|
+
|
|
332
|
+
### JavaScript 注意事项
|
|
333
|
+
- legacy OO 中保持原型行为、构造顺序、`instanceof`、方法绑定和 `super` 调用。
|
|
334
|
+
|
|
335
|
+
### TypeScript 注意事项
|
|
336
|
+
- 检查结构类型、discriminated union、abstract contract、可见性和公共 subtype API。
|
|
337
|
+
|
|
338
|
+
### React 注意事项
|
|
339
|
+
- React 组件通常优先 composition、Hook、render props 或 delegate,而不是类继承。
|
|
340
|
+
|
|
341
|
+
### Vue 注意事项
|
|
342
|
+
- Vue 组件通常优先 composition、composable、slot 和 delegation,而不是继承。
|
|
343
|
+
|
|
344
|
+
### Frontend-Craft 前端适配
|
|
345
|
+
- 这些手法主要服务真实的 legacy OO JS/TS、domain model、SDK、editor engine;组合优先的前端代码应转换其设计意图而不是照搬继承。
|
|
346
|
+
|
|
347
|
+
### 原创前端变换示例
|
|
348
|
+
- 把“Remove Subclass”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
|
|
349
|
+
|
|
350
|
+
## RF-EXTRACT-SUPERCLASS — 提炼超类(Extract Superclass)
|
|
351
|
+
|
|
352
|
+
### 意图
|
|
353
|
+
当多个类真正共享职责且替换关系有价值时,提炼共同抽象;仅为去重几行代码不值得建立继承。
|
|
354
|
+
|
|
355
|
+
### 典型信号
|
|
356
|
+
- 当前结构出现与本手法目标一致的重复、耦合、命名、职责、数据所有权或控制流问题,并有具体代码证据。
|
|
357
|
+
|
|
358
|
+
### 不适用条件
|
|
359
|
+
- 仅为了消除几行重复、但不存在真实替换关系时,优先组合或共享函数。
|
|
360
|
+
|
|
361
|
+
### 前置条件
|
|
362
|
+
- 已明确当前可观察行为、受影响调用者和公共契约。
|
|
363
|
+
- 目标位于声明的差异预算内,并且这个单一主要变换完成后能够立即验证。
|
|
364
|
+
|
|
365
|
+
### 操作步骤
|
|
366
|
+
1. 确认当前行为、调用者和边界,并锁定本步骤只处理这一项主要结构意图。
|
|
367
|
+
2. 创建最小的新结构/位置/接口,让旧行为可以逐步迁移而不是一次性大改。
|
|
368
|
+
3. 一次迁移一个调用点或职责片段,并保持兼容边界。
|
|
369
|
+
4. 运行窄范围验证;若变红,先回滚本步骤,再缩小变换。
|
|
370
|
+
|
|
371
|
+
### 行为保持检查点
|
|
372
|
+
- 对比输入、输出、异常、副作用、执行顺序和公共契约。
|
|
373
|
+
- 前端还要核对 UI 状态、事件、焦点、网络请求、生命周期/状态迁移,以及相关对象身份语义。
|
|
374
|
+
|
|
375
|
+
### 相关坏味道
|
|
376
|
+
- `SMELL-LARGE-CLASS`
|
|
377
|
+
- `SMELL-ALTERNATIVE-CLASSES-DIFFERENT-INTERFACES`
|
|
378
|
+
|
|
379
|
+
### 常见组合
|
|
380
|
+
- 不建立固定流水线;下一步必须重新依据证据选择。
|
|
381
|
+
|
|
382
|
+
### JavaScript 注意事项
|
|
383
|
+
- legacy OO 中保持原型行为、构造顺序、`instanceof`、方法绑定和 `super` 调用。
|
|
384
|
+
|
|
385
|
+
### TypeScript 注意事项
|
|
386
|
+
- 检查结构类型、discriminated union、abstract contract、可见性和公共 subtype API。
|
|
387
|
+
|
|
388
|
+
### React 注意事项
|
|
389
|
+
- React 组件通常优先 composition、Hook、render props 或 delegate,而不是类继承。
|
|
390
|
+
|
|
391
|
+
### Vue 注意事项
|
|
392
|
+
- Vue 组件通常优先 composition、composable、slot 和 delegation,而不是继承。
|
|
393
|
+
|
|
394
|
+
### Frontend-Craft 前端适配
|
|
395
|
+
- 这些手法主要服务真实的 legacy OO JS/TS、domain model、SDK、editor engine;组合优先的前端代码应转换其设计意图而不是照搬继承。
|
|
396
|
+
|
|
397
|
+
### 原创前端变换示例
|
|
398
|
+
- 把“Extract Superclass”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
|
|
399
|
+
|
|
400
|
+
## RF-COLLAPSE-HIERARCHY — 折叠继承体系(Collapse Hierarchy)
|
|
401
|
+
|
|
402
|
+
### 意图
|
|
403
|
+
当某个继承层级已没有有意义差异时合并层级,减少无价值类型间接层。
|
|
404
|
+
|
|
405
|
+
### 典型信号
|
|
406
|
+
- 当前结构出现与本手法目标一致的重复、耦合、命名、职责、数据所有权或控制流问题,并有具体代码证据。
|
|
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-LAZY-ELEMENT`
|
|
427
|
+
- `SMELL-SPECULATIVE-GENERALITY`
|
|
428
|
+
|
|
429
|
+
### 常见组合
|
|
430
|
+
- 不建立固定流水线;下一步必须重新依据证据选择。
|
|
431
|
+
|
|
432
|
+
### JavaScript 注意事项
|
|
433
|
+
- legacy OO 中保持原型行为、构造顺序、`instanceof`、方法绑定和 `super` 调用。
|
|
434
|
+
|
|
435
|
+
### TypeScript 注意事项
|
|
436
|
+
- 检查结构类型、discriminated union、abstract contract、可见性和公共 subtype API。
|
|
437
|
+
|
|
438
|
+
### React 注意事项
|
|
439
|
+
- React 组件通常优先 composition、Hook、render props 或 delegate,而不是类继承。
|
|
440
|
+
|
|
441
|
+
### Vue 注意事项
|
|
442
|
+
- Vue 组件通常优先 composition、composable、slot 和 delegation,而不是继承。
|
|
443
|
+
|
|
444
|
+
### Frontend-Craft 前端适配
|
|
445
|
+
- 这些手法主要服务真实的 legacy OO JS/TS、domain model、SDK、editor engine;组合优先的前端代码应转换其设计意图而不是照搬继承。
|
|
446
|
+
|
|
447
|
+
### 原创前端变换示例
|
|
448
|
+
- 把“Collapse Hierarchy”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
|
|
449
|
+
|
|
450
|
+
## RF-REPLACE-SUBCLASS-WITH-DELEGATE — 以委托取代子类(Replace Subclass with Delegate)
|
|
451
|
+
|
|
452
|
+
### 意图
|
|
453
|
+
把一个变化维度从继承转为委托/策略,使对象能更灵活地组合行为。
|
|
454
|
+
|
|
455
|
+
### 典型信号
|
|
456
|
+
- 当前结构出现与本手法目标一致的重复、耦合、命名、职责、数据所有权或控制流问题,并有具体代码证据。
|
|
457
|
+
|
|
458
|
+
### 不适用条件
|
|
459
|
+
- 当前结构已经清晰,或该变换会制造更强耦合、隐藏依赖、破坏公共契约且没有兼容方案时,不使用。
|
|
460
|
+
|
|
461
|
+
### 前置条件
|
|
462
|
+
- 已明确当前可观察行为、受影响调用者和公共契约。
|
|
463
|
+
- 目标位于声明的差异预算内,并且这个单一主要变换完成后能够立即验证。
|
|
464
|
+
|
|
465
|
+
### 操作步骤
|
|
466
|
+
1. 确认当前行为、调用者和边界,并锁定本步骤只处理这一项主要结构意图。
|
|
467
|
+
2. 创建最小的新结构/位置/接口,让旧行为可以逐步迁移而不是一次性大改。
|
|
468
|
+
3. 一次迁移一个调用点或职责片段,并保持兼容边界。
|
|
469
|
+
4. 运行窄范围验证;若变红,先回滚本步骤,再缩小变换。
|
|
470
|
+
|
|
471
|
+
### 行为保持检查点
|
|
472
|
+
- 对比输入、输出、异常、副作用、执行顺序和公共契约。
|
|
473
|
+
- 前端还要核对 UI 状态、事件、焦点、网络请求、生命周期/状态迁移,以及相关对象身份语义。
|
|
474
|
+
|
|
475
|
+
### 相关坏味道
|
|
476
|
+
- `SMELL-MIDDLE-MAN`
|
|
477
|
+
- `SMELL-INSIDER-TRADING`
|
|
478
|
+
- `SMELL-REFUSED-BEQUEST`
|
|
479
|
+
|
|
480
|
+
### 常见组合
|
|
481
|
+
- `RF-REPLACE-SUPERCLASS-WITH-DELEGATE`:仅当下一手法自身前置条件也成立时组合。
|
|
482
|
+
|
|
483
|
+
### JavaScript 注意事项
|
|
484
|
+
- legacy OO 中保持原型行为、构造顺序、`instanceof`、方法绑定和 `super` 调用。
|
|
485
|
+
|
|
486
|
+
### TypeScript 注意事项
|
|
487
|
+
- 检查结构类型、discriminated union、abstract contract、可见性和公共 subtype API。
|
|
488
|
+
|
|
489
|
+
### React 注意事项
|
|
490
|
+
- React 组件通常优先 composition、Hook、render props 或 delegate,而不是类继承。
|
|
491
|
+
|
|
492
|
+
### Vue 注意事项
|
|
493
|
+
- Vue 组件通常优先 composition、composable、slot 和 delegation,而不是继承。
|
|
494
|
+
|
|
495
|
+
### Frontend-Craft 前端适配
|
|
496
|
+
- 这些手法主要服务真实的 legacy OO JS/TS、domain model、SDK、editor engine;组合优先的前端代码应转换其设计意图而不是照搬继承。
|
|
497
|
+
|
|
498
|
+
### 原创前端变换示例
|
|
499
|
+
- 把“Replace Subclass with Delegate”应用到一个局部组件/Hook/Composable/Service 范围内,先记录行为契约,只迁移一个职责片段,并立即验证输出、事件与状态变化保持不变。
|
|
500
|
+
|
|
501
|
+
## RF-REPLACE-SUPERCLASS-WITH-DELEGATE — 以委托取代超类(Replace Superclass with Delegate)
|
|
502
|
+
|
|
503
|
+
### 意图
|
|
504
|
+
当继承只是为了复用实现而不满足真实替换关系时,改为持有并委托所需能力。
|
|
505
|
+
|
|
506
|
+
### 典型信号
|
|
507
|
+
- 当前结构出现与本手法目标一致的重复、耦合、命名、职责、数据所有权或控制流问题,并有具体代码证据。
|
|
508
|
+
|
|
509
|
+
### 不适用条件
|
|
510
|
+
- 当前结构已经清晰,或该变换会制造更强耦合、隐藏依赖、破坏公共契约且没有兼容方案时,不使用。
|
|
511
|
+
|
|
512
|
+
### 前置条件
|
|
513
|
+
- 已明确当前可观察行为、受影响调用者和公共契约。
|
|
514
|
+
- 目标位于声明的差异预算内,并且这个单一主要变换完成后能够立即验证。
|
|
515
|
+
|
|
516
|
+
### 操作步骤
|
|
517
|
+
1. 确认当前行为、调用者和边界,并锁定本步骤只处理这一项主要结构意图。
|
|
518
|
+
2. 创建最小的新结构/位置/接口,让旧行为可以逐步迁移而不是一次性大改。
|
|
519
|
+
3. 一次迁移一个调用点或职责片段,并保持兼容边界。
|
|
520
|
+
4. 运行窄范围验证;若变红,先回滚本步骤,再缩小变换。
|
|
521
|
+
|
|
522
|
+
### 行为保持检查点
|
|
523
|
+
- 对比输入、输出、异常、副作用、执行顺序和公共契约。
|
|
524
|
+
- 前端还要核对 UI 状态、事件、焦点、网络请求、生命周期/状态迁移,以及相关对象身份语义。
|
|
525
|
+
|
|
526
|
+
### 相关坏味道
|
|
527
|
+
- `SMELL-MIDDLE-MAN`
|
|
528
|
+
- `SMELL-INSIDER-TRADING`
|
|
529
|
+
- `SMELL-REFUSED-BEQUEST`
|
|
530
|
+
|
|
531
|
+
### 常见组合
|
|
532
|
+
- 不建立固定流水线;下一步必须重新依据证据选择。
|
|
533
|
+
|
|
534
|
+
### JavaScript 注意事项
|
|
535
|
+
- legacy OO 中保持原型行为、构造顺序、`instanceof`、方法绑定和 `super` 调用。
|
|
536
|
+
|
|
537
|
+
### TypeScript 注意事项
|
|
538
|
+
- 检查结构类型、discriminated union、abstract contract、可见性和公共 subtype API。
|
|
539
|
+
|
|
540
|
+
### React 注意事项
|
|
541
|
+
- React 组件通常优先 composition、Hook、render props 或 delegate,而不是类继承。
|
|
542
|
+
|
|
543
|
+
### Vue 注意事项
|
|
544
|
+
- Vue 组件通常优先 composition、composable、slot 和 delegation,而不是继承。
|
|
545
|
+
|
|
546
|
+
### Frontend-Craft 前端适配
|
|
547
|
+
- 这些手法主要服务真实的 legacy OO JS/TS、domain model、SDK、editor engine;组合优先的前端代码应转换其设计意图而不是照搬继承。
|
|
548
|
+
|
|
549
|
+
### 原创前端变换示例
|
|
550
|
+
- 编辑器仅为了复用集合实现而 extends Collection,可改为持有 collection delegate,只暴露编辑器真正需要的能力。
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fec-refactoring-move-features
|
|
3
|
+
description: 保持行为的前端重构主要涉及搬移特性类重构,已经选定或正在评估对应手法,需要查询该 family 的操作步骤、风险与 JavaScript/TypeScript/React/Vue 适配时。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 搬移特性类重构
|
|
7
|
+
|
|
8
|
+
## 概览
|
|
9
|
+
只有在证据和前置条件支持时才使用对应手法。一次只执行一个主要结构变换,并在完成后立即验证。
|
|
10
|
+
|
|
11
|
+
## 执行流程
|
|
12
|
+
1. 在[搬移特性类重构详细卡片](references/moving-refactorings.md)确认手法和前置条件。
|
|
13
|
+
2. 记录受影响行为与差异预算。
|
|
14
|
+
3. 只执行该手法最小可行的一步。
|
|
15
|
+
4. 在组合下一手法之前验证当前步骤。
|
|
16
|
+
5. 公共契约、生命周期、状态身份或实际范围超出预期时停止并重新评估。
|
|
17
|
+
|
|
18
|
+
## 快速索引
|
|
19
|
+
详细 Reference 包含本 family 的 9 个标准手法,每项均包括意图、信号、不适用条件、操作步骤、行为保持检查、相关坏味道、组合关系、JS/TS/React/Vue 注意事项、前端适配和原创示例。
|
|
20
|
+
|
|
21
|
+
## 常见错误
|
|
22
|
+
- 只根据手法名称套用,不核对前置条件。
|
|
23
|
+
- 一个 diff 同时混入多个结构目标。
|
|
24
|
+
- 把经典 class 形式机械套进现代 React/Vue。
|
|
25
|
+
- 相关行为没有覆盖时,仅凭“测试通过”就声称行为已得到证明。
|