@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
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Front-end performance rules
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This document will be used whenever new pages, components, resource loading or data requests are added.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Core Principles
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
7
|
+
- Lazy loading by default, loading on demand
|
|
8
|
+
- Reduce key resources on the first screen
|
|
9
|
+
- Avoid unnecessary re-rendering
|
|
10
|
+
- Follow Core Web Vitals
|
|
11
|
+
- The front-end build must verify the development experience and production products at the same time. You cannot just check whether the dev server is normal.
|
|
12
|
+
- Do not initiate large-scale performance refactoring when the context or task boundaries are unclear; locate bottlenecks first and then change the code
|
|
13
|
+
- Keep reviewable logs of long-running commands, using terminal sessions, CI artifacts, or test reports when necessary
|
|
14
|
+
- Each performance recommendation must be bound with evidence, scope of impact, verification methods and rollback risks
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## Code splitting and lazy loading
|
|
17
17
|
|
|
18
|
-
###
|
|
18
|
+
### Routing level segmentation
|
|
19
19
|
|
|
20
20
|
```tsx
|
|
21
21
|
// React
|
|
@@ -25,77 +25,77 @@ const Dashboard = lazy(() => import('./pages/Dashboard'));
|
|
|
25
25
|
const Dashboard = () => import('./pages/Dashboard.vue');
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
###
|
|
28
|
+
### Component level segmentation
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
Only use component-level lazy loading in the following scenarios:
|
|
31
31
|
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
32
|
+
- Heavy-duty third-party libraries (charts, editors, maps)
|
|
33
|
+
- Large modules for conditional rendering (such as settings panel, advanced filtering)
|
|
34
|
+
- Content that is not in the visible area of the first screen
|
|
35
35
|
|
|
36
|
-
##
|
|
36
|
+
## Rendering performance
|
|
37
37
|
|
|
38
38
|
### React
|
|
39
39
|
|
|
40
|
-
-
|
|
41
|
-
- `useMemo` / `useCallback`
|
|
42
|
-
-
|
|
43
|
-
-
|
|
40
|
+
- Use `React.memo` wisely to avoid unnecessary re-rendering
|
|
41
|
+
- `useMemo` / `useCallback` only makes sense if the dependency is stable and the subcomponent uses memo
|
|
42
|
+
- List rendering must use a stable `key`
|
|
43
|
+
- Avoid creating new objects, arrays or functions inside render functions
|
|
44
44
|
|
|
45
45
|
### Vue
|
|
46
46
|
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
##
|
|
53
|
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
|
|
59
|
-
## Vite
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
- `vite build`
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
- CJS/UMD
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
- `vite preview`
|
|
70
|
-
|
|
71
|
-
##
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
|
|
78
|
-
##
|
|
79
|
-
|
|
80
|
-
- [ ]
|
|
81
|
-
- [ ]
|
|
82
|
-
- [ ]
|
|
83
|
-
- [ ]
|
|
84
|
-
- [ ]
|
|
85
|
-
- [ ]
|
|
86
|
-
- [ ]
|
|
87
|
-
- [ ] Vite
|
|
88
|
-
- [ ] Vite
|
|
89
|
-
- [ ]
|
|
90
|
-
|
|
91
|
-
##
|
|
92
|
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
101
|
-
-
|
|
47
|
+
- Use `computed` instead of `watch` + manual assignment
|
|
48
|
+
- Use virtual scrolling for large lists
|
|
49
|
+
- Avoid using `v-if` inside `v-for`
|
|
50
|
+
- Use `shallowRef` / `shallowReactive` to optimize large objects
|
|
51
|
+
|
|
52
|
+
## Resource optimization
|
|
53
|
+
|
|
54
|
+
- Images use WebP/AVIF format and provide appropriate sizes
|
|
55
|
+
- For icons, use SVG sprite or icon font first to avoid a large number of independent image requests
|
|
56
|
+
- Fonts are loaded on demand, use `font-display: swap`
|
|
57
|
+
- Third-party dependencies are imported on demand (such as `import { Button } from 'antd'` instead of `import antd from 'antd'`)
|
|
58
|
+
|
|
59
|
+
## Vite build and development performance
|
|
60
|
+
|
|
61
|
+
Additional compliance when using Vite:
|
|
62
|
+
|
|
63
|
+
- `vite build` does not do type checking, CI must execute `tsc --noEmit` separately or access `vite-plugin-checker`
|
|
64
|
+
- Use `vite --profile` to locate plug-in, parsing or pre-built bottlenecks before slow start
|
|
65
|
+
- Large projects can use `server.warmup.clientFiles` to warm up the core entrance
|
|
66
|
+
- CJS/UMD dependency interoperability issues are first handled through `optimizeDeps.include`
|
|
67
|
+
- For manual sub-packaging, use stable object form first, do not split each `node_modules` package into independent chunks
|
|
68
|
+
- Component library mode must externalize peer dependencies and produce type declarations separately
|
|
69
|
+
- `vite preview` is only used for local build smoke tests, not production servers
|
|
70
|
+
|
|
71
|
+
## Data request
|
|
72
|
+
|
|
73
|
+
- Avoid waterfall requests (serial dependencies), parallelize as much as possible
|
|
74
|
+
- Proper use of caching strategies (SWR/React Query/VueQuery)
|
|
75
|
+
- Paged loading or virtual scrolling for processing large data sets
|
|
76
|
+
- Anti-shake/throttle processing of high-frequency triggered requests (search, scrolling)
|
|
77
|
+
|
|
78
|
+
## Checklist
|
|
79
|
+
|
|
80
|
+
- [ ] Whether to record core routing, device, network and current metrics
|
|
81
|
+
- [ ] Whether the route is loaded on demand
|
|
82
|
+
- [ ] Whether heavy components are lazy loaded
|
|
83
|
+
- [ ] Whether to use virtual scrolling or paging for large lists
|
|
84
|
+
- [ ] Whether the image uses a modern format and reasonable size
|
|
85
|
+
- [ ] Whether third-party libraries are imported on demand
|
|
86
|
+
- [ ] Whether there is unnecessary re-rendering
|
|
87
|
+
- [ ] Whether the Vite project executes typecheck separately
|
|
88
|
+
- [ ] Whether the Vite build product has passed the `vite build` and local preview smoke tests
|
|
89
|
+
- [ ] Whether to review loading, error, empty, disabled and mobile status are not destroyed by optimization
|
|
90
|
+
|
|
91
|
+
## Anti-pattern
|
|
92
|
+
|
|
93
|
+
- Pack all routes in one chunk
|
|
94
|
+
- Load the entire chart library or editor on the first screen
|
|
95
|
+
- Create the same API request repeatedly within the component
|
|
96
|
+
- Large lists directly render thousands of lines of DOM without virtualization
|
|
97
|
+
- No anti-shake/throttling for frequent operations (such as input, scrolling)
|
|
98
|
+
- It is considered that passing `vite build` means that TypeScript has no errors
|
|
99
|
+
- Set `envPrefix: ""` or inject the server key into the client bundle
|
|
100
|
+
- Doing extensive “performance optimization” without first reproducing lag, packet size or Web Vitals indicators
|
|
101
|
+
- Remove status feedback, reduce accessibility, or sacrifice main path maintainability in pursuit of lab scores
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
# React
|
|
1
|
+
# React rules
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This file applies when the repository or target module uses React.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Technology stack
|
|
6
6
|
|
|
7
|
-
<!--
|
|
7
|
+
<!-- Please modify according to the actual situation of the project -->
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
- UI
|
|
13
|
-
-
|
|
9
|
+
- Framework: React + TypeScript
|
|
10
|
+
- Style: Tailwind CSS + CSS Modules
|
|
11
|
+
- Status management: Zustand / Redux Toolkit / Jotai (select according to the actual project)
|
|
12
|
+
- UI component library: actual selection by project (such as Ant Design, Material UI or internal Design System)
|
|
13
|
+
- Versions and dependencies: Before creating a new module, supplementing `package.json` or updating this section, give priority to using mainstream stable versions that are compatible with each other (align with official documents, scaffolding defaults or package manager recommendations) to avoid mixing dependencies that have stopped maintaining or do not match the major of the mainline of the warehouse.
|
|
14
14
|
|
|
15
|
-
## React
|
|
15
|
+
## React component specification
|
|
16
16
|
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
- props
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
- CSS
|
|
17
|
+
- Use **Function Components**, Hooks and TypeScript; **Do not** add new class components (including handwritten Error Boundary, use `react-error-boundary` and other libraries)
|
|
18
|
+
- Keep components small and composable
|
|
19
|
+
- Extract reusable logic into hooks
|
|
20
|
+
- Keep props explicit and clearly typed
|
|
21
|
+
- Maintain accessibility with keyboard interaction
|
|
22
|
+
- Prioritize the use of deducible state to avoid repeated state maintenance
|
|
23
|
+
- Reuse existing design systems before creating new base components
|
|
24
|
+
- It is forbidden to use any, prefer unknown
|
|
25
|
+
- CSS naming follows BEM (CSS Modules scenario)
|
|
26
26
|
|
|
27
|
-
##
|
|
27
|
+
## Patterns and Best Practices (React)
|
|
28
28
|
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
- **Render Props
|
|
32
|
-
- **Context + useReducer
|
|
33
|
-
-
|
|
34
|
-
- **Error Boundary
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
- **Next.js
|
|
29
|
+
- **Composition**: Use widgets + `children`/props to assemble; avoid wide boolean props and fake "inheritance".
|
|
30
|
+
- **Composite component**: The root component uses Context to expose state to sub-components; sub-components explicitly report an error when Context is missing.
|
|
31
|
+
- **Render Props**: Only considered when it is necessary to encapsulate the data state and hand over the rendering to the upper layer; in most scenarios, custom Hook + ordinary components are given priority.
|
|
32
|
+
- **Context + useReducer**: Medium complexity multi-subtree client state; do not put high-frequency changing large objects in the top-level Context; use React Query / SWR for server-side data.
|
|
33
|
+
- **Form**: Prioritize medium and large forms with React Hook Form + Zod; avoid single-file giant controlled state.
|
|
34
|
+
- **Error Boundary**: Key modules use **`react-error-boundary`** (or a similar library unified by the team) to cover the module boundaries; business components must be functional, and no handwritten class components Error Boundary.
|
|
35
|
+
- **Performance**: Use `useMemo`/`useCallback`/`React.memo` on demand; use virtual lists for long lists (such as TanStack Virtual, react-window); pay attention to immutable derivation for expensive calculations (do not `sort` the original array in place).
|
|
36
|
+
- **Motion**: Framer Motion or CSS transition; respect `prefers-reduced-motion`.
|
|
37
|
+
- **Accessibility**: Compound controls complement `role`/`aria-*` and keyboard operations; pop-up window management focus is dropped and restored after closing.
|
|
38
|
+
- **Next.js**: The relevant agreements between App Router and Server Components are subject to the project Next rules.
|
|
39
39
|
|
|
40
|
-
## React
|
|
40
|
+
## React Implementation Guide
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
Before creating a new component:
|
|
43
43
|
|
|
44
|
-
1.
|
|
45
|
-
2.
|
|
46
|
-
3.
|
|
44
|
+
1. First search whether equivalent components already exist
|
|
45
|
+
2. Determine whether the logic should be put into a custom hook
|
|
46
|
+
3. Be consistent with the current style scheme of the project
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
When editing a React component:
|
|
49
49
|
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
50
|
+
- Avoid mixing data requests, heavy business logic and presentation logic in the same file
|
|
51
|
+
- Avoid designing props APIs that are too broad or have unclear semantics
|
|
52
|
+
- Avoid abusing context for local problems
|
|
53
|
+
- Keep conditional rendering readable and extract duplicate branches if necessary
|
|
54
54
|
|
|
55
|
-
## React
|
|
55
|
+
## React file organization
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
Priority is given to following existing agreements in the warehouse.
|
|
58
|
+
Common output may include:
|
|
59
59
|
|
|
60
60
|
- `Component.tsx`
|
|
61
61
|
- `Component.types.ts`
|
|
62
62
|
- `hooks/useComponentLogic.ts`
|
|
63
|
-
- `ComponentName.styles.css
|
|
64
|
-
-
|
|
63
|
+
- `ComponentName.styles.css` (plain CSS / CSS Modules; `ComponentName.styles.ts` when using styled-components)
|
|
64
|
+
- If the warehouse uses nearby testing, add test files, such as: `__tests__/Component.spec.tsx`
|
|
65
65
|
|
|
66
|
-
##
|
|
66
|
+
## Component file size
|
|
67
67
|
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
68
|
+
- A single component file maintains a single responsibility, clear semantics, and is easy to maintain.
|
|
69
|
+
- **Line number reference**: Prioritize the single file to be controlled within about **300 lines**; more than **500 lines** should be regarded as a **strong splitting signal**.
|
|
70
|
+
- **Situations that should be split even if it is less than 500 lines**: There are **complex state interleaving**, **too many side effects**, **JSX too deep nesting**, **dense conditional branches**, data acquisition and UI are mixed in the same file for a long time, etc., making it difficult to grasp a single file at a glance. It should be split into independent units such as **subcomponents**, **custom Hooks**, **tool functions**, **constants** and **type definitions** (the directory and naming still follow the "React file organization" above).
|
|
71
71
|
|
|
72
|
-
## React
|
|
72
|
+
## React anti-patterns
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
Avoid:
|
|
75
75
|
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
76
|
+
- Create a new **class component** or handwritten class Error Boundary (function component + `react-error-boundary`, etc. should be used)
|
|
77
|
+
- Use redundant state for derivable values
|
|
78
|
+
- Large sections of JSX are not broken into subcomponents
|
|
79
|
+
- A single file is stacked with too many responsibilities and lines. It exceeds 500 lines or has high complexity and still refuses to be split (see "Component file size" above)
|
|
80
|
+
- Use unstable keys
|
|
81
|
+
- Use `any` in props and hooks without reason
|
|
82
|
+
- Introduce a second style system when there is no good reason
|
|
@@ -1,43 +1,47 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Refactor project rules
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This document applies when the task involves refactoring, migrating, or rewriting front-end code from an existing project.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Target
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
7
|
+
- **Visual and interactive**: consistent with the original project, no perceived difference by users
|
|
8
|
+
- **Code Quality**: more concise, easier to maintain, and in line with the target framework specifications
|
|
9
|
+
- **Business functions**: consistent with the original project, **no missing functions**; behaviors before and after reconstruction are equivalent
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Pictures and Icons
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
13
|
+
- Directly use the image resource path of the original project without rehosting or replacing it.
|
|
14
|
+
- SVG images (`<img src="*.svg" />` or CSS `background-image`) can be used, **inline SVG is prohibited** (`<svg>...</svg>` written directly in the component)
|
|
15
|
+
- **If the original project uses iconfont or IcoMoon icons, continue to use them** during reconstruction to keep the icon system consistent; do not replace it with other icon schemes
|
|
16
|
+
- For icons, priority is given to using existing icon files in the original project (iconfont / IcoMoon / existing SVG). If necessary, SVG files can be introduced as independent resources
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## Style
|
|
19
19
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
20
|
+
- The layout style aligns with the visual effects of the original project, but **only refers to the original project effects and does not copy its CSS**
|
|
21
|
+
- Prioritize the use of **flex elastic layout** to avoid `float`, complex `position`, and redundant nesting
|
|
22
|
+
- Avoid unreasonable writing methods: `!important` abuse, excessively deep selectors, and repeated definitions
|
|
23
|
+
- **Inline styles are prohibited in components** (`style={{ ... }}` / `style="..."`). Styles are unified in CSS Modules, Tailwind classes or style files for easy maintenance.
|
|
24
24
|
|
|
25
|
-
##
|
|
25
|
+
##Strong constraints
|
|
26
26
|
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
27
|
+
- The business functions are completely equivalent to the original project and must not be missing.
|
|
28
|
+
- Images use original project resources, no inline SVG; if the original project uses iconfont/IcoMoon, continue to use it
|
|
29
|
+
- The style refers to the original project effect but does not copy CSS, giving priority to flex layout, no inline style
|
|
30
|
+
- Establish a behavior list for public APIs, routing, events, hidden points, permissions, caches and error status, and check them one by one before and after reconstruction
|
|
31
|
+
- For migrations involving pages, components, routes, forms, pop-ups, navigation or key user processes, Playwright or equivalent real browser verification methods must be used to compare and verify the critical paths.
|
|
32
|
+
- For visually sensitive pages, screenshot comparison or manual screenshot acceptance should be supplemented; dynamic content, animation, fonts and environmental differences need to be clearly blocked, stabilized or explained
|
|
33
|
+
- For pure logic, type, build or no UI migrations, Playwright is not mandatory and a validation layer closer to the risk should be chosen: type-check, unit test, component test, build or lint
|
|
34
|
+
- The verification goal is not to be completely consistent at the pixel level, but to confirm that there are no missing business functions, key interactions are equivalent, there are no unexpected deviations in the main visual layout, and the code is clearer and maintainable than the old implementation.
|
|
31
35
|
|
|
32
|
-
##
|
|
36
|
+
## Dead code cleanup
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
When cleaning unused code, exports, styles or dependencies:
|
|
35
39
|
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
40
|
+
- Establish a verification baseline first, then clean it up.
|
|
41
|
+
- Use tools or search for evidence that candidates have no citations.
|
|
42
|
+
- Classify candidates into SAFE, CAUTION, and DANGER.
|
|
43
|
+
- Only SAFE items are automatically sanitized; routing, configuration, runtime templates, dynamic imports, and public APIs are considered high risk by default.
|
|
44
|
+
- Run affected verification command after each batch cleanup.
|
|
45
|
+
- If the verification fails, return to the most recent batch of candidates and do not continue to expand the scope of cleaning.
|
|
42
46
|
|
|
43
|
-
|
|
47
|
+
Don’t mix dead code cleanup with feature rewrites, visual tweaks, or dependency upgrades in the same change.
|
|
@@ -1,183 +1,40 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
|
8
|
-
|
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
│
|
|
42
|
-
├── SaaS Dashboard / 后台管理系统
|
|
43
|
-
│ ├── 登录后页面 → CSR
|
|
44
|
-
│ └── 登录/注册页(SEO)→ SSG
|
|
45
|
-
│
|
|
46
|
-
├── 混合场景(公开页 + 私有页)
|
|
47
|
-
│ └── 混合模式:公开页 SSR/SSG,私有页 CSR
|
|
48
|
-
│
|
|
49
|
-
└── 内容密集型(博客 + 商品 + Dashboard)
|
|
50
|
-
└── RSC(Next.js App Router)
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### 详细对比
|
|
54
|
-
|
|
55
|
-
| 维度 | CSR | SSR | SSG | ISR |
|
|
56
|
-
| -------------- | ------------------------ | --------------------- | --------------------- | ----------------------- |
|
|
57
|
-
| **SEO** | ❌ 搜索引擎看到空壳 HTML | ✅ 完整 HTML | ✅ 完整 HTML | ✅ 完整 HTML |
|
|
58
|
-
| **FCP** | ⚠️ 慢(需下载执行 JS) | ✅ 快(服务端已渲染) | ✅ 最快(纯静态文件) | ✅ 最快(同 SSG) |
|
|
59
|
-
| **TTI** | ⚠️ 慢(hydrate 后交互) | ⚠️ 中(hydrate 开销) | ✅ 快 | ✅ 快 |
|
|
60
|
-
| **内容实时性** | ✅ 实时 | ✅ 实时 | ❌ 构建时固定 | ⚠️ 可配置(秒/分钟级) |
|
|
61
|
-
| **服务器成本** | ✅ 无需 Node 服务 | ❌ 需 Node 服务 | ✅ 仅需 CDN | ⚠️ 需 Node 服务(按需) |
|
|
62
|
-
| **构建时间** | ✅ 快 | — | ⚠️ 页面多时慢 | ✅ 增量构建 |
|
|
63
|
-
| **缓存友好** | ⚠️ API 级缓存 | ⚠️ 页面级缓存 | ✅ CDN 全量缓存 | ✅ CDN + 按需失效 |
|
|
64
|
-
| **复杂度** | ✅ 低 | ⚠️ 中 | ✅ 低 | ⚠️ 中 |
|
|
65
|
-
|
|
66
|
-
## 各模式实施要点
|
|
67
|
-
|
|
68
|
-
### CSR(客户端渲染)
|
|
69
|
-
|
|
70
|
-
适用:后台管理系统、内部工具、登录后页面。
|
|
71
|
-
|
|
72
|
-
```tsx
|
|
73
|
-
// 纯 SPA 入口
|
|
74
|
-
import { createRoot } from "react-dom/client";
|
|
75
|
-
import { App } from "./App";
|
|
76
|
-
|
|
77
|
-
createRoot(document.getElementById("root")!).render(<App />);
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
**SEO 补救**:对需要 SEO 的页面使用动态 import 加载预渲染版本,或使用 Prerender SPA Plugin。
|
|
81
|
-
|
|
82
|
-
### SSR(服务端渲染)
|
|
83
|
-
|
|
84
|
-
适用:电商、新闻、社交等 SEO 关键场景。
|
|
85
|
-
|
|
86
|
-
```tsx
|
|
87
|
-
// Next.js Pages Router
|
|
88
|
-
export async function getServerSideProps() {
|
|
89
|
-
const data = await fetchProductData();
|
|
90
|
-
return { props: { data } };
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Next.js App Router (RSC)
|
|
94
|
-
async function ProductPage() {
|
|
95
|
-
const data = await fetchProductData(); // 服务端直接 await
|
|
96
|
-
return <ProductLayout data={data} />;
|
|
97
|
-
}
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
**注意**:
|
|
101
|
-
|
|
102
|
-
- SSR 页面必须考虑服务端兼容性(无 window/document)
|
|
103
|
-
- Hydration 不匹配会导致客户端重新渲染(SSR 水合失败)
|
|
104
|
-
- 服务端数据获取必须有超时和错误降级
|
|
105
|
-
|
|
106
|
-
### SSG(静态站点生成)
|
|
107
|
-
|
|
108
|
-
适用:博客、文档、营销落地页。
|
|
109
|
-
|
|
110
|
-
```tsx
|
|
111
|
-
// Next.js 构建时生成
|
|
112
|
-
export async function getStaticProps() {
|
|
113
|
-
const posts = await fetchPosts();
|
|
114
|
-
return { props: { posts } };
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export async function getStaticPaths() {
|
|
118
|
-
const posts = await fetchPosts();
|
|
119
|
-
return {
|
|
120
|
-
paths: posts.map((p) => `/blog/${p.slug}`),
|
|
121
|
-
fallback: false, // 未预渲染的 404
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### ISR(增量静态再生)
|
|
127
|
-
|
|
128
|
-
适用:页面数量多、内容更新频繁但非实时。
|
|
129
|
-
|
|
130
|
-
```tsx
|
|
131
|
-
export async function getStaticProps() {
|
|
132
|
-
const product = await fetchProduct();
|
|
133
|
-
return {
|
|
134
|
-
props: { product },
|
|
135
|
-
revalidate: 60, // 60 秒内返回缓存版本,后台异步更新
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
## React Server Components(RSC)
|
|
141
|
-
|
|
142
|
-
Next.js App Router 的默认模式,服务端组件不发送 JS 到客户端:
|
|
143
|
-
|
|
144
|
-
```tsx
|
|
145
|
-
// 服务端组件(默认)— 可直接 await 数据库查询
|
|
146
|
-
async function ProductList() {
|
|
147
|
-
const products = await db.products.findMany();
|
|
148
|
-
return (
|
|
149
|
-
<div>
|
|
150
|
-
{products.map((p) => (
|
|
151
|
-
<ProductCard key={p.id} product={p} />
|
|
152
|
-
))}
|
|
153
|
-
</div>
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// 客户端组件 — 需要交互/状态时显式标记
|
|
158
|
-
("use client");
|
|
159
|
-
|
|
160
|
-
function AddToCartButton({ productId }: { productId: string }) {
|
|
161
|
-
const [loading, setLoading] = useState(false);
|
|
162
|
-
return (
|
|
163
|
-
<button onClick={() => addToCart(productId)}>
|
|
164
|
-
{loading ? "..." : "加入购物车"}
|
|
165
|
-
</button>
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
**RSC 优势**:
|
|
171
|
-
|
|
172
|
-
- 服务端组件的 JS 不发送到客户端,减小 bundle
|
|
173
|
-
- 直接 await 数据库/API 调用,无需 useEffect + loading 状态
|
|
174
|
-
- 服务端组件可嵌套客户端组件,按需选择
|
|
175
|
-
|
|
176
|
-
## 检查清单
|
|
177
|
-
|
|
178
|
-
- [ ] 明确哪些页面需要 SEO(公开页 vs 私有页)
|
|
179
|
-
- [ ] 明确哪些页面需要实时数据(SSR),哪些可接受延迟(ISR/SSG)
|
|
180
|
-
- [ ] 评估页面数量(> 10000 时 SSG 构建时间可能不可接受)
|
|
181
|
-
- [ ] 评估服务器成本(SSR 需 Node 服务,SSG 仅需 CDN)
|
|
182
|
-
- [ ] 确认 Hydration 一致性(SSR 页面首屏 HTML 与客户端渲染匹配)
|
|
183
|
-
- [ ] 为 SSR 页面设置合理的缓存策略(CDN 缓存 + revalidate)
|
|
1
|
+
#Rendering mode selection
|
|
2
|
+
|
|
3
|
+
Reference this document when a project needs to select or evaluate CSR/SSR/SSG/ISR/RSC. This article only retains cross-framework decision constraints; Next.js App Router details are left to `fec-nextjs-project-standard`, Nuxt details are left to `fec-nuxt-project-standard`, and performance evidence is left to `fec-performance-optimization`.
|
|
4
|
+
|
|
5
|
+
## Rendering mode overview
|
|
6
|
+
|
|
7
|
+
| Mode | Generation timing | Typical application |
|
|
8
|
+
| ---- | -------- | -------- |
|
|
9
|
+
| CSR | Browser runtime | Post-login backend, internal tools, high-interaction SPA |
|
|
10
|
+
| SSR | Server-side on request | SEO-critical and real-time content public page |
|
|
11
|
+
| SSG | Build-time | Documentation, blogs, marketing pages, slow-changing public content |
|
|
12
|
+
| ISR | Build time + regenerate on demand | Large number of pages, frequent content updates but allow for delays |
|
|
13
|
+
| RSC | Server-side component rendering | Scenarios where client-side JS needs to be reduced in Next.js App Router |
|
|
14
|
+
|
|
15
|
+
## Selection principles
|
|
16
|
+
|
|
17
|
+
- SEO is a must and content is live: Prioritize SSR and be clear about caching, timeouts and error degradation.
|
|
18
|
+
- SEO is required and the content is stable: Prioritize SSG; consider ISR when the number of pages is huge or updates are frequent.
|
|
19
|
+
- Backend after login, strong interaction workspace, internal tools: priority CSR, public login/registration page can be separate SSG/SSR.
|
|
20
|
+
- Hybrid product: Public pages and private pages can adopt different models without sacrificing experience or cost for a unified architecture.
|
|
21
|
+
- Number of pages, update frequency, server cost, deployment platform, caching strategy and team operation and maintenance capabilities must be evaluated together.
|
|
22
|
+
- RSC is only used in supported frameworks and routing architectures; client interactions, browser APIs, and high-frequency states are still placed in client leaf components.
|
|
23
|
+
|
|
24
|
+
## Implement constraints
|
|
25
|
+
|
|
26
|
+
- SSR/RSC paths must not directly depend on `window`, `document`, localStorage or browser-specific libraries.
|
|
27
|
+
- HTML, time, random numbers, user preferences and media query results before and after hydration should be consistent to avoid hydration mismatch.
|
|
28
|
+
- Server-side data retrieval must have timeout, error degradation and caching strategies.
|
|
29
|
+
- SSG/ISR needs to clarify the non-prerendered path, revalidate/invalidation strategy and rollback method.
|
|
30
|
+
- Client-side large animation libraries, charts, editors, maps, WebGL/Canvas, etc. should be loaded on demand without entering the root layout synchronization bundle.
|
|
31
|
+
- No longer assert that a route is "cached" or "must be dynamic" without evidence of response headers, build output, traces, route behavior, or online metrics.
|
|
32
|
+
|
|
33
|
+
## Checklist
|
|
34
|
+
|
|
35
|
+
- [ ] Clarify public pages and private pages, SEO requirements and real-time requirements.
|
|
36
|
+
- [ ] Clarify the reasons for using CSR / SSR / SSG / ISR / RSC for each type of page.
|
|
37
|
+
- [ ] Evaluate page count, build times, server costs, and cache invalidation strategies.
|
|
38
|
+
- [ ] Check that SSR/RSC code has no browser API dependencies and non-serializable props.
|
|
39
|
+
- [ ] Confirm that loading, error, not-found, offline and permission states are not lost across render modes.
|
|
40
|
+
- [ ] Verify the final schema with build output, response headers, traces, or routing behavior.
|