@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,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fec-browser-storage
|
|
3
|
+
description: 用于选择、实现或审查 localStorage、sessionStorage、IndexedDB、cookie、客户端持久化、离线数据、安全存储或清理策略等浏览器存储方案;中文触发词包括 浏览器存储、客户端持久化。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 浏览器存储
|
|
7
|
+
|
|
8
|
+
## 用途
|
|
9
|
+
|
|
10
|
+
根据数据大小、安全要求和生命周期选择合适的客户端存储方案。
|
|
11
|
+
|
|
12
|
+
## 流程
|
|
13
|
+
|
|
14
|
+
1. 先判断数据敏感度、体积、生命周期、是否需要跨 Tab、是否需要随请求发送。
|
|
15
|
+
2. 小量非敏感偏好用 localStorage;Tab 级临时数据用 sessionStorage;大量结构化数据或离线缓存用 IndexedDB;认证态优先 httpOnly cookie。
|
|
16
|
+
3. 封装统一 key 前缀、JSON parse/stringify、异常处理、过期清理和 quota 兜底。
|
|
17
|
+
4. 敏感数据按安全规则处理,不把明文 token、密码、信用卡信息放进可被 JS 读取的存储。
|
|
18
|
+
5. 审查隐私模式、存储配额、清理策略和跨浏览器兼容性。
|
|
19
|
+
|
|
20
|
+
## 详细参考
|
|
21
|
+
|
|
22
|
+
涉及存储选型表、localStorage/sessionStorage 封装、IndexedDB 示例、Cookie 辅助方法和敏感数据规则时,加载 [references/storage-patterns.md](references/storage-patterns.md)。
|
|
23
|
+
|
|
24
|
+
## 约束
|
|
25
|
+
|
|
26
|
+
- localStorage/sessionStorage 是同步 API,大数据读写会阻塞主线程。
|
|
27
|
+
- 除 httpOnly cookie 外,客户端存储都可被 XSS 读取。
|
|
28
|
+
- Cookie 每次请求自动携带,不适合大数据。
|
|
29
|
+
- IndexedDB 配额和隐私模式行为有浏览器差异。
|
|
30
|
+
- URL 中不要传 token 或敏感数据。
|
|
31
|
+
|
|
32
|
+
## 预期输出
|
|
33
|
+
|
|
34
|
+
产出统一的 storage/cookie/db 封装,key 有命名空间,数据有过期或清理策略,敏感数据只进入合适的安全边界。
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# 浏览器存储模式
|
|
2
|
+
|
|
3
|
+
## 选型表
|
|
4
|
+
|
|
5
|
+
| 存储 | 容量 | API | 是否发送服务端 | 适用场景 | 安全性 |
|
|
6
|
+
| --- | --- | --- | --- | --- | --- |
|
|
7
|
+
| LocalStorage | ~5MB | 同步 | 否 | 用户偏好、非敏感持久数据 | XSS 可读取 |
|
|
8
|
+
| SessionStorage | ~5MB | 同步 | 否 | Tab 级临时数据 | XSS 可读取 |
|
|
9
|
+
| IndexedDB | 大 | 异步 | 否 | 大数据、文件、离线缓存 | XSS 可读取 |
|
|
10
|
+
| Cookie | ~4KB | 同步 | 是 | 认证 Session/httpOnly token | httpOnly 可防 JS 读取 |
|
|
11
|
+
|
|
12
|
+
## localStorage 封装
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
const STORAGE_PREFIX = "app:";
|
|
16
|
+
|
|
17
|
+
export const storage = {
|
|
18
|
+
get<T>(key: string): T | null {
|
|
19
|
+
try {
|
|
20
|
+
const raw = localStorage.getItem(STORAGE_PREFIX + key);
|
|
21
|
+
return raw ? JSON.parse(raw) : null;
|
|
22
|
+
} catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
set<T>(key: string, value: T): void {
|
|
27
|
+
localStorage.setItem(STORAGE_PREFIX + key, JSON.stringify(value));
|
|
28
|
+
},
|
|
29
|
+
remove(key: string): void {
|
|
30
|
+
localStorage.removeItem(STORAGE_PREFIX + key);
|
|
31
|
+
},
|
|
32
|
+
clear(): void {
|
|
33
|
+
Object.keys(localStorage)
|
|
34
|
+
.filter((key) => key.startsWith(STORAGE_PREFIX))
|
|
35
|
+
.forEach((key) => localStorage.removeItem(key));
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## IndexedDB
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { openDB } from "idb";
|
|
44
|
+
|
|
45
|
+
export const db = openDB("app-offline-db", 1, {
|
|
46
|
+
upgrade(database) {
|
|
47
|
+
if (!database.objectStoreNames.contains("requests")) {
|
|
48
|
+
database.createObjectStore("requests", { keyPath: "id" });
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Cookie
|
|
55
|
+
|
|
56
|
+
- httpOnly 只能由服务端设置。
|
|
57
|
+
- 认证 Cookie 使用 `Secure`、`SameSite=Lax/Strict`。
|
|
58
|
+
- 需要跨站点嵌入时才考虑 `SameSite=None; Secure`。
|
|
59
|
+
|
|
60
|
+
## 敏感数据规则
|
|
61
|
+
|
|
62
|
+
- 认证 token、刷新 token、Session ID:优先 httpOnly cookie。
|
|
63
|
+
- 用户偏好:localStorage。
|
|
64
|
+
- 表单草稿:sessionStorage 或 IndexedDB,避免敏感字段。
|
|
65
|
+
- 离线数据:IndexedDB,但不要缓存隐私或高价值敏感数据。
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fec-canvas-threejs
|
|
3
|
+
description: 用于构建或审查 Canvas 2D、Three.js/WebGL、React Three Fiber、GLSL shader、ShaderToy 到 WebGL 适配、2D/3D 可视化、游戏渲染、动画循环、GPU 资源清理或渲染性能。不要用于标准 DOM UI、已有图表库覆盖的图表或非图形类性能工作;中文触发词包括 Canvas、Three.js、WebGL、GLSL、Shader、3D、数据可视化、游戏。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Canvas 与 Three.js
|
|
7
|
+
|
|
8
|
+
## 用途
|
|
9
|
+
|
|
10
|
+
在浏览器中实现高性能 2D/3D 图形渲染。
|
|
11
|
+
|
|
12
|
+
## 流程
|
|
13
|
+
|
|
14
|
+
1. 先选渲染层:标准 UI 用 DOM;简单 2D 图形/签名/粒子用 Canvas 2D;3D 模型、空间交互和复杂粒子用 Three.js/WebGL;React 项目中的声明式 3D 用 React Three Fiber。
|
|
15
|
+
2. 为渲染容器定义稳定尺寸、DPI 适配和 resize 行为;Canvas 不会自动随 CSS 清晰缩放。
|
|
16
|
+
3. 动画循环使用 `requestAnimationFrame`,不可见或无变化时暂停,卸载时取消。
|
|
17
|
+
4. Three.js 必须释放 geometry/material/texture/renderer,并移除事件监听和 observer。
|
|
18
|
+
5. Shader/WebGL 任务先识别是 SDF、ray marching、noise、particle、post-processing、multipass 还是调试问题,再决定是否需要原生 WebGL2、Three.js ShaderMaterial 或 R3F。
|
|
19
|
+
6. WebGL2 适配时检查 GLSL 版本、入口函数、varying/in-out、texture API、uniform 使用和函数声明顺序,避免白屏只留控制台错误。
|
|
20
|
+
7. 对不可访问的图形内容提供 `aria-label`、替代文本或 DOM 版摘要;交互式图形要有键盘兜底。
|
|
21
|
+
|
|
22
|
+
## 核心模式
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
const dpr = Math.min(window.devicePixelRatio || 1, 2);
|
|
26
|
+
canvas.width = width * dpr;
|
|
27
|
+
canvas.height = height * dpr;
|
|
28
|
+
canvas.style.width = `${width}px`;
|
|
29
|
+
canvas.style.height = `${height}px`;
|
|
30
|
+
ctx.scale(dpr, dpr);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
let animationId = 0;
|
|
35
|
+
function animate() {
|
|
36
|
+
animationId = requestAnimationFrame(animate);
|
|
37
|
+
renderer.render(scene, camera);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return () => {
|
|
41
|
+
cancelAnimationFrame(animationId);
|
|
42
|
+
geometry.dispose();
|
|
43
|
+
material.dispose();
|
|
44
|
+
renderer.dispose();
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 详细参考
|
|
49
|
+
|
|
50
|
+
涉及 Canvas 2D 绘图、动画循环、Three.js 场景搭建、React Three Fiber、InstancedMesh 和性能清理时,加载 [references/rendering-patterns.md](references/rendering-patterns.md)。
|
|
51
|
+
|
|
52
|
+
涉及着色器路由、WebGL2 适配、GLSL 调试、多 pass 预算和视觉验证时,加载 [references/shader-webgl-patterns.md](references/shader-webgl-patterns.md)。
|
|
53
|
+
|
|
54
|
+
## 约束
|
|
55
|
+
|
|
56
|
+
- Canvas/WebGL 内容对屏幕阅读器不可见,必须提供替代语义。
|
|
57
|
+
- WebGL 消耗 GPU,低端设备需限制像素比、面数和纹理大小。
|
|
58
|
+
- Three.js 资源不会自动释放,遗漏 `dispose()` 会造成 GPU 内存泄漏。
|
|
59
|
+
- Canvas 响应式必须同步 CSS 尺寸、绘图尺寸和相机/viewport。
|
|
60
|
+
- 复杂布局/路径规划可联用后台线程 workflow,但渲染本身仍在主线程/渲染线程协调。
|
|
61
|
+
- Shader 主循环、采样层数和多 pass 数量必须有预算;低端设备上要降低 DPR、步数、粒子数或禁用重后处理。
|
|
62
|
+
- 交付前必须确认 canvas 非空、尺寸正确、resize 后不拉伸、控制台无 shader compile/link 错误。
|
|
63
|
+
|
|
64
|
+
## 预期输出
|
|
65
|
+
|
|
66
|
+
2D/3D 场景清晰、响应式、可清理,关键设备上接近 60fps;用户能通过替代文本或键盘路径理解/操作核心内容。
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Canvas、Three.js 与 R3F 模式
|
|
2
|
+
|
|
3
|
+
## Canvas 2D
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
const canvas = document.getElementById("chart") as HTMLCanvasElement;
|
|
7
|
+
const ctx = canvas.getContext("2d");
|
|
8
|
+
if (!ctx) throw new Error("Canvas 2D is unavailable");
|
|
9
|
+
|
|
10
|
+
ctx.fillStyle = "#3b82f6";
|
|
11
|
+
ctx.fillRect(10, 10, 50, 50);
|
|
12
|
+
ctx.beginPath();
|
|
13
|
+
ctx.arc(100, 100, 30, 0, Math.PI * 2);
|
|
14
|
+
ctx.fill();
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 动画循环
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
let animationId = 0;
|
|
21
|
+
|
|
22
|
+
function animate() {
|
|
23
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
24
|
+
updateParticles();
|
|
25
|
+
drawParticles(ctx);
|
|
26
|
+
animationId = requestAnimationFrame(animate);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
animate();
|
|
30
|
+
return () => cancelAnimationFrame(animationId);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Three.js 基础场景
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
const scene = new THREE.Scene();
|
|
37
|
+
const camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 1000);
|
|
38
|
+
const renderer = new THREE.WebGLRenderer({ antialias: true });
|
|
39
|
+
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
|
|
40
|
+
|
|
41
|
+
const geometry = new THREE.BoxGeometry(1, 1, 1);
|
|
42
|
+
const material = new THREE.MeshStandardMaterial({ color: 0x00ff00 });
|
|
43
|
+
const cube = new THREE.Mesh(geometry, material);
|
|
44
|
+
scene.add(cube);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## React Three Fiber
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
<Canvas camera={{ position: [0, 0, 5], fov: 75 }} role="img" aria-label="3D 产品预览">
|
|
51
|
+
<ambientLight intensity={0.5} />
|
|
52
|
+
<directionalLight position={[5, 5, 5]} />
|
|
53
|
+
<mesh>
|
|
54
|
+
<boxGeometry />
|
|
55
|
+
<meshStandardMaterial color="hotpink" />
|
|
56
|
+
</mesh>
|
|
57
|
+
<OrbitControls />
|
|
58
|
+
</Canvas>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 性能与清理
|
|
62
|
+
|
|
63
|
+
- 纹理尽量压缩并限制尺寸,常规上限先按 2048px 评估。
|
|
64
|
+
- 重复几何体用 `InstancedMesh`。
|
|
65
|
+
- 不需要持续重绘时暂停 animation loop。
|
|
66
|
+
- 卸载时释放 geometry、material、texture、renderer、controls。
|
|
67
|
+
- ResizeObserver 更新相机 aspect 和 renderer size。
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Shader 与 WebGL 模式
|
|
2
|
+
|
|
3
|
+
## 技术选型参考
|
|
4
|
+
|
|
5
|
+
| 目标 | 推荐起点 | 注意事项 |
|
|
6
|
+
| ------------------ | ------------------ | ------------------------------ |
|
|
7
|
+
| 数学几何 3D 形态 | SDF + 光线步进 | 步数上限、法线质量、软阴影开销 |
|
|
8
|
+
| 有机运动效果 | 噪声 + 域扭曲 | 过度绘制、重复噪声调用 |
|
|
9
|
+
| 粒子效果 | 实例化或着色器粒子 | 移动端粒子数量上限、混合开销 |
|
|
10
|
+
| 泛光/故障/色彩调整 | 后处理通道 | 额外帧缓冲区显存 |
|
|
11
|
+
| 持续模拟 | 乒乓帧缓冲区 | 纹理格式支持 |
|
|
12
|
+
| 白屏调试 | 编译/链接日志 | 函数顺序、被优化掉的 uniform |
|
|
13
|
+
|
|
14
|
+
## WebGL2 适配清单
|
|
15
|
+
|
|
16
|
+
- 片元着色器以 `#version 300 es` 开头。
|
|
17
|
+
- 添加 `precision highp float;` 和 `out vec4 fragColor;`。
|
|
18
|
+
- 用 `in`/`out` 替代旧版 `varying`。
|
|
19
|
+
- 用 `texture()` 替代 `texture2D()`。
|
|
20
|
+
- 将 ShaderToy 风格的 `mainImage` 包装为标准 `main`。
|
|
21
|
+
- 使用 `gl_FragCoord.xy` 获取片元坐标。
|
|
22
|
+
- 辅助函数必须在被调用前声明。
|
|
23
|
+
- 预计算常量,不要在宏定义中放函数调用。
|
|
24
|
+
|
|
25
|
+
## 运行时骨架
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
const gl = canvas.getContext("webgl2");
|
|
29
|
+
if (!gl) throw new Error("WebGL2 is unavailable");
|
|
30
|
+
|
|
31
|
+
function compile(type: number, source: string) {
|
|
32
|
+
const shader = gl.createShader(type);
|
|
33
|
+
if (!shader) throw new Error("Cannot create shader");
|
|
34
|
+
gl.shaderSource(shader, source.trim());
|
|
35
|
+
gl.compileShader(shader);
|
|
36
|
+
|
|
37
|
+
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
|
|
38
|
+
throw new Error(gl.getShaderInfoLog(shader) ?? "Shader compile failed");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return shader;
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 性能预算
|
|
46
|
+
|
|
47
|
+
- 光线步进步数:从 64 起步,仅在出现伪影且证明必要时再提升。
|
|
48
|
+
- 体积采样:桌面端每条射线 16-24 次,移动端酌情降低。
|
|
49
|
+
- FBM 倍频:从 4 开始;避免在光线循环内嵌套 FBM。
|
|
50
|
+
- DPR:桌面端上限 2,移动端重度场景上限 1.5。
|
|
51
|
+
- 纹理尺寸:使用压缩或缩放资源;不要假设 4K 纹理是安全的。
|
|
52
|
+
|
|
53
|
+
## 调试视图
|
|
54
|
+
|
|
55
|
+
- 法线:输出归一化后的法线,映射到 0-1 范围。
|
|
56
|
+
- 步数:输出当前步数除以最大步数。
|
|
57
|
+
- 距离/深度:以灰度输出命中距离。
|
|
58
|
+
- UV:映射后输出 `vec3(uv, 0.0)`。
|
|
59
|
+
- 材质 ID:将 ID 映射到少量固定调色板。
|
|
60
|
+
|
|
61
|
+
## 视觉验证
|
|
62
|
+
|
|
63
|
+
- 桌面端和移动端尺寸下 Canvas 不为空白。
|
|
64
|
+
- 缩放时更新绘制缓冲区、视口、相机纵横比和 uniform。
|
|
65
|
+
- 低功耗模式下仍能响应,或有静态降级方案。
|
|
66
|
+
- 控制台无着色器编译/链接错误。
|
|
67
|
+
- 卸载或场景隐藏时停止动画。
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fec-code-review
|
|
3
|
+
description: 用于用户要求通用前端代码评审、PR 评审、合并就绪评估、架构可维护性、类型安全、渲染/状态风险、样式一致性、可测性缺口或横向评审总结时。深度安全、无障碍、E2E 或性能问题应委托对应专项 skill;中文触发词包括 代码审查、代码评审、review。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 前端代码评审
|
|
7
|
+
|
|
8
|
+
## 评审模式与覆盖范围
|
|
9
|
+
|
|
10
|
+
用户明确指定的范围优先于默认行为。采用以下三种审核模式:
|
|
11
|
+
|
|
12
|
+
- **改动审核**:仅在明确要求或当前任务已明确最近改动、本次修改、暂存区、PR 或提交上下文时,审核这些改动及必要上下文。本地模式在请求范围内检查暂存、未暂存差异及相关未跟踪项目文件;仅要求暂存区时只审核暂存改动。无改动时说明没有可审核的改动,不自动切换到最近提交或扩大范围。
|
|
13
|
+
- **指定范围审核**:用户指定文件或目录时,建立范围内文件清单,审核其中现有代码,包括未改动代码;不要求 Git 差异。
|
|
14
|
+
- **全项目审核(默认)**:未指定范围或改动上下文,或明确要求审核整个项目时,建立项目自有前端代码、相关测试、配置和依赖声明的清单,再按模块分批审核,包括未改动代码;不要求 Git 差异。
|
|
15
|
+
|
|
16
|
+
先选择范围,再收集差异。仅指定文件或目录表示全量审核该范围;路径与明确改动请求同时出现时,仅增量审核该路径的改动。未限定的调用即使存在 Git 改动也默认全项目审核。开始审核时说明选定模式和目标范围。修改后自动委托审核时,显式传入本次改动范围,避免无范围调用触发全项目审核。
|
|
17
|
+
|
|
18
|
+
默认排除依赖目录、构建产物、缓存、生成文件和第三方代码,并记录排除项。保持前端职责边界,不宣称完成后端专项审核。目标不存在或范围内无相关文件时,明确说明,不替换为其他范围。
|
|
19
|
+
|
|
20
|
+
跨批次合并同根因发现。报告记录**审核模式、目标范围、已审核文件或模块、排除项、未覆盖文件或模块、完成状态及验证命令和结果**。受上下文或执行预算限制时,标记部分完成并列出剩余模块,不宣称已完成全项目覆盖。为理解上下文而读取调用方或执行全项目 lint/类型检查,不计为完成这些文件的人工审核。
|
|
21
|
+
|
|
22
|
+
改动审核保留合并建议;指定范围和全项目审核使用风险评估(低 / 中 / 高,并标明阻塞问题),不宣称合并就绪。保留严重程度、证据要求和报告文件命名。除非用户明确要求修复,否则仅输出报告。
|
|
23
|
+
|
|
24
|
+
## 用途
|
|
25
|
+
|
|
26
|
+
从架构、类型安全、可访问性、样式一致性、性能和可测试性等 8 个维度审查前端代码质量,输出分级评审报告。
|
|
27
|
+
|
|
28
|
+
## 流程
|
|
29
|
+
|
|
30
|
+
1. 先读项目事实:package scripts、框架、目录约定、最近 diff、现有测试和相关规则。
|
|
31
|
+
2. 按风险找问题,而不是按个人偏好挑风格;每个发现都要能指向具体文件、行号和用户影响。
|
|
32
|
+
3. 用五轴收敛结论:正确性、可维护性、类型/接口、用户体验、验证覆盖。
|
|
33
|
+
4. 对安全、无障碍、E2E、性能等深水区只做初筛;需要专项调查时明确分流。
|
|
34
|
+
5. 多维评审时先按职责拆分,再合并同类发现;同一文件同一根因只保留一条主发现,避免重复噪声。
|
|
35
|
+
6. 报告先列阻塞问题,再列建议项;没有证据的问题不要写成确定结论。
|
|
36
|
+
|
|
37
|
+
## 多维评审编排
|
|
38
|
+
|
|
39
|
+
当改动跨越多个质量维度时,按“主评审 + 专项分流”组织,而不是让所有维度重复检查同一处代码。
|
|
40
|
+
|
|
41
|
+
| 维度 | 触发条件 | 分流边界 |
|
|
42
|
+
| ------------------- | ---------------------------------------------------- | ------------------------------------ |
|
|
43
|
+
| TypeScript 工程与类型契约 | DTO、泛型、公共类型、类型守卫、`any`、断言、tsconfig | 深入类型建模和 TS 配置交给 TypeScript 流程 |
|
|
44
|
+
| 状态管理 | 状态归属、全局 store、URL 状态、派生状态、跨页面同步 | 状态选型与迁移交给状态管理专项流程 |
|
|
45
|
+
| 安全 | 用户输入、HTML 渲染、token、上传、第三方脚本 | 漏洞级分析交给安全专项流程 |
|
|
46
|
+
| 无障碍 | 弹窗、菜单、表单、键盘操作、焦点管理 | WCAG 细查交给无障碍专项流程 |
|
|
47
|
+
| 性能 | 大列表、重依赖、重复请求、长任务、包体积 | 性能证据与预算交给性能专项流程 |
|
|
48
|
+
| E2E | 关键用户路径、登录态、支付、跨页面流程 | 浏览器用例与 trace 交给 E2E 专项流程 |
|
|
49
|
+
|
|
50
|
+
发现合并规则:
|
|
51
|
+
|
|
52
|
+
- 同一根因出现在多个维度时,只保留最高严重级别,并在 `Dimension` 中列出相关维度。
|
|
53
|
+
- 同一文件多处重复模式,合并为一条模式级发现,列出代表性位置。
|
|
54
|
+
- 置信度不足的问题放入 Open Questions,不升级为阻塞项。
|
|
55
|
+
- 自动化可稳定捕获的格式问题交给 lint/format,不作为人工评审主发现。
|
|
56
|
+
|
|
57
|
+
## 评审维度
|
|
58
|
+
|
|
59
|
+
1. 架构
|
|
60
|
+
|
|
61
|
+
- 组件边界是否清晰
|
|
62
|
+
- 展示逻辑与业务逻辑是否分离
|
|
63
|
+
- 是否有可复用抽象
|
|
64
|
+
- 是否存在上帝组件
|
|
65
|
+
|
|
66
|
+
2. 类型安全
|
|
67
|
+
|
|
68
|
+
- 是否存在不必要的 `any`
|
|
69
|
+
- props 类型是否明确
|
|
70
|
+
- hooks/composables 返回值是否稳定
|
|
71
|
+
- 在可行情况下 API 契约是否有类型约束
|
|
72
|
+
|
|
73
|
+
3. 渲染与状态
|
|
74
|
+
|
|
75
|
+
- 是否存在不必要的重复渲染
|
|
76
|
+
- key 的使用是否稳定
|
|
77
|
+
- 可推导状态是否被重复存储
|
|
78
|
+
- 本地状态是否耦合过深
|
|
79
|
+
- 全局 store 是否只保存真正跨边界共享的客户端状态
|
|
80
|
+
- URL 状态、服务端状态、表单状态和浏览器持久化是否边界清晰
|
|
81
|
+
|
|
82
|
+
4. 样式
|
|
83
|
+
|
|
84
|
+
- 已有 Token 时是否还在使用 magic number
|
|
85
|
+
- 类名是否与仓库约定一致
|
|
86
|
+
- 响应式处理是否明确
|
|
87
|
+
- 是否无必要地混用了多套样式体系
|
|
88
|
+
|
|
89
|
+
5. 可访问性
|
|
90
|
+
|
|
91
|
+
- 语义结构是否合理
|
|
92
|
+
- 是否在需要时正确使用 label 和 aria
|
|
93
|
+
- 是否支持键盘操作
|
|
94
|
+
- 浮层和菜单的焦点管理是否正确
|
|
95
|
+
|
|
96
|
+
6. 可维护性
|
|
97
|
+
|
|
98
|
+
- 组件/页面文件规模是否合理(宜约 **300 行**内;逾 **500 行**或复杂度过高须拆分,见共享 React / Vue 规则中的「组件文件规模」)
|
|
99
|
+
- 命名质量是否良好
|
|
100
|
+
- 是否有应该提取的重复逻辑
|
|
101
|
+
- 是否存在死代码、过期注释或临时性 hack
|
|
102
|
+
- 业务状态、类型、标识是否用裸数字/裸字符串(应对齐 `templates/shared/rules/fec-typescript.md`「禁止 Magic Number / Magic String」)
|
|
103
|
+
|
|
104
|
+
7. 测试
|
|
105
|
+
|
|
106
|
+
- 是否缺少关键测试覆盖
|
|
107
|
+
- 是否存在脆弱的选择器或不稳定的测试模式
|
|
108
|
+
|
|
109
|
+
8. 安全
|
|
110
|
+
|
|
111
|
+
- 无明显 XSS 风险(dangerouslySetInnerHTML / v-html 必须审查)
|
|
112
|
+
- 无敏感信息硬编码
|
|
113
|
+
- 无未校验的用户输入直接渲染
|
|
114
|
+
|
|
115
|
+
9. 性能与体验证据
|
|
116
|
+
|
|
117
|
+
- 是否引入首屏重依赖、重复请求、大列表渲染或长任务
|
|
118
|
+
- loading、empty、error、disabled、focus 等状态是否完整
|
|
119
|
+
- 响应式布局是否有可验证断点和文本溢出保护
|
|
120
|
+
|
|
121
|
+
10. 必检项(阻塞合并)
|
|
122
|
+
|
|
123
|
+
- [ ] TypeScript 类型完整,无 `any`
|
|
124
|
+
- [ ] 外部输入、DTO、公共类型边界无无守卫断言
|
|
125
|
+
- [ ] 无 XSS 风险
|
|
126
|
+
- [ ] 无敏感信息硬编码
|
|
127
|
+
- [ ] 核心逻辑有单元测试
|
|
128
|
+
|
|
129
|
+
11. 质量项(建议修改)
|
|
130
|
+
|
|
131
|
+
- [ ] 组件文件规模符合约定(约 300 行内为佳;逾 500 行或高复杂度已拆子组件 / Hooks / Composables / utils)
|
|
132
|
+
- [ ] 无重复代码(DRY 原则)
|
|
133
|
+
- [ ] 无未使用的 import
|
|
134
|
+
|
|
135
|
+
12. 规范项(风格建议)
|
|
136
|
+
|
|
137
|
+
- [ ] 命名语义清晰
|
|
138
|
+
- [ ] 注释覆盖复杂逻辑
|
|
139
|
+
|
|
140
|
+
## 详细参考
|
|
141
|
+
|
|
142
|
+
撰写代码评审报告时,加载 [references/report-template.md](references/report-template.md)。发现必须具体且可操作;不要写"优化性能"等空泛建议而不指出具体代码模式。
|
|
143
|
+
|
|
144
|
+
## 约束
|
|
145
|
+
|
|
146
|
+
- 不把个人风格偏好写成阻塞问题;阻塞项必须有明确用户影响、运行时风险、安全风险或维护成本证据。
|
|
147
|
+
- 缺少文件位置和支持证据时,不要给出确定结论;仅改动审核要求差异。
|
|
148
|
+
- 深度安全、无障碍、E2E 和性能问题只做初筛;需要证据链时分流到专项 skill。
|
|
149
|
+
- 同一根因不要重复报多条;合并为一条代表性发现并列出影响范围。
|
|
150
|
+
- 自动化工具稳定覆盖的格式问题交给 lint/format,不作为人工评审主发现。
|
|
151
|
+
|
|
152
|
+
## 预期输出
|
|
153
|
+
|
|
154
|
+
- 分级评审报告(CRITICAL / HIGH / MEDIUM / LOW)
|
|
155
|
+
- 每个问题关联具体文件和行号,附修复建议
|
|
156
|
+
- 阻塞项(CRITICAL)修复前不建议合并
|
|
157
|
+
- 评审报告保存为 `reports/code-review-YYYY-MM-DD-HHmmss.md`
|
|
158
|
+
- 多维评审要合并重复发现,并说明已分流到哪些专项能力
|
|
159
|
+
- 对不确定项标注需要的验证命令或补充上下文,不把猜测写成事实
|
|
160
|
+
## 重构边界
|
|
161
|
+
|
|
162
|
+
通用 Review 可以发现可维护性证据,但需要系统判断结构问题时,应交给坏味道诊断;需要形成保持行为的有序变化方案时,应交给重构计划。Review 不应静默执行结构修改。
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# 代码审查报告模板
|
|
2
|
+
|
|
3
|
+
```markdown
|
|
4
|
+
# 代码审查报告
|
|
5
|
+
|
|
6
|
+
> 生成时间: YYYY-MM-DD HH:mm
|
|
7
|
+
> 评审工具: frontend-craft
|
|
8
|
+
|
|
9
|
+
> 审核模式:改动审核 / 指定范围审核 / 全项目审核
|
|
10
|
+
> 目标范围:路径或 PR/提交
|
|
11
|
+
> 已审核:文件或模块清单
|
|
12
|
+
> 排除项:路径及原因
|
|
13
|
+
> 未覆盖:剩余文件或模块清单(无则注明)
|
|
14
|
+
> 完成状态:完成 / 部分完成
|
|
15
|
+
> 验证结果:命令、结果及未执行原因
|
|
16
|
+
|
|
17
|
+
## CRITICAL / 必须修改 (N项)
|
|
18
|
+
- **[文件:行号]** 问题描述 -> 建议修改
|
|
19
|
+
|
|
20
|
+
## HIGH / 建议优化 (N项)
|
|
21
|
+
- ...
|
|
22
|
+
|
|
23
|
+
## MEDIUM / 可选优化项 (N项)
|
|
24
|
+
- ...
|
|
25
|
+
|
|
26
|
+
## LOW / 观察项 (N项)
|
|
27
|
+
- ...
|
|
28
|
+
|
|
29
|
+
## 做得好的地方
|
|
30
|
+
- ...
|
|
31
|
+
|
|
32
|
+
## 风险等级:低 / 中 / 高
|
|
33
|
+
|
|
34
|
+
**总体评价**: 改动审核填写合并建议;指定范围或全项目审核填写低 / 中 / 高风险及阻塞问题
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
评审完成后,将报告保存到 `reports/code-review-YYYY-MM-DD-HHmmss.md`,并告知用户报告路径。
|
|
38
|
+
|
|
39
|
+
改动审核保留合并建议;指定范围和全项目审核输出风险评估。部分完成时,结论仅适用于已审核范围,不构成全项目通过结论。
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fec-code-smells
|
|
3
|
+
description: 需要在不修改业务代码的前提下诊断既有前端代码的结构性可维护性问题,并要求提供证据、误判检查与候选重构方向时。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 代码坏味道诊断
|
|
7
|
+
|
|
8
|
+
## 概览
|
|
9
|
+
基于具体证据诊断结构问题。坏味道是进一步调查的信号,不等于必须修改代码的结论。
|
|
10
|
+
|
|
11
|
+
## 执行流程
|
|
12
|
+
1. 明确分析范围和项目事实。
|
|
13
|
+
2. 收集结构、依赖方向、职责和变化耦合证据。
|
|
14
|
+
3. 对照[坏味道目录](references/smell-catalog.md)。
|
|
15
|
+
4. 执行[误判检查](references/detection-guide.md)。
|
|
16
|
+
5. 根据[坏味道到重构手法映射](references/smell-to-refactoring-map.md)报告置信度、影响和候选方案。
|
|
17
|
+
6. 如果用户只要求诊断,不修改业务代码。
|
|
18
|
+
|
|
19
|
+
## Finding 输出契约
|
|
20
|
+
每项必须包含位置、证据、坏味道 ID/名称、影响、置信度(`HIGH`、`MEDIUM`、`LOW`)、候选重构、优先级和重要误判因素。`LOW` 置信度不能作为自动修改依据。
|
|
21
|
+
|
|
22
|
+
## 快速索引
|
|
23
|
+
| 需要 | 资料 |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| 24 种标准坏味道 | [坏味道目录](references/smell-catalog.md) |
|
|
26
|
+
| 证据与误判保护 | [检测指南](references/detection-guide.md) |
|
|
27
|
+
| 候选重构手法 | [映射指南](references/smell-to-refactoring-map.md) |
|
|
28
|
+
|
|
29
|
+
## 常见错误
|
|
30
|
+
- 把指标阈值当成坏味道证据。
|
|
31
|
+
- 不指出文件/符号就下结论。
|
|
32
|
+
- 把所有循环、switch、注释、包装层或管道都视为缺陷。
|
|
33
|
+
- 用户要求只诊断时仍直接改代码。
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# 代码坏味道检测指南
|
|
2
|
+
|
|
3
|
+
## 证据优先
|
|
4
|
+
优先观察代码结构、依赖方向、数据所有权、重复变化模式和实际维护负担。指标只能帮助定位,不能单独证明坏味道。
|
|
5
|
+
|
|
6
|
+
## 必须执行的误判保护
|
|
7
|
+
- 不能仅凭代码行数认定“过长函数”或“过大的类”。
|
|
8
|
+
- 单个 `switch` 不能证明“重复的 switch”。
|
|
9
|
+
- 函数链或数组管道不自动等于“过长的消息链”。
|
|
10
|
+
- 注释本身不是缺陷。
|
|
11
|
+
- 不可变的传输数据可以合理地保持纯数据形态。
|
|
12
|
+
- React/Vue 声明式组合不自动等于“中间人”。
|
|
13
|
+
- `filter().map().reduce()` 管道不是消息链。
|
|
14
|
+
|
|
15
|
+
## 前端证据检查
|
|
16
|
+
- 核对 props、store、API DTO、Hook/Composable 与模块的数据所有权。
|
|
17
|
+
- 判断 effect/watch 等生命周期语义后,再评价重复或链式耦合。
|
|
18
|
+
- 推荐搬移前核对组件、路由、事件和包导出的公共契约。
|
|
19
|
+
- 检查动态引用:懒加载、路由注册、Storybook、i18n key、运行时模板和动态 CSS class。
|
|
20
|
+
- 区分真正的领域规则重复与仅仅外观相似的渲染代码。
|
|
21
|
+
|
|
22
|
+
## 置信度
|
|
23
|
+
- **HIGH:** 有直接、重复证据,且重要误判因素已排除。
|
|
24
|
+
- **MEDIUM:** 证据成立,但历史、动态引用或所有权仍不完整。
|
|
25
|
+
- **LOW:** 主要依据表面指标或存在重大不确定性;只报告,不自动修改。
|