@bovinphang/frontend-craft 2.7.0 → 2.8.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 +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +34 -0
- package/CHANGELOG.zh-CN.md +34 -0
- package/README.md +1 -1
- package/README.openclaw.md +99 -43
- package/README.openclaw.zh-CN.md +99 -43
- package/README.zh-CN.md +1 -1
- package/agents/fec-architect.md +70 -70
- package/agents/fec-code-reviewer.md +82 -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 +14 -14
- package/agents/fec-security-reviewer.md +66 -67
- package/agents/fec-test-planner.md +27 -27
- package/agents/fec-typescript-reviewer.md +87 -87
- package/agents/fec-ui-checker.md +74 -74
- 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-review.md +41 -41
- package/commands/fec-scaffold.md +41 -41
- package/commands/fec-tdd.md +13 -13
- package/dist/bin/frontend-craft.js +29 -27
- package/docs/example-prompts.md +3 -0
- package/docs/ja-JP/README.md +1 -1
- package/docs/ko-KR/README.md +1 -1
- package/docs/project-structure.md +13 -5
- package/docs/zh-CN/example-prompts.md +3 -0
- package/docs/zh-CN/project-structure.md +6 -1
- package/docs/zh-TW/README.md +1 -1
- package/localized/zh-CN/agents/fec-architect.md +125 -0
- package/localized/zh-CN/agents/fec-code-reviewer.md +152 -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 +32 -0
- package/localized/zh-CN/agents/fec-security-reviewer.md +116 -0
- package/localized/zh-CN/agents/fec-test-planner.md +50 -0
- package/localized/zh-CN/agents/fec-typescript-reviewer.md +142 -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-review.md +66 -0
- package/localized/zh-CN/commands/fec-scaffold.md +205 -0
- package/localized/zh-CN/commands/fec-tdd.md +21 -0
- package/localized/zh-CN/skills/TEMPLATE.md +155 -0
- package/localized/zh-CN/skills/eval_queries.json +1013 -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 +143 -0
- package/localized/zh-CN/skills/fec-code-review/references/report-template.md +29 -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 +80 -0
- package/localized/zh-CN/skills/fec-image-generation/assets/interactive-diagram.html +371 -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 +74 -0
- package/localized/zh-CN/skills/fec-image-generation/references/html-technical-diagrams.md +236 -0
- package/localized/zh-CN/skills/fec-image-generation/references/png-qa-autofix.md +30 -0
- package/localized/zh-CN/skills/fec-image-generation/scripts/export-diagram.mjs +364 -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/png-qa.mjs +431 -0
- package/localized/zh-CN/skills/fec-image-generation/scripts/tech-diagram-render.mjs +1397 -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 +51 -0
- package/localized/zh-CN/skills/fec-refactor-clean/references/report-template.md +42 -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 +38 -0
- package/localized/zh-CN/skills/fec-security-review/references/report-template.md +27 -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 +52 -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 +1646 -0
- package/localized/zh-CN/skills/relations.json +755 -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 +54 -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 +1 -1
- package/package.json +3 -2
- package/skills/TEMPLATE.md +74 -74
- package/skills/eval_queries.json +678 -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 +94 -94
- package/skills/fec-code-review/references/report-template.md +13 -13
- 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 +54 -29
- package/skills/fec-image-generation/assets/interactive-diagram.html +371 -0
- package/skills/fec-image-generation/references/diagram-workflows.md +33 -2
- package/skills/fec-image-generation/references/html-technical-diagrams.md +236 -0
- package/skills/fec-image-generation/scripts/export-diagram.mjs +364 -0
- package/skills/fec-image-generation/scripts/interactive-diagram-server.mjs +654 -0
- package/skills/fec-image-generation/scripts/tech-diagram-render.mjs +1397 -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 +30 -30
- package/skills/fec-refactor-clean/references/report-template.md +23 -23
- 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 +20 -20
- package/skills/fec-security-review/references/report-template.md +12 -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 +28 -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 +121 -115
- package/skills/relations.json +4 -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 +40 -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/skills/fec-drawio-studio/data/shape-index.json.gz +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fec-validation-fix
|
|
3
|
+
description: 用于运行现有项目验证命令并修复代码变更后的失败,包括 lint、type-check、单元/集成测试、build、CI 或本地脚本失败。不要用于设计或编写新的组件/E2E 测试;中文触发词包括 验证、检查失败、修复失败、CI 失败。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 验证并修复
|
|
7
|
+
|
|
8
|
+
## 用途
|
|
9
|
+
|
|
10
|
+
自动化执行已有验证命令,分析失败原因并安全修复,确保质量门禁达标。
|
|
11
|
+
|
|
12
|
+
## 流程
|
|
13
|
+
|
|
14
|
+
1. 从 package.json 或仓库文档中识别可用命令。
|
|
15
|
+
2. 优先按以下顺序执行:
|
|
16
|
+
- lint
|
|
17
|
+
- type-check
|
|
18
|
+
- unit/integration tests
|
|
19
|
+
- build
|
|
20
|
+
3. 仔细阅读失败输出。
|
|
21
|
+
4. 将错误按文件、错误类型和依赖关系分组,优先处理阻塞后续诊断的根因。
|
|
22
|
+
5. 一次只修复一类问题,并显示或记录关键错误上下文。
|
|
23
|
+
6. 每次关键修复后重新执行受影响命令,确认错误是否减少。
|
|
24
|
+
7. 如果同一错误连续三次修复仍失败,停止扩大改动并报告阻塞。
|
|
25
|
+
8. 最后按“预期输出”总结执行结果、修复内容和剩余风险。
|
|
26
|
+
|
|
27
|
+
## 失败分诊
|
|
28
|
+
|
|
29
|
+
- 先修最早出现且会级联的错误,例如缺失类型、导入失败、配置解析失败。
|
|
30
|
+
- 区分真实产品 bug、测试环境问题、快照漂移、依赖版本变化和 flaky。
|
|
31
|
+
- 对 CI 专属失败记录 Node 版本、包管理器、环境变量、路径大小写和工作目录差异。
|
|
32
|
+
- 修复测试时优先修产品代码或测试等待方式,不用删除断言掩盖真实回归。
|
|
33
|
+
|
|
34
|
+
## 约束
|
|
35
|
+
|
|
36
|
+
- 不要盲目关闭规则来消除报错
|
|
37
|
+
- 除非有明确理由,不要为了通过检查而降低类型安全
|
|
38
|
+
- 不要因为附近测试失败就顺手重写无关模块
|
|
39
|
+
- 不要一次性修改多个无关根因
|
|
40
|
+
- 不要删除失败测试来让验证通过
|
|
41
|
+
- 不要只运行失败命令的片段就声称整体验证通过
|
|
42
|
+
|
|
43
|
+
## 详细参考
|
|
44
|
+
|
|
45
|
+
撰写验证修复报告时,加载 [references/report-template.md](references/report-template.md)。
|
|
46
|
+
|
|
47
|
+
## 预期输出
|
|
48
|
+
|
|
49
|
+
- lint / type-check / test / build 等验证命令全部通过
|
|
50
|
+
- 失败项已修复或给出明确原因和后续行动
|
|
51
|
+
- 修复报告保存为 `reports/validation-fix-YYYY-MM-DD-HHmmss.md`
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# 验证修复报告模板
|
|
2
|
+
|
|
3
|
+
```markdown
|
|
4
|
+
# 验证修复报告
|
|
5
|
+
|
|
6
|
+
> 生成时间: YYYY-MM-DD HH:mm
|
|
7
|
+
> 验证范围: lint / type-check / test / build / CI
|
|
8
|
+
|
|
9
|
+
## 命令状态表
|
|
10
|
+
|
|
11
|
+
| 命令 | 初始状态 | 修复后状态 | 备注 |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| `npm run type-check` | 失败 / 通过 / 未运行 | 失败 / 通过 / 未运行 | ... |
|
|
14
|
+
|
|
15
|
+
## 失败摘要
|
|
16
|
+
|
|
17
|
+
- 最早出现且会级联的错误
|
|
18
|
+
- 受影响文件、错误类型和关键日志
|
|
19
|
+
- 是否属于 CI 专属、测试环境、依赖版本或 flaky 问题
|
|
20
|
+
|
|
21
|
+
## 根因
|
|
22
|
+
|
|
23
|
+
- 确认的根本原因
|
|
24
|
+
- 支持该结论的输出、日志或复现证据
|
|
25
|
+
|
|
26
|
+
## 修复内容
|
|
27
|
+
|
|
28
|
+
- 修改的文件和行为
|
|
29
|
+
- 为什么没有通过关闭规则、删除断言或降低类型安全来规避失败
|
|
30
|
+
|
|
31
|
+
## 验证结果
|
|
32
|
+
|
|
33
|
+
- 重新执行的命令
|
|
34
|
+
- 命令输出摘要
|
|
35
|
+
- 是否仍有失败项
|
|
36
|
+
|
|
37
|
+
## 剩余风险
|
|
38
|
+
|
|
39
|
+
- 未覆盖的验证命令
|
|
40
|
+
- 仍需用户决策或外部环境确认的问题
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
验证修复完成后,将报告保存到 `reports/validation-fix-YYYY-MM-DD-HHmmss.md`,并告知用户报告路径。
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fec-vite-project-standard
|
|
3
|
+
description: 用于创建、配置、审查或调试基于 Vite 的前端项目、vite.config.ts、环境变量、dev server proxy、HMR、插件顺序、library mode、依赖预打包、bundle splitting 或 Vite 构建性能。React/Vue 组件架构请使用框架专项 skill;中文触发词包括 Vite 配置、vite.config、Vite 构建、Vite 性能。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Vite 项目规范
|
|
7
|
+
|
|
8
|
+
适用于 Vite 应用、组件库、开发服务器和构建配置的设计与审查。
|
|
9
|
+
|
|
10
|
+
## 用途
|
|
11
|
+
|
|
12
|
+
规范 Vite 配置、安全边界和构建性能,避免开发环境与生产构建的常见陷阱。
|
|
13
|
+
|
|
14
|
+
## 流程
|
|
15
|
+
|
|
16
|
+
1. 识别项目类型
|
|
17
|
+
- 应用项目优先检查 `root`、`base`、`server.proxy`、`envPrefix`、`build` 和框架插件。
|
|
18
|
+
- 组件库项目优先检查 `build.lib`、类型产物、peer dependencies external 和导出入口。
|
|
19
|
+
- Monorepo 额外检查 `server.fs.allow`、路径别名和包依赖边界。
|
|
20
|
+
|
|
21
|
+
2. 选择插件
|
|
22
|
+
- React 默认优先 `@vitejs/plugin-react-swc`;需要 Babel 插件时才用 `@vitejs/plugin-react`。
|
|
23
|
+
- Vue 项目使用 `@vitejs/plugin-vue`,路径别名优先交给 `vite-tsconfig-paths`。
|
|
24
|
+
- TypeScript 项目必须通过 `tsc --noEmit`、CI 或 `vite-plugin-checker` 补齐类型检查。
|
|
25
|
+
|
|
26
|
+
3. 管理环境变量
|
|
27
|
+
- 客户端只读取明确公开的前缀,如 `VITE_`。
|
|
28
|
+
- `loadEnv` 第三个参数使用显式前缀数组,不使用空字符串加载全部变量。
|
|
29
|
+
- 密钥、数据库地址、私有 token 必须留在服务端或构建系统,不进入客户端 bundle。
|
|
30
|
+
|
|
31
|
+
4. 优化开发体验
|
|
32
|
+
- 慢启动先用 `vite --profile` 定位插件、解析或预构建瓶颈。
|
|
33
|
+
- 对 CJS/UMD 依赖用 `optimizeDeps.include` 处理互操作问题。
|
|
34
|
+
- 大项目可用 `server.warmup.clientFiles` 预热核心入口。
|
|
35
|
+
|
|
36
|
+
5. 优化生产构建
|
|
37
|
+
- 发布前运行 `vite build`,并用 `vite preview` 做本地构建烟测。
|
|
38
|
+
- 手动分包使用稳定的对象形式优先,避免把每个依赖拆成独立小 chunk。
|
|
39
|
+
- 生产 sourcemap 默认关闭;若上传错误追踪平台,上传后不随站点公开。
|
|
40
|
+
- 动效、3D、图表、编辑器、地图和音视频处理库优先通过动态导入或路由级拆包隔离。
|
|
41
|
+
- 检查静态资源是否进入正确目录、是否被 hash/cache、是否存在占位 URL 或过大的未压缩媒体。
|
|
42
|
+
|
|
43
|
+
## 最小配置
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import { defineConfig, loadEnv } from "vite";
|
|
47
|
+
import react from "@vitejs/plugin-react-swc";
|
|
48
|
+
import tsconfigPaths from "vite-tsconfig-paths";
|
|
49
|
+
|
|
50
|
+
export default defineConfig(({ mode }) => {
|
|
51
|
+
const env = loadEnv(mode, process.cwd(), ["VITE_"]);
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
plugins: [react(), tsconfigPaths()],
|
|
55
|
+
define: {
|
|
56
|
+
__PUBLIC_API_URL__: JSON.stringify(env.VITE_API_URL),
|
|
57
|
+
},
|
|
58
|
+
server: {
|
|
59
|
+
proxy: {
|
|
60
|
+
"/api": {
|
|
61
|
+
target: "http://localhost:8080",
|
|
62
|
+
changeOrigin: true,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## 约束
|
|
71
|
+
|
|
72
|
+
- `vite build` 只转译和打包,不等于类型检查;CI 必须另跑 typecheck。
|
|
73
|
+
- `VITE_` 不是安全边界;任何 `VITE_` 变量都会进入客户端包。
|
|
74
|
+
- 不设置 `envPrefix: ""`,不使用 `loadEnv(mode, root, "")` 后再随意 `define`。
|
|
75
|
+
- 不默认引入 legacy 插件;只有真实用户数据需要时再启用。
|
|
76
|
+
- 不用 `vite preview` 作为生产服务器。
|
|
77
|
+
- 组件库必须 externalize peer dependencies,并单独产出 `.d.ts`。
|
|
78
|
+
- 不把服务端密钥通过 `define`、`import.meta.env` 或空前缀 `loadEnv` 注入客户端。
|
|
79
|
+
- 不把 GSAP、Three.js、Lottie、Monaco、地图 SDK 等重型库放进所有页面共享入口;先评估 async chunk 和首屏影响。
|
|
80
|
+
|
|
81
|
+
## 预期输出
|
|
82
|
+
|
|
83
|
+
输出应包含项目类型判断、关键配置变更、环境变量安全说明、构建/开发性能验证方式。完成后 Vite 配置应可类型检查、可构建、密钥不泄露,并能解释 dev 与 build 的差异。
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fec-vue3-project-standard
|
|
3
|
+
description: 用于设计或审查 Vue 3 + TypeScript 项目结构、SFC/组件边界、composables 组织、路由组合、Pinia 归属、API/错误/样式默认约定、directives 或仓库级 Vue 规范。表单、数据获取、测试、无障碍、虚拟列表、动画或安全深挖优先使用更窄的 skill;中文触发词包括 Vue 3 项目规范、Vue 组件架构。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Vue 3 项目规范
|
|
7
|
+
|
|
8
|
+
适用于使用 Vue 3 + TypeScript 的仓库。
|
|
9
|
+
|
|
10
|
+
## 用途
|
|
11
|
+
|
|
12
|
+
为 Vue 3 + TypeScript 项目提供工程结构、组件边界、Composables 和默认实现约定,确保约定式开发和类型安全。
|
|
13
|
+
|
|
14
|
+
## 流程
|
|
15
|
+
|
|
16
|
+
1. 识别仓库已有 Vue 约定:目录、路由、Pinia、请求层、样式体系、组件库和测试框架。
|
|
17
|
+
2. 划分页面、业务组件、通用组件、composables、stores、services 和 utils 的边界。
|
|
18
|
+
3. 优先沿用 `<script setup lang="ts">`、组合式 API 和仓库现有自动导入/模块出口约定。
|
|
19
|
+
4. 输出时补齐状态归属、API 层、错误处理、样式隔离和专项 skill 分流。
|
|
20
|
+
5. 页面和模块要有可恢复错误 UI;全局 `errorHandler`、`onErrorCaptured`、请求错误映射和路由错误页分工明确。
|
|
21
|
+
6. Tailwind token/variant 或响应式布局需求应分流到对应专项 skill,避免把样式系统规则塞进 Vue 组件规范。
|
|
22
|
+
7. 状态归属复杂时先做状态清单;DTO、公共 props、泛型 composable 或 `tsconfig` 边界复杂时,先使用 TypeScript 项目规范流程收敛跨框架类型契约。
|
|
23
|
+
8. 设计可复用 composable 时明确输入是否支持 plain value、ref、computed 或 getter;测试 Vue 组件时覆盖 Pinia、Router、Teleport、Suspense 和 async setup 的常见边界。
|
|
24
|
+
|
|
25
|
+
## 详细参考
|
|
26
|
+
|
|
27
|
+
按需要加载更细的参考文件:
|
|
28
|
+
|
|
29
|
+
- 项目目录、组件分层、组件规范、注释和 TypeScript:加载 [references/vue3-project-structure.md](references/vue3-project-structure.md)。
|
|
30
|
+
- Composables、slots、Provide/Inject 和路由组织:加载 [references/vue3-composables-routing.md](references/vue3-composables-routing.md)。
|
|
31
|
+
- Pinia、API 层、错误处理、指令、样式、测试、反模式和输出检查清单:加载 [references/vue3-state-api-quality.md](references/vue3-state-api-quality.md)。
|
|
32
|
+
- Vue 项目规范层面的轻量性能约定:加载 [references/vue3-performance-patterns.md](references/vue3-performance-patterns.md)。
|
|
33
|
+
|
|
34
|
+
## 约束
|
|
35
|
+
|
|
36
|
+
- 使用 `<script setup lang="ts">`,禁止使用 Options API 新增组件
|
|
37
|
+
- 组件文件规模宜约 **300 行**内;逾 **500 行**或复杂度过高须拆子组件与 Composables
|
|
38
|
+
- Props / Emits 必须使用 TypeScript interface 定义,禁止使用 `any`
|
|
39
|
+
- Composable 返回 `readonly` 引用,防止外部意外修改
|
|
40
|
+
- 不要在 store 中存放 UI 临时状态(modal 开关、表单输入等)
|
|
41
|
+
- 服务端数据优先用请求库管理,而非手动存入 Pinia
|
|
42
|
+
- 避免在 `v-for` 中使用 `v-if`(提取为 computed 过滤)
|
|
43
|
+
- 禁止直接从 feature 内部深层路径导入,绕过 `index.ts`
|
|
44
|
+
- 不用全局错误处理吞掉组件内可恢复的 API、表单或权限错误。
|
|
45
|
+
- 不把函数型参数误当 getter 自动调用;composable 参数若可能是回调,应避免使用 getter 型输入约定。
|
|
46
|
+
- 不依赖快照作为 Vue 组件唯一断言;异步组件、Teleport 和 Pinia 场景要有用户可见行为断言。
|
|
47
|
+
|
|
48
|
+
## 预期输出
|
|
49
|
+
|
|
50
|
+
- 组件使用 `<script setup lang="ts">`,Props / Emits 类型完整
|
|
51
|
+
- 可复用逻辑已提取到 composable,返回 `readonly` 引用
|
|
52
|
+
- Loading / Error / Empty / Data 状态均已处理
|
|
53
|
+
- 路由组件使用动态 import 加载,状态管理符合就近原则
|
|
54
|
+
- URL 状态、服务端状态、表单状态和 Pinia 全局状态边界明确
|
|
55
|
+
- API 调用有类型约束和统一错误处理
|
|
56
|
+
- 样式使用 scoped 隔离,关键行为有测试覆盖
|
|
57
|
+
- 文件结构与项目约定一致(pages / features / components 分离)
|
|
58
|
+
- 可复用 composable 的输入响应性、Pinia/Router 边界和异步组件测试策略已说明
|
package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-composables-routing.md
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Vue 3 composables 与路由模式
|
|
2
|
+
|
|
3
|
+
## Composables 规范
|
|
4
|
+
|
|
5
|
+
### 设计原则
|
|
6
|
+
|
|
7
|
+
- 以 `use` 前缀命名
|
|
8
|
+
- 返回值使用对象,明确标注类型
|
|
9
|
+
- 内部处理 loading / error / data 三态
|
|
10
|
+
- 支持参数响应式(接受 `Ref` 或 getter)
|
|
11
|
+
- 库级 composable 要明确参数是否支持普通值、`Ref`、`computed` 或 getter,并在副作用内部解析最新值
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
export function useUserList(params: MaybeRef<QueryParams>) {
|
|
15
|
+
const data = ref<User[]>([]);
|
|
16
|
+
const loading = ref(false);
|
|
17
|
+
const error = ref<Error | null>(null);
|
|
18
|
+
|
|
19
|
+
async function fetch() {
|
|
20
|
+
loading.value = true;
|
|
21
|
+
error.value = null;
|
|
22
|
+
try {
|
|
23
|
+
const res = await getUserList(toValue(params));
|
|
24
|
+
data.value = res.list;
|
|
25
|
+
} catch (e) {
|
|
26
|
+
error.value = e as Error;
|
|
27
|
+
} finally {
|
|
28
|
+
loading.value = false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
watchEffect(() => {
|
|
33
|
+
fetch();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
data: readonly(data),
|
|
38
|
+
loading: readonly(loading),
|
|
39
|
+
error: readonly(error),
|
|
40
|
+
refetch: fetch,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Composable 使用原则
|
|
46
|
+
|
|
47
|
+
- 返回 `readonly` 引用防止外部意外修改
|
|
48
|
+
- 数据请求场景优先使用 VueQuery / VueUse 等库(如项目已引入)
|
|
49
|
+
- `onUnmounted` 中清理定时器、事件监听等副作用
|
|
50
|
+
- 避免在 composable 中直接操作 DOM
|
|
51
|
+
- 只读输入可接受普通值、ref、computed 或 getter;需要双向写入的输入只接受可写 ref 或明确的 setter。
|
|
52
|
+
- 如果参数本身是回调、比较器或 predicate,不要把它设计成 getter 型输入,否则解析时可能误调用业务函数。
|
|
53
|
+
|
|
54
|
+
### Vue Router / Pinia / 测试常见边界
|
|
55
|
+
|
|
56
|
+
- 路由参数变化不会重新创建同一个路由组件;依赖 `route.params` 的数据要 watch 明确字段,并处理取消和竞态。
|
|
57
|
+
- 导航守卫中避免旧式 `next()` 多分支重复调用;优先返回 `false`、重定向对象或抛出可处理错误。
|
|
58
|
+
- Pinia store 解构会丢失响应性时使用 `storeToRefs`;setup store 必须返回需要被外部追踪的 state、getter 和 action。
|
|
59
|
+
- UI 临时状态、表单输入、弹窗开关不进入全局 store;URL 查询、服务端缓存和本地组件状态先各归其位。
|
|
60
|
+
- Vue Test Utils 测试优先断言用户可见行为,不把快照作为唯一证明;异步更新使用 `await`、`flushPromises` 或框架推荐的等待方式。
|
|
61
|
+
- 测试使用 Pinia、Router、Teleport、Suspense、async setup 或 `defineAsyncComponent` 时,在测试夹具中显式安装插件、挂载目标容器并等待异步稳定。
|
|
62
|
+
|
|
63
|
+
## Slots 与 Provide/Inject
|
|
64
|
+
|
|
65
|
+
### Slots
|
|
66
|
+
|
|
67
|
+
- 用 `<slot>` 实现组件组合,而非过多 props
|
|
68
|
+
- 具名 slot 用于明确的布局区域
|
|
69
|
+
- 作用域 slot 传递数据给父组件自定义渲染
|
|
70
|
+
|
|
71
|
+
```vue
|
|
72
|
+
<template>
|
|
73
|
+
<div class="card">
|
|
74
|
+
<div class="card-header">
|
|
75
|
+
<slot name="header">{{ title }}</slot>
|
|
76
|
+
</div>
|
|
77
|
+
<div class="card-body">
|
|
78
|
+
<slot :data="processedData" :loading="loading" />
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</template>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Provide/Inject
|
|
85
|
+
|
|
86
|
+
- 用于跨多层级的上下文共享(主题、配置、权限)
|
|
87
|
+
- 提供 InjectionKey 保证类型安全
|
|
88
|
+
- 不要用 provide/inject 替代 props 传递直接父子数据
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
// keys.ts
|
|
92
|
+
export const ThemeKey: InjectionKey<Ref<Theme>> = Symbol("theme");
|
|
93
|
+
|
|
94
|
+
// Provider.vue
|
|
95
|
+
provide(ThemeKey, theme);
|
|
96
|
+
|
|
97
|
+
// Consumer.vue
|
|
98
|
+
const theme = inject(ThemeKey);
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## 路由规范
|
|
102
|
+
|
|
103
|
+
### 路由组织
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
// app/router.ts
|
|
107
|
+
const routes: RouteRecordRaw[] = [
|
|
108
|
+
{
|
|
109
|
+
path: "/",
|
|
110
|
+
component: MainLayout,
|
|
111
|
+
children: [
|
|
112
|
+
{
|
|
113
|
+
path: "",
|
|
114
|
+
name: "Dashboard",
|
|
115
|
+
component: () => import("@/pages/Dashboard/DashboardPage.vue"),
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
path: "users",
|
|
119
|
+
name: "UserList",
|
|
120
|
+
component: () => import("@/pages/UserList/UserListPage.vue"),
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
path: "users/:id",
|
|
124
|
+
name: "UserDetail",
|
|
125
|
+
component: () => import("@/pages/UserDetail/UserDetailPage.vue"),
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
path: "settings",
|
|
129
|
+
name: "Settings",
|
|
130
|
+
component: () => import("@/pages/Settings/SettingsPage.vue"),
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
path: "/login",
|
|
136
|
+
name: "Login",
|
|
137
|
+
component: () => import("@/pages/Login/LoginPage.vue"),
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
path: "/:pathMatch(.*)*",
|
|
141
|
+
name: "NotFound",
|
|
142
|
+
component: () => import("@/pages/NotFound.vue"),
|
|
143
|
+
},
|
|
144
|
+
];
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### 路由原则
|
|
148
|
+
|
|
149
|
+
- 路由配置集中管理,每个路由必须有 `name`
|
|
150
|
+
- 页面组件使用动态 `import()` 按需加载
|
|
151
|
+
- 权限控制使用路由守卫(`beforeEach`),而非在每个页面内判断
|
|
152
|
+
- URL 参数(分页、筛选、排序)与路由状态同步
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
// 导航守卫
|
|
156
|
+
router.beforeEach((to) => {
|
|
157
|
+
const authStore = useAuthStore();
|
|
158
|
+
if (to.meta.requiresAuth && !authStore.isLoggedIn) {
|
|
159
|
+
return { name: "Login", query: { redirect: to.fullPath } };
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
```
|
package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-performance-patterns.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Vue 3 性能模式
|
|
2
|
+
|
|
3
|
+
本文件保留轻量级 Vue 项目规范性能指导。当任务需要指标、trace、profile、包体分析、网络证据或正式性能报告时,使用前端性能工作流。
|
|
4
|
+
|
|
5
|
+
## 性能
|
|
6
|
+
|
|
7
|
+
- 使用 `shallowRef` / `shallowReactive` 优化大型对象
|
|
8
|
+
- 大列表使用虚拟滚动
|
|
9
|
+
- 避免在 `v-for` 中使用 `v-if`(提取为 computed 过滤)
|
|
10
|
+
- 使用 `defineAsyncComponent` 懒加载重型组件
|
|
11
|
+
- `v-for` 必须有稳定的 `:key`
|
|
12
|
+
- 路由组件使用动态 `import()` 按需加载
|
|
13
|
+
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Vue 3 项目结构与组件规范
|
|
2
|
+
|
|
3
|
+
## 项目结构
|
|
4
|
+
|
|
5
|
+
以下为中大型 Vue 3 项目的业界最佳实践结构,按项目实际情况裁剪:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
src/
|
|
9
|
+
├── app/ # 应用入口与全局配置
|
|
10
|
+
│ ├── App.vue # 根组件
|
|
11
|
+
│ ├── main.ts # 应用启动入口
|
|
12
|
+
│ └── router.ts # 路由实例与配置
|
|
13
|
+
│
|
|
14
|
+
├── pages/ # 页面组件(与路由一一对应)
|
|
15
|
+
│ ├── Dashboard/
|
|
16
|
+
│ │ ├── DashboardPage.vue
|
|
17
|
+
│ │ ├── components/ # 页面私有组件
|
|
18
|
+
│ │ └── composables/ # 页面私有 composables
|
|
19
|
+
│ ├── UserList/
|
|
20
|
+
│ └── Settings/
|
|
21
|
+
│
|
|
22
|
+
├── layouts/ # 布局组件
|
|
23
|
+
│ ├── MainLayout.vue # 主布局(侧边栏 + 顶栏 + 内容区)
|
|
24
|
+
│ ├── AuthLayout.vue # 登录/注册页布局
|
|
25
|
+
│ └── BlankLayout.vue # 空白布局(错误页等)
|
|
26
|
+
│
|
|
27
|
+
├── features/ # 功能模块(按业务领域划分)
|
|
28
|
+
│ ├── auth/
|
|
29
|
+
│ │ ├── components/ # 模块组件
|
|
30
|
+
│ │ ├── composables/ # 模块 composables
|
|
31
|
+
│ │ ├── api.ts # 模块 API 调用
|
|
32
|
+
│ │ ├── types.ts # 模块类型定义
|
|
33
|
+
│ │ ├── constants.ts # 模块常量
|
|
34
|
+
│ │ └── index.ts # 模块公开导出
|
|
35
|
+
│ └── order/
|
|
36
|
+
│
|
|
37
|
+
├── components/ # 全局共享 UI 组件
|
|
38
|
+
│ ├── AppButton/
|
|
39
|
+
│ │ ├── AppButton.vue
|
|
40
|
+
│ │ └── __tests__/
|
|
41
|
+
│ ├── AppModal/
|
|
42
|
+
│ ├── AppForm/
|
|
43
|
+
│ └── AppErrorBoundary/
|
|
44
|
+
│
|
|
45
|
+
├── composables/ # 全局共享 composables
|
|
46
|
+
│ ├── useAuth.ts
|
|
47
|
+
│ ├── useDebounce.ts
|
|
48
|
+
│ └── useMediaQuery.ts
|
|
49
|
+
│
|
|
50
|
+
├── services/ # API 基础层
|
|
51
|
+
│ ├── request.ts # Axios/fetch 实例与拦截器
|
|
52
|
+
│ └── endpoints/ # API 端点定义(如按领域拆分)
|
|
53
|
+
│
|
|
54
|
+
├── stores/ # Pinia 状态管理
|
|
55
|
+
│ ├── authStore.ts
|
|
56
|
+
│ └── uiStore.ts
|
|
57
|
+
│
|
|
58
|
+
├── locales/ # 国际化语言包
|
|
59
|
+
│ ├── zh-CN.json # 中文
|
|
60
|
+
│ ├── en-US.json # 英文
|
|
61
|
+
│ └── index.ts # i18n 实例初始化(vue-i18n)
|
|
62
|
+
│
|
|
63
|
+
├── assets/ # 静态资源
|
|
64
|
+
│ ├── images/ # 图片(PNG、JPG、WebP)
|
|
65
|
+
│ ├── icons/ # SVG 图标
|
|
66
|
+
│ └── fonts/ # 自定义字体
|
|
67
|
+
│
|
|
68
|
+
├── config/ # 应用配置
|
|
69
|
+
│ ├── env.ts # 环境变量类型化封装
|
|
70
|
+
│ └── features.ts # Feature Flags 管理
|
|
71
|
+
│
|
|
72
|
+
├── types/ # 全局共享类型
|
|
73
|
+
│ ├── api.ts # API 响应/请求通用类型
|
|
74
|
+
│ ├── models.ts # 业务实体类型
|
|
75
|
+
│ └── global.d.ts # 全局类型扩展(组件类型、模块声明等)
|
|
76
|
+
│
|
|
77
|
+
├── utils/ # 纯工具函数
|
|
78
|
+
│ ├── format.ts # 日期、数字、货币格式化
|
|
79
|
+
│ ├── validators.ts # 表单校验规则
|
|
80
|
+
│ └── storage.ts # LocalStorage / SessionStorage 封装
|
|
81
|
+
│
|
|
82
|
+
├── directives/ # 自定义指令
|
|
83
|
+
│ ├── vPermission.ts # 权限指令
|
|
84
|
+
│ └── vClickOutside.ts # 点击外部关闭
|
|
85
|
+
│
|
|
86
|
+
├── plugins/ # Vue 插件注册
|
|
87
|
+
│ ├── i18n.ts # vue-i18n 插件配置
|
|
88
|
+
│ └── index.ts # 插件统一注册入口
|
|
89
|
+
│
|
|
90
|
+
├── styles/ # 全局样式与主题
|
|
91
|
+
│ ├── global.css # 全局基础样式(reset / normalize)
|
|
92
|
+
│ ├── variables.css # CSS 变量(颜色、间距、字号)
|
|
93
|
+
│ ├── breakpoints.ts # 响应式断点常量
|
|
94
|
+
│ └── themes/ # 主题定义
|
|
95
|
+
│ ├── light.css # 亮色主题变量
|
|
96
|
+
│ ├── dark.css # 暗色主题变量
|
|
97
|
+
│ └── index.ts # 主题切换逻辑
|
|
98
|
+
│
|
|
99
|
+
└── constants/ # 全局常量
|
|
100
|
+
├── routes.ts # 路由路径常量
|
|
101
|
+
└── config.ts # 业务常量(分页大小、超时时间等)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 关键原则
|
|
105
|
+
|
|
106
|
+
- `pages/` 做路由映射和布局组合,不放业务逻辑
|
|
107
|
+
- `layouts/` 定义页面骨架(侧边栏、顶栏、面包屑),由路由配置的 `component` 引用
|
|
108
|
+
- `features/` 按业务领域划分,模块内自包含(components + composables + api + types)
|
|
109
|
+
- `components/` 仅放无业务耦合的通用组件,可跨项目复用
|
|
110
|
+
- `composables/` 仅放通用逻辑(防抖、媒体查询等),业务 composables 放到对应 feature 中
|
|
111
|
+
- `locales/` 存放语言包 JSON 文件,模板中使用 `$t('key')` 而非硬编码文案
|
|
112
|
+
- `assets/` 存放静态资源,图标优先使用 SVG,图片优先使用 WebP/AVIF
|
|
113
|
+
- `config/` 封装环境变量和 Feature Flags,禁止组件中直接读取 `import.meta.env`
|
|
114
|
+
- `styles/themes/` 通过 CSS 变量实现主题切换,组件中引用变量而非硬编码颜色
|
|
115
|
+
- 每个模块通过 `index.ts` 管控公开 API,避免深层路径导入
|
|
116
|
+
|
|
117
|
+
## 组件设计规范
|
|
118
|
+
|
|
119
|
+
- 使用 `<script setup lang="ts">`
|
|
120
|
+
- 明确使用 `defineProps` / `defineEmits` 并附带类型
|
|
121
|
+
- 可复用逻辑优先提取到 composables
|
|
122
|
+
- 保持 template 可读,避免过深条件嵌套
|
|
123
|
+
- 优先使用计算属性,而不是重复维护状态
|
|
124
|
+
- 避免构建大型单体组件;**单文件规模**见 `templates/shared/rules/fec-vue.md`「**组件文件规模**」(约 300 行内为佳,逾 500 行或复杂度过高拆子组件与 Composables)
|
|
125
|
+
- 优先使用强类型的 props、emits 和暴露方法
|
|
126
|
+
- 遵循仓库的文件与目录命名规范
|
|
127
|
+
- 优先复用现有 UI 组件和 Token
|
|
128
|
+
|
|
129
|
+
### 组件分层
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
页面组件 (Pages) → 路由映射、布局组合
|
|
133
|
+
└── 容器组件 (Containers) → 数据获取、状态编排
|
|
134
|
+
└── 业务组件 (Features) → 领域逻辑展示
|
|
135
|
+
└── 通用组件 (UI) → 纯展示,无业务耦合
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## 注释规范
|
|
139
|
+
|
|
140
|
+
- **优先使用中文**:解释「为什么这样做」、业务约束、边界情况、非显而易见的权衡时,优先用中文撰写注释,便于团队与业务方阅读。
|
|
141
|
+
- **与代码语言一致时的例外**:对接第三方协议字段名、HTTP 头、规范中的英文术语时,注释里可保留英文专有名词,必要时中英文并列说明。
|
|
142
|
+
- **少而精**:能通过清晰命名与类型表达清楚的逻辑不写废话注释;复杂分支、临时兼容、性能取舍必须写清意图。
|
|
143
|
+
- **公开 API**:composable 或模块的对外契约可用 JSDoc(`@param` / `@returns` / `@example`),说明用中文即可,除非仓库统一要求英文。
|
|
144
|
+
|
|
145
|
+
## TypeScript 规范
|
|
146
|
+
|
|
147
|
+
通用 TypeScript 工程规则由 `fec-typescript-project-standard` 负责,包括 `tsconfig`、strictness、DTO / view model 边界、`unknown` 收窄、public API 类型、声明产物和类型测试。
|
|
148
|
+
|
|
149
|
+
Vue 规范只补充 SFC、Props / Emits、暴露方法、Provide / Inject 和 composable 响应性类型;复杂类型建模或跨框架类型契约先分流到 `fec-typescript-project-standard`。
|
|
150
|
+
|
|
151
|
+
### Vue 3 项目补充约定
|
|
152
|
+
|
|
153
|
+
```vue
|
|
154
|
+
<script setup lang="ts">
|
|
155
|
+
interface Props {
|
|
156
|
+
title: string;
|
|
157
|
+
items: Item[];
|
|
158
|
+
loading?: boolean;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
interface Emits {
|
|
162
|
+
(e: "select", item: Item): void;
|
|
163
|
+
(e: "delete", id: string): void;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
167
|
+
loading: false,
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
const emit = defineEmits<Emits>();
|
|
171
|
+
</script>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
- Props 和 Emits 使用 TypeScript interface 定义
|
|
175
|
+
- 使用 `withDefaults` 设置默认值
|
|
176
|
+
- `defineExpose` 暴露的方法需有类型约束
|