claude-code-workflow 6.3.48 → 6.3.49

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 (211) hide show
  1. package/.claude/CLAUDE.md +6 -8
  2. package/.claude/agents/action-planning-agent.md +28 -45
  3. package/.claude/agents/cli-lite-planning-agent.md +93 -1
  4. package/.claude/agents/code-developer.md +144 -27
  5. package/.claude/commands/ccw-coordinator.md +175 -21
  6. package/.claude/commands/ccw-debug.md +832 -0
  7. package/.claude/commands/ccw.md +90 -9
  8. package/.claude/commands/cli/cli-init.md +1 -0
  9. package/.claude/commands/issue/convert-to-plan.md +718 -0
  10. package/.claude/commands/issue/from-brainstorm.md +382 -0
  11. package/.claude/commands/memory/tips.md +332 -0
  12. package/.claude/commands/workflow/analyze-with-file.md +804 -0
  13. package/.claude/commands/workflow/brainstorm/auto-parallel.md +18 -43
  14. package/.claude/commands/workflow/brainstorm/role-analysis.md +705 -0
  15. package/.claude/commands/workflow/brainstorm-with-file.md +1153 -0
  16. package/.claude/commands/workflow/debug-with-file.md +7 -5
  17. package/.claude/commands/workflow/execute.md +6 -4
  18. package/.claude/commands/workflow/lite-plan.md +2 -2
  19. package/.claude/commands/workflow/plan-verify.md +162 -327
  20. package/.claude/commands/workflow/plan.md +162 -26
  21. package/.claude/commands/workflow/replan.md +78 -2
  22. package/.claude/commands/workflow/{review-fix.md → review-cycle-fix.md} +6 -6
  23. package/.claude/commands/workflow/review-module-cycle.md +2 -2
  24. package/.claude/commands/workflow/review-session-cycle.md +2 -2
  25. package/.claude/commands/workflow/tools/conflict-resolution.md +16 -26
  26. package/.claude/commands/workflow/tools/context-gather.md +81 -118
  27. package/.claude/commands/workflow/tools/task-generate-agent.md +94 -10
  28. package/.claude/skills/ccw-help/command.json +4 -4
  29. package/.claude/skills/lite-skill-generator/SKILL.md +650 -0
  30. package/.claude/skills/lite-skill-generator/templates/simple-skill.md +68 -0
  31. package/.claude/skills/lite-skill-generator/templates/style-guide.md +64 -0
  32. package/.claude/skills/skill-generator/SKILL.md +277 -85
  33. package/.claude/skills/skill-generator/phases/01-requirements-discovery.md +4 -15
  34. package/.claude/skills/skill-generator/phases/02-structure-generation.md +72 -17
  35. package/.claude/skills/skill-generator/phases/03-phase-generation.md +218 -51
  36. package/.claude/skills/skill-generator/phases/04-specs-templates.md +111 -41
  37. package/.claude/skills/skill-generator/phases/05-validation.md +139 -56
  38. package/.claude/skills/skill-generator/templates/autonomous-action.md +78 -268
  39. package/.claude/skills/skill-generator/templates/autonomous-orchestrator.md +14 -0
  40. package/.claude/skills/skill-generator/templates/code-analysis-action.md +12 -0
  41. package/.claude/skills/skill-generator/templates/llm-action.md +12 -0
  42. package/.claude/skills/skill-generator/templates/script-template.md +368 -0
  43. package/.claude/skills/skill-generator/templates/sequential-phase.md +14 -0
  44. package/.claude/skills/skill-generator/templates/skill-md.md +14 -0
  45. package/.claude/skills/skill-tuning/SKILL.md +130 -266
  46. package/.claude/skills/skill-tuning/phases/orchestrator.md +95 -283
  47. package/.claude/skills/skill-tuning/specs/problem-taxonomy.md +90 -198
  48. package/.claude/skills/skill-tuning/specs/tuning-strategies.md +193 -1345
  49. package/.claude/workflows/cli-templates/schemas/plan-verify-agent-schema.json +47 -0
  50. package/.claude/workflows/cli-templates/schemas/verify-json-schema.json +158 -0
  51. package/.claude/workflows/cli-tools-usage.md +1 -1
  52. package/.codex/AGENTS.md +1 -3
  53. package/.codex/prompts/analyze-with-file.md +607 -0
  54. package/.codex/prompts/brainstorm-to-cycle.md +455 -0
  55. package/.codex/prompts/brainstorm-with-file.md +933 -0
  56. package/.codex/prompts/debug-with-file.md +15 -20
  57. package/.codex/skills/ccw-cli-tools/SKILL.md +559 -0
  58. package/ccw/dist/commands/cli.d.ts.map +1 -1
  59. package/ccw/dist/commands/cli.js +29 -5
  60. package/ccw/dist/commands/cli.js.map +1 -1
  61. package/ccw/dist/commands/issue.d.ts +2 -0
  62. package/ccw/dist/commands/issue.d.ts.map +1 -1
  63. package/ccw/dist/commands/issue.js +62 -20
  64. package/ccw/dist/commands/issue.js.map +1 -1
  65. package/ccw/dist/config/litellm-api-config-manager.d.ts.map +1 -1
  66. package/ccw/dist/config/litellm-api-config-manager.js +5 -3
  67. package/ccw/dist/config/litellm-api-config-manager.js.map +1 -1
  68. package/ccw/dist/config/litellm-provider-models.d.ts +73 -0
  69. package/ccw/dist/config/litellm-provider-models.d.ts.map +1 -0
  70. package/ccw/dist/config/litellm-provider-models.js +172 -0
  71. package/ccw/dist/config/litellm-provider-models.js.map +1 -0
  72. package/ccw/dist/config/provider-models.d.ts +25 -51
  73. package/ccw/dist/config/provider-models.d.ts.map +1 -1
  74. package/ccw/dist/config/provider-models.js +84 -149
  75. package/ccw/dist/config/provider-models.js.map +1 -1
  76. package/ccw/dist/config/storage-paths.d.ts.map +1 -1
  77. package/ccw/dist/config/storage-paths.js +23 -5
  78. package/ccw/dist/config/storage-paths.js.map +1 -1
  79. package/ccw/dist/core/auth/csrf-middleware.js +3 -3
  80. package/ccw/dist/core/auth/csrf-middleware.js.map +1 -1
  81. package/ccw/dist/core/dashboard-generator.d.ts.map +1 -1
  82. package/ccw/dist/core/dashboard-generator.js +3 -1
  83. package/ccw/dist/core/dashboard-generator.js.map +1 -1
  84. package/ccw/dist/core/routes/claude-routes.d.ts.map +1 -1
  85. package/ccw/dist/core/routes/claude-routes.js +206 -14
  86. package/ccw/dist/core/routes/claude-routes.js.map +1 -1
  87. package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
  88. package/ccw/dist/core/routes/cli-routes.js.map +1 -1
  89. package/ccw/dist/core/routes/commands-routes.d.ts +7 -0
  90. package/ccw/dist/core/routes/commands-routes.d.ts.map +1 -0
  91. package/ccw/dist/core/routes/commands-routes.js +480 -0
  92. package/ccw/dist/core/routes/commands-routes.js.map +1 -0
  93. package/ccw/dist/core/routes/model-routes.d.ts +11 -0
  94. package/ccw/dist/core/routes/model-routes.d.ts.map +1 -0
  95. package/ccw/dist/core/routes/model-routes.js +112 -0
  96. package/ccw/dist/core/routes/model-routes.js.map +1 -0
  97. package/ccw/dist/core/routes/nav-status-routes.d.ts.map +1 -1
  98. package/ccw/dist/core/routes/nav-status-routes.js +84 -1
  99. package/ccw/dist/core/routes/nav-status-routes.js.map +1 -1
  100. package/ccw/dist/core/routes/provider-routes.d.ts +11 -0
  101. package/ccw/dist/core/routes/provider-routes.d.ts.map +1 -0
  102. package/ccw/dist/core/routes/provider-routes.js +67 -0
  103. package/ccw/dist/core/routes/provider-routes.js.map +1 -0
  104. package/ccw/dist/core/routes/skills-routes.d.ts.map +1 -1
  105. package/ccw/dist/core/routes/skills-routes.js +219 -7
  106. package/ccw/dist/core/routes/skills-routes.js.map +1 -1
  107. package/ccw/dist/core/routes/system-routes.d.ts.map +1 -1
  108. package/ccw/dist/core/routes/system-routes.js +58 -6
  109. package/ccw/dist/core/routes/system-routes.js.map +1 -1
  110. package/ccw/dist/core/server.d.ts.map +1 -1
  111. package/ccw/dist/core/server.js +13 -0
  112. package/ccw/dist/core/server.js.map +1 -1
  113. package/ccw/dist/mcp-server/index.js +2 -2
  114. package/ccw/dist/mcp-server/index.js.map +1 -1
  115. package/ccw/dist/tools/claude-cli-tools.d.ts +48 -11
  116. package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
  117. package/ccw/dist/tools/claude-cli-tools.js +146 -50
  118. package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
  119. package/ccw/dist/tools/cli-config-manager.d.ts +1 -13
  120. package/ccw/dist/tools/cli-config-manager.d.ts.map +1 -1
  121. package/ccw/dist/tools/cli-config-manager.js +3 -27
  122. package/ccw/dist/tools/cli-config-manager.js.map +1 -1
  123. package/ccw/dist/tools/cli-executor-core.d.ts.map +1 -1
  124. package/ccw/dist/tools/cli-executor-core.js +7 -2
  125. package/ccw/dist/tools/cli-executor-core.js.map +1 -1
  126. package/ccw/dist/tools/cli-executor-state.d.ts.map +1 -1
  127. package/ccw/dist/tools/cli-history-store.d.ts +11 -0
  128. package/ccw/dist/tools/cli-history-store.d.ts.map +1 -1
  129. package/ccw/dist/tools/cli-history-store.js +82 -2
  130. package/ccw/dist/tools/cli-history-store.js.map +1 -1
  131. package/ccw/dist/tools/command-registry.d.ts +7 -0
  132. package/ccw/dist/tools/command-registry.d.ts.map +1 -1
  133. package/ccw/dist/tools/command-registry.js +14 -1
  134. package/ccw/dist/tools/command-registry.js.map +1 -1
  135. package/ccw/dist/tools/generate-module-docs.d.ts.map +1 -1
  136. package/ccw/dist/tools/generate-module-docs.js +11 -7
  137. package/ccw/dist/tools/generate-module-docs.js.map +1 -1
  138. package/ccw/dist/tools/litellm-executor.d.ts +1 -0
  139. package/ccw/dist/tools/litellm-executor.d.ts.map +1 -1
  140. package/ccw/dist/tools/litellm-executor.js +11 -9
  141. package/ccw/dist/tools/litellm-executor.js.map +1 -1
  142. package/ccw/dist/types/skill-types.d.ts +97 -0
  143. package/ccw/dist/types/skill-types.d.ts.map +1 -0
  144. package/ccw/dist/types/skill-types.js +6 -0
  145. package/ccw/dist/types/skill-types.js.map +1 -0
  146. package/ccw/src/commands/cli.ts +36 -5
  147. package/ccw/src/commands/issue.ts +81 -26
  148. package/ccw/src/config/litellm-api-config-manager.ts +5 -3
  149. package/ccw/src/config/litellm-provider-models.ts +222 -0
  150. package/ccw/src/config/provider-models.ts +91 -190
  151. package/ccw/src/config/storage-paths.ts +20 -5
  152. package/ccw/src/core/auth/csrf-middleware.ts +3 -3
  153. package/ccw/src/core/dashboard-generator.ts +3 -1
  154. package/ccw/src/core/routes/claude-routes.ts +233 -15
  155. package/ccw/src/core/routes/cli-routes.ts +2 -3
  156. package/ccw/src/core/routes/commands-routes.ts +620 -0
  157. package/ccw/src/core/routes/nav-status-routes.ts +95 -1
  158. package/ccw/src/core/routes/provider-routes.ts +78 -0
  159. package/ccw/src/core/routes/skills-routes.ts +266 -45
  160. package/ccw/src/core/routes/system-routes.ts +102 -50
  161. package/ccw/src/core/server.ts +13 -0
  162. package/ccw/src/mcp-server/index.ts +2 -2
  163. package/ccw/src/templates/dashboard-css/18-cli-settings.css +35 -0
  164. package/ccw/src/templates/dashboard-css/37-commands.css +193 -0
  165. package/ccw/src/templates/dashboard-js/components/navigation.js +4 -0
  166. package/ccw/src/templates/dashboard-js/i18n.js +116 -0
  167. package/ccw/src/templates/dashboard-js/views/cli-manager.js +249 -4
  168. package/ccw/src/templates/dashboard-js/views/commands-manager.js +503 -0
  169. package/ccw/src/templates/dashboard-js/views/issue-manager.js +7 -7
  170. package/ccw/src/templates/dashboard-js/views/mcp-manager.js +2 -7
  171. package/ccw/src/templates/dashboard-js/views/skills-manager.js +164 -23
  172. package/ccw/src/templates/dashboard.html +7 -0
  173. package/ccw/src/tools/claude-cli-tools.ts +170 -56
  174. package/ccw/src/tools/cli-config-manager.ts +2 -33
  175. package/ccw/src/tools/cli-executor-core.ts +8 -2
  176. package/ccw/src/tools/cli-history-store.ts +92 -2
  177. package/ccw/src/tools/command-registry.ts +16 -1
  178. package/ccw/src/tools/generate-module-docs.ts +11 -7
  179. package/ccw/src/tools/litellm-executor.ts +13 -9
  180. package/ccw/src/types/skill-types.ts +99 -0
  181. package/package.json +1 -1
  182. package/.claude/commands/enhance-prompt.md +0 -93
  183. package/.claude/commands/memory/code-map-memory.md +0 -687
  184. package/.claude/commands/memory/docs.md +0 -615
  185. package/.claude/commands/memory/load-skill-memory.md +0 -182
  186. package/.claude/commands/memory/skill-memory.md +0 -525
  187. package/.claude/commands/memory/swagger-docs.md +0 -773
  188. package/.claude/commands/memory/tech-research-rules.md +0 -310
  189. package/.claude/commands/memory/workflow-skill-memory.md +0 -517
  190. package/.claude/commands/task/breakdown.md +0 -208
  191. package/.claude/commands/task/create.md +0 -152
  192. package/.claude/commands/task/execute.md +0 -270
  193. package/.claude/commands/task/replan.md +0 -441
  194. package/.claude/commands/version.md +0 -254
  195. package/.claude/commands/workflow/action-plan-verify.md +0 -485
  196. package/.claude/commands/workflow/brainstorm/api-designer.md +0 -587
  197. package/.claude/commands/workflow/brainstorm/data-architect.md +0 -220
  198. package/.claude/commands/workflow/brainstorm/product-manager.md +0 -200
  199. package/.claude/commands/workflow/brainstorm/product-owner.md +0 -200
  200. package/.claude/commands/workflow/brainstorm/scrum-master.md +0 -200
  201. package/.claude/commands/workflow/brainstorm/subject-matter-expert.md +0 -200
  202. package/.claude/commands/workflow/brainstorm/system-architect.md +0 -389
  203. package/.claude/commands/workflow/brainstorm/ui-designer.md +0 -221
  204. package/.claude/commands/workflow/brainstorm/ux-expert.md +0 -221
  205. package/.claude/commands/workflow/debug.md +0 -331
  206. package/.claude/commands/workflow/develop-with-file.md +0 -1044
  207. package/.claude/skills/ccw-loop/README.md +0 -303
  208. package/.claude/skills/skill-generator/templates/script-bash.md +0 -277
  209. package/.claude/skills/skill-generator/templates/script-python.md +0 -198
  210. package/.codex/prompts/debug.md +0 -318
  211. package/ccw/src/core/routes/mcp-routes.ts.backup +0 -549
@@ -6,298 +6,162 @@ allowed-tools: Task, AskUserQuestion, Read, Write, Bash, Glob, Grep, mcp__ace-to
6
6
 
7
7
  # Skill Tuning
8
8
 
9
- Universal skill diagnosis and optimization tool that identifies and resolves skill execution problems through iterative multi-agent analysis.
9
+ Autonomous diagnosis and optimization for skill execution issues.
10
10
 
11
- ## Architecture Overview
11
+ ## Architecture
12
12
 
13
13
  ```
14
- ┌─────────────────────────────────────────────────────────────────────────────┐
15
- Skill Tuning Architecture (Autonomous Mode + Gemini CLI) │
16
- ├─────────────────────────────────────────────────────────────────────────────┤
17
- │ │
18
- │ ⚠️ Phase 0: Specification → 阅读规范 + 理解目标 skill 结构 (强制前置) │
19
- │ Study │
20
-
21
- ┌───────────────────────────────────────────────────────────────────────┐
22
- │ │ Orchestrator (状态驱动决策) │ │
23
- │ │ 读取诊断状态 → 选择下一步动作 → 执行 → 更新状态 → 循环直到完成 │ │
24
- │ └───────────────────────────────────────────────────────────────────────┘ │
25
-
26
- ┌────────────┬───────────┼───────────┬────────────┬────────────┐
27
- ↓ ↓ ↓ ↓ ↓ ↓
28
- ┌──────┐ ┌──────────┐ ┌─────────┐ ┌────────┐ ┌────────┐ ┌─────────┐
29
- Init │→ Analyze │→ Diagnose │ │Diagnose│ │Diagnose│ │ Gemini
30
- │ │ │Requiremts│ │ Context Memory │DataFlow│ │Analysis │ │
31
- └──────┘ └──────────┘ └─────────┘ └────────┘ └────────┘ └─────────┘
32
- │ │ │ │ │ │ │
33
- │ │ └───────────┴───────────┴────────────┘ │
34
- │ ↓ │
35
- ┌───────────────────────────────────────────────────────────────────────┐
36
- │ Requirement Analysis (NEW) │
37
- │ │ • Phase 1: 维度拆解 (Gemini CLI) - 单一描述 → 多个关注维度 │ │
38
- │ │ • Phase 2: Spec 匹配 - 每个维度 → taxonomy + strategy │ │
39
- │ │ • Phase 3: 覆盖度评估 - 以"有修复策略"为满足标准 │ │
40
- │ │ • Phase 4: 歧义检测 - 识别多义性描述,必要时请求澄清 │ │
41
- │ └───────────────────────────────────────────────────────────────────────┘ │
42
- │ ↓ │
43
- │ ┌──────────────────┐ │
44
- │ │ Apply Fixes + │ │
45
- │ │ Verify Results │ │
46
- │ └──────────────────┘ │
47
- │ │
48
- │ ┌───────────────────────────────────────────────────────────────────────┐ │
49
- │ │ Gemini CLI Integration │ │
50
- │ │ 根据用户需求动态调用 gemini cli 进行深度分析: │ │
51
- │ │ • 需求维度拆解 (requirement decomposition) │ │
52
- │ │ • 复杂问题分析 (prompt engineering, architecture review) │ │
53
- │ │ • 代码模式识别 (pattern matching, anti-pattern detection) │ │
54
- │ │ • 修复策略生成 (fix generation, refactoring suggestions) │ │
55
- │ └───────────────────────────────────────────────────────────────────────┘ │
56
- │ │
57
- └─────────────────────────────────────────────────────────────────────────────┘
14
+ ┌─────────────────────────────────────────────────────┐
15
+ Phase 0: Read Specs (mandatory) │
16
+ │ → problem-taxonomy.md, tuning-strategies.md │
17
+ └─────────────────────────────────────────────────────┘
18
+
19
+ ┌─────────────────────────────────────────────────────┐
20
+ Orchestrator (state-driven)
21
+ Read state → Select action → Execute → Update → ✓
22
+ └─────────────────────────────────────────────────────┘
23
+ ↓ ↓
24
+ ┌──────────────────────┐ ┌──────────────────┐
25
+ Diagnosis Phase Gemini CLI │
26
+ • Context │ Deep analysis │
27
+ • Memory │ (on-demand) │
28
+ • DataFlow │ │
29
+ Agent Complex issues
30
+ Docs Architecture
31
+ • Token Usage │ Performance │
32
+ └──────────────────────┘ └──────────────────┘
33
+
34
+ ┌───────────────────┐
35
+ Fix & Verify
36
+ Apply Re-test
37
+ └───────────────────┘
58
38
  ```
59
39
 
60
- ## Problem Domain
40
+ ## Core Issues Detected
61
41
 
62
- Based on comprehensive analysis, skill-tuning addresses **core skill issues** and **general optimization areas**:
63
-
64
- ### Core Skill Issues (自动检测)
65
-
66
- | Priority | Problem | Root Cause | Solution Strategy |
67
- |----------|---------|------------|-------------------|
68
- | **P0** | Authoring Principles Violation | 中间文件存储, State膨胀, 文件中转 | eliminate_intermediate_files, minimize_state, context_passing |
42
+ | Priority | Problem | Root Cause | Fix Strategy |
43
+ |----------|---------|-----------|--------------|
44
+ | **P0** | Authoring Violation | Intermediate files, state bloat, file relay | eliminate_intermediate, minimize_state |
69
45
  | **P1** | Data Flow Disruption | Scattered state, inconsistent formats | state_centralization, schema_enforcement |
70
- | **P2** | Agent Coordination | Fragile call chains, merge complexity | error_wrapping, result_validation |
71
- | **P3** | Context Explosion | Token accumulation, multi-turn bloat | sliding_window, context_summarization |
46
+ | **P2** | Agent Coordination | Fragile chains, no error handling | error_wrapping, result_validation |
47
+ | **P3** | Context Explosion | Unbounded history, full content passing | sliding_window, path_reference |
72
48
  | **P4** | Long-tail Forgetting | Early constraint loss | constraint_injection, checkpoint_restore |
73
- | **P5** | Token Consumption | Verbose prompts, excessive state, redundant I/O | prompt_compression, lazy_loading, output_minimization |
74
-
75
- ### General Optimization Areas (按需分析 via Gemini CLI)
76
-
77
- | Category | Issues | Gemini Analysis Scope |
78
- |----------|--------|----------------------|
79
- | **Prompt Engineering** | 模糊指令, 输出格式不一致, 幻觉风险 | 提示词优化, 结构化输出设计 |
80
- | **Architecture** | 阶段划分不合理, 依赖混乱, 扩展性差 | 架构审查, 模块化建议 |
81
- | **Performance** | 执行慢, Token消耗高, 重复计算 | 性能分析, 缓存策略 |
82
- | **Error Handling** | 错误恢复不当, 无降级策略, 日志不足 | 容错设计, 可观测性增强 |
83
- | **Output Quality** | 输出不稳定, 格式漂移, 质量波动 | 质量门控, 验证机制 |
84
- | **User Experience** | 交互不流畅, 反馈不清晰, 进度不可见 | UX优化, 进度追踪 |
85
-
86
- ## Key Design Principles
87
-
88
- 1. **Problem-First Diagnosis**: Systematic identification before any fix attempt
89
- 2. **Data-Driven Analysis**: Record execution traces, token counts, state snapshots
90
- 3. **Iterative Refinement**: Multiple tuning rounds until quality gates pass
91
- 4. **Non-Destructive**: All changes are reversible with backup checkpoints
92
- 5. **Agent Coordination**: Use specialized sub-agents for each diagnosis type
93
- 6. **Gemini CLI On-Demand**: Deep analysis via CLI for complex/custom issues
94
-
95
- ---
96
-
97
- ## Gemini CLI Integration
98
-
99
- 根据用户需求动态调用 Gemini CLI 进行深度分析。
100
-
101
- ### Trigger Conditions
102
-
103
- | Condition | Action | CLI Mode |
104
- |-----------|--------|----------|
105
- | 用户描述复杂问题 | 调用 Gemini 分析问题根因 | `analysis` |
106
- | 自动诊断发现 critical 问题 | 请求深度分析确认 | `analysis` |
107
- | 用户请求架构审查 | 执行架构分析 | `analysis` |
108
- | 需要生成修复代码 | 生成修复提案 | `write` |
109
- | 标准策略不适用 | 请求定制化策略 | `analysis` |
110
-
111
- ### CLI Command Template
112
-
113
- ```bash
114
- ccw cli -p "
115
- PURPOSE: ${purpose}
116
- TASK: ${task_steps}
117
- MODE: ${mode}
118
- CONTEXT: @${skill_path}/**/*
119
- EXPECTED: ${expected_output}
120
- RULES: $(cat ~/.claude/workflows/cli-templates/protocols/${mode}-protocol.md) | ${constraints}
121
- " --tool gemini --mode ${mode} --cd ${skill_path}
49
+ | **P5** | Token Consumption | Verbose prompts, state bloat | prompt_compression, lazy_loading |
50
+
51
+ ## Problem Categories (Detailed Specs)
52
+
53
+ See [specs/problem-taxonomy.md](specs/problem-taxonomy.md) for:
54
+ - Detection patterns (regex/checks)
55
+ - Severity calculations
56
+ - Impact assessments
57
+
58
+ ## Tuning Strategies (Detailed Specs)
59
+
60
+ See [specs/tuning-strategies.md](specs/tuning-strategies.md) for:
61
+ - 10+ strategies per category
62
+ - Implementation patterns
63
+ - Verification methods
64
+
65
+ ## Workflow
66
+
67
+ | Step | Action | Orchestrator Decision | Output |
68
+ |------|--------|----------------------|--------|
69
+ | 1 | `action-init` | status='pending' | Backup, session created |
70
+ | 2 | `action-analyze-requirements` | After init | Required dimensions + coverage |
71
+ | 3 | Diagnosis (6 types) | Focus areas | state.diagnosis.{type} |
72
+ | 4 | `action-gemini-analysis` | Critical issues OR user request | Deep findings |
73
+ | 5 | `action-generate-report` | All diagnosis complete | state.final_report |
74
+ | 6 | `action-propose-fixes` | Issues found | state.proposed_fixes[] |
75
+ | 7 | `action-apply-fix` | Pending fixes | Applied + verified |
76
+ | 8 | `action-complete` | Quality gates pass | session.status='completed' |
77
+
78
+ ## Action Reference
79
+
80
+ | Category | Actions | Purpose |
81
+ |----------|---------|---------|
82
+ | **Setup** | action-init | Initialize backup, session state |
83
+ | **Analysis** | action-analyze-requirements | Decompose user request via Gemini CLI |
84
+ | **Diagnosis** | action-diagnose-{context,memory,dataflow,agent,docs,token_consumption} | Detect category-specific issues |
85
+ | **Deep Analysis** | action-gemini-analysis | Gemini CLI: complex/critical issues |
86
+ | **Reporting** | action-generate-report | Consolidate findings → final_report |
87
+ | **Fixing** | action-propose-fixes, action-apply-fix | Generate + apply fixes |
88
+ | **Verify** | action-verify | Re-run diagnosis, check gates |
89
+ | **Exit** | action-complete, action-abort | Finalize or rollback |
90
+
91
+ Full action details: [phases/actions/](phases/actions/)
92
+
93
+ ## State Management
94
+
95
+ **Single source of truth**: `.workflow/.scratchpad/skill-tuning-{ts}/state.json`
96
+
97
+ ```json
98
+ {
99
+ "status": "pending|running|completed|failed",
100
+ "target_skill": { "name": "...", "path": "..." },
101
+ "diagnosis": {
102
+ "context": {...},
103
+ "memory": {...},
104
+ "dataflow": {...},
105
+ "agent": {...},
106
+ "docs": {...},
107
+ "token_consumption": {...}
108
+ },
109
+ "issues": [{"id":"...", "severity":"...", "category":"...", "strategy":"..."}],
110
+ "proposed_fixes": [...],
111
+ "applied_fixes": [...],
112
+ "quality_gate": "pass|fail",
113
+ "final_report": "..."
114
+ }
122
115
  ```
123
116
 
124
- ### Analysis Types
117
+ See [phases/state-schema.md](phases/state-schema.md) for complete schema.
125
118
 
126
- #### 1. Problem Root Cause Analysis
119
+ ## Orchestrator Logic
127
120
 
128
- ```bash
129
- ccw cli -p "
130
- PURPOSE: Identify root cause of skill execution issue: ${user_issue_description}
131
- TASK: • Analyze skill structure and phase flow • Identify anti-patterns Trace data flow issues
132
- MODE: analysis
133
- CONTEXT: @**/*.md
134
- EXPECTED: JSON with { root_causes: [], patterns_found: [], recommendations: [] }
135
- RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) | Focus on execution flow
136
- " --tool gemini --mode analysis
137
- ```
121
+ See [phases/orchestrator.md](phases/orchestrator.md) for:
122
+ - Decision logic (termination checks → action selection)
123
+ - State transitions
124
+ - Error recovery
138
125
 
139
- #### 2. Architecture Review
126
+ ## Key Principles
140
127
 
141
- ```bash
142
- ccw cli -p "
143
- PURPOSE: Review skill architecture for scalability and maintainability
144
- TASK: Evaluate phase decomposition Check state management patterns • Assess agent coordination
145
- MODE: analysis
146
- CONTEXT: @**/*.md
147
- EXPECTED: Architecture assessment with improvement recommendations
148
- RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) | Focus on modularity
149
- " --tool gemini --mode analysis
150
- ```
128
+ 1. **Problem-First**: Diagnosis before any fix
129
+ 2. **Data-Driven**: Record traces, token counts, snapshots
130
+ 3. **Iterative**: Multiple rounds until quality gates pass
131
+ 4. **Reversible**: All changes with backup checkpoints
132
+ 5. **Non-Invasive**: Minimal changes, maximum clarity
151
133
 
152
- #### 3. Fix Strategy Generation
134
+ ## Usage Examples
153
135
 
154
136
  ```bash
155
- ccw cli -p "
156
- PURPOSE: Generate fix strategy for issue: ${issue_id} - ${issue_description}
157
- TASK: • Analyze issue context • Design fix approach • Generate implementation plan
158
- MODE: analysis
159
- CONTEXT: @**/*.md
160
- EXPECTED: JSON with { strategy: string, changes: [], verification_steps: [] }
161
- RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) | Minimal invasive changes
162
- " --tool gemini --mode analysis
163
- ```
164
-
165
- ---
166
-
167
- ## Mandatory Prerequisites
168
-
169
- > **CRITICAL**: Read these documents before executing any action.
137
+ # Basic skill diagnosis
138
+ /skill-tuning "Fix memory leaks in my skill"
170
139
 
171
- ### Core Specs (Required)
140
+ # Deep analysis with Gemini
141
+ /skill-tuning "Architecture issues in async workflow"
172
142
 
173
- | Document | Purpose | Priority |
174
- |----------|---------|----------|
175
- | [specs/skill-authoring-principles.md](specs/skill-authoring-principles.md) | **首要准则:简洁高效、去除存储、上下文流转** | **P0** |
176
- | [specs/problem-taxonomy.md](specs/problem-taxonomy.md) | Problem classification and detection patterns | **P0** |
177
- | [specs/tuning-strategies.md](specs/tuning-strategies.md) | Fix strategies for each problem type | **P0** |
178
- | [specs/dimension-mapping.md](specs/dimension-mapping.md) | Dimension to Spec mapping rules | **P0** |
179
- | [specs/quality-gates.md](specs/quality-gates.md) | Quality thresholds and verification criteria | P1 |
143
+ # Focus on specific areas
144
+ /skill-tuning "Optimize token consumption and fix agent coordination"
180
145
 
181
- ### Templates (Reference)
182
-
183
- | Document | Purpose |
184
- |----------|---------|
185
- | [templates/diagnosis-report.md](templates/diagnosis-report.md) | Diagnosis report structure |
186
- | [templates/fix-proposal.md](templates/fix-proposal.md) | Fix proposal format |
187
-
188
- ---
189
-
190
- ## Execution Flow
191
-
192
- ```
193
- ┌─────────────────────────────────────────────────────────────────────────────┐
194
- │ Phase 0: Specification Study (强制前置 - 禁止跳过) │
195
- │ → Read: specs/problem-taxonomy.md (问题分类) │
196
- │ → Read: specs/tuning-strategies.md (调优策略) │
197
- │ → Read: specs/dimension-mapping.md (维度映射规则) │
198
- │ → Read: Target skill's SKILL.md and phases/*.md │
199
- │ → Output: 内化规范,理解目标 skill 结构 │
200
- ├─────────────────────────────────────────────────────────────────────────────┤
201
- │ action-init: Initialize Tuning Session │
202
- │ → Create work directory: .workflow/.scratchpad/skill-tuning-{timestamp} │
203
- │ → Initialize state.json with target skill info │
204
- │ → Create backup of target skill files │
205
- ├─────────────────────────────────────────────────────────────────────────────┤
206
- │ action-analyze-requirements: Requirement Analysis │
207
- │ → Phase 1: 维度拆解 (Gemini CLI) - 单一描述 → 多个关注维度 │
208
- │ → Phase 2: Spec 匹配 - 每个维度 → taxonomy + strategy │
209
- │ → Phase 3: 覆盖度评估 - 以"有修复策略"为满足标准 │
210
- │ → Phase 4: 歧义检测 - 识别多义性描述,必要时请求澄清 │
211
- │ → Output: state.json (requirement_analysis field) │
212
- ├─────────────────────────────────────────────────────────────────────────────┤
213
- │ action-diagnose-*: Diagnosis Actions (context/memory/dataflow/agent/docs/ │
214
- │ token_consumption) │
215
- │ → Execute pattern-based detection for each category │
216
- │ → Output: state.json (diagnosis.{category} field) │
217
- ├─────────────────────────────────────────────────────────────────────────────┤
218
- │ action-generate-report: Consolidated Report │
219
- │ → Generate markdown summary from state.diagnosis │
220
- │ → Prioritize issues by severity │
221
- │ → Output: state.json (final_report field) │
222
- ├─────────────────────────────────────────────────────────────────────────────┤
223
- │ action-propose-fixes: Fix Proposal Generation │
224
- │ → Generate fix strategies for each issue │
225
- │ → Create implementation plan │
226
- │ → Output: state.json (proposed_fixes field) │
227
- ├─────────────────────────────────────────────────────────────────────────────┤
228
- │ action-apply-fix: Apply Selected Fix │
229
- │ → User selects fix to apply │
230
- │ → Execute fix with backup │
231
- │ → Update state with fix result │
232
- ├─────────────────────────────────────────────────────────────────────────────┤
233
- │ action-verify: Verification │
234
- │ → Re-run affected diagnosis │
235
- │ → Check quality gates │
236
- │ → Update iteration count │
237
- ├─────────────────────────────────────────────────────────────────────────────┤
238
- │ action-complete: Finalization │
239
- │ → Set status='completed' │
240
- │ → Final report already in state.json (final_report field) │
241
- │ → Output: state.json (final) │
242
- └─────────────────────────────────────────────────────────────────────────────┘
146
+ # Custom issue
147
+ /skill-tuning "My skill produces inconsistent outputs"
243
148
  ```
244
149
 
245
- ## Directory Setup
246
-
247
- ```javascript
248
- const timestamp = new Date().toISOString().slice(0,19).replace(/[-:T]/g, '');
249
- const workDir = `.workflow/.scratchpad/skill-tuning-${timestamp}`;
250
-
251
- // Simplified: Only backups dir needed, diagnosis results go into state.json
252
- Bash(`mkdir -p "${workDir}/backups"`);
253
- ```
254
-
255
- ## Output Structure
256
-
257
- ```
258
- .workflow/.scratchpad/skill-tuning-{timestamp}/
259
- ├── state.json # Single source of truth (all results consolidated)
260
- │ ├── diagnosis.* # All diagnosis results embedded
261
- │ ├── issues[] # Found issues
262
- │ ├── proposed_fixes[] # Fix proposals
263
- │ └── final_report # Markdown summary (on completion)
264
- └── backups/
265
- └── {skill-name}-backup/ # Original skill files backup
266
- ```
267
-
268
- > **Token Optimization**: All outputs consolidated into state.json. No separate diagnosis files or report files.
269
-
270
- ## State Schema
271
-
272
- 详细状态结构定义请参阅 [phases/state-schema.md](phases/state-schema.md)。
150
+ ## Output
273
151
 
274
- 核心状态字段:
275
- - `status`: 工作流状态 (pending/running/completed/failed)
276
- - `target_skill`: 目标 skill 信息
277
- - `diagnosis`: 各维度诊断结果
278
- - `issues`: 发现的问题列表
279
- - `proposed_fixes`: 建议的修复方案
152
+ After completion, review:
153
+ - `.workflow/.scratchpad/skill-tuning-{ts}/state.json` - Full state with final_report
154
+ - `state.final_report` - Markdown summary (in state.json)
155
+ - `state.applied_fixes` - List of applied fixes with verification results
280
156
 
281
157
  ## Reference Documents
282
158
 
283
159
  | Document | Purpose |
284
160
  |----------|---------|
285
- | [phases/orchestrator.md](phases/orchestrator.md) | Orchestrator decision logic |
161
+ | [specs/problem-taxonomy.md](specs/problem-taxonomy.md) | Classification + detection patterns |
162
+ | [specs/tuning-strategies.md](specs/tuning-strategies.md) | Fix implementation guide |
163
+ | [specs/dimension-mapping.md](specs/dimension-mapping.md) | Dimension ↔ Spec mapping |
164
+ | [specs/quality-gates.md](specs/quality-gates.md) | Quality verification criteria |
165
+ | [phases/orchestrator.md](phases/orchestrator.md) | Workflow orchestration |
286
166
  | [phases/state-schema.md](phases/state-schema.md) | State structure definition |
287
- | [phases/actions/action-init.md](phases/actions/action-init.md) | Initialize tuning session |
288
- | [phases/actions/action-analyze-requirements.md](phases/actions/action-analyze-requirements.md) | Requirement analysis (NEW) |
289
- | [phases/actions/action-diagnose-context.md](phases/actions/action-diagnose-context.md) | Context explosion diagnosis |
290
- | [phases/actions/action-diagnose-memory.md](phases/actions/action-diagnose-memory.md) | Long-tail forgetting diagnosis |
291
- | [phases/actions/action-diagnose-dataflow.md](phases/actions/action-diagnose-dataflow.md) | Data flow diagnosis |
292
- | [phases/actions/action-diagnose-agent.md](phases/actions/action-diagnose-agent.md) | Agent coordination diagnosis |
293
- | [phases/actions/action-diagnose-docs.md](phases/actions/action-diagnose-docs.md) | Documentation structure diagnosis |
294
- | [phases/actions/action-diagnose-token-consumption.md](phases/actions/action-diagnose-token-consumption.md) | Token consumption diagnosis |
295
- | [phases/actions/action-generate-report.md](phases/actions/action-generate-report.md) | Report generation |
296
- | [phases/actions/action-propose-fixes.md](phases/actions/action-propose-fixes.md) | Fix proposal |
297
- | [phases/actions/action-apply-fix.md](phases/actions/action-apply-fix.md) | Fix application |
298
- | [phases/actions/action-verify.md](phases/actions/action-verify.md) | Verification |
299
- | [phases/actions/action-complete.md](phases/actions/action-complete.md) | Finalization |
300
- | [specs/problem-taxonomy.md](specs/problem-taxonomy.md) | Problem classification |
301
- | [specs/tuning-strategies.md](specs/tuning-strategies.md) | Fix strategies |
302
- | [specs/dimension-mapping.md](specs/dimension-mapping.md) | Dimension to Spec mapping (NEW) |
303
- | [specs/quality-gates.md](specs/quality-gates.md) | Quality criteria |
167
+ | [phases/actions/](phases/actions/) | Individual action implementations |