@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.
Files changed (414) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +72 -1
  4. package/CHANGELOG.zh-CN.md +71 -1
  5. package/README.md +10 -6
  6. package/README.openclaw.md +100 -42
  7. package/README.openclaw.zh-CN.md +100 -42
  8. package/README.zh-CN.md +10 -6
  9. package/agents/fec-architect.md +70 -70
  10. package/agents/fec-code-reviewer.md +82 -82
  11. package/agents/fec-debugger.md +20 -20
  12. package/agents/fec-design-token-mapper.md +36 -36
  13. package/agents/fec-doc-updater.md +13 -13
  14. package/agents/fec-e2e-runner.md +45 -45
  15. package/agents/fec-figma-implementer.md +59 -59
  16. package/agents/fec-performance-optimizer.md +128 -128
  17. package/agents/fec-refactor-cleaner.md +14 -14
  18. package/agents/fec-security-reviewer.md +66 -67
  19. package/agents/fec-test-planner.md +27 -27
  20. package/agents/fec-typescript-reviewer.md +88 -88
  21. package/agents/fec-ui-checker.md +74 -74
  22. package/commands/fec-debug.md +19 -19
  23. package/commands/fec-doc-sync.md +11 -11
  24. package/commands/fec-init.md +37 -38
  25. package/commands/fec-plan.md +58 -58
  26. package/commands/fec-refactor-clean.md +11 -11
  27. package/commands/fec-review.md +41 -41
  28. package/commands/fec-scaffold.md +41 -41
  29. package/commands/fec-tdd.md +13 -13
  30. package/dist/bin/frontend-craft.js +29 -27
  31. package/docs/example-prompts.md +84 -69
  32. package/docs/ja-JP/README.md +56 -52
  33. package/docs/ko-KR/README.md +45 -41
  34. package/docs/project-structure.md +19 -7
  35. package/docs/superpowers/plans/2026-05-29-fec-debug.md +491 -0
  36. package/docs/superpowers/specs/2026-05-29-fec-debug-design.md +340 -0
  37. package/docs/zh-CN/example-prompts.md +84 -69
  38. package/docs/zh-CN/project-structure.md +14 -5
  39. package/docs/zh-TW/README.md +33 -29
  40. package/localized/zh-CN/agents/fec-architect.md +125 -0
  41. package/localized/zh-CN/agents/fec-code-reviewer.md +152 -0
  42. package/localized/zh-CN/agents/fec-debugger.md +44 -0
  43. package/localized/zh-CN/agents/fec-design-token-mapper.md +75 -0
  44. package/localized/zh-CN/agents/fec-doc-updater.md +30 -0
  45. package/localized/zh-CN/agents/fec-e2e-runner.md +107 -0
  46. package/localized/zh-CN/agents/fec-figma-implementer.md +104 -0
  47. package/localized/zh-CN/agents/fec-performance-optimizer.md +293 -0
  48. package/localized/zh-CN/agents/fec-refactor-cleaner.md +32 -0
  49. package/localized/zh-CN/agents/fec-security-reviewer.md +116 -0
  50. package/localized/zh-CN/agents/fec-test-planner.md +50 -0
  51. package/localized/zh-CN/agents/fec-typescript-reviewer.md +142 -0
  52. package/localized/zh-CN/agents/fec-ui-checker.md +120 -0
  53. package/localized/zh-CN/commands/fec-debug.md +30 -0
  54. package/localized/zh-CN/commands/fec-doc-sync.md +19 -0
  55. package/localized/zh-CN/commands/fec-init.md +70 -0
  56. package/localized/zh-CN/commands/fec-plan.md +94 -0
  57. package/localized/zh-CN/commands/fec-refactor-clean.md +19 -0
  58. package/localized/zh-CN/commands/fec-review.md +66 -0
  59. package/localized/zh-CN/commands/fec-scaffold.md +205 -0
  60. package/localized/zh-CN/commands/fec-tdd.md +21 -0
  61. package/localized/zh-CN/skills/TEMPLATE.md +155 -0
  62. package/localized/zh-CN/skills/eval_queries.json +1013 -0
  63. package/localized/zh-CN/skills/fec-accessibility-check/SKILL.md +39 -0
  64. package/localized/zh-CN/skills/fec-accessibility-check/references/report-template.md +23 -0
  65. package/localized/zh-CN/skills/fec-accessibility-check/references/screen-reader-testing.md +33 -0
  66. package/localized/zh-CN/skills/fec-alchemy/SKILL.md +74 -0
  67. package/localized/zh-CN/skills/fec-alchemy/assets/absorption-plan-template.md +47 -0
  68. package/localized/zh-CN/skills/fec-alchemy/assets/intake-template.md +55 -0
  69. package/localized/zh-CN/skills/fec-alchemy/assets/review-checklist.md +31 -0
  70. package/localized/zh-CN/skills/fec-alchemy/references/methodology.md +94 -0
  71. package/localized/zh-CN/skills/fec-alchemy/references/originality-and-licensing.md +57 -0
  72. package/localized/zh-CN/skills/fec-api-integration/SKILL.md +78 -0
  73. package/localized/zh-CN/skills/fec-api-integration/references/integration-patterns.md +80 -0
  74. package/localized/zh-CN/skills/fec-backend-requirements-handoff/SKILL.md +45 -0
  75. package/localized/zh-CN/skills/fec-browser-storage/SKILL.md +34 -0
  76. package/localized/zh-CN/skills/fec-browser-storage/references/storage-patterns.md +65 -0
  77. package/localized/zh-CN/skills/fec-canvas-threejs/SKILL.md +66 -0
  78. package/localized/zh-CN/skills/fec-canvas-threejs/references/rendering-patterns.md +67 -0
  79. package/localized/zh-CN/skills/fec-canvas-threejs/references/shader-webgl-patterns.md +67 -0
  80. package/localized/zh-CN/skills/fec-code-review/SKILL.md +143 -0
  81. package/localized/zh-CN/skills/fec-code-review/references/report-template.md +29 -0
  82. package/localized/zh-CN/skills/fec-component-testing/SKILL.md +119 -0
  83. package/localized/zh-CN/skills/fec-data-fetching/SKILL.md +62 -0
  84. package/localized/zh-CN/skills/fec-data-fetching/references/query-patterns.md +103 -0
  85. package/localized/zh-CN/skills/fec-debug-framework/SKILL.md +157 -0
  86. package/localized/zh-CN/skills/fec-debug-framework/references/report-template.md +58 -0
  87. package/localized/zh-CN/skills/fec-dependency-upgrade/SKILL.md +34 -0
  88. package/localized/zh-CN/skills/fec-dependency-upgrade/references/dependency-upgrade-workflow.md +56 -0
  89. package/localized/zh-CN/skills/fec-doc-sync/SKILL.md +39 -0
  90. package/localized/zh-CN/skills/fec-drawio-studio/SKILL.md +73 -0
  91. package/localized/zh-CN/skills/fec-drawio-studio/data/THIRD_PARTY_NOTICES.md +10 -0
  92. package/localized/zh-CN/skills/fec-drawio-studio/data/brand-icons.json +878 -0
  93. package/localized/zh-CN/skills/fec-drawio-studio/data/shape-index.json +83570 -0
  94. package/localized/zh-CN/skills/fec-drawio-studio/references/data-residency.md +27 -0
  95. package/localized/zh-CN/skills/fec-drawio-studio/references/diagram-patterns.md +60 -0
  96. package/localized/zh-CN/skills/fec-drawio-studio/references/flowchart-quality.md +49 -0
  97. package/localized/zh-CN/skills/fec-drawio-studio/references/layout-and-export.md +72 -0
  98. package/localized/zh-CN/skills/fec-drawio-studio/references/troubleshooting.md +29 -0
  99. package/localized/zh-CN/skills/fec-drawio-studio/references/xml-and-mermaid.md +58 -0
  100. package/localized/zh-CN/skills/fec-drawio-studio/scripts/brand-symbols.mjs +99 -0
  101. package/localized/zh-CN/skills/fec-drawio-studio/scripts/diagram-lint.mjs +205 -0
  102. package/localized/zh-CN/skills/fec-drawio-studio/scripts/diagram-url.mjs +102 -0
  103. package/localized/zh-CN/skills/fec-drawio-studio/scripts/drawio-export.mjs +134 -0
  104. package/localized/zh-CN/skills/fec-drawio-studio/scripts/layout-graph.mjs +107 -0
  105. package/localized/zh-CN/skills/fec-drawio-studio/scripts/png-embed-fix.mjs +26 -0
  106. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-go-packages.mjs +36 -0
  107. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-js-modules.mjs +52 -0
  108. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-python-classes.mjs +30 -0
  109. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-python-modules.mjs +55 -0
  110. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-rust-modules.mjs +35 -0
  111. package/localized/zh-CN/skills/fec-drawio-studio/scripts/scan-ts-modules.mjs +7 -0
  112. package/localized/zh-CN/skills/fec-drawio-studio/scripts/shape-query.mjs +121 -0
  113. package/localized/zh-CN/skills/fec-drawio-studio/scripts/studio-core.mjs +139 -0
  114. package/localized/zh-CN/skills/fec-drawio-studio/styles/built-in/corporate.json +49 -0
  115. package/localized/zh-CN/skills/fec-drawio-studio/styles/built-in/default.json +49 -0
  116. package/localized/zh-CN/skills/fec-drawio-studio/styles/built-in/handdrawn.json +49 -0
  117. package/localized/zh-CN/skills/fec-drawio-studio/styles/schema.json +112 -0
  118. package/localized/zh-CN/skills/fec-e2e-testing/SKILL.md +42 -0
  119. package/localized/zh-CN/skills/fec-e2e-testing/references/e2e-ci-reporting.md +62 -0
  120. package/localized/zh-CN/skills/fec-e2e-testing/references/e2e-special-scenarios.md +52 -0
  121. package/localized/zh-CN/skills/fec-e2e-testing/references/e2e-visual-regression.md +60 -0
  122. package/localized/zh-CN/skills/fec-e2e-testing/references/playwright-patterns.md +95 -0
  123. package/localized/zh-CN/skills/fec-form-handling/SKILL.md +76 -0
  124. package/localized/zh-CN/skills/fec-form-handling/references/advanced-form-patterns.md +101 -0
  125. package/localized/zh-CN/skills/fec-image-generation/SKILL.md +80 -0
  126. package/localized/zh-CN/skills/fec-image-generation/assets/interactive-diagram.html +371 -0
  127. package/localized/zh-CN/skills/fec-image-generation/references/artifact-routing.md +80 -0
  128. package/localized/zh-CN/skills/fec-image-generation/references/diagram-workflows.md +74 -0
  129. package/localized/zh-CN/skills/fec-image-generation/references/html-technical-diagrams.md +236 -0
  130. package/localized/zh-CN/skills/fec-image-generation/references/png-qa-autofix.md +30 -0
  131. package/localized/zh-CN/skills/fec-image-generation/scripts/export-diagram.mjs +364 -0
  132. package/localized/zh-CN/skills/fec-image-generation/scripts/interactive-diagram-server.mjs +654 -0
  133. package/localized/zh-CN/skills/fec-image-generation/scripts/png-qa.mjs +431 -0
  134. package/localized/zh-CN/skills/fec-image-generation/scripts/tech-diagram-render.mjs +1397 -0
  135. package/localized/zh-CN/skills/fec-implement-from-design/SKILL.md +129 -0
  136. package/localized/zh-CN/skills/fec-implement-from-design/references/design-plan-template.md +36 -0
  137. package/localized/zh-CN/skills/fec-legacy-to-modern-migration/SKILL.md +46 -0
  138. package/localized/zh-CN/skills/fec-legacy-to-modern-migration/references/migration-execution-checklist.md +110 -0
  139. package/localized/zh-CN/skills/fec-legacy-to-modern-migration/references/migration-report-template.md +41 -0
  140. package/localized/zh-CN/skills/fec-legacy-to-modern-migration/references/migration-strategy-and-mapping.md +48 -0
  141. package/localized/zh-CN/skills/fec-legacy-web-standard/SKILL.md +35 -0
  142. package/localized/zh-CN/skills/fec-legacy-web-standard/references/legacy-patterns.md +85 -0
  143. package/localized/zh-CN/skills/fec-list-virtualization/SKILL.md +34 -0
  144. package/localized/zh-CN/skills/fec-list-virtualization/references/virtualization-patterns.md +80 -0
  145. package/localized/zh-CN/skills/fec-monorepo-project-standard/SKILL.md +142 -0
  146. package/localized/zh-CN/skills/fec-motion-interaction/SKILL.md +73 -0
  147. package/localized/zh-CN/skills/fec-motion-interaction/references/motion-patterns.md +112 -0
  148. package/localized/zh-CN/skills/fec-nextjs-project-standard/SKILL.md +123 -0
  149. package/localized/zh-CN/skills/fec-nuxt-project-standard/SKILL.md +122 -0
  150. package/localized/zh-CN/skills/fec-performance-optimization/SKILL.md +80 -0
  151. package/localized/zh-CN/skills/fec-performance-optimization/references/framework-performance-patterns.md +38 -0
  152. package/localized/zh-CN/skills/fec-performance-optimization/references/report-template.md +59 -0
  153. package/localized/zh-CN/skills/fec-pwa-implementation/SKILL.md +35 -0
  154. package/localized/zh-CN/skills/fec-pwa-implementation/references/manifest-and-icons.md +53 -0
  155. package/localized/zh-CN/skills/fec-pwa-implementation/references/service-worker-workbox.md +68 -0
  156. package/localized/zh-CN/skills/fec-react-project-standard/SKILL.md +91 -0
  157. package/localized/zh-CN/skills/fec-react-project-standard/references/react-performance-patterns.md +35 -0
  158. package/localized/zh-CN/skills/fec-react-project-standard/references/react-project-structure.md +197 -0
  159. package/localized/zh-CN/skills/fec-react-project-standard/references/react-quality-patterns.md +131 -0
  160. package/localized/zh-CN/skills/fec-react-project-standard/references/react-runtime-patterns.md +293 -0
  161. package/localized/zh-CN/skills/fec-refactor-clean/SKILL.md +51 -0
  162. package/localized/zh-CN/skills/fec-refactor-clean/references/report-template.md +42 -0
  163. package/localized/zh-CN/skills/fec-responsive-layout/SKILL.md +34 -0
  164. package/localized/zh-CN/skills/fec-responsive-layout/references/responsive-layout-patterns.md +70 -0
  165. package/localized/zh-CN/skills/fec-route-protection/SKILL.md +135 -0
  166. package/localized/zh-CN/skills/fec-security-review/SKILL.md +38 -0
  167. package/localized/zh-CN/skills/fec-security-review/references/report-template.md +27 -0
  168. package/localized/zh-CN/skills/fec-security-review/references/security-checklist.md +64 -0
  169. package/localized/zh-CN/skills/fec-source-driven-development/SKILL.md +87 -0
  170. package/localized/zh-CN/skills/fec-state-management/SKILL.md +140 -0
  171. package/localized/zh-CN/skills/fec-state-management/references/state-patterns.md +109 -0
  172. package/localized/zh-CN/skills/fec-storybook-component-doc/SKILL.md +37 -0
  173. package/localized/zh-CN/skills/fec-storybook-component-doc/references/story-patterns.md +118 -0
  174. package/localized/zh-CN/skills/fec-svg-animation/SKILL.md +148 -0
  175. package/localized/zh-CN/skills/fec-tailwind-design-system/SKILL.md +34 -0
  176. package/localized/zh-CN/skills/fec-tailwind-design-system/references/tailwind-system-patterns.md +59 -0
  177. package/localized/zh-CN/skills/fec-tdd-workflow/SKILL.md +52 -0
  178. package/localized/zh-CN/skills/fec-testing-strategy/SKILL.md +45 -0
  179. package/localized/zh-CN/skills/fec-typescript-project-standard/SKILL.md +54 -0
  180. package/{skills/fec-typescript-type-safety → localized/zh-CN/skills/fec-typescript-project-standard}/references/type-safety-patterns.md +1 -1
  181. package/{skills/fec-typescript-type-safety/SKILL.md → localized/zh-CN/skills/fec-typescript-project-standard/references/type-safety.md} +5 -14
  182. package/localized/zh-CN/skills/fec-ui-design/SKILL.md +108 -0
  183. package/localized/zh-CN/skills/fec-ui-design/data/product-rules.json +231 -0
  184. package/localized/zh-CN/skills/fec-ui-design/data/stack-ui-rules.json +146 -0
  185. package/localized/zh-CN/skills/fec-ui-design/data/style-archetypes.json +373 -0
  186. package/localized/zh-CN/skills/fec-ui-design/data/ux-quality-rules.json +203 -0
  187. package/localized/zh-CN/skills/fec-ui-design/references/design-intelligence.md +97 -0
  188. package/localized/zh-CN/skills/fec-ui-design/references/master-page-overrides.md +30 -0
  189. package/localized/zh-CN/skills/fec-ui-design/references/pre-delivery-checklist.md +39 -0
  190. package/localized/zh-CN/skills/fec-ui-design/scripts/design-system.mjs +648 -0
  191. package/localized/zh-CN/skills/fec-validation-fix/SKILL.md +51 -0
  192. package/localized/zh-CN/skills/fec-validation-fix/references/report-template.md +43 -0
  193. package/localized/zh-CN/skills/fec-vite-project-standard/SKILL.md +83 -0
  194. package/localized/zh-CN/skills/fec-vue3-project-standard/SKILL.md +58 -0
  195. package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-composables-routing.md +162 -0
  196. package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-performance-patterns.md +13 -0
  197. package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-project-structure.md +176 -0
  198. package/localized/zh-CN/skills/fec-vue3-project-standard/references/vue3-state-api-quality.md +216 -0
  199. package/localized/zh-CN/skills/fec-web-video-presentation/SKILL.md +61 -0
  200. package/localized/zh-CN/skills/fec-web-video-presentation/data/starter-themes.json +59 -0
  201. package/localized/zh-CN/skills/fec-web-video-presentation/references/chapter-craft.md +37 -0
  202. package/localized/zh-CN/skills/fec-web-video-presentation/references/content-plan.md +38 -0
  203. package/localized/zh-CN/skills/fec-web-video-presentation/references/recording-and-audio.md +33 -0
  204. package/localized/zh-CN/skills/fec-web-video-presentation/references/theme-system.md +36 -0
  205. package/localized/zh-CN/skills/fec-web-video-presentation/scripts/create-video-presentation.mjs +430 -0
  206. package/localized/zh-CN/skills/fec-web-workers/SKILL.md +35 -0
  207. package/localized/zh-CN/skills/fec-web-workers/references/advanced-workers.md +54 -0
  208. package/localized/zh-CN/skills/fec-web-workers/references/basic-worker.md +67 -0
  209. package/localized/zh-CN/skills/metadata.json +1646 -0
  210. package/localized/zh-CN/skills/relations.json +755 -0
  211. package/localized/zh-CN/templates/claude/CLAUDE.md +106 -0
  212. package/localized/zh-CN/templates/claude/settings.json +62 -0
  213. package/localized/zh-CN/templates/codex/AGENTS.md +105 -0
  214. package/localized/zh-CN/templates/codex/config.toml +32 -0
  215. package/localized/zh-CN/templates/openclaw/AGENTS.md +101 -0
  216. package/localized/zh-CN/templates/openclaw/OPENCLAW-CONFIG.md +12 -0
  217. package/localized/zh-CN/templates/shared/rules/fec-agent-workflow.md +54 -0
  218. package/localized/zh-CN/templates/shared/rules/fec-api-layer.md +99 -0
  219. package/localized/zh-CN/templates/shared/rules/fec-ci-cd.md +40 -0
  220. package/localized/zh-CN/templates/shared/rules/fec-code-comments.md +33 -0
  221. package/localized/zh-CN/templates/shared/rules/fec-design-system.md +72 -0
  222. package/localized/zh-CN/templates/shared/rules/fec-error-handling.md +56 -0
  223. package/localized/zh-CN/templates/shared/rules/fec-git-conventions.md +73 -0
  224. package/localized/zh-CN/templates/shared/rules/fec-i18n.md +64 -0
  225. package/localized/zh-CN/templates/shared/rules/fec-naming-conventions.md +120 -0
  226. package/localized/zh-CN/templates/shared/rules/fec-performance.md +101 -0
  227. package/localized/zh-CN/templates/shared/rules/fec-react.md +82 -0
  228. package/localized/zh-CN/templates/shared/rules/fec-refactoring.md +47 -0
  229. package/localized/zh-CN/templates/shared/rules/fec-rendering-patterns.md +40 -0
  230. package/localized/zh-CN/templates/shared/rules/fec-responsive-design.md +50 -0
  231. package/localized/zh-CN/templates/shared/rules/fec-source-driven-development.md +31 -0
  232. package/localized/zh-CN/templates/shared/rules/fec-state-management.md +60 -0
  233. package/localized/zh-CN/templates/shared/rules/fec-testing.md +98 -0
  234. package/localized/zh-CN/templates/shared/rules/fec-typescript.md +112 -0
  235. package/localized/zh-CN/templates/shared/rules/fec-vue.md +64 -0
  236. package/localized/zh-CN/templates/shared/rules/fec-working-modes.md +50 -0
  237. package/openclaw.plugin.json +1 -1
  238. package/package.json +4 -3
  239. package/skills/TEMPLATE.md +74 -74
  240. package/skills/eval_queries.json +717 -619
  241. package/skills/fec-accessibility-check/SKILL.md +21 -21
  242. package/skills/fec-accessibility-check/references/report-template.md +12 -12
  243. package/skills/fec-accessibility-check/references/screen-reader-testing.md +24 -24
  244. package/skills/fec-alchemy/SKILL.md +50 -50
  245. package/skills/fec-alchemy/assets/absorption-plan-template.md +32 -32
  246. package/skills/fec-alchemy/assets/intake-template.md +55 -55
  247. package/skills/fec-alchemy/assets/review-checklist.md +23 -23
  248. package/skills/fec-alchemy/references/methodology.md +66 -66
  249. package/skills/fec-alchemy/references/originality-and-licensing.md +42 -42
  250. package/skills/fec-api-integration/SKILL.md +61 -61
  251. package/skills/fec-api-integration/references/integration-patterns.md +30 -30
  252. package/skills/fec-backend-requirements-handoff/SKILL.md +45 -0
  253. package/skills/fec-browser-storage/SKILL.md +16 -16
  254. package/skills/fec-browser-storage/references/storage-patterns.md +16 -16
  255. package/skills/fec-canvas-threejs/SKILL.md +21 -21
  256. package/skills/fec-canvas-threejs/references/rendering-patterns.md +10 -10
  257. package/skills/fec-canvas-threejs/references/shader-webgl-patterns.md +37 -37
  258. package/skills/fec-code-review/SKILL.md +94 -94
  259. package/skills/fec-code-review/references/report-template.md +13 -13
  260. package/skills/fec-component-testing/SKILL.md +39 -39
  261. package/skills/fec-data-fetching/SKILL.md +16 -16
  262. package/skills/fec-data-fetching/references/query-patterns.md +27 -27
  263. package/skills/fec-debug-framework/SKILL.md +95 -95
  264. package/skills/fec-debug-framework/references/report-template.md +34 -34
  265. package/skills/fec-dependency-upgrade/SKILL.md +17 -17
  266. package/skills/fec-dependency-upgrade/references/dependency-upgrade-workflow.md +31 -31
  267. package/skills/fec-doc-sync/SKILL.md +23 -23
  268. package/skills/fec-drawio-studio/SKILL.md +73 -0
  269. package/skills/fec-drawio-studio/data/THIRD_PARTY_NOTICES.md +10 -0
  270. package/skills/fec-drawio-studio/data/brand-icons.json +878 -0
  271. package/skills/fec-drawio-studio/data/shape-index.json +83570 -0
  272. package/skills/fec-drawio-studio/references/data-residency.md +27 -0
  273. package/skills/fec-drawio-studio/references/diagram-patterns.md +60 -0
  274. package/skills/fec-drawio-studio/references/flowchart-quality.md +49 -0
  275. package/skills/fec-drawio-studio/references/layout-and-export.md +72 -0
  276. package/skills/fec-drawio-studio/references/troubleshooting.md +29 -0
  277. package/skills/fec-drawio-studio/references/xml-and-mermaid.md +58 -0
  278. package/skills/fec-drawio-studio/scripts/brand-symbols.mjs +99 -0
  279. package/skills/fec-drawio-studio/scripts/diagram-lint.mjs +205 -0
  280. package/skills/fec-drawio-studio/scripts/diagram-url.mjs +102 -0
  281. package/skills/fec-drawio-studio/scripts/drawio-export.mjs +134 -0
  282. package/skills/fec-drawio-studio/scripts/layout-graph.mjs +107 -0
  283. package/skills/fec-drawio-studio/scripts/png-embed-fix.mjs +26 -0
  284. package/skills/fec-drawio-studio/scripts/scan-go-packages.mjs +36 -0
  285. package/skills/fec-drawio-studio/scripts/scan-js-modules.mjs +52 -0
  286. package/skills/fec-drawio-studio/scripts/scan-python-classes.mjs +30 -0
  287. package/skills/fec-drawio-studio/scripts/scan-python-modules.mjs +55 -0
  288. package/skills/fec-drawio-studio/scripts/scan-rust-modules.mjs +35 -0
  289. package/skills/fec-drawio-studio/scripts/scan-ts-modules.mjs +7 -0
  290. package/skills/fec-drawio-studio/scripts/shape-query.mjs +121 -0
  291. package/skills/fec-drawio-studio/scripts/studio-core.mjs +139 -0
  292. package/skills/fec-drawio-studio/styles/built-in/corporate.json +49 -0
  293. package/skills/fec-drawio-studio/styles/built-in/default.json +49 -0
  294. package/skills/fec-drawio-studio/styles/built-in/handdrawn.json +49 -0
  295. package/skills/fec-drawio-studio/styles/schema.json +112 -0
  296. package/skills/fec-e2e-testing/SKILL.md +24 -22
  297. package/skills/fec-e2e-testing/references/e2e-ci-reporting.md +62 -0
  298. package/skills/fec-e2e-testing/references/e2e-special-scenarios.md +52 -0
  299. package/skills/fec-e2e-testing/references/e2e-visual-regression.md +60 -0
  300. package/skills/fec-e2e-testing/references/playwright-patterns.md +6 -6
  301. package/skills/fec-form-handling/SKILL.md +21 -21
  302. package/skills/fec-form-handling/references/advanced-form-patterns.md +41 -41
  303. package/skills/fec-image-generation/SKILL.md +81 -0
  304. package/skills/fec-image-generation/assets/interactive-diagram.html +371 -0
  305. package/skills/fec-image-generation/references/artifact-routing.md +80 -0
  306. package/skills/fec-image-generation/references/diagram-workflows.md +74 -0
  307. package/skills/fec-image-generation/references/html-technical-diagrams.md +236 -0
  308. package/skills/fec-image-generation/references/png-qa-autofix.md +30 -0
  309. package/skills/fec-image-generation/scripts/export-diagram.mjs +364 -0
  310. package/skills/fec-image-generation/scripts/interactive-diagram-server.mjs +654 -0
  311. package/skills/fec-image-generation/scripts/png-qa.mjs +431 -0
  312. package/skills/fec-image-generation/scripts/tech-diagram-render.mjs +1397 -0
  313. package/skills/fec-implement-from-design/SKILL.md +81 -74
  314. package/skills/fec-implement-from-design/references/design-plan-template.md +16 -16
  315. package/skills/fec-legacy-to-modern-migration/SKILL.md +29 -173
  316. package/skills/fec-legacy-to-modern-migration/references/migration-execution-checklist.md +110 -0
  317. package/skills/fec-legacy-to-modern-migration/references/migration-report-template.md +37 -37
  318. package/skills/fec-legacy-to-modern-migration/references/migration-strategy-and-mapping.md +48 -0
  319. package/skills/fec-legacy-web-standard/SKILL.md +17 -17
  320. package/skills/fec-legacy-web-standard/references/legacy-patterns.md +16 -16
  321. package/skills/fec-list-virtualization/SKILL.md +16 -16
  322. package/skills/fec-list-virtualization/references/virtualization-patterns.md +31 -31
  323. package/skills/fec-monorepo-project-standard/SKILL.md +52 -52
  324. package/skills/fec-motion-interaction/SKILL.md +51 -44
  325. package/skills/fec-motion-interaction/references/motion-patterns.md +11 -11
  326. package/skills/fec-nextjs-project-standard/SKILL.md +64 -58
  327. package/skills/fec-nuxt-project-standard/SKILL.md +57 -57
  328. package/skills/fec-performance-optimization/SKILL.md +54 -50
  329. package/skills/fec-performance-optimization/references/framework-performance-patterns.md +38 -0
  330. package/skills/fec-performance-optimization/references/report-template.md +34 -28
  331. package/skills/fec-pwa-implementation/SKILL.md +17 -17
  332. package/skills/fec-pwa-implementation/references/manifest-and-icons.md +12 -12
  333. package/skills/fec-pwa-implementation/references/service-worker-workbox.md +13 -13
  334. package/skills/fec-react-project-standard/SKILL.md +72 -64
  335. package/skills/fec-react-project-standard/references/react-performance-patterns.md +35 -0
  336. package/skills/fec-react-project-standard/references/react-project-structure.md +197 -0
  337. package/skills/fec-react-project-standard/references/react-quality-patterns.md +131 -0
  338. package/skills/fec-react-project-standard/references/react-runtime-patterns.md +293 -0
  339. package/skills/fec-refactor-clean/SKILL.md +30 -30
  340. package/skills/fec-refactor-clean/references/report-template.md +23 -23
  341. package/skills/fec-responsive-layout/SKILL.md +17 -17
  342. package/skills/fec-responsive-layout/references/responsive-layout-patterns.md +39 -28
  343. package/skills/fec-route-protection/SKILL.md +26 -26
  344. package/skills/fec-security-review/SKILL.md +20 -20
  345. package/skills/fec-security-review/references/report-template.md +12 -12
  346. package/skills/fec-security-review/references/security-checklist.md +27 -27
  347. package/skills/fec-source-driven-development/SKILL.md +66 -40
  348. package/skills/fec-state-management/SKILL.md +34 -34
  349. package/skills/fec-state-management/references/state-patterns.md +19 -19
  350. package/skills/fec-storybook-component-doc/SKILL.md +19 -19
  351. package/skills/fec-storybook-component-doc/references/story-patterns.md +12 -12
  352. package/skills/fec-svg-animation/SKILL.md +32 -32
  353. package/skills/fec-tailwind-design-system/SKILL.md +17 -17
  354. package/skills/fec-tailwind-design-system/references/tailwind-system-patterns.md +36 -32
  355. package/skills/fec-tdd-workflow/SKILL.md +28 -28
  356. package/skills/fec-testing-strategy/SKILL.md +29 -29
  357. package/skills/fec-typescript-project-standard/SKILL.md +54 -0
  358. package/skills/fec-typescript-project-standard/references/type-safety-patterns.md +102 -0
  359. package/skills/fec-typescript-project-standard/references/type-safety.md +148 -0
  360. package/skills/fec-ui-design/SKILL.md +90 -72
  361. package/skills/fec-ui-design/data/style-archetypes.json +40 -0
  362. package/skills/fec-ui-design/data/ux-quality-rules.json +35 -0
  363. package/skills/fec-ui-design/references/design-intelligence.md +81 -21
  364. package/skills/fec-ui-design/references/master-page-overrides.md +15 -15
  365. package/skills/fec-ui-design/references/pre-delivery-checklist.md +38 -32
  366. package/skills/fec-ui-design/scripts/design-system.mjs +119 -1
  367. package/skills/fec-validation-fix/SKILL.md +26 -26
  368. package/skills/fec-validation-fix/references/report-template.md +25 -25
  369. package/skills/fec-vite-project-standard/SKILL.md +39 -39
  370. package/skills/fec-vue3-project-standard/SKILL.md +39 -30
  371. package/skills/fec-vue3-project-standard/references/vue3-composables-routing.md +163 -0
  372. package/skills/fec-vue3-project-standard/references/vue3-performance-patterns.md +13 -0
  373. package/skills/fec-vue3-project-standard/references/vue3-project-structure.md +177 -0
  374. package/skills/fec-vue3-project-standard/references/vue3-state-api-quality.md +216 -0
  375. package/skills/fec-web-video-presentation/SKILL.md +61 -0
  376. package/skills/fec-web-video-presentation/data/starter-themes.json +59 -0
  377. package/skills/fec-web-video-presentation/references/chapter-craft.md +37 -0
  378. package/skills/fec-web-video-presentation/references/content-plan.md +38 -0
  379. package/skills/fec-web-video-presentation/references/recording-and-audio.md +33 -0
  380. package/skills/fec-web-video-presentation/references/theme-system.md +36 -0
  381. package/skills/fec-web-video-presentation/scripts/create-video-presentation.mjs +430 -0
  382. package/skills/fec-web-workers/SKILL.md +16 -16
  383. package/skills/fec-web-workers/references/advanced-workers.md +13 -13
  384. package/skills/fec-web-workers/references/basic-worker.md +8 -8
  385. package/skills/metadata.json +402 -220
  386. package/skills/relations.json +120 -25
  387. package/templates/claude/CLAUDE.md +60 -60
  388. package/templates/codex/AGENTS.md +76 -76
  389. package/templates/codex/config.toml +4 -4
  390. package/templates/openclaw/AGENTS.md +68 -68
  391. package/templates/openclaw/OPENCLAW-CONFIG.md +8 -8
  392. package/templates/shared/rules/fec-agent-workflow.md +40 -40
  393. package/templates/shared/rules/fec-api-layer.md +52 -52
  394. package/templates/shared/rules/fec-ci-cd.md +29 -117
  395. package/templates/shared/rules/fec-code-comments.md +22 -22
  396. package/templates/shared/rules/fec-design-system.md +65 -241
  397. package/templates/shared/rules/fec-error-handling.md +41 -185
  398. package/templates/shared/rules/fec-git-conventions.md +42 -42
  399. package/templates/shared/rules/fec-i18n.md +48 -96
  400. package/templates/shared/rules/fec-naming-conventions.md +91 -91
  401. package/templates/shared/rules/fec-performance.md +78 -78
  402. package/templates/shared/rules/fec-react.md +58 -58
  403. package/templates/shared/rules/fec-refactoring.md +34 -30
  404. package/templates/shared/rules/fec-rendering-patterns.md +40 -183
  405. package/templates/shared/rules/fec-responsive-design.md +37 -214
  406. package/templates/shared/rules/fec-source-driven-development.md +22 -22
  407. package/templates/shared/rules/fec-state-management.md +45 -148
  408. package/templates/shared/rules/fec-testing.md +64 -64
  409. package/templates/shared/rules/fec-typescript.md +98 -341
  410. package/templates/shared/rules/fec-vue.md +42 -42
  411. package/templates/shared/rules/fec-working-modes.md +34 -34
  412. package/skills/fec-e2e-testing/references/e2e-advanced.md +0 -176
  413. package/skills/fec-react-project-standard/references/react-project-details.md +0 -642
  414. package/skills/fec-vue3-project-standard/references/vue3-project-details.md +0 -547
@@ -0,0 +1,430 @@
1
+ #!/usr/bin/env node
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+
6
+ const skillDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
7
+ const themesPath = path.join(skillDir, "data", "starter-themes.json");
8
+ const themes = JSON.parse(fs.readFileSync(themesPath, "utf8"));
9
+
10
+ const args = process.argv.slice(2);
11
+ const options = parseArgs(args);
12
+
13
+ if (options.help) {
14
+ printHelp();
15
+ process.exit(0);
16
+ }
17
+
18
+ if (options.listThemes) {
19
+ for (const theme of themes) {
20
+ console.log(`${theme.id}\t${theme.name}\t${theme.bestFor}`);
21
+ }
22
+ process.exit(0);
23
+ }
24
+
25
+ const target = path.resolve(process.cwd(), options.target ?? "presentation");
26
+ const theme = themes.find((candidate) => candidate.id === options.theme);
27
+
28
+ if (!theme) {
29
+ fail(`Unknown theme "${options.theme}". Run with --list-themes to see available themes.`);
30
+ }
31
+
32
+ const files = buildFiles(theme);
33
+
34
+ if (options.dryRun) {
35
+ console.log(`Would create ${files.length} files in ${target}`);
36
+ console.log(`Theme: ${theme.id} (${theme.name})`);
37
+ for (const file of files) console.log(`- ${file.name}`);
38
+ process.exit(0);
39
+ }
40
+
41
+ if (fs.existsSync(target) && fs.readdirSync(target).length > 0) {
42
+ fail(`Target directory is not empty: ${target}`);
43
+ }
44
+
45
+ for (const file of files) {
46
+ const fullPath = path.join(target, file.name);
47
+ fs.mkdirSync(path.dirname(fullPath), { recursive: true });
48
+ fs.writeFileSync(fullPath, file.body, "utf8");
49
+ }
50
+
51
+ console.log(`Created web video presentation at ${target}`);
52
+ console.log(`Theme: ${theme.id} (${theme.name})`);
53
+ console.log("Next:");
54
+ console.log(" cd " + path.relative(process.cwd(), target));
55
+ console.log(" npm install");
56
+ console.log(" npm run dev");
57
+
58
+ function parseArgs(values) {
59
+ const out = {
60
+ dryRun: false,
61
+ help: false,
62
+ listThemes: false,
63
+ target: undefined,
64
+ theme: themes[0]?.id ?? "editorial-slate",
65
+ };
66
+
67
+ for (let index = 0; index < values.length; index += 1) {
68
+ const value = values[index];
69
+ if (value === "--help" || value === "-h") out.help = true;
70
+ else if (value === "--dry-run") out.dryRun = true;
71
+ else if (value === "--list-themes") out.listThemes = true;
72
+ else if (value.startsWith("--theme=")) out.theme = value.slice("--theme=".length);
73
+ else if (value === "--theme") {
74
+ const next = values[index + 1];
75
+ if (!next || next.startsWith("--")) fail("Missing value for --theme.");
76
+ out.theme = next;
77
+ index += 1;
78
+ }
79
+ else if (value.startsWith("--")) fail(`Unknown option: ${value}`);
80
+ else if (!out.target) out.target = value;
81
+ else fail(`Unexpected argument: ${value}`);
82
+ }
83
+
84
+ return out;
85
+ }
86
+
87
+ function buildFiles(theme) {
88
+ const tokenCss = renderTokens(theme.tokens);
89
+ return [
90
+ {
91
+ name: "package.json",
92
+ body: JSON.stringify(
93
+ {
94
+ scripts: {
95
+ dev: "vite",
96
+ build: "tsc --noEmit && vite build",
97
+ preview: "vite preview",
98
+ },
99
+ dependencies: {
100
+ react: "latest",
101
+ "react-dom": "latest",
102
+ },
103
+ devDependencies: {
104
+ "@types/react": "latest",
105
+ "@types/react-dom": "latest",
106
+ "@vitejs/plugin-react": "latest",
107
+ typescript: "latest",
108
+ vite: "latest",
109
+ },
110
+ },
111
+ null,
112
+ 2,
113
+ ) + "\n",
114
+ },
115
+ {
116
+ name: "index.html",
117
+ body: `<!doctype html>
118
+ <html lang="en">
119
+ <head>
120
+ <meta charset="UTF-8" />
121
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
122
+ <title>Web Video Presentation</title>
123
+ </head>
124
+ <body>
125
+ <div id="root"></div>
126
+ <script type="module" src="/src/main.tsx"></script>
127
+ </body>
128
+ </html>
129
+ `,
130
+ },
131
+ {
132
+ name: "tsconfig.json",
133
+ body: JSON.stringify(
134
+ {
135
+ compilerOptions: {
136
+ target: "ES2022",
137
+ useDefineForClassFields: true,
138
+ lib: ["DOM", "DOM.Iterable", "ES2022"],
139
+ allowJs: false,
140
+ skipLibCheck: true,
141
+ esModuleInterop: true,
142
+ allowSyntheticDefaultImports: true,
143
+ strict: true,
144
+ forceConsistentCasingInFileNames: true,
145
+ module: "ESNext",
146
+ moduleResolution: "Node",
147
+ resolveJsonModule: true,
148
+ isolatedModules: true,
149
+ noEmit: true,
150
+ jsx: "react-jsx",
151
+ },
152
+ include: ["src"],
153
+ },
154
+ null,
155
+ 2,
156
+ ) + "\n",
157
+ },
158
+ {
159
+ name: "vite.config.ts",
160
+ body: `import { defineConfig } from 'vite';
161
+ import react from '@vitejs/plugin-react';
162
+
163
+ export default defineConfig({
164
+ plugins: [react()],
165
+ });
166
+ `,
167
+ },
168
+ {
169
+ name: "src/main.tsx",
170
+ body: `import React, { useEffect, useMemo, useState } from 'react';
171
+ import { createRoot } from 'react-dom/client';
172
+ import './styles.css';
173
+
174
+ type Scene = {
175
+ eyebrow: string;
176
+ title: string;
177
+ body: string;
178
+ detail: string;
179
+ };
180
+
181
+ const scenes: Scene[] = [
182
+ {
183
+ eyebrow: '01 / Hook',
184
+ title: 'Replace this with the first spoken beat',
185
+ body: 'One step equals one idea. Keep it readable in a 1080p recording.',
186
+ detail: 'Use source facts, product states, diagrams, or real assets to make the screen specific.',
187
+ },
188
+ {
189
+ eyebrow: '02 / Proof',
190
+ title: 'Show the evidence, not a generic slide',
191
+ body: 'Turn a claim into a visual: timeline, interface state, metric, map, comparison, or system diagram.',
192
+ detail: 'Advance with Space, ArrowRight, PageDown, or click. Go back with ArrowLeft or PageUp.',
193
+ },
194
+ {
195
+ eyebrow: '03 / Close',
196
+ title: 'End on the idea the viewer should remember',
197
+ body: 'Swap this starter content for your script and outline.',
198
+ detail: 'Controls stay quiet so the stage is clean for recording.',
199
+ },
200
+ ];
201
+
202
+ const storageKey = 'fec-web-video-presentation-step-v1';
203
+
204
+ function App() {
205
+ const [step, setStep] = useState(() => Number(localStorage.getItem(storageKey) ?? 0));
206
+ const current = scenes[Math.min(Math.max(step, 0), scenes.length - 1)];
207
+ const progress = useMemo(() => ((step + 1) / scenes.length) * 100, [step]);
208
+
209
+ useEffect(() => {
210
+ localStorage.setItem(storageKey, String(step));
211
+ }, [step]);
212
+
213
+ useEffect(() => {
214
+ const onKeyDown = (event: KeyboardEvent) => {
215
+ if (event.key === 'ArrowRight' || event.key === 'PageDown' || event.key === ' ') {
216
+ event.preventDefault();
217
+ setStep((value) => Math.min(value + 1, scenes.length - 1));
218
+ }
219
+ if (event.key === 'ArrowLeft' || event.key === 'PageUp') {
220
+ event.preventDefault();
221
+ setStep((value) => Math.max(value - 1, 0));
222
+ }
223
+ if (event.key.toLowerCase() === 'r') {
224
+ setStep(0);
225
+ }
226
+ };
227
+ window.addEventListener('keydown', onKeyDown);
228
+ return () => window.removeEventListener('keydown', onKeyDown);
229
+ }, []);
230
+
231
+ return (
232
+ <main className="viewport" onClick={() => setStep((value) => Math.min(value + 1, scenes.length - 1))}>
233
+ <section className="stage" aria-live="polite">
234
+ <div className="scene-grid">
235
+ <div className="copy">
236
+ <p className="eyebrow">{current.eyebrow}</p>
237
+ <h1>{current.title}</h1>
238
+ <p className="body">{current.body}</p>
239
+ </div>
240
+ <div className="visual" aria-label="Visual evidence placeholder">
241
+ <span>{String(step + 1).padStart(2, '0')}</span>
242
+ <p>{current.detail}</p>
243
+ </div>
244
+ </div>
245
+ <div className="progress" aria-hidden="true">
246
+ <span style={{ width: \`\${progress}%\` }} />
247
+ </div>
248
+ </section>
249
+ </main>
250
+ );
251
+ }
252
+
253
+ createRoot(document.getElementById('root')!).render(<App />);
254
+ `,
255
+ },
256
+ {
257
+ name: "src/styles.css",
258
+ body: `${tokenCss}
259
+
260
+ * {
261
+ box-sizing: border-box;
262
+ }
263
+
264
+ html,
265
+ body,
266
+ #root {
267
+ margin: 0;
268
+ min-height: 100%;
269
+ }
270
+
271
+ body {
272
+ background: #111;
273
+ color: var(--stage-fg);
274
+ font-family: var(--font-body);
275
+ }
276
+
277
+ .viewport {
278
+ min-height: 100vh;
279
+ display: grid;
280
+ place-items: center;
281
+ padding: 24px;
282
+ }
283
+
284
+ .stage {
285
+ width: min(100vw - 48px, calc((100vh - 48px) * 16 / 9));
286
+ aspect-ratio: 16 / 9;
287
+ position: relative;
288
+ overflow: hidden;
289
+ background: var(--stage-bg);
290
+ color: var(--stage-fg);
291
+ box-shadow: var(--shadow);
292
+ }
293
+
294
+ .scene-grid {
295
+ height: 100%;
296
+ display: grid;
297
+ grid-template-columns: 1.12fr 0.88fr;
298
+ gap: 72px;
299
+ align-items: center;
300
+ padding: 96px;
301
+ }
302
+
303
+ .eyebrow {
304
+ color: var(--accent);
305
+ font-size: 24px;
306
+ font-weight: 700;
307
+ margin: 0 0 26px;
308
+ text-transform: uppercase;
309
+ letter-spacing: 0.08em;
310
+ }
311
+
312
+ h1 {
313
+ font-family: var(--font-display);
314
+ font-size: clamp(48px, 6vw, 104px);
315
+ line-height: 0.96;
316
+ letter-spacing: 0;
317
+ margin: 0;
318
+ text-wrap: balance;
319
+ }
320
+
321
+ .body {
322
+ color: var(--muted-fg);
323
+ font-size: 32px;
324
+ line-height: 1.35;
325
+ margin: 36px 0 0;
326
+ max-width: 820px;
327
+ text-wrap: pretty;
328
+ }
329
+
330
+ .visual {
331
+ min-height: 560px;
332
+ border: 1px solid var(--line);
333
+ border-radius: var(--radius);
334
+ background: var(--panel);
335
+ display: grid;
336
+ align-content: space-between;
337
+ padding: 42px;
338
+ }
339
+
340
+ .visual span {
341
+ color: var(--accent-2);
342
+ font-family: var(--font-display);
343
+ font-size: 132px;
344
+ line-height: 1;
345
+ font-variant-numeric: tabular-nums;
346
+ }
347
+
348
+ .visual p {
349
+ margin: 0;
350
+ color: var(--muted-fg);
351
+ font-size: 26px;
352
+ line-height: 1.4;
353
+ }
354
+
355
+ .progress {
356
+ position: absolute;
357
+ left: 32px;
358
+ right: 32px;
359
+ bottom: 28px;
360
+ height: 3px;
361
+ background: color-mix(in srgb, var(--line) 70%, transparent);
362
+ opacity: 0;
363
+ transition: opacity 160ms ease;
364
+ }
365
+
366
+ .stage:hover .progress,
367
+ .stage:focus-within .progress {
368
+ opacity: 1;
369
+ }
370
+
371
+ .progress span {
372
+ display: block;
373
+ height: 100%;
374
+ background: var(--accent);
375
+ transition: width var(--step-duration) ease;
376
+ }
377
+
378
+ @media (prefers-reduced-motion: reduce) {
379
+ .progress,
380
+ .progress span {
381
+ transition: none;
382
+ }
383
+ }
384
+ `,
385
+ },
386
+ {
387
+ name: "README.md",
388
+ body: `# Web Video Presentation
389
+
390
+ Generated with Frontend Craft.
391
+
392
+ - 16:9 browser recording stage
393
+ - Step-driven scenes
394
+ - Keyboard and click navigation
395
+ - Theme tokens in \`src/styles.css\`
396
+
397
+ Replace the starter scenes in \`src/main.tsx\` with your script and outline.
398
+ `,
399
+ },
400
+ ];
401
+ }
402
+
403
+ function renderTokens(tokens) {
404
+ return `:root {
405
+ --stage-bg: ${tokens.stageBg};
406
+ --stage-fg: ${tokens.stageFg};
407
+ --muted-fg: ${tokens.mutedFg};
408
+ --accent: ${tokens.accent};
409
+ --accent-2: ${tokens.accent2};
410
+ --panel: ${tokens.panel};
411
+ --line: ${tokens.line};
412
+ --shadow: ${tokens.shadow};
413
+ --font-display: ${tokens.fontDisplay};
414
+ --font-body: ${tokens.fontBody};
415
+ --radius: ${tokens.radius};
416
+ --step-duration: ${tokens.stepDuration};
417
+ }`;
418
+ }
419
+
420
+ function printHelp() {
421
+ console.log(`Usage:
422
+ node skills/fec-web-video-presentation/scripts/create-video-presentation.mjs [target] [--theme=<id>] [--dry-run]
423
+ node skills/fec-web-video-presentation/scripts/create-video-presentation.mjs --list-themes
424
+ `);
425
+ }
426
+
427
+ function fail(message) {
428
+ console.error(`[create-video-presentation] ${message}`);
429
+ process.exit(1);
430
+ }
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: fec-web-workers
3
+ description: 用于将昂贵的浏览器工作移出主线程,涉及 Web Workers、SharedWorker、worker 池、Comlink、transferable objects、Vite/Webpack worker 集成或 UI 响应性修复。不要用于轻量同步工作或 DOM 操作;中文触发词包括 Web Worker、后台线程、主线程阻塞。
4
+ ---
5
+
6
+ # Web Workers
7
+
8
+ ## 用途
9
+
10
+ 把昂贵计算移出主线程,保持输入、滚动和动画响应。
11
+
12
+ ## 流程
13
+
14
+ 1. 先确认瓶颈:任务超过约 10ms、用户输入延迟明显、FPS 下滑或大文件解析/图像处理/加密计算才考虑 Worker。
15
+ 2. 选择通信模型:简单任务用 `postMessage`,函数式 RPC 用 Comlink,大量并行小任务用 Worker pool,跨 Tab 同步用 SharedWorker。
16
+ 3. 设计消息协议:请求/响应类型、错误类型、取消或超时策略都要明确。
17
+ 4. 传大对象时优先 Transferable Objects;不要让结构化克隆吞掉 Worker 带来的收益。
18
+ 5. 在组件或页面卸载时 `terminate()`,并通过 Profiler、Performance 面板或 FPS 指标验证主线程改善。
19
+
20
+ ## 详细参考
21
+
22
+ - 需要原生 Worker 文件、构建工具导入、React 生命周期封装和清理示例时,加载 [references/basic-worker.md](references/basic-worker.md)。
23
+ - 需要 Transferable Objects、Comlink、Worker pool、SharedWorker、CSP 和 SharedArrayBuffer 注意事项时,加载 [references/advanced-workers.md](references/advanced-workers.md)。
24
+
25
+ ## 约束
26
+
27
+ - Worker 内不能访问 DOM、`window`、`document`、`alert()` 或同步 `localStorage`。
28
+ - 高频通信可能比主线程计算更慢;先测量再拆分。
29
+ - Worker 文件必须同源加载,并受 `worker-src` CSP 限制。
30
+ - 大型二进制数据优先 transfer,transfer 后原引用会失效。
31
+ - 每个 Worker 有独立 JS 堆,必须主动管理生命周期和内存。
32
+
33
+ ## 预期输出
34
+
35
+ 计算密集型操作在后台线程执行,主线程输入和滚动恢复流畅,错误与取消路径明确,Worker 在卸载时被终止且无内存泄漏。
@@ -0,0 +1,54 @@
1
+ # 高级 Worker 模式
2
+
3
+ ## 可转移对象
4
+
5
+ ```ts
6
+ const buffer = new ArrayBuffer(10 * 1024 * 1024);
7
+ worker.postMessage(buffer, [buffer]);
8
+ // transfer 后主线程中的 buffer.byteLength 变为 0。
9
+ ```
10
+
11
+ 适用于图片像素、音频采样、大型二进制文件。不要在 transfer 后继续读取原引用。
12
+
13
+ ## Comlink
14
+
15
+ ```ts
16
+ // math.worker.ts
17
+ import { expose } from "comlink";
18
+
19
+ const mathApi = {
20
+ batchProcess(items: number[]) {
21
+ return items.map((item) => item * 2);
22
+ },
23
+ };
24
+
25
+ expose(mathApi);
26
+ export type MathApi = typeof mathApi;
27
+ ```
28
+
29
+ ```ts
30
+ import { wrap } from "comlink";
31
+ import MathWorker from "./math.worker?worker";
32
+ import type { MathApi } from "./math.worker";
33
+
34
+ const mathApi = wrap<MathApi>(new MathWorker());
35
+ const result = await mathApi.batchProcess([1, 2, 3]);
36
+ ```
37
+
38
+ ## Worker 池
39
+
40
+ - 适合大量独立任务,不适合强顺序依赖任务。
41
+ - 默认 pool size 不要超过 `navigator.hardwareConcurrency`。
42
+ - 队列中任务需要超时、取消或页面卸载清理策略。
43
+
44
+ ## SharedWorker
45
+
46
+ - 适合跨 Tab 共享连接或广播状态。
47
+ - 兼容性弱于 Dedicated Worker,必须先确认目标浏览器。
48
+ - 每个连接使用 `MessagePort`,需要 `port.start()`。
49
+
50
+ ## 安全与兼容
51
+
52
+ - CSP 需允许 `worker-src`。
53
+ - `SharedArrayBuffer` 需要 COOP/COEP 头。
54
+ - Worker 中可用 IndexedDB,但不可用同步 localStorage。
@@ -0,0 +1,67 @@
1
+ # 基础 Worker 与生命周期
2
+
3
+ ## Worker 文件
4
+
5
+ ```ts
6
+ // workers/heavy-compute.worker.ts
7
+ self.onmessage = (event: MessageEvent<{ numbers: number[] }>) => {
8
+ const result = [...event.data.numbers].sort((a, b) => a - b);
9
+ self.postMessage(result);
10
+ };
11
+ ```
12
+
13
+ ## Vite 导入
14
+
15
+ ```ts
16
+ import HeavyComputeWorker from "./workers/heavy-compute.worker?worker";
17
+
18
+ const worker = new HeavyComputeWorker();
19
+ worker.postMessage({ numbers: [3, 1, 4, 1, 5] });
20
+ worker.onmessage = (event: MessageEvent<number[]>) => {
21
+ console.log(event.data);
22
+ };
23
+ worker.onerror = (error) => {
24
+ console.error(error.message);
25
+ };
26
+ ```
27
+
28
+ ## React 生命周期封装
29
+
30
+ ```tsx
31
+ import { useCallback, useEffect, useRef, useState } from "react";
32
+
33
+ export function useWorker<TRequest, TResult>(factory: () => Worker) {
34
+ const workerRef = useRef<Worker | null>(null);
35
+ const [result, setResult] = useState<TResult | null>(null);
36
+ const [error, setError] = useState<string | null>(null);
37
+ const [isRunning, setIsRunning] = useState(false);
38
+
39
+ useEffect(() => {
40
+ const worker = factory();
41
+ workerRef.current = worker;
42
+ worker.onmessage = (event: MessageEvent<TResult>) => {
43
+ setResult(event.data);
44
+ setIsRunning(false);
45
+ };
46
+ worker.onerror = (event) => {
47
+ setError(event.message);
48
+ setIsRunning(false);
49
+ };
50
+ return () => worker.terminate();
51
+ }, [factory]);
52
+
53
+ const run = useCallback((data: TRequest) => {
54
+ setIsRunning(true);
55
+ setError(null);
56
+ workerRef.current?.postMessage(data);
57
+ }, []);
58
+
59
+ return { run, result, error, isRunning };
60
+ }
61
+ ```
62
+
63
+ ## 验证
64
+
65
+ - Performance 面板中长任务减少。
66
+ - 用户输入延迟下降。
67
+ - 组件卸载后没有继续收到 worker message。