@playcraft/cli 0.0.40 → 0.0.42

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 (130) hide show
  1. package/README.md +66 -3
  2. package/dist/atom-plan/validate-atom-plan.js +298 -0
  3. package/dist/cli-root-help.js +1 -1
  4. package/dist/commands/3d.js +363 -0
  5. package/dist/commands/create.js +337 -0
  6. package/dist/commands/image.js +1337 -43
  7. package/dist/commands/recommend.js +1 -1
  8. package/dist/commands/remix.js +213 -0
  9. package/dist/commands/skills.js +1379 -0
  10. package/dist/commands/tools-3d.js +473 -0
  11. package/dist/commands/tools-generation.js +452 -0
  12. package/dist/commands/tools-project.js +400 -0
  13. package/dist/commands/tools-research.js +37 -0
  14. package/dist/commands/tools-research.test.js +216 -0
  15. package/dist/commands/tools-utils.js +183 -0
  16. package/dist/commands/tools.js +7 -616
  17. package/dist/config.js +2 -0
  18. package/dist/index.js +19 -1
  19. package/dist/utils/version-checker.js +8 -11
  20. package/package.json +9 -3
  21. package/project-template/.claude/agents/designer.md +120 -0
  22. package/project-template/.claude/agents/developer.md +124 -0
  23. package/project-template/.claude/agents/pm.md +164 -0
  24. package/project-template/.claude/agents/refs/README.md +73 -0
  25. package/project-template/.claude/agents/refs/designer-art-style-catalog.md +533 -0
  26. package/project-template/.claude/agents/refs/designer-color-audio-recipes.md +153 -0
  27. package/project-template/.claude/agents/refs/designer-deliverable-spec.md +191 -0
  28. package/project-template/.claude/agents/refs/designer-dimension-axis.md +27 -0
  29. package/project-template/.claude/agents/refs/designer-handoff-v2-checklist.md +68 -0
  30. package/project-template/.claude/agents/refs/designer-master-composite-recipes.md +208 -0
  31. package/project-template/.claude/agents/refs/designer-style-exploration-flow.md +37 -0
  32. package/project-template/.claude/agents/refs/developer-dev-handoff.md +109 -0
  33. package/project-template/.claude/agents/refs/developer-impl-cookbook.md +134 -0
  34. package/project-template/.claude/agents/refs/developer-phase1-flow.md +136 -0
  35. package/project-template/.claude/agents/refs/pm-workflow-detail.md +551 -0
  36. package/project-template/.claude/agents/refs/reviewer-convergence-eval.md +130 -0
  37. package/project-template/.claude/agents/refs/reviewer-six-dimension-eval.md +6 -0
  38. package/project-template/.claude/agents/refs/ta-3d-flip-recipe.md +85 -0
  39. package/project-template/.claude/agents/refs/ta-atlas-deliverable-standard.md +67 -0
  40. package/project-template/.claude/agents/refs/ta-batch-pipeline-recipes.md +120 -0
  41. package/project-template/.claude/agents/refs/ta-image-generation-detail.md +356 -0
  42. package/project-template/.claude/agents/refs/ta-image-ops-reference.md +495 -0
  43. package/project-template/.claude/agents/refs/ta-pipeline-cookbook.md +1108 -0
  44. package/project-template/.claude/agents/refs/ta-tools-reference.md +111 -0
  45. package/project-template/.claude/agents/refs/ta-vfx-preset-catalog.md +365 -0
  46. package/project-template/.claude/agents/reviewer.md +127 -0
  47. package/project-template/.claude/agents/technical-artist.md +122 -0
  48. package/project-template/.claude/hooks/README.md +44 -0
  49. package/project-template/.claude/hooks/validate-atom-plan.mjs +224 -0
  50. package/project-template/.claude/hooks/validate-workflow-stop.mjs +343 -0
  51. package/project-template/.claude/settings.json +36 -0
  52. package/project-template/.claude/settings.local.json +4 -0
  53. package/project-template/.claude/skills/playcraft-ad-psychology/SKILL.md +182 -0
  54. package/project-template/.claude/skills/playcraft-art-style-guide/SKILL.md +123 -0
  55. package/project-template/.claude/skills/playcraft-asset-state-sheet/SKILL.md +141 -0
  56. package/project-template/.claude/skills/playcraft-audio-generation/SKILL.md +280 -0
  57. package/project-template/.claude/skills/playcraft-batch-pipeline/SKILL.md +184 -0
  58. package/project-template/.claude/skills/playcraft-build-optimizer/SKILL.md +306 -0
  59. package/project-template/.claude/skills/playcraft-image-generation/SKILL.md +279 -0
  60. package/project-template/.claude/skills/playcraft-image-generation/reference/build-sprite-sheet.template.mjs +123 -0
  61. package/project-template/.claude/skills/playcraft-image-generation/reference/compare-style.template.mjs +254 -0
  62. package/project-template/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +235 -0
  63. package/project-template/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +97 -0
  64. package/project-template/.claude/skills/playcraft-image-generation/reference/gen-edit-variants.template.mjs +118 -0
  65. package/project-template/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +137 -0
  66. package/project-template/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +397 -0
  67. package/project-template/.claude/skills/playcraft-image-generation/reference/validate-sprite-sheet.template.mjs +296 -0
  68. package/project-template/.claude/skills/playcraft-image-ops/SKILL.md +122 -0
  69. package/project-template/.claude/skills/playcraft-masking/SKILL.md +373 -0
  70. package/project-template/.claude/skills/playcraft-research/SKILL.md +212 -0
  71. package/project-template/.claude/skills/playcraft-sprite-generation/SKILL.md +423 -0
  72. package/project-template/.claude/skills/playcraft-storyboard/SKILL.md +167 -0
  73. package/project-template/.claude/skills/playcraft-style-qa/SKILL.md +270 -0
  74. package/project-template/.claude/skills/playcraft-text-rendering/SKILL.md +236 -0
  75. package/project-template/.claude/skills/playcraft-vfx-animation/SKILL.md +130 -0
  76. package/project-template/.claude/skills/playcraft-workflow/SKILL.md +485 -0
  77. package/project-template/.claude/skills/playwright-cli/SKILL.md +390 -0
  78. package/project-template/.claude/skills/playwright-cli/references/element-attributes.md +23 -0
  79. package/project-template/.claude/skills/playwright-cli/references/playwright-tests.md +39 -0
  80. package/project-template/.claude/skills/playwright-cli/references/request-mocking.md +87 -0
  81. package/project-template/.claude/skills/playwright-cli/references/running-code.md +240 -0
  82. package/project-template/.claude/skills/playwright-cli/references/session-management.md +226 -0
  83. package/project-template/.claude/skills/playwright-cli/references/spec-driven-testing.md +312 -0
  84. package/project-template/.claude/skills/playwright-cli/references/storage-state.md +275 -0
  85. package/project-template/.claude/skills/playwright-cli/references/test-generation.md +138 -0
  86. package/project-template/.claude/skills/playwright-cli/references/tracing.md +142 -0
  87. package/project-template/.claude/skills/playwright-cli/references/video-recording.md +157 -0
  88. package/project-template/.cursor/hooks.json +17 -0
  89. package/project-template/.cursor/rules/playcraft-orchestrator.mdc +137 -0
  90. package/project-template/.cursor/rules/playcraft-subagent-boundary.mdc +18 -0
  91. package/project-template/CLAUDE.md +280 -0
  92. package/project-template/assets/audio/bgm/.gitkeep +0 -0
  93. package/project-template/assets/audio/sfx/.gitkeep +0 -0
  94. package/project-template/assets/bundles/.gitkeep +0 -0
  95. package/project-template/assets/images/bg/.gitkeep +0 -0
  96. package/project-template/assets/images/reference/.gitkeep +0 -0
  97. package/project-template/assets/images/storyboard/.gitkeep +0 -0
  98. package/project-template/assets/images/tiles/.gitkeep +0 -0
  99. package/project-template/assets/images/ui/.gitkeep +0 -0
  100. package/project-template/assets/images/vfx/.gitkeep +0 -0
  101. package/project-template/assets/models/.gitkeep +0 -0
  102. package/project-template/docs/team/agent-conduct.md +121 -0
  103. package/project-template/docs/team/agent-runtime-matrix.md +62 -0
  104. package/project-template/docs/team/atom-plan-format.md +105 -0
  105. package/project-template/docs/team/collaboration.md +297 -0
  106. package/project-template/docs/team/core-model.md +50 -0
  107. package/project-template/docs/team/platform-capabilities.md +15 -0
  108. package/project-template/docs/team/workflow-changelog.md +65 -0
  109. package/project-template/docs/team/workflow-consistency-checklist.md +140 -0
  110. package/project-template/game/config/.gitkeep +0 -0
  111. package/project-template/game/gameplay/.gitkeep +0 -0
  112. package/project-template/game/scenes/.gitkeep +0 -0
  113. package/project-template/logs/.gitkeep +0 -0
  114. package/project-template/ta-workspace/logs/.gitkeep +0 -0
  115. package/project-template/ta-workspace/scripts/.gitkeep +0 -0
  116. package/project-template/ta-workspace/tmp/.gitkeep +0 -0
  117. package/project-template/templates/atom-plan.template.json +26 -0
  118. package/project-template/templates/atom-plan.template.md +108 -0
  119. package/project-template/templates/design-brief.template.md +195 -0
  120. package/project-template/templates/design-lens-checklist.reference.md +117 -0
  121. package/project-template/templates/design-methodology.md +99 -0
  122. package/project-template/templates/designer-log.template.md +114 -0
  123. package/project-template/templates/developer-log.template.md +134 -0
  124. package/project-template/templates/five-axis-framework.md +186 -0
  125. package/project-template/templates/intent-clarifications.template.md +58 -0
  126. package/project-template/templates/layout-spec.template.md +146 -0
  127. package/project-template/templates/project-state.template.md +237 -0
  128. package/project-template/templates/review-report.template.md +91 -0
  129. package/project-template/templates/style-exploration.template.md +93 -0
  130. package/project-template/templates/ta-log.template.md +343 -0
@@ -0,0 +1,130 @@
1
+ ---
2
+ name: playcraft-vfx-animation
3
+ description: VFX 特效与动画精灵图选型决策树与核心命令速查。按游戏事件快速选定预设,详细预设目录见 refs/ta-vfx-preset-catalog.md。
4
+ triggers: VFX,特效,动画,animate,animation,use-vfx,精灵动画,sprite animation,爆炸特效,闪光效果,vfx预设,animate预设,bounce,spin,pulse,shake,float,blink,swing,wobble,flip,confetti,sparkle,explosion,starburst,smoke,glow,impact
5
+ ---
6
+
7
+ # PlayCraft VFX 特效与动画精灵图生成指南
8
+
9
+ ## 0. Overview
10
+
11
+ VFX(视觉特效精灵图)和 animate(运动动画精灵图)是可玩广告视觉品质的关键层。它们属于 TA 工作流的 **Stage B**(精灵图处理阶段),在 Stage A 元素生成完成后执行。
12
+
13
+ - **VFX**:预制粒子/爆炸/光效精灵表,用于游戏事件反馈(消除、得分、胜利等)
14
+ - **animate**:将静态素材转为循环动画精灵表,用于 idle 状态、UI 引导、装饰运动
15
+
16
+ **发现可用预设**:
17
+
18
+ ```bash
19
+ playcraft image list-vfx # 列出所有 VFX 预设(含帧数、体积)
20
+ playcraft image animate --list-presets # 列出所有 animate 预设
21
+ ```
22
+
23
+ ## 1. VFX 选型决策树
24
+
25
+ 按游戏事件选择预设:
26
+
27
+ ```
28
+ 需要为哪种游戏事件添加 VFX?
29
+ +-- 元素消除/击破 -> explosion_small (8帧, ~30KB)
30
+ | 理由: 中心爆发+碎片扩散, 8帧在视觉冲击与体积间取得平衡
31
+ +-- 得分/收集奖励 -> sparkle (6帧, ~15KB)
32
+ | 理由: 轻量粒子迸发, 15KB 可高频触发而不累积体积压力
33
+ +-- 关卡完成/大胜利 -> confetti (12帧, ~25KB)
34
+ | 理由: 多彩纸片飘落, 12帧保证庆祝感的持续时长
35
+ +-- 连击触发/特殊技能 -> starburst (8帧, ~20KB)
36
+ | 理由: 金色放射线条, 视觉冲击强且不遮挡游戏元素
37
+ +-- 元素消失/冲刺残影 -> smoke (8帧, ~20KB)
38
+ | 理由: 烟雾自然消散, 柔和过渡不抢视觉焦点
39
+ +-- 元素高亮/选中状态 -> glow (6帧, ~10KB)
40
+ | 理由: 最小体积, 适合持续循环播放(选中状态)
41
+ +-- 落地/点击反馈 -> impact_ring (6帧, ~15KB)
42
+ | 理由: 快速扩散环, 6帧短促匹配瞬时反馈的时间尺度
43
+ +-- 金币/货币拾取 -> coin_collect (8帧, ~20KB)
44
+ 理由: 专用金色闪光发散, 与通用 sparkle 区分货币语义
45
+ ```
46
+
47
+ ## 2. Animate 选型决策树
48
+
49
+ 按运动需求选择预设:
50
+
51
+ ```
52
+ 需要什么运动效果?
53
+ +-- 引起注意(CTA/重要按钮) -> pulse (缩放脉冲, 周期1.5-2s)
54
+ | 理由: 缩放振荡是最有效的注意力引导, 不依赖位移空间
55
+ +-- 持续旋转(加载/转盘/金币) -> spin (X轴缩放模拟Y轴旋转)
56
+ | 理由: 2D压缩模拟3D翻转, 适合圆形/对称元素
57
+ +-- 弹跳反馈(点击/收集/idle) -> bounce (Y轴正弦平移)
58
+ | 理由: 最自然的"活着"感, 适用面最广
59
+ +-- 错误/警告/受击 -> shake (随机小幅XY偏移)
60
+ | 理由: 随机位移制造紧张感, 强制引导注意力
61
+ +-- 悬浮装饰(idle/魔法道具) -> float (轻柔漂浮+微旋转)
62
+ | 理由: 比bounce更轻柔, 加入+-3度旋转增添神秘感
63
+ +-- 闪烁提示(光标/倒计时) -> blink (不透明度振荡)
64
+ | 理由: 最简单的"请注意我"动画, 最小视觉干扰
65
+ +-- 钟摆装饰(悬挂物/灯笼) -> swing (绕顶部中心摆动)
66
+ | 理由: 物理感强, 专为"挂着"的元素设计
67
+ +-- 可爱/卡通idle(果冻/气泡) -> wobble (左右交替小幅旋转)
68
+ | 理由: +-5-10度交替旋转产生弹性感, 适合软体元素
69
+ +-- 卡牌翻转/3D旋转 -> flip (需要正面+背面两张素材)
70
+ 理由: 完整正面->过渡->背面翻转; 详见 ta-3d-flip-recipe.md
71
+ ```
72
+
73
+ ## 3. Core Commands
74
+
75
+ ### use-vfx 完整示例
76
+
77
+ ```bash
78
+ playcraft image use-vfx \
79
+ --preset explosion_small \ # 预设名(必填), 从决策树选定
80
+ --tint "#FF6B35" \ # 颜色叠加(可选), hex格式, 按元素颜色调整
81
+ --scale 1.2 \ # 缩放(可选, 默认1.0), 范围0.5-3.0
82
+ --output assets/images/vfx/tile_break.png # 输出路径(必填)
83
+ ```
84
+
85
+ | 参数 | 类型 | 默认值 | 说明 |
86
+ | ---------- | ------ | ---------- | -------------------- |
87
+ | `--preset` | string | 必填 | VFX 预设名 |
88
+ | `--output` | string | 必填 | 输出精灵表路径(.png) |
89
+ | `--tint` | hex | 预设默认色 | 颜色叠加 `#RRGGBB` |
90
+ | `--scale` | number | 1.0 | 整体缩放(0.5-3.0) |
91
+
92
+ ### animate 完整示例
93
+
94
+ ```bash
95
+ playcraft image animate \
96
+ --input assets/images/ui/cta_button.png \ # 输入静态素材(必填)
97
+ --preset pulse \ # 动画预设(默认bounce)
98
+ --frames 8 \ # 总帧数(2-64, 默认8)
99
+ --columns 4 \ # 精灵表列数(默认4)
100
+ --output assets/images/ui/cta_button_pulse.png # 输出路径(必填)
101
+ ```
102
+
103
+ | 参数 | 类型 | 默认值 | 说明 |
104
+ | ----------- | ------ | ------ | ----------------------- |
105
+ | `--input` | string | 必填 | 输入图片路径 |
106
+ | `--output` | string | 必填 | 输出精灵表路径(.png) |
107
+ | `--preset` | string | bounce | 动画预设名 |
108
+ | `--frames` | number | 8 | 总帧数(2-64) |
109
+ | `--columns` | number | 4 | 精灵表列数 |
110
+ | `--back` | string | 无 | flip 专用: 背面图片路径 |
111
+
112
+ ## 4. Post-Generation Checklist
113
+
114
+ | 检查项 | 方法 | 不通过时 |
115
+ | ------------------ | ---------------------------------- | ---------------------------- |
116
+ | 帧数与预设规格匹配 | 计算精灵表格子数 = 行x列 | 重新生成, 检查 --frames 参数 |
117
+ | 精灵表尺寸合理 | 单帧 <= 256x256, 总图 <= 1024px 宽 | 降低 --scale 或减少帧数 |
118
+ | 文件体积在预算内 | VFX 总计 <= 150KB | 减少预设数量或降帧 |
119
+ | 记录到 ta-log.md | grid 参数(帧数/列数/单帧尺寸) | 补写, Developer 需要此信息 |
120
+
121
+ ## 5. Detailed Reference
122
+
123
+ 完整预设目录与组合配方见 `refs/ta-vfx-preset-catalog.md`,包含:
124
+
125
+ - 每个 VFX 预设的完整详解(动画感描述、Tint 建议、Scale 建议、典型错误)
126
+ - 每个 animate 预设的完整详解(参数建议、最佳用途、典型错误)
127
+ - 按游戏类型的 VFX + 动画组合配方(Match-3 / 跑酷 / 卡牌 / 泡泡射击)
128
+ - flip 工作流详情
129
+ - 自定义帧数决策指南与非均匀帧时长技巧
130
+ - 体积预算分配参考
@@ -0,0 +1,485 @@
1
+ ---
2
+ name: playcraft-workflow
3
+ description: PlayCraft 可玩广告开发工作流与 Skill 体系入口。在开始构建任何游戏项目、选择组件、查找 Skill、生成图片/音频、创建 Remix 时自动触发。解释双层 Skill 体系并引导正确工作流。
4
+ triggers: 构建游戏,开始开发,创建项目,选择组件,选择 skill,查找 skill,生成图片,生成音频,工作流,workflow
5
+ ---
6
+
7
+ # PlayCraft 工作流与 Skill 体系
8
+
9
+ ## 执行模式(首先判断)
10
+
11
+ 在开始任何工作前,先判断当前执行环境:
12
+
13
+ ### Multi-Agent Mode(默认,优先使用)
14
+
15
+ 如果当前环境支持 sub-agent 调用(Claude Code 的 `@agent` 语法可用):
16
+
17
+ 1. **你是 orchestrator**,不要自己执行任何 Agent 的工作
18
+ 2. 按 `CLAUDE.md` 中 Orchestration Protocol 的阶段转换表 spawn sub-agents
19
+ 3. 每个 sub-agent 完成后,读取 `docs/project-state.md` 的 **`## Agent handoff`** YAML + Gates 表,再决定下一步
20
+ 4. **Orchestrator 会话**优先遵循 `.cursor/rules/playcraft-orchestrator.mdc`;子 Agent 会话不加载 orchestrator rule
21
+ 5. **仅 orchestrator** 对用户 `AskUserQuestion` — 子 Agent **禁止**问用户(见 `docs/team/agent-conduct.md`)
22
+ - `gate_pending` 非 null 且 `waiting_for: user_gate` 时:**只跑 Gate**,不得 invoke 子 Agent
23
+ - `subagent_stop: true` 时:只执行 `next_orchestrator_action`
24
+ - Gate #1 / #2a / #2b:`AskUserQuestion`(子 Agent 更新 handoff 后 STOP)
25
+ - **Gate #1 / #2b 前**:先 invoke `@reviewer design_check`(软性 checklist)
26
+ - Gate #3:Reviewer `load_check` 通过后展示 **devUrl**(用户只点链;玩法由用户判断)
27
+ - Gate / handoff 细则:`docs/team/collaboration.md` § Gate Protocol、§ Agent Handoff
28
+ 6. `devStatus: ui_ready` → `@reviewer ui_diff`;`ui_rework` → 按 report 修复 → 再 `@reviewer ui_diff`
29
+ 7. `devStatus: ready` → `@reviewer load_check` → Gate #3
30
+ 8. `devStatus: blocked_upstream` → 按 `devBlockers.routeTo` 调度 TA/Designer → 再 `@developer`
31
+ 9. 当前交付终点 = 用户在 Dev URL 验收通过(`done`),**不要求** `playcraft build`
32
+
33
+ ### ⚠️ Orchestrator 调度原则:传 WHAT 不传 HOW
34
+
35
+ **Orchestrator 不是全知全能的指挥官。** 不要在调度时给子 Agent 写详细步骤——子 Agent 有完整的 `.claude/agents/<role>.md` + `refs/` + 相关 Skills。
36
+
37
+ **正确的调度方式:**
38
+
39
+ ```
40
+ @technical-artist
41
+ 目标:完成 atom-plan.json 中所有 assignTo: TA 的 atoms。
42
+ 注意:atom-plan.json → skillsMatch.mediaGroups 有 3 个预制图片资产可复用,优先 link。
43
+ ```
44
+
45
+ **错误的调度方式(越俎代庖):**
46
+
47
+ ```
48
+ @technical-artist
49
+ 1. 先生成 tile_01.png,用绿幕...
50
+ 2. 然后 remove-background --tolerance 25...
51
+ 3. 接着 resize 到 128x128...
52
+ ```
53
+
54
+ **原则:**
55
+
56
+ - Orchestrator 只传递 **目标 + 约束 + 关键提醒**(如 mediaGroups 可用)
57
+ - 子 Agent 自己读 `refs/` + Skills 找到正确方法论
58
+ - Orchestrator 在 sub-agent STOP 后 **验证结果**(atom status 是否更新、Context 是否填写)
59
+
60
+ ### Orchestrator STOP 后验证清单
61
+
62
+ Sub-agent STOP 返回后,Orchestrator 必须验证:
63
+
64
+ ```bash
65
+ # 检查 atom status 是否全部更新
66
+ cat docs/atom-plan.json | jq '[.atoms[] | select(.assignTo == "<agent>") | select(.status == "pending")] | length'
67
+ # 应该 = 0(所有该 agent 的 atom 都已 done / skipped)
68
+
69
+ # 检查 Context 是否填写
70
+ grep -c "Pending" docs/atom-plan.md
71
+ # 对应 agent 的 Context 区不应包含 "Pending"
72
+
73
+ # 检查 actualOutput 文件是否存在
74
+ cat docs/atom-plan.json | jq '.atoms[] | select(.assignTo == "<agent>" and .status == "done") | .actualOutput' | xargs -I {} test -f {}
75
+ ```
76
+
77
+ 如果验证失败 → 不转入下一阶段,而是要求该 agent 补全。
78
+
79
+ ### Single-Agent Mode(降级模式,当 sub-agent 不可用时)
80
+
81
+ 串行执行所有阶段,但**必须**:
82
+
83
+ - 每进入一个新阶段时,先完整读取对应 `.claude/agents/<role>.md` 的所有指令
84
+ - 不可跳过任何阶段的必选产出(特别是 TA 的完整素材生产——UI 图、VFX、精灵图都必须生产)
85
+ - 必须执行 Spec Quick-Check:TA 在 production Wave 2 启动后 30s 内;Developer 在 `ui_pass` 启动后 30s 内
86
+ - PM 定稿后运行 `playcraft skills link --from-atom-plan`;Developer 优先读 `.claude/skills/<atomId>/SKILL.md`,仅断链时用 `playcraft skills read`
87
+
88
+ ---
89
+
90
+ ## 双层 Skill 体系
91
+
92
+ PlayCraft 使用 **两套互补的 Skill 系统**:
93
+
94
+ | 层 | 位置 | 用途 | 发现方式 |
95
+ | ---------------------- | ----------------------------------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
96
+ | **Claude Code Skills** | `.claude/skills/` | 平台工具使用指南(图片生成、音频、代码编辑器等) | IDE 自动发现和注入 |
97
+ | **DAG Atom Skills** | `playcraft skills match` 返回的 `skillDir` 路径 | 游戏积木(玩法规则、组件、图片、音效、配置) | `playcraft skills match` CLI 推荐;PM 定稿后 `playcraft skills link --from-atom-plan` 软链到 `.claude/skills/` 供 IDE 自动发现 |
98
+
99
+ **关键规则**:构建任何新游戏项目前,**必须先运行 `playcraft skills match`** 获取完整的推荐积木清单,再动手写代码。
100
+
101
+ ---
102
+
103
+ ## 标准工作流(必须遵守)
104
+
105
+ ```
106
+ ① 运行本地 Skill 推荐(必须)
107
+ playcraft skills match --intent "<关键词,逗号分隔>" --json
108
+ # 自动推断引擎;若已定:加 --engine <threejs|phaser>
109
+
110
+ ② 评估本地 Skill 覆盖度
111
+ - 完整覆盖 → 进入步骤 ③
112
+ - 部分覆盖 → 进入步骤 ③,同时触发 ②-ext
113
+ - 完全没有 → 触发 ②-ext
114
+
115
+ ② -ext(本地不足时)网络研究补充
116
+ - 参阅 playcraft-research SKILL,按角色执行定向研究
117
+ - 研究结论写入 `docs/atom-plan.md` 的对应 Context 区域
118
+ - 标记候选新 Skill(在 DAG Revisions 中记录)
119
+
120
+ ③ 读取每个代码 Skill 的 SKILL.md(PM 已 link 后优先项目内路径):
121
+ cat .claude/skills/<atomId>/SKILL.md
122
+ # 软链缺失时兜底:playcraft skills read <atomId>
123
+ - 理解 Recipe;列出将使用的 ref/ 文件
124
+ - 将关键信息记入 `docs/atom-plan.md` 对应的 Context 区域
125
+
126
+ ④ PM 定稿 `atom-plan.json` 后,软连接 DAG Skill 到项目(IDE 自动发现,强烈推荐):
127
+ playcraft skills link --from-atom-plan --prune
128
+
129
+ ⑤ 执行 scaffold 命令,复制 ref 文件到项目(注:package.json/tsconfig.json 使用 merge-json 模式,不覆盖已有配置)
130
+ playcraft skills scaffold --engine <引擎> --atoms <skill1,skill2> --out ./game
131
+
132
+ ⑥ 按各媒体 Skill 的参数(或网络研究得出的参数)生成图片/音频资产
133
+ playcraft tools generate-image --prompt "..." --output ta-workspace/xxx.png
134
+ playcraft tools generate-sfx --prompt "..." --duration 1.5
135
+ playcraft tools generate-bgm --prompt "..."
136
+
137
+ ⑦ 在已有 ref 文件基础上(或基于研究方案)编写项目代码
138
+ ```
139
+
140
+ **禁止**:
141
+
142
+ - ❌ 未运行 `skills match` 就开始写引擎/布局/输入/渲染代码
143
+ - ❌ 未读 SKILL.md(项目软链或 CLI 兜底)就跳过 Skill 内容直接从头实现
144
+ - ❌ 对已有 ref 文件重新实现相同功能
145
+ - ❌ 手动猜测 Skill 名称
146
+ - ❌ 本地无 Skill 就直接凭感觉写——先做网络研究,把依据记录在活 DAG 里
147
+
148
+ ---
149
+
150
+ ## Agent 自增强协议(Skill-on-Demand)
151
+
152
+ > **核心原则**:Skill 是持续可用的资源,不是一次性查询。每个 Agent 在其专属阶段都应独立做角色相关的 Skill 发现。
153
+
154
+ ### 为什么需要多次 Skill 查询
155
+
156
+ - 每个 Agent 是独立 session,不继承前一个 Agent 的 Skill 搜索结果
157
+ - 每个角色需要的 Skill 类型完全不同
158
+ - 在实现某个具体功能时才知道需要什么,无法在规划阶段完全预见
159
+
160
+ ### 按角色的 Skill 发现模式
161
+
162
+ **PM(规划阶段)**
163
+
164
+ ```bash
165
+ # 确认玩法类型的已有实现和依赖关系
166
+ playcraft skills match --engine <engine> --intent "<gameplay_type>,<game_mechanic>" --json
167
+ # 浏览所有可用配置封包
168
+ playcraft skills list --category config --json
169
+ ```
170
+
171
+ **Designer(创意样本生产阶段)**
172
+
173
+ ```bash
174
+ # 找视觉资产参考和生成参数(aiimage Skill 包含 manifest.json 里的 generation 字段)
175
+ playcraft skills list --category visual --json
176
+ # 找音频资产参考
177
+ playcraft skills list --category audio --json
178
+ # 按具体元素类型搜索
179
+ playcraft skills match --intent "<element_type>,<art_style>" --json
180
+ ```
181
+
182
+ **Technical Artist(技术生产阶段)**
183
+
184
+ ```bash
185
+ # 找精灵图/图集生产 Skill
186
+ playcraft skills list --category visual --json
187
+ playcraft skills match --intent "<element_type>,sprite,atlas,sheet" --json
188
+ # 找 3D 渲染/翻转精灵图 Skill
189
+ playcraft skills match --intent "3d,sprite,flip,render" --json
190
+ # 找图片处理 Skill
191
+ playcraft skills match --intent "image,processing,pipeline" --json
192
+ # 找验证器(用于合规检查)
193
+ playcraft skills list --category validator --json
194
+ ```
195
+
196
+ **Developer(代码实现阶段)**
197
+
198
+ ```bash
199
+ # 每实现一个 Atom 前,先搜索是否有现成的代码积木
200
+ playcraft skills match --engine <engine> --intent "<feature_name>,<component_type>" --json
201
+ # 找引擎适配层
202
+ playcraft skills list --category engine --json
203
+ # 找布局/UI 组件
204
+ playcraft skills list --category layout --json
205
+ ```
206
+
207
+ **Reviewer(质量验证阶段)**
208
+
209
+ ```bash
210
+ # 找可用的校验器 Skill
211
+ playcraft skills list --category validator --json
212
+ # 按具体校验目标搜索
213
+ playcraft skills match --intent "validator,balance,compliance,ux" --json
214
+ ```
215
+
216
+ ### "写代码前先查 Skill" 规则
217
+
218
+ 在实现任何非平凡组件之前,**必须先执行此检查**:
219
+
220
+ ```
221
+ 1. 我即将实现:<描述功能>
222
+ 2. 运行:playcraft skills match --engine <e> --intent "<功能关键词>" --json
223
+ 3a. 找到完整匹配 Skill → 读取其 SKILL.md → scaffold → 基于 ref 文件实现
224
+ 3b. 找到部分匹配 → 使用 Skill 作为基础,参阅 playcraft-research 补充网络研究
225
+ 3c. 完全未找到 Skill → 参阅 playcraft-research 执行定向网络研究 → 研究结论写入
226
+ `atom-plan.md` § Impl Skill Context → 在 `dagRevisions` / DAG Revisions 标注候选新 Skill → 实现
227
+ ```
228
+
229
+ > 本地 Skill 库不可能穷尽所有场景。遇到陌生玩法、新艺术风格、特定算法时,**网络研究是标准流程,不是例外**。关键是把研究结论沉淀进活 DAG,让整个团队受益。
230
+
231
+ **典型触发场景**:
232
+
233
+ - 要写一个新的 UI 组件 → `skills match --intent "ui,component,<具体名称>"`
234
+ - 要实现某种玩法规则 → `skills match --intent "<gameplay>,rules,algorithm"`
235
+ - 要做图片后处理/精灵图 → 读取 `playcraft-image-generation` SKILL.md(涵盖后处理管线与脚本模板)
236
+ - 要做音频生成/处理 → 读取 `playcraft-audio-generation` SKILL.md
237
+ - 要读取某个 Skill 的完整说明 → `playcraft skills read <atomId>`
238
+
239
+ ### Skill 依赖链发现
240
+
241
+ Atom Skill 之间通过 `imports` 字段形成依赖链。发现一个 Skill 可能引出更多:
242
+
243
+ ```bash
244
+ # 读取某 Skill 的完整 SKILL.md(含 imports / Recipe / 操作流程)
245
+ playcraft skills read <atomId>
246
+
247
+ # match 输出的 JSON 中每个 item 包含 skillDir 字段,可直接访问 ref/ 目录
248
+ # 例如读取 memory_match 的 PGS 规则骨架:
249
+ playcraft skills match --engine phaser --intent "memory,match" --json \
250
+ | python3 -c "import json,sys; items=json.load(sys.stdin)['items']; [print(i['atomId'], i['skillDir']) for i in items]"
251
+
252
+ # 查看 skill 的 ref/ 目录文件(先用 read 获取 skillDir)
253
+ playcraft skills read <atomId> # 找到 skillDir 路径
254
+ # 然后直接读取 ref/ 文件:
255
+ cat <skillDir>/ref/<file>
256
+
257
+ # 按依赖 Skill 名称递归读取
258
+ playcraft skills match --intent "<imported_skill_keywords>" --json
259
+ ```
260
+
261
+ ---
262
+
263
+ ## 活 DAG 分层富集模式(保持一致性)
264
+
265
+ > **问题**:多个 Agent 各自做 DAG/Skill 搜索,结果会不会冲突?谁的优先?
266
+ >
267
+ > **答案**:不冲突。**活 DAG** 在 `docs/atom-plan.json`(`atoms[]` + `skillsMatch`);各 Agent 在 `docs/atom-plan.md` 向专属 Context 区富集,形成统一知识库。
268
+
269
+ ### 活 DAG 的分层结构
270
+
271
+ ```
272
+ docs/atom-plan.json
273
+ ├── skillsMatch ← PM:`playcraft skills match --json`(skillRef 唯一来源)
274
+ ├── atoms[] ← PM:排期 DAG;Gameplay/Config 的 skillRef 仅来自 skillsMatch.items
275
+ └── dagRevisions[] ← 结构变更 / skills-match-gap(可与 md 同步)
276
+
277
+ docs/atom-plan.md
278
+ ├── Atom List(可选镜像表) ← 与 atoms[] 同步;可省略
279
+ ├── ## Acceptance Criteria ← PM:每 atom 一条可测验收
280
+ ├── ## Asset Skill Context ← Designer
281
+ ├── ## TA Skill Context ← TA
282
+ ├── ## Impl Skill Context ← Developer
283
+ └── ## DAG Revisions ← 人类可读修订记录
284
+ ```
285
+
286
+ Skills 路径真源:`playcraft.config.json` → `agent.skillsDir`(**不要**在 atom-plan 写死 node_modules)。格式详解:[`docs/team/atom-plan-format.md`](../../docs/team/atom-plan-format.md)
287
+
288
+ ### 各 Agent 的读写职责
289
+
290
+ | Agent | 读取 | 写入 |
291
+ | -------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------- |
292
+ | **PM** | design-brief, layout-spec | `atom-plan.json`(skillsMatch + atoms[]) |
293
+ | **Designer** | `atoms[]` + `mediaGroups` + design-brief | `atom-plan.md` § Asset Skill Context;`atoms[].status` + `atoms[].actualOutput` |
294
+ | **Technical Artist** | `atoms[]` + `mediaGroups` + Asset Context + designer-log | `atom-plan.md` § TA Skill Context;`atoms[].status` + `atoms[].actualOutput` |
295
+ | **Developer** | `atoms[]` + Context 区 + design-brief | `atom-plan.md` § Impl Skill Context;`atoms[].status` + `atoms[].actualOutput` |
296
+ | **Reviewer** | JSON + MD(只读) | 不写 |
297
+
298
+ ### ⚠️ Status Update 纪律(所有 Agent 必须遵守)
299
+
300
+ 每个 Agent 完成 atom 后 **立即** 更新 `atom-plan.json`:
301
+
302
+ ```json
303
+ {
304
+ "atomId": "<id>",
305
+ "status": "done",
306
+ "actualOutput": "<deliverable_path>"
307
+ }
308
+ ```
309
+
310
+ - **Designer**: `actualOutput` = 文件路径 或 `"ASR:<sheet>:<region>"` (when covered by ASR)
311
+ - **TA**: `actualOutput` = `"assets/images/<path>.webp"` (final WebP contract path)
312
+ - **Developer**: `actualOutput` = `"game/<path>.ts"` (implementation file)
313
+
314
+ **atom-plan 不是 PM 的一次性输出文档,而是贯穿全流程的活依赖追踪系统。**
315
+
316
+ ### mediaGroups 使用纪律(Designer + TA 必须遵守)
317
+
318
+ `skillsMatch.mediaGroups` 包含 PM 通过 `playcraft skills match` 找到的可复用预制资产。
319
+
320
+ **流程**:
321
+
322
+ ```
323
+ Designer/TA 读 mediaGroups
324
+ ├─ 匹配当前 atom?
325
+ │ ├─ 是 → `playcraft skills link --atom <atomId>` → 后处理 → status=done
326
+ │ └─ 否 / 质量不够 → 记录跳过原因到 dagRevisions → 正常生产流程
327
+ └─ mediaGroups 为空?→ 正常生产流程
328
+ ```
329
+
330
+ **禁止**:忽略 mediaGroups 中存在匹配的预制资产而从零生成(浪费 token + 引入不一致风险)。
331
+
332
+ ### 为什么这样设计能避免冲突
333
+
334
+ **示例**:游戏风格为"像素风"
335
+
336
+ ```
337
+ PM:
338
+ → 搜索 aigameplay skills,得到 arrow_pick_match_rules
339
+ → 在 atoms[] 填:arrow_rules | skillRef = arrow_pick_match_rules.aigameplay
340
+ → 不知道像素风需要什么具体的图片参数,留 VisualAtom skillRef 为空(—)
341
+
342
+ Designer:
343
+ → 读到 StyleDirection = "像素风 8-bit 高饱和"
344
+ → 搜索 aiimage skills,得到 pixel_art_sprite.aiimage
345
+ → 读 pixel_art_sprite 的 manifest.json:了解 prompt 模板、block 尺寸参数
346
+ → 在 Asset Skill Context 写:bg_atom → pixel_art_sprite → 关键参数...
347
+ → 现在知道"像素风"具体怎么生产了
348
+
349
+ Developer:
350
+ → 读 PM 的 skillRef = arrow_pick_match_rules.aigameplay
351
+ → 读 Designer 的 Asset Skill Context(了解视觉风格,确保代码绑定正确)
352
+ → 搜索额外的 aicomponent skills
353
+ → 在 Impl Skill Context 写:arrow_rules_impl → 实现细节...
354
+
355
+ Reviewer:
356
+ → 读 Atom List + Asset Skill Context + Impl Skill Context
357
+ → 有了完整 Skill 依据,搜索 aivalidator skills 进行验证
358
+ ```
359
+
360
+ **无冲突的根本原因**:每个 Agent 的写入区域不重叠。DAG 是合作共建的,不是争夺的。
361
+
362
+ ---
363
+
364
+ ## Scaffold 所有权模型(防冲突)
365
+
366
+ > **核心规则**:`playcraft skills match/list` 是只读操作,任何 Agent 随时可用,零冲突。
367
+ > **唯一风险**:`playcraft skills scaffold`(写文件),必须遵守所有权规则。
368
+
369
+ ### 每个 Agent 的 Scaffold 域
370
+
371
+ | Agent | 可 Scaffold 的 Skill 类型 | 写入目录 | 禁止 Scaffold |
372
+ | -------------------- | -------------------------------------------------------------- | --------- | --------------------------------------------------------- |
373
+ | **Developer** | `aicomponent`, `aigameplay`, `aiconfig` | `game/` | `aiimage`, `aiaudio`, `aivalidator` |
374
+ | **Technical Artist** | ❌ 不 Scaffold(读 manifest.json generation 参数,直接调 CLI) | `assets/` | **全部**(TA 通过 CLI 管线生产,不 Scaffold) |
375
+ | **Designer** | ❌ 不 Scaffold | `assets/` | **全部**(只读 manifest.json 的 generation 参数用于生成) |
376
+ | **Reviewer** | ❌ 不 Scaffold | 只读 | **全部**(read-only 角色) |
377
+ | **PM** | ❌ 不 Scaffold | `docs/` | **全部**(只做规划 + 协调) |
378
+
379
+ ### 为什么 Designer 和 TA 不需要 Scaffold
380
+
381
+ `aiimage` / `aiaudio` Skill 没有 `ref/` 代码文件,只有 `manifest.json` 中的 `generation` 字段(prompt、aspectRatio、duration 等)。Designer 和 TA 读取这些参数作为生成基准,通过 `playcraft image *`、`playcraft tools generate-image` 等 CLI 命令执行,不复制任何文件到项目。
382
+
383
+ **Reviewer(convergence-v1)**
384
+
385
+ - **`design_check`**:Gate #1 / #2b 前 — 文档完整性 checklist(无需浏览器)
386
+ - **`ui_diff`**:读取 **`playwright-cli`** skill — 截图 vs MC 各面板
387
+ - **`load_check`**:读取 **`playwright-cli`** skill — 页面加载 + console 无 Error
388
+
389
+ ### Production 串行编排(convergence-v1)
390
+
391
+ Gate #2b 通过后 **严格串行**(见 `workflow-changelog.md`):
392
+
393
+ ```
394
+ Wave 1 Designer Ph.2 → Wave 2 TA → ui_pass Developer → ui_review (Reviewer ui_diff) → gameplay_pass Developer → load_check → Gate #3
395
+ ```
396
+
397
+ Developer 在 **`ui_pass`** 写入 UI shell(无核心玩法);**`gameplay_pass`** 叠加玩法逻辑。TA 已交付合同路径上的真实资产。
398
+
399
+ ### 避免重复 Scaffold 的规则
400
+
401
+ 同一个 Skill 不应被多次 Scaffold 到同一目录:
402
+
403
+ - PM 在 `atom-plan.json` → `atoms[]` 标注 `skillRef`(若有)+ 调度元信息(assignTo/dependsOn/priority/parallelGroup/referenceSource)
404
+ - Developer 在 **`ui_pass`** 开始时,按 `atoms[]` 中 `assignTo: Developer` 批量 scaffold 一次
405
+ - **不要在实现单个 Atom 时反复 scaffold** — 先统一 scaffold 所有依赖,再逐一实现
406
+
407
+ ---
408
+
409
+ ## 如何阅读 Atom Skill 的 SKILL.md
410
+
411
+ 每个 Atom Skill 的 `SKILL.md` 包含:
412
+
413
+ 1. **YAML frontmatter**:`name`(格式为 `<name>.<bundleType>`)、`description`、`triggers`
414
+ 2. **功能说明**:Skill 做什么、输出什么
415
+ 3. **Scaffold / Imports**:依赖哪些其他 Skill
416
+ 4. **Skill Definition 区块**(部分 Skill 有):
417
+ ```yaml
418
+ ## Skill Definition
419
+ tools:
420
+ - bash
421
+ - read
422
+ prompt_extension: |
423
+ 这里是注入给 agent 的操作指令
424
+ ```
425
+ `prompt_extension` 的内容是 agent 执行此 Skill 时需要遵循的具体指令。
426
+
427
+ ---
428
+
429
+ ## Skill 推荐示例
430
+
431
+ ```bash
432
+ # Three.js 3D 棋盘消除游戏
433
+ playcraft skills match --engine threejs --intent "board,3d,path,animation"
434
+
435
+ # Phaser 三消游戏
436
+ playcraft skills match --engine phaser --intent "match3,grid,tile,score"
437
+
438
+ # 跑酷游戏
439
+ playcraft skills match --engine phaser --intent "parkour,left_right,run,obstacle"
440
+
441
+ # 查看所有可用 Skill
442
+ playcraft skills list --json
443
+ ```
444
+
445
+ ---
446
+
447
+ ## 平台工具快速参考
448
+
449
+ ### Claude Code Skills(`.claude/skills/` 目录,自动注入)
450
+
451
+ > ⚠️ 下表只列出**项目模板中实际存在**的 Skill。不要查找或引用表外的 Skill 名称。
452
+
453
+ | Skill | 职责 | 主要角色 |
454
+ | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------- | ------------- |
455
+ | `playcraft-workflow`(本文件) | 工作流入口、Skill 体系、DAG 协作规范 | 全员 |
456
+ | `playcraft-image-generation` | AI 图片生成全指南:模型选择、gpt-image-2 双 provider、精灵图直出、绿幕策略、edit 变体、错误恢复、ta-workspace 脚本模板 | Designer / TA |
457
+ | `playcraft-audio-generation` | AI 音频生成全指南:SFX/BGM 生成参数、prompt 套路、本地音频后处理(compress/fade/loop) | Designer |
458
+ | `playcraft-research` | 网络研究协议:`tools research/fetch-url/search-image` 三工具标准流程、研究结果融入活 DAG | 全员 |
459
+
460
+ ### CLI 命令组(`playcraft <group>`,无需 Skill 文件)
461
+
462
+ | 命令组 | 能力摘要 | 主要角色 | 完整文档 |
463
+ | --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------ |
464
+ | `playcraft tools generate-image` | AI 文生图/图生图;`--reference-image`、`--image-model`(裸模型名时后端按优先级 fallback)、`--count N`(同 prompt 批量出图)、`--timeout` | Designer / TA | `docs/cli/tools.md §1.2` |
465
+ | `playcraft tools generate-sfx/bgm` | AI 音效/背景音乐生成 | Designer | `docs/cli/tools.md §1.2` |
466
+ | `playcraft tools generate-3d` 系列 | AI 3D 模型生成、贴图、重拓扑、UV 展开、动作 | TA | `docs/cli/tools.md §1.3` |
467
+ | `playcraft tools research/fetch-url` | AI 网络研究与 URL 读取 | 全员 | `docs/cli/tools.md §1.7` |
468
+ | `playcraft tools save-to-git/build-project/publish` | 项目保存、构建、发布 | Developer | `docs/cli/tools.md §1.4` |
469
+ | `playcraft image` | 本地图片处理 + 后端抠图/分层:resize/crop/decompose-layers/segment/remove-background/sprite-split/sprite-sheet/batch/pipeline/animate/tint/overlay/gen-tile-back | TA | `docs/cli/tools.md §2`;分层与蒙版选型见 `playcraft-masking` |
470
+ | `playcraft audio` | 本地音频处理:compress/trim/fade/loop/normalize/mix | Designer / TA | `docs/cli/tools.md §3` |
471
+ | `playcraft 3d` | 本地 3D 处理:白模库/apply-texture/optimize/convert | TA | `docs/cli/tools.md §4` |
472
+ | `npm run dev` | 项目 Dev 预览(`package.json` → `scripts.dev`) | Developer / Reviewer | 用户不执行;Gate #3 由 orchestrator 递 devUrl |
473
+ | `playcraft build / build-all` | 打包 Playable Ads(**未来**交付路径,非当前 `done` 条件) | — | — |
474
+ | `playcraft skills match/list/link/scaffold/read` | DAG Atom Skill 推荐、IDE 软链、脚手架、内容读取(`link` 供 PM;`read` 供 Developer Preflight) | 全员 | — |
475
+
476
+ ---
477
+
478
+ ## Skill 目录发现优先级
479
+
480
+ `playcraft skills` 命令按以下优先级发现 Skill 目录:
481
+
482
+ 1. `--skills-dir <path>` 参数
483
+ 2. `playcraft.config.json` 中的 `skillsDir` 字段
484
+ 3. `AGENT_SKILLS_PATHS` 环境变量
485
+ 4. `<项目根>/node_modules/@playcraft/skills/skills`(npm 安装后)