@bovinphang/frontend-craft 2.6.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 +3 -3
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +72 -1
- package/CHANGELOG.zh-CN.md +71 -1
- package/README.md +10 -6
- package/README.openclaw.md +100 -42
- package/README.openclaw.zh-CN.md +100 -42
- package/README.zh-CN.md +10 -6
- 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 +88 -88
- 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 +84 -69
- package/docs/ja-JP/README.md +56 -52
- package/docs/ko-KR/README.md +45 -41
- package/docs/project-structure.md +19 -7
- package/docs/superpowers/plans/2026-05-29-fec-debug.md +491 -0
- package/docs/superpowers/specs/2026-05-29-fec-debug-design.md +340 -0
- package/docs/zh-CN/example-prompts.md +84 -69
- package/docs/zh-CN/project-structure.md +14 -5
- package/docs/zh-TW/README.md +33 -29
- 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/{skills/fec-typescript-type-safety → localized/zh-CN/skills/fec-typescript-project-standard}/references/type-safety-patterns.md +1 -1
- package/{skills/fec-typescript-type-safety/SKILL.md → localized/zh-CN/skills/fec-typescript-project-standard/references/type-safety.md} +5 -14
- 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 +4 -3
- package/skills/TEMPLATE.md +74 -74
- package/skills/eval_queries.json +717 -619
- 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 +45 -0
- 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 +73 -0
- package/skills/fec-drawio-studio/data/THIRD_PARTY_NOTICES.md +10 -0
- package/skills/fec-drawio-studio/data/brand-icons.json +878 -0
- package/skills/fec-drawio-studio/data/shape-index.json +83570 -0
- package/skills/fec-drawio-studio/references/data-residency.md +27 -0
- package/skills/fec-drawio-studio/references/diagram-patterns.md +60 -0
- package/skills/fec-drawio-studio/references/flowchart-quality.md +49 -0
- package/skills/fec-drawio-studio/references/layout-and-export.md +72 -0
- package/skills/fec-drawio-studio/references/troubleshooting.md +29 -0
- package/skills/fec-drawio-studio/references/xml-and-mermaid.md +58 -0
- package/skills/fec-drawio-studio/scripts/brand-symbols.mjs +99 -0
- package/skills/fec-drawio-studio/scripts/diagram-lint.mjs +205 -0
- package/skills/fec-drawio-studio/scripts/diagram-url.mjs +102 -0
- package/skills/fec-drawio-studio/scripts/drawio-export.mjs +134 -0
- package/skills/fec-drawio-studio/scripts/layout-graph.mjs +107 -0
- package/skills/fec-drawio-studio/scripts/png-embed-fix.mjs +26 -0
- package/skills/fec-drawio-studio/scripts/scan-go-packages.mjs +36 -0
- package/skills/fec-drawio-studio/scripts/scan-js-modules.mjs +52 -0
- package/skills/fec-drawio-studio/scripts/scan-python-classes.mjs +30 -0
- package/skills/fec-drawio-studio/scripts/scan-python-modules.mjs +55 -0
- package/skills/fec-drawio-studio/scripts/scan-rust-modules.mjs +35 -0
- package/skills/fec-drawio-studio/scripts/scan-ts-modules.mjs +7 -0
- package/skills/fec-drawio-studio/scripts/shape-query.mjs +121 -0
- package/skills/fec-drawio-studio/scripts/studio-core.mjs +139 -0
- package/skills/fec-drawio-studio/styles/built-in/corporate.json +49 -0
- package/skills/fec-drawio-studio/styles/built-in/default.json +49 -0
- package/skills/fec-drawio-studio/styles/built-in/handdrawn.json +49 -0
- package/skills/fec-drawio-studio/styles/schema.json +112 -0
- package/skills/fec-e2e-testing/SKILL.md +24 -22
- package/skills/fec-e2e-testing/references/e2e-ci-reporting.md +62 -0
- package/skills/fec-e2e-testing/references/e2e-special-scenarios.md +52 -0
- package/skills/fec-e2e-testing/references/e2e-visual-regression.md +60 -0
- 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 +81 -0
- package/skills/fec-image-generation/assets/interactive-diagram.html +371 -0
- package/skills/fec-image-generation/references/artifact-routing.md +80 -0
- package/skills/fec-image-generation/references/diagram-workflows.md +74 -0
- package/skills/fec-image-generation/references/html-technical-diagrams.md +236 -0
- package/skills/fec-image-generation/references/png-qa-autofix.md +30 -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/png-qa.mjs +431 -0
- package/skills/fec-image-generation/scripts/tech-diagram-render.mjs +1397 -0
- package/skills/fec-implement-from-design/SKILL.md +81 -74
- package/skills/fec-implement-from-design/references/design-plan-template.md +16 -16
- package/skills/fec-legacy-to-modern-migration/SKILL.md +29 -173
- package/skills/fec-legacy-to-modern-migration/references/migration-execution-checklist.md +110 -0
- 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 +48 -0
- 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 -44
- package/skills/fec-motion-interaction/references/motion-patterns.md +11 -11
- package/skills/fec-nextjs-project-standard/SKILL.md +64 -58
- package/skills/fec-nuxt-project-standard/SKILL.md +57 -57
- package/skills/fec-performance-optimization/SKILL.md +54 -50
- package/skills/fec-performance-optimization/references/framework-performance-patterns.md +38 -0
- package/skills/fec-performance-optimization/references/report-template.md +34 -28
- 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 -64
- package/skills/fec-react-project-standard/references/react-performance-patterns.md +35 -0
- package/skills/fec-react-project-standard/references/react-project-structure.md +197 -0
- package/skills/fec-react-project-standard/references/react-quality-patterns.md +131 -0
- package/skills/fec-react-project-standard/references/react-runtime-patterns.md +293 -0
- 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 +39 -28
- 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 +66 -40
- 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 -32
- 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 +54 -0
- package/skills/fec-typescript-project-standard/references/type-safety-patterns.md +102 -0
- package/skills/fec-typescript-project-standard/references/type-safety.md +148 -0
- package/skills/fec-ui-design/SKILL.md +90 -72
- package/skills/fec-ui-design/data/style-archetypes.json +40 -0
- package/skills/fec-ui-design/data/ux-quality-rules.json +35 -0
- package/skills/fec-ui-design/references/design-intelligence.md +81 -21
- package/skills/fec-ui-design/references/master-page-overrides.md +15 -15
- package/skills/fec-ui-design/references/pre-delivery-checklist.md +38 -32
- package/skills/fec-ui-design/scripts/design-system.mjs +119 -1
- 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 +39 -30
- package/skills/fec-vue3-project-standard/references/vue3-composables-routing.md +163 -0
- package/skills/fec-vue3-project-standard/references/vue3-performance-patterns.md +13 -0
- package/skills/fec-vue3-project-standard/references/vue3-project-structure.md +177 -0
- package/skills/fec-vue3-project-standard/references/vue3-state-api-quality.md +216 -0
- package/skills/fec-web-video-presentation/SKILL.md +61 -0
- package/skills/fec-web-video-presentation/data/starter-themes.json +59 -0
- package/skills/fec-web-video-presentation/references/chapter-craft.md +37 -0
- package/skills/fec-web-video-presentation/references/content-plan.md +38 -0
- package/skills/fec-web-video-presentation/references/recording-and-audio.md +33 -0
- package/skills/fec-web-video-presentation/references/theme-system.md +36 -0
- package/skills/fec-web-video-presentation/scripts/create-video-presentation.mjs +430 -0
- 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 +402 -220
- package/skills/relations.json +120 -25
- 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 -117
- package/templates/shared/rules/fec-code-comments.md +22 -22
- package/templates/shared/rules/fec-design-system.md +65 -241
- package/templates/shared/rules/fec-error-handling.md +41 -185
- package/templates/shared/rules/fec-git-conventions.md +42 -42
- package/templates/shared/rules/fec-i18n.md +48 -96
- 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 -30
- package/templates/shared/rules/fec-rendering-patterns.md +40 -183
- package/templates/shared/rules/fec-responsive-design.md +37 -214
- package/templates/shared/rules/fec-source-driven-development.md +22 -22
- package/templates/shared/rules/fec-state-management.md +45 -148
- package/templates/shared/rules/fec-testing.md +64 -64
- package/templates/shared/rules/fec-typescript.md +98 -341
- package/templates/shared/rules/fec-vue.md +42 -42
- package/templates/shared/rules/fec-working-modes.md +34 -34
- package/skills/fec-e2e-testing/references/e2e-advanced.md +0 -176
- package/skills/fec-react-project-standard/references/react-project-details.md +0 -642
- package/skills/fec-vue3-project-standard/references/vue3-project-details.md +0 -547
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# E2E 视觉回归测试
|
|
2
|
+
|
|
3
|
+
通过截图快照对比检测非预期的 UI 变化。适用于 CSS 重构、设计 Token 更新、组件改版等场景。
|
|
4
|
+
|
|
5
|
+
## 基础用法
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { test, expect } from "@playwright/test";
|
|
9
|
+
|
|
10
|
+
test("首页布局与基线一致", async ({ page }) => {
|
|
11
|
+
await page.goto("/");
|
|
12
|
+
await page.waitForLoadState("networkidle");
|
|
13
|
+
|
|
14
|
+
// 全页截图对比 - 首次运行自动生成基线
|
|
15
|
+
await expect(page).toHaveScreenshot("homepage-full.png", {
|
|
16
|
+
fullPage: true,
|
|
17
|
+
maxDiffPixels: 100, // 允许的轻微像素差异(抗锯齿等)
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test("按钮组件视觉一致", async ({ page }) => {
|
|
22
|
+
await page.goto("/components/buttons");
|
|
23
|
+
const submitButton = page.getByTestId("submit-button");
|
|
24
|
+
await expect(submitButton).toHaveScreenshot("submit-button.png");
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 屏蔽动态内容
|
|
29
|
+
|
|
30
|
+
时间、随机 ID、第三方广告等动态元素会导致误报,使用 `mask` 屏蔽:
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
await expect(page).toHaveScreenshot("dashboard.png", {
|
|
34
|
+
mask: [
|
|
35
|
+
page.locator(".live-clock"),
|
|
36
|
+
page.locator(".random-id"),
|
|
37
|
+
page.locator(".ad-banner"),
|
|
38
|
+
],
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## 禁用动画
|
|
43
|
+
|
|
44
|
+
CSS 动画会导致截图不一致,注入样式禁用动画后再截图:
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
await page.addStyleTag({
|
|
48
|
+
content:
|
|
49
|
+
"*, *::before, *::after { animation-duration: 0s !important; transition-duration: 0s !important; }",
|
|
50
|
+
});
|
|
51
|
+
await expect(page).toHaveScreenshot("animated-page.png");
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 基线管理
|
|
55
|
+
|
|
56
|
+
- **首次运行**: `npx playwright test` 失败但自动生成基线到 `tests/` 目录
|
|
57
|
+
- **更新基线**: UI 有意变更时 `npx playwright test --update-snapshots`
|
|
58
|
+
- **CI 一致性**: 基线必须在与 CI 相同的 OS(Linux/Ubuntu)上生成,字体渲染在 macOS 与 Linux 间存在差异
|
|
59
|
+
- **多浏览器**: 每个 project 独立生成基线(Chromium/Firefox/WebKit 渲染结果不同)
|
|
60
|
+
- **基线文件**: 纳入 `.gitignore` 或 Git LFS 管理,避免仓库膨胀
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Playwright / Cypress E2E 模式
|
|
2
|
+
|
|
3
|
+
## 目录结构
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
tests/
|
|
7
|
+
├── e2e/
|
|
8
|
+
│ ├── auth/login.spec.ts
|
|
9
|
+
│ └── features/search.spec.ts
|
|
10
|
+
├── fixtures/
|
|
11
|
+
│ └── auth.ts
|
|
12
|
+
└── pages/
|
|
13
|
+
├── LoginPage.ts
|
|
14
|
+
└── ItemsPage.ts
|
|
15
|
+
playwright.config.ts
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Page Object 模式
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { type Locator, type Page } from "@playwright/test";
|
|
22
|
+
|
|
23
|
+
export class ItemsPage {
|
|
24
|
+
readonly searchInput: Locator;
|
|
25
|
+
readonly itemCards: Locator;
|
|
26
|
+
|
|
27
|
+
constructor(private readonly page: Page) {
|
|
28
|
+
this.searchInput = page.getByTestId("search-input");
|
|
29
|
+
this.itemCards = page.getByTestId("item-card");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async goto() {
|
|
33
|
+
await this.page.goto("/items");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async search(keyword: string) {
|
|
37
|
+
await this.searchInput.fill(keyword);
|
|
38
|
+
await this.page.waitForResponse((response) => response.url().includes("/api/search"));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Spec 示例
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import { expect, test } from "@playwright/test";
|
|
47
|
+
import { ItemsPage } from "../pages/ItemsPage";
|
|
48
|
+
|
|
49
|
+
test.describe("商品搜索", () => {
|
|
50
|
+
test("按关键词搜索有结果", async ({ page }) => {
|
|
51
|
+
const itemsPage = new ItemsPage(page);
|
|
52
|
+
await itemsPage.goto();
|
|
53
|
+
await itemsPage.search("test");
|
|
54
|
+
await expect(itemsPage.itemCards.first()).toContainText(/test/i);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 配置
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { defineConfig, devices } from "@playwright/test";
|
|
63
|
+
|
|
64
|
+
export default defineConfig({
|
|
65
|
+
testDir: "./tests/e2e",
|
|
66
|
+
forbidOnly: !!process.env.CI,
|
|
67
|
+
retries: process.env.CI ? 2 : 0,
|
|
68
|
+
reporter: [["html"], ["junit", { outputFile: "playwright-results.xml" }]],
|
|
69
|
+
use: {
|
|
70
|
+
baseURL: process.env.BASE_URL || "http://localhost:3000",
|
|
71
|
+
trace: "on-first-retry",
|
|
72
|
+
screenshot: "only-on-failure",
|
|
73
|
+
video: "retain-on-failure",
|
|
74
|
+
},
|
|
75
|
+
projects: [
|
|
76
|
+
{ name: "chromium", use: { ...devices["Desktop Chrome"] } },
|
|
77
|
+
{ name: "webkit", use: { ...devices["Desktop Safari"] } },
|
|
78
|
+
],
|
|
79
|
+
webServer: {
|
|
80
|
+
command: "npm run dev",
|
|
81
|
+
url: "http://localhost:3000",
|
|
82
|
+
reuseExistingServer: !process.env.CI,
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Flaky 调试
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npx playwright test path/to/spec.ts --repeat-each=10
|
|
91
|
+
npx playwright test path/to/spec.ts --retries=3
|
|
92
|
+
npx playwright show-trace path/to/trace.zip
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
常见原因:竞态、网络时序、动画、测试数据污染、跨测试状态泄露。
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fec-form-handling
|
|
3
|
+
description: 用于构建或审查较复杂表单,包括 React Hook Form、Zod schema、类型化校验、动态字段、受控第三方输入、文件上传、多步骤流程、依赖校验或表单性能。不要用于没有校验的 1-3 个字段小表单;中文触发词包括 表单、表单校验、动态字段。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 表单处理
|
|
7
|
+
|
|
8
|
+
## 用途
|
|
9
|
+
|
|
10
|
+
管理表单状态、校验和提交,避免复杂表单输入卡顿。
|
|
11
|
+
|
|
12
|
+
## 流程
|
|
13
|
+
|
|
14
|
+
1. 先识别框架、项目既有表单库、schema 校验库、组件库和复杂度;10+ 字段、动态字段、联动校验、文件上传、多步流程或输入卡顿时再引入专门表单方案。
|
|
15
|
+
2. 按项目栈选型:React 可考虑 React Hook Form + Zod;Vue 可考虑 vee-validate / FormKit + Zod、Yup 或 Valibot;简单表单可用框架原生状态和基础校验。
|
|
16
|
+
3. 用运行时 schema 或明确校验函数守住外部输入边界;TypeScript 类型可从 schema 推导,但不要只写 TS 类型。
|
|
17
|
+
4. 明确默认值、字段注册、受控/非受控边界和组件库适配;错误提示用 `aria-invalid`、`aria-describedby` 和 `role="alert"`。
|
|
18
|
+
5. 提交时处理 loading、服务端错误、重复提交和 reset;大型表单用局部订阅和子组件隔离控制重渲染。
|
|
19
|
+
|
|
20
|
+
## React 快速开始
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
24
|
+
import { useForm } from "react-hook-form";
|
|
25
|
+
import { z } from "zod";
|
|
26
|
+
|
|
27
|
+
const loginSchema = z.object({
|
|
28
|
+
email: z.string().email("请输入有效的邮箱地址"),
|
|
29
|
+
password: z.string().min(8, "密码至少 8 个字符"),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
type LoginForm = z.infer<typeof loginSchema>;
|
|
33
|
+
|
|
34
|
+
export function LoginFormView() {
|
|
35
|
+
const {
|
|
36
|
+
register,
|
|
37
|
+
handleSubmit,
|
|
38
|
+
formState: { errors, isSubmitting },
|
|
39
|
+
} = useForm<LoginForm>({
|
|
40
|
+
resolver: zodResolver(loginSchema),
|
|
41
|
+
defaultValues: { email: "", password: "" },
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<form onSubmit={handleSubmit((data) => api.login(data))} noValidate>
|
|
46
|
+
<label htmlFor="email">邮箱</label>
|
|
47
|
+
<input id="email" {...register("email")} aria-invalid={!!errors.email} />
|
|
48
|
+
{errors.email && <span role="alert">{errors.email.message}</span>}
|
|
49
|
+
|
|
50
|
+
<label htmlFor="password">密码</label>
|
|
51
|
+
<input id="password" type="password" {...register("password")} />
|
|
52
|
+
{errors.password && <span role="alert">{errors.password.message}</span>}
|
|
53
|
+
|
|
54
|
+
<button disabled={isSubmitting}>
|
|
55
|
+
{isSubmitting ? "提交中..." : "提交"}
|
|
56
|
+
</button>
|
|
57
|
+
</form>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 详细参考
|
|
63
|
+
|
|
64
|
+
涉及是否需要表单库、框架选型、`Controller`、`useFieldArray`、联动校验、文件上传、多步表单、异步校验和性能模式时,加载 [references/advanced-form-patterns.md](references/advanced-form-patterns.md)。
|
|
65
|
+
|
|
66
|
+
## 约束
|
|
67
|
+
|
|
68
|
+
- 沿用仓库既有表单库、schema 库和组件库适配方式,不为单个表单引入第二套体系。
|
|
69
|
+
- 默认值必须完整,避免 undefined 触发受控/非受控警告或初始化抖动。
|
|
70
|
+
- reset 应传服务器返回或明确的完整默认对象。
|
|
71
|
+
- 异步校验必须 debounce 或放到提交边界,避免每次键入请求。
|
|
72
|
+
- schema 级联动校验的错误 path 必须指向实际字段。
|
|
73
|
+
|
|
74
|
+
## 预期输出
|
|
75
|
+
|
|
76
|
+
产出类型安全、可访问、提交状态明确的表单;复杂字段和文件上传有 schema 约束,输入过程无明显卡顿,服务端错误能回填到用户可理解的位置。
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# 高级表单模式
|
|
2
|
+
|
|
3
|
+
## 先判断是否需要表单库
|
|
4
|
+
|
|
5
|
+
- 1-3 个字段、无复杂校验、无动态字段、无组件库适配压力的表单,可用框架原生状态、浏览器约束校验和轻量提交状态。
|
|
6
|
+
- 需要动态字段、跨字段校验、多步流程、文件上传、异步校验、服务端错误回填或明显输入卡顿时,再引入专门表单方案。
|
|
7
|
+
- 表单库只管理字段状态和校验流程,不替代 API 错误映射、权限判断、可访问性标注或服务端最终校验。
|
|
8
|
+
|
|
9
|
+
## 选型参考
|
|
10
|
+
|
|
11
|
+
先沿用项目已有表单库、schema 库和组件库适配方式;新增依赖时再按场景选择。
|
|
12
|
+
|
|
13
|
+
| 场景 | 候选方案 | 注意点 |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| React 复杂表单 | React Hook Form + Zod | 非受控优先,第三方受控组件用 `Controller`。 |
|
|
16
|
+
| Vue 复杂表单 | vee-validate / FormKit + Zod、Yup 或 Valibot | 不要为 Vue 项目引入 React-only 表单 API;优先沿用项目既有 Vue 表单库。 |
|
|
17
|
+
| 简单表单 | 框架原生状态 + 基础校验 | 避免为了 1-3 个字段引入重型表单体系。 |
|
|
18
|
+
| 多步表单 | 分步 schema + 最终提交 schema | 明确跨步数据保存、返回上一步和最终校验策略。 |
|
|
19
|
+
| 文件上传 | 表单库字段状态 + `FormData` | 校验文件数量、大小、类型;不要把 `File` JSON 序列化。 |
|
|
20
|
+
| 异步校验 | 提交边界校验或 debounce 字段校验 | 避免每次键入请求;处理竞态和旧响应覆盖。 |
|
|
21
|
+
|
|
22
|
+
## 通用实现原则
|
|
23
|
+
|
|
24
|
+
- 运行时 schema 或校验函数负责外部输入边界;TypeScript 类型不能替代运行时校验。
|
|
25
|
+
- 默认值、reset 数据和服务端回填数据要形状一致,避免字段在受控/非受控之间切换。
|
|
26
|
+
- 字段错误要能映射到具体字段;全局错误用于提交失败、权限或服务不可用等非字段问题。
|
|
27
|
+
- 组件库适配层要透传 value、onChange、onBlur、name/ref 或等价字段注册能力。
|
|
28
|
+
- 提交时保护 loading、重复提交、取消/过期请求、服务端错误回填和成功后 reset。
|
|
29
|
+
- 文件上传使用 `FormData` 或直传流程,前端校验只做体验保护,服务端仍需最终校验。
|
|
30
|
+
- 性能优化优先使用字段级订阅、局部组件拆分和延迟校验,不要全表单 watch 后驱动整页重渲染。
|
|
31
|
+
|
|
32
|
+
## React Hook Form Controller
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
<Controller
|
|
36
|
+
name="role"
|
|
37
|
+
control={control}
|
|
38
|
+
rules={{ required: "请选择角色" }}
|
|
39
|
+
render={({ field, fieldState }) => (
|
|
40
|
+
<>
|
|
41
|
+
<Select {...field} options={roleOptions} />
|
|
42
|
+
{fieldState.error && <span role="alert">{fieldState.error.message}</span>}
|
|
43
|
+
</>
|
|
44
|
+
)}
|
|
45
|
+
/>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
用于不暴露原生 `ref` 的 Select、DatePicker、RichEditor 等组件。
|
|
49
|
+
|
|
50
|
+
## React Hook Form 动态字段
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
const { fields, append, remove } = useFieldArray({
|
|
54
|
+
control,
|
|
55
|
+
name: "contacts",
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
{fields.map((field, index) => (
|
|
59
|
+
<div key={field.id}>
|
|
60
|
+
<input {...register(`contacts.${index}.name`)} />
|
|
61
|
+
<button type="button" onClick={() => remove(index)}>删除</button>
|
|
62
|
+
</div>
|
|
63
|
+
))}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`key` 必须使用 `field.id`,不要使用数组 index。
|
|
67
|
+
|
|
68
|
+
## Zod 联动校验
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
const schema = z
|
|
72
|
+
.object({
|
|
73
|
+
password: z.string().min(8),
|
|
74
|
+
confirmPassword: z.string().min(8),
|
|
75
|
+
})
|
|
76
|
+
.refine((data) => data.password === data.confirmPassword, {
|
|
77
|
+
message: "两次密码不一致",
|
|
78
|
+
path: ["confirmPassword"],
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Zod 文件上传校验
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
const schema = z.object({
|
|
86
|
+
avatar: z
|
|
87
|
+
.instanceof(FileList)
|
|
88
|
+
.refine((files) => files.length > 0, "请上传头像")
|
|
89
|
+
.refine((files) => files[0]?.size <= 5 * 1024 * 1024, "文件大小不超过 5MB")
|
|
90
|
+
.refine((files) => ["image/jpeg", "image/png"].includes(files[0]?.type), "仅支持 JPG/PNG"),
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
提交时用 `FormData`,不要把 `File` JSON 序列化。
|
|
95
|
+
|
|
96
|
+
## 性能
|
|
97
|
+
|
|
98
|
+
- 用 `useWatch` 或字段级订阅替代全表单 watch。
|
|
99
|
+
- 大表单拆成 memoized 子组件或框架等价的局部更新单元。
|
|
100
|
+
- 高频输入不要每次键入触发网络校验。
|
|
101
|
+
- 多步表单要明确每步 schema 和跨步最终 schema。
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fec-image-generation
|
|
3
|
+
description: 用于生成或编辑图表、图形资产、海报、UI 样机、产品图、信息图、学术图、漫画、头像、分镜、品牌板或图像编辑工作流,尤其是导出 PNG 需要视觉质检和有限自动修复时。文字密集图表优先使用确定性的 Mermaid/SVG/HTML/canvas 源;浏览器可打开的技术图优先使用 HTML technical diagrams,覆盖系统蓝图、架构图、部署拓扑、Agent runtime、memory flow、before-after architecture、流程、序列、数据流、生命周期、runbook、PII/数据血缘和状态机;不要用于不涉及生成图像的普通 UI 打磨。中文触发词包括 图片生成、图像编辑、图表生成、架构图、系统蓝图、部署拓扑、Agent runtime、memory flow、before-after architecture、工作流图、数据流、生命周期图、状态机、ER 图、UML、序列图、海报、UI 样机、产品图、信息图、学术图、漫画、头像、分镜、品牌板、PNG 自检、自动修复。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 图片生成与图表工作流
|
|
7
|
+
|
|
8
|
+
## 用途
|
|
9
|
+
|
|
10
|
+
生成或编辑图表、视觉资产和图片工作流,并对导出的 PNG 做可复查的自检与修复迭代。
|
|
11
|
+
|
|
12
|
+
## 流程
|
|
13
|
+
|
|
14
|
+
1. 判断产物类型
|
|
15
|
+
- 文本、结构和连线准确性优先时,用 Mermaid、SVG、HTML/CSS、canvas 或图表库生成可编辑源,再导出 PNG。
|
|
16
|
+
- 需要单文件浏览器打开、暗/亮主题和结构化 QA 的系统蓝图、架构图、部署拓扑、Agent runtime、memory flow、before-after architecture、流程、序列、数据流、生命周期、runbook、状态机或 PII/数据血缘图时,使用 HTML technical diagrams。
|
|
17
|
+
- 流程地图、审批流、自动化运行、异常路径和循环运营流需要清晰的起止节点、决策、参与者、步骤编号和摘要,但不需要 diagrams.net 时,使用 HTML `workflow` 路线。
|
|
18
|
+
- 系统、Agent、memory、数据或 tool-call 图需要语义节点形状、有含义的连线和可浏览器打开、可导出、可 QA 的源文件时,使用主题化 HTML technical diagrams。
|
|
19
|
+
- 用户需要在本地浏览器里看到节点和连线实时出现,或需要在会话中拖拽、改标签、删除、缩放并快速导出草图时,使用交互式实时图表路线。
|
|
20
|
+
- 审美、质感、照片、插画、漫画、产品图或品牌氛围优先时,用图片生成或编辑工具,再把最终资产保存到项目或报告目录。
|
|
21
|
+
|
|
22
|
+
2. 明确输入与约束
|
|
23
|
+
- 收集受众、用途、尺寸、语言、必须出现的文本、品牌限制、可编辑源格式、导出格式和禁用元素。
|
|
24
|
+
- 对海报、UI 样机、品牌板和产品图,先写出一行视觉读取:目标用户、场景、可信感来源、主视觉锚点。
|
|
25
|
+
|
|
26
|
+
3. 选择生成路线
|
|
27
|
+
- ER 图、UML 类图、序列图、技术架构图、ML/深度学习、流程图等,优先按 [diagram-workflows.md](references/diagram-workflows.md) 建立结构化源。
|
|
28
|
+
- 浏览器可打开的系统蓝图、架构、流程、序列、数据流和生命周期图,先读 [html-technical-diagrams.md](references/html-technical-diagrams.md),再用 [tech-diagram-render.mjs](scripts/tech-diagram-render.mjs) 渲染 JSON IR。流程工作流用 `lanes` 表达参与方,用 `nodes` 表达有序动作,用 `edges` 表达异常或回环路径,并可添加 `waypoints`:
|
|
29
|
+
```bash
|
|
30
|
+
node skills/fec-image-generation/scripts/tech-diagram-render.mjs --input diagram.json --output diagram.html --type architecture --manifest diagram.layout.json
|
|
31
|
+
```
|
|
32
|
+
- Agent 和 memory 图优先使用 `architecture` IR,并使用 `agent`、`model`、`memory`、`vectorstore`、`graphdb`、`tool`、`document`、`queue`、`browser`、`user`、`gateway` 等语义节点类型。连线含义重要时添加 `flow`:`control`、`data`、`read`、`write`、`async`、`feedback`;出现两种以上 flow 时自动生成 flow legend。
|
|
33
|
+
- 需要源文件级主题方向时可添加 `visual.style`:`default`、`terminal`、`blueprint`、`minimal`、`glass`、`warm`、`openai` 或 `editorial-dark`。这些是交付主题,不等同于品牌规范承诺。
|
|
34
|
+
- 需要从生成好的 HTML/SVG 源导出适合 README 的 SVG、PNG、JPG 或 JPEG 交付物时,使用 [export-diagram.mjs](scripts/export-diagram.mjs):
|
|
35
|
+
```bash
|
|
36
|
+
node skills/fec-image-generation/scripts/export-diagram.mjs --input diagram.html --format svg
|
|
37
|
+
node skills/fec-image-generation/scripts/export-diagram.mjs --input diagram.html --format png --output diagram.png --scale 2
|
|
38
|
+
```
|
|
39
|
+
- 实时交互草图使用 [interactive-diagram-server.mjs](scripts/interactive-diagram-server.mjs),打开服务提供的 [interactive-diagram.html](assets/interactive-diagram.html) 页面并带上唯一 `?s=session-id`,再向 `/cmd?s=session-id` 发送小 JSON 命令:
|
|
40
|
+
```bash
|
|
41
|
+
node skills/fec-image-generation/scripts/interactive-diagram-server.mjs --port 6100
|
|
42
|
+
curl -s "http://127.0.0.1:6100/cmd?s=checkout-flow" -d '{"cmd":"init","title":"Checkout Flow","direction":"TB"}'
|
|
43
|
+
curl -s "http://127.0.0.1:6100/cmd?s=checkout-flow" -d '{"cmd":"node","id":"cart","label":"Review cart","type":"process"}'
|
|
44
|
+
```
|
|
45
|
+
- 海报、UI 样机、产品图、信息图、学术图、漫画、头像、分镜、品牌板和图像编辑,按 [artifact-routing.md](references/artifact-routing.md) 选择生成、编辑或混合路线。
|
|
46
|
+
|
|
47
|
+
4. 导出并自检 PNG
|
|
48
|
+
- 每次交付前都读取导出的 PNG,检查主体是否真实渲染、文字是否截断、连线是否堆叠、节点是否重叠。
|
|
49
|
+
- 有布局 manifest 时运行:
|
|
50
|
+
```bash
|
|
51
|
+
node skills/fec-image-generation/scripts/png-qa.mjs --png output.png --manifest layout.json --format markdown
|
|
52
|
+
```
|
|
53
|
+
- 没有 manifest 时仍运行 PNG 基础检查:
|
|
54
|
+
```bash
|
|
55
|
+
node skills/fec-image-generation/scripts/png-qa.mjs --png output.png --format json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
5. 自动修复循环
|
|
59
|
+
- 默认最多 2 轮;用户明确要求时可提高到 5 轮软上限。
|
|
60
|
+
- 修复对象是源文件、prompt、布局参数或导出尺寸,不直接破坏性修改 PNG 像素。
|
|
61
|
+
- 按 [png-qa-autofix.md](references/png-qa-autofix.md) 把问题转成具体修复:增大画布、换行、移动节点、分层连线、调整 padding 或重导出。
|
|
62
|
+
|
|
63
|
+
6. 交付记录
|
|
64
|
+
- 说明最终源文件、PNG 路径、生成路线、QA 轮次、发现并修复的问题、仍需人工确认的文字或品牌风险。
|
|
65
|
+
|
|
66
|
+
## 约束
|
|
67
|
+
|
|
68
|
+
- 文本密集图不要只靠位图模型生成;必须保留可编辑结构化源。
|
|
69
|
+
- HTML 技术图必须保留 JSON 源和生成的 HTML;PNG/SVG/JPG 是交付产物,不是事实源。需要官方厂商图标或长期手工编辑时,改用 `.drawio` 路线。
|
|
70
|
+
- 主题化语义图由 Frontend Craft 渲染器实现。不要把 Python、shell、cairosvg、rsvg-convert、Puppeteer、CDN 截图库、复制来的 SVG 模板或外部图标包作为这一路线的必需依赖。
|
|
71
|
+
- 交互式实时图表是会话期预览;当图表成为交付物时要保存 JSON/SVG/PNG 导出,需要长期维护事实源时改用 HTML technical diagrams 或 `.drawio`。
|
|
72
|
+
- 不把截图、假数据或占位图当成最终产品图,除非用户明确要求概念稿。
|
|
73
|
+
- 不直接覆盖原图;编辑工作流默认输出新文件。
|
|
74
|
+
- 不为追求美观牺牲可读标签、连线归属、图例、坐标轴和可访问替代说明。
|
|
75
|
+
- PNG helper 只做检测和建议;修复必须回到源、prompt 或布局参数。
|
|
76
|
+
- 自检结果不能替代人工确认专有名词、公式、论文图注、品牌规范和合规信息。
|
|
77
|
+
|
|
78
|
+
## 预期输出
|
|
79
|
+
|
|
80
|
+
产出可编辑源、最终 PNG 或编辑后图片,并附带生成路线与 QA 结果。图表应结构清晰、标签不截断、连线不混乱;视觉资产应匹配用途、尺寸、品牌语气和交付路径。
|