claude-code-workflow 6.3.50 → 6.3.51

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 (66) hide show
  1. package/.claude/commands/view.md +367 -0
  2. package/.claude/commands/workflow/unified-execute-with-file.md +807 -0
  3. package/.claude/skills/ccw-help/SKILL.md +72 -12
  4. package/.claude/skills/ccw-help/command.json +922 -520
  5. package/.claude/skills/ccw-help/index/all-agents.json +97 -0
  6. package/.claude/skills/ccw-help/index/all-commands.json +805 -0
  7. package/.claude/skills/ccw-help/index/by-category.json +833 -0
  8. package/.claude/skills/ccw-help/index/by-use-case.json +819 -0
  9. package/.claude/skills/ccw-help/index/command-relationships.json +160 -0
  10. package/.claude/skills/ccw-help/index/essential-commands.json +90 -0
  11. package/.claude/skills/ccw-help/scripts/auto-update.py +34 -0
  12. package/.claude/skills/skill-generator/SKILL.md +255 -208
  13. package/.claude/skills/skill-generator/phases/01-requirements-discovery.md +238 -228
  14. package/.claude/skills/skill-generator/phases/02-structure-generation.md +261 -262
  15. package/.claude/skills/skill-generator/phases/03-phase-generation.md +976 -969
  16. package/.claude/skills/skill-generator/phases/04-specs-templates.md +398 -398
  17. package/.claude/skills/skill-generator/phases/05-validation.md +417 -417
  18. package/.claude/skills/skill-generator/specs/cli-integration.md +131 -131
  19. package/.claude/skills/skill-generator/specs/execution-modes.md +399 -396
  20. package/.claude/skills/skill-generator/specs/reference-docs-spec.md +271 -0
  21. package/.claude/skills/skill-generator/specs/scripting-integration.md +265 -265
  22. package/.claude/skills/skill-generator/specs/skill-requirements.md +466 -466
  23. package/.claude/skills/skill-generator/templates/autonomous-action.md +91 -88
  24. package/.claude/skills/skill-generator/templates/autonomous-orchestrator.md +89 -89
  25. package/.claude/skills/skill-generator/templates/code-analysis-action.md +148 -149
  26. package/.claude/skills/skill-generator/templates/llm-action.md +367 -367
  27. package/.claude/skills/skill-generator/templates/script-template.md +79 -79
  28. package/.claude/skills/skill-generator/templates/sequential-phase.md +129 -129
  29. package/.claude/skills/skill-generator/templates/skill-md.md +134 -75
  30. package/.codex/prompts/UNIFIED_EXECUTE_COMPARISON.md +205 -0
  31. package/.codex/prompts/unified-execute-with-file.md +722 -0
  32. package/.codex/skills/codex-issue-plan-execute/SKILL.md +239 -0
  33. package/.codex/skills/codex-issue-plan-execute/phases/actions/action-complete.md +173 -0
  34. package/.codex/skills/codex-issue-plan-execute/phases/actions/action-execute.md +220 -0
  35. package/.codex/skills/codex-issue-plan-execute/phases/actions/action-init.md +86 -0
  36. package/.codex/skills/codex-issue-plan-execute/phases/actions/action-list.md +165 -0
  37. package/.codex/skills/codex-issue-plan-execute/phases/actions/action-plan.md +170 -0
  38. package/.codex/skills/codex-issue-plan-execute/phases/orchestrator.md +210 -0
  39. package/.codex/skills/codex-issue-plan-execute/phases/state-schema.md +136 -0
  40. package/.codex/skills/codex-issue-plan-execute/prompts/execution-agent-system.md +136 -0
  41. package/.codex/skills/codex-issue-plan-execute/prompts/execution-agent.md +135 -0
  42. package/.codex/skills/codex-issue-plan-execute/prompts/planning-agent-system.md +107 -0
  43. package/.codex/skills/codex-issue-plan-execute/prompts/planning-agent.md +122 -0
  44. package/.codex/skills/codex-issue-plan-execute/specs/issue-handling.md +187 -0
  45. package/.codex/skills/codex-issue-plan-execute/specs/quality-standards.md +231 -0
  46. package/.codex/skills/codex-issue-plan-execute/specs/solution-schema.md +270 -0
  47. package/.codex/skills/codex-issue-plan-execute/specs/subagent-roles.md +268 -0
  48. package/ccw/dist/commands/cli.d.ts.map +1 -1
  49. package/ccw/dist/commands/cli.js +23 -2
  50. package/ccw/dist/commands/cli.js.map +1 -1
  51. package/ccw/dist/core/routes/help-routes.d.ts.map +1 -1
  52. package/ccw/dist/core/routes/help-routes.js +51 -1
  53. package/ccw/dist/core/routes/help-routes.js.map +1 -1
  54. package/ccw/dist/tools/cli-executor-core.d.ts.map +1 -1
  55. package/ccw/dist/tools/cli-executor-core.js +5 -3
  56. package/ccw/dist/tools/cli-executor-core.js.map +1 -1
  57. package/ccw/dist/tools/cli-executor-utils.d.ts +1 -0
  58. package/ccw/dist/tools/cli-executor-utils.d.ts.map +1 -1
  59. package/ccw/dist/tools/cli-executor-utils.js +3 -1
  60. package/ccw/dist/tools/cli-executor-utils.js.map +1 -1
  61. package/ccw/src/commands/cli.ts +26 -2
  62. package/ccw/src/core/routes/help-routes.ts +60 -1
  63. package/ccw/src/templates/dashboard-js/views/help.js +423 -1
  64. package/ccw/src/tools/cli-executor-core.ts +6 -3
  65. package/ccw/src/tools/cli-executor-utils.ts +5 -2
  66. package/package.json +1 -1
@@ -1,398 +1,398 @@
1
- # Phase 4: Specifications & Templates Generation
2
-
3
- Generate domain requirements, quality standards, agent templates, and action catalogs.
4
-
5
- ## Objective
6
-
7
- Generate comprehensive specifications and templates:
8
- - Domain requirements document with validation function
9
- - Quality standards with automated check system
10
- - Agent base template with prompt structure
11
- - Action catalog for autonomous mode (conditional)
12
-
13
- ## Input
14
-
15
- **File Dependencies**:
16
- - `skill-config.json` (from Phase 1)
17
- - `.claude/skills/{skill-name}/` directory (from Phase 2)
18
- - Generated phase/action files (from Phase 3)
19
-
20
- **Required Information**:
21
- - Skill name, display name, description
22
- - Execution mode (determines if action-catalog.md is generated)
23
- - Output format and location
24
- - Phase/action definitions
25
-
26
- ## Output
27
-
28
- **Generated Files**:
29
-
30
- | File | Purpose | Generation Condition |
31
- |------|---------|---------------------|
32
- | `specs/{skill-name}-requirements.md` | Domain requirements with validation | Always |
33
- | `specs/quality-standards.md` | Quality evaluation criteria | Always |
34
- | `templates/agent-base.md` | Agent prompt template | Always |
35
- | `specs/action-catalog.md` | Action dependency graph and selection priority | Autonomous/Hybrid mode only |
36
-
37
- **File Structure**:
38
-
39
- **Domain Requirements** (`specs/{skill-name}-requirements.md`):
40
- ```markdown
41
- # {display_name} Requirements
42
- - When to Use (phase/action reference table)
43
- - Domain Requirements (功能要求, 输出要求, 质量要求)
44
- - Validation Function (JavaScript code)
45
- - Error Handling (recovery strategies)
46
- ```
47
-
48
- **Quality Standards** (`specs/quality-standards.md`):
49
- ```markdown
50
- # Quality Standards
51
- - Quality Dimensions (Completeness 25%, Consistency 25%, Accuracy 25%, Usability 25%)
52
- - Quality Gates (Pass ≥80%, Review 60-79%, Fail <60%)
53
- - Issue Classification (Errors, Warnings, Info)
54
- - Automated Checks (runQualityChecks function)
55
- ```
56
-
57
- **Agent Base** (`templates/agent-base.md`):
58
- ```markdown
59
- # Agent Base Template
60
- - 通用 Prompt 结构 (ROLE, PROJECT CONTEXT, TASK, CONSTRAINTS, OUTPUT_FORMAT, QUALITY_CHECKLIST)
61
- - 变量说明 (workDir, output_path)
62
- - 返回格式 (AgentReturn interface)
63
- - 角色定义参考 (phase/action specific agents)
64
- ```
65
-
66
- **Action Catalog** (`specs/action-catalog.md`, Autonomous/Hybrid only):
67
- ```markdown
68
- # Action Catalog
69
- - Available Actions (table with Purpose, Preconditions, Effects)
70
- - Action Dependencies (Mermaid diagram)
71
- - State Transitions (state machine table)
72
- - Selection Priority (ordered action list)
73
- ```
74
-
75
- ## Decision Logic
76
-
77
- ```
78
- Decision (execution_mode check):
79
- ├─ mode === 'sequential' → Generate 3 files only
80
- │ └─ Files: requirements.md, quality-standards.md, agent-base.md
81
-
82
- ├─ mode === 'autonomous' → Generate 4 files
83
- │ ├─ Files: requirements.md, quality-standards.md, agent-base.md
84
- │ └─ Additional: action-catalog.md (with action dependencies)
85
-
86
- └─ mode === 'hybrid' → Generate 4 files
87
- ├─ Files: requirements.md, quality-standards.md, agent-base.md
88
- └─ Additional: action-catalog.md (with hybrid logic)
89
- ```
90
-
91
- ## Execution Protocol
92
-
93
- ```javascript
94
- // Phase 4: Generate Specifications & Templates
95
- // Reference: phases/04-specs-templates.md
96
-
97
- // Load config and setup
98
- const config = JSON.parse(Read(`${workDir}/skill-config.json`));
99
- const skillDir = `.claude/skills/${config.skill_name}`;
100
-
101
- // Ensure specs and templates directories exist (created in Phase 2)
102
- // skillDir structure: phases/, specs/, templates/
103
-
104
- // Step 1: Generate domain requirements
105
- const domainRequirements = `# ${config.display_name} Requirements
106
-
107
- ${config.description}
108
-
109
- ## When to Use
110
-
111
- | Phase | Usage | Reference |
112
- |-------|-------|-----------|
113
- ${config.execution_mode === 'sequential' ?
114
- config.sequential_config.phases.map((p, i) =>
115
- `| Phase ${i+1} | ${p.name} | ${p.id}.md |`
116
- ).join('\n') :
117
- `| Orchestrator | 动作选择 | orchestrator.md |
118
- | Actions | 动作执行 | actions/*.md |`}
119
-
120
- ---
121
-
122
- ## Domain Requirements
123
-
124
- ### 功能要求
125
-
126
- - [ ] 要求1: TODO
127
- - [ ] 要求2: TODO
128
- - [ ] 要求3: TODO
129
-
130
- ### 输出要求
131
-
132
- - [ ] 格式: ${config.output.format}
133
- - [ ] 位置: ${config.output.location}
134
- - [ ] 命名: ${config.output.filename_pattern}
135
-
136
- ### 质量要求
137
-
138
- - [ ] 完整性: 所有必需内容存在
139
- - [ ] 一致性: 术语和格式统一
140
- - [ ] 准确性: 内容基于实际分析
141
-
142
- ## Validation Function
143
-
144
- \`\`\`javascript
145
- function validate${toPascalCase(config.skill_name)}(output) {
146
- const checks = [
147
- // TODO: 添加验证规则
148
- { name: "格式正确", pass: output.format === "${config.output.format}" },
149
- { name: "内容完整", pass: output.content?.length > 0 }
150
- ];
151
-
152
- return {
153
- passed: checks.filter(c => c.pass).length,
154
- total: checks.length,
155
- details: checks
156
- };
157
- }
158
- \`\`\`
159
-
160
- ## Error Handling
161
-
162
- | Error | Recovery |
163
- |-------|----------|
164
- | 输入数据缺失 | 返回明确错误信息 |
165
- | 处理超时 | 缩小范围,重试 |
166
- | 输出验证失败 | 记录问题,人工审核 |
167
- `;
168
-
169
- Write(`${skillDir}/specs/${config.skill_name}-requirements.md`, domainRequirements);
170
-
171
- // Step 2: Generate quality standards
172
- const qualityStandards = `# Quality Standards
173
-
174
- ${config.display_name} 的质量评估标准。
175
-
176
- ## Quality Dimensions
177
-
178
- ### 1. Completeness (完整性) - 25%
179
-
180
- | 要求 | 权重 | 检查方式 |
181
- |------|------|----------|
182
- | 所有必需输出存在 | 10 | 文件检查 |
183
- | 内容覆盖完整 | 10 | 内容分析 |
184
- | 无占位符残留 | 5 | 文本搜索 |
185
-
186
- ### 2. Consistency (一致性) - 25%
187
-
188
- | 方面 | 检查 |
189
- |------|------|
190
- | 术语 | 同一概念使用相同术语 |
191
- | 格式 | 标题层级、代码块格式一致 |
192
- | 风格 | 语气和表达方式统一 |
193
-
194
- ### 3. Accuracy (准确性) - 25%
195
-
196
- | 要求 | 说明 |
197
- |------|------|
198
- | 数据正确 | 引用和数据无错误 |
199
- | 逻辑正确 | 流程和关系描述准确 |
200
- | 代码正确 | 代码示例可运行 |
201
-
202
- ### 4. Usability (可用性) - 25%
203
-
204
- | 指标 | 目标 |
205
- |------|------|
206
- | 可读性 | 结构清晰,易于理解 |
207
- | 可导航 | 目录和链接正确 |
208
- | 可操作 | 步骤明确,可执行 |
209
-
210
- ## Quality Gates
211
-
212
- | Gate | Threshold | Action |
213
- |------|-----------|--------|
214
- | Pass | 80% | 输出最终产物 |
215
- | Review | 60-79% | 处理警告后继续 |
216
- | Fail | < 60% | 必须修复 |
217
-
218
- ## Issue Classification
219
-
220
- ### Errors (Must Fix)
221
-
222
- - 必需输出缺失
223
- - 数据错误
224
- - 代码不可运行
225
-
226
- ### Warnings (Should Fix)
227
-
228
- - 格式不一致
229
- - 内容深度不足
230
- - 缺少示例
231
-
232
- ### Info (Nice to Have)
233
-
234
- - 优化建议
235
- - 增强机会
236
-
237
- ## Automated Checks
238
-
239
- \`\`\`javascript
240
- function runQualityChecks(workDir) {
241
- const results = {
242
- completeness: checkCompleteness(workDir),
243
- consistency: checkConsistency(workDir),
244
- accuracy: checkAccuracy(workDir),
245
- usability: checkUsability(workDir)
246
- };
247
-
248
- results.overall = (
249
- results.completeness * 0.25 +
250
- results.consistency * 0.25 +
251
- results.accuracy * 0.25 +
252
- results.usability * 0.25
253
- );
254
-
255
- return {
256
- score: results.overall,
257
- gate: results.overall >= 80 ? 'pass' :
258
- results.overall >= 60 ? 'review' : 'fail',
259
- details: results
260
- };
261
- }
262
- \`\`\`
263
- `;
264
-
265
- Write(`${skillDir}/specs/quality-standards.md`, qualityStandards);
266
-
267
- // Step 3: Generate agent base template
268
- const agentBase = `# Agent Base Template
269
-
270
- ${config.display_name} 的 Agent 基础模板。
271
-
272
- ## 通用 Prompt 结构
273
-
274
- \`\`\`
275
- [ROLE] 你是{角色},专注于{职责}
276
-
277
- [PROJECT CONTEXT]
278
- Skill: ${config.skill_name}
279
- 目标: ${config.description}
280
-
281
- [TASK]
282
- {任务描述}
283
- - 输出: {output_path}
284
- - 格式: ${config.output.format}
285
-
286
- [CONSTRAINTS]
287
- - 约束1
288
- - 约束2
289
-
290
- [OUTPUT_FORMAT]
291
- 1. 执行任务
292
- 2. 返回 JSON 简要信息
293
-
294
- [QUALITY_CHECKLIST]
295
- - [ ] 输出格式正确
296
- - [ ] 内容完整无遗漏
297
- - [ ] 无占位符残留
298
- \`\`\`
299
-
300
- ## 变量说明
301
-
302
- | 变量 | 来源 | 示例 |
303
- |------|------|------|
304
- | {workDir} | 运行时 | .workflow/.scratchpad/${config.skill_name}-xxx |
305
- | {output_path} | 配置 | ${config.output.location}/${config.output.filename_pattern} |
306
-
307
- ## 返回格式
308
-
309
- \`\`\`typescript
310
- interface AgentReturn {
311
- status: "completed" | "partial" | "failed";
312
- output_file: string;
313
- summary: string; // Max 50 chars
314
- stats?: {
315
- items_processed?: number;
316
- errors?: number;
317
- };
318
- }
319
- \`\`\`
320
-
321
- ## 角色定义参考
322
-
323
- ${config.execution_mode === 'sequential' ?
324
- config.sequential_config.phases.map((p, i) =>
325
- `- **Phase ${i+1} Agent**: ${p.name} 专家`
326
- ).join('\n') :
327
- config.autonomous_config.actions.map(a =>
328
- `- **${a.name} Agent**: ${a.description || a.name + ' 执行者'}`
329
- ).join('\n')}
330
- `;
331
-
332
- Write(`${skillDir}/templates/agent-base.md`, agentBase);
333
-
334
- // Step 4: Conditional - Generate action catalog for autonomous/hybrid mode
335
- if (config.execution_mode === 'autonomous' || config.execution_mode === 'hybrid') {
336
- const actionCatalog = `# Action Catalog
337
-
338
- ${config.display_name} 的可用动作目录。
339
-
340
- ## Available Actions
341
-
342
- | Action | Purpose | Preconditions | Effects |
343
- |--------|---------|---------------|---------|
344
- ${config.autonomous_config.actions.map(a =>
345
- `| [${a.id}](../phases/actions/${a.id}.md) | ${a.description || a.name} | ${a.preconditions?.join(', ') || '-'} | ${a.effects?.join(', ') || '-'} |`
346
- ).join('\n')}
347
-
348
- ## Action Dependencies
349
-
350
- \`\`\`mermaid
351
- graph TD
352
- ${config.autonomous_config.actions.map((a, i, arr) => {
353
- if (i === 0) return ` ${a.id.replace(/-/g, '_')}[${a.name}]`;
354
- const prev = arr[i-1];
355
- return ` ${prev.id.replace(/-/g, '_')} --> ${a.id.replace(/-/g, '_')}[${a.name}]`;
356
- }).join('\n')}
357
- \`\`\`
358
-
359
- ## State Transitions
360
-
361
- | From State | Action | To State |
362
- |------------|--------|----------|
363
- | pending | action-init | running |
364
- ${config.autonomous_config.actions.slice(1).map(a =>
365
- `| running | ${a.id} | running |`
366
- ).join('\n')}
367
- | running | action-complete | completed |
368
- | running | action-abort | failed |
369
-
370
- ## Selection Priority
371
-
372
- 当多个动作的前置条件都满足时,按以下优先级选择:
373
-
374
- ${config.autonomous_config.actions.map((a, i) =>
375
- `${i + 1}. \`${a.id}\` - ${a.name}`
376
- ).join('\n')}
377
- `;
378
-
379
- Write(`${skillDir}/specs/action-catalog.md`, actionCatalog);
380
- }
381
-
382
- // Helper function
383
- function toPascalCase(str) {
384
- return str.split('-').map(s => s.charAt(0).toUpperCase() + s.slice(1)).join('');
385
- }
386
-
387
- // Phase output summary
388
- console.log('Phase 4 complete: Generated specs and templates');
389
- ```
390
-
391
- ## Next Phase
392
-
393
- → [Phase 5: Validation](05-validation.md)
394
-
395
- **Data Flow to Phase 5**:
396
- - All generated files in `specs/` and `templates/`
397
- - skill-config.json for validation reference
398
- - Complete skill directory structure ready for final validation
1
+ # Phase 4: Specifications & Templates Generation
2
+
3
+ Generate domain requirements, quality standards, agent templates, and action catalogs.
4
+
5
+ ## Objective
6
+
7
+ Generate comprehensive specifications and templates:
8
+ - Domain requirements document with validation function
9
+ - Quality standards with automated check system
10
+ - Agent base template with prompt structure
11
+ - Action catalog for autonomous mode (conditional)
12
+
13
+ ## Input
14
+
15
+ **File Dependencies**:
16
+ - `skill-config.json` (from Phase 1)
17
+ - `.claude/skills/{skill-name}/` directory (from Phase 2)
18
+ - Generated phase/action files (from Phase 3)
19
+
20
+ **Required Information**:
21
+ - Skill name, display name, description
22
+ - Execution mode (determines if action-catalog.md is generated)
23
+ - Output format and location
24
+ - Phase/action definitions
25
+
26
+ ## Output
27
+
28
+ **Generated Files**:
29
+
30
+ | File | Purpose | Generation Condition |
31
+ |------|---------|---------------------|
32
+ | `specs/{skill-name}-requirements.md` | Domain requirements with validation | Always |
33
+ | `specs/quality-standards.md` | Quality evaluation criteria | Always |
34
+ | `templates/agent-base.md` | Agent prompt template | Always |
35
+ | `specs/action-catalog.md` | Action dependency graph and selection priority | Autonomous/Hybrid mode only |
36
+
37
+ **File Structure**:
38
+
39
+ **Domain Requirements** (`specs/{skill-name}-requirements.md`):
40
+ ```markdown
41
+ # {display_name} Requirements
42
+ - When to Use (phase/action reference table)
43
+ - Domain Requirements (Functional requirements, Output requirements, Quality requirements)
44
+ - Validation Function (JavaScript code)
45
+ - Error Handling (recovery strategies)
46
+ ```
47
+
48
+ **Quality Standards** (`specs/quality-standards.md`):
49
+ ```markdown
50
+ # Quality Standards
51
+ - Quality Dimensions (Completeness 25%, Consistency 25%, Accuracy 25%, Usability 25%)
52
+ - Quality Gates (Pass ≥80%, Review 60-79%, Fail <60%)
53
+ - Issue Classification (Errors, Warnings, Info)
54
+ - Automated Checks (runQualityChecks function)
55
+ ```
56
+
57
+ **Agent Base** (`templates/agent-base.md`):
58
+ ```markdown
59
+ # Agent Base Template
60
+ - Universal Prompt Structure (ROLE, PROJECT CONTEXT, TASK, CONSTRAINTS, OUTPUT_FORMAT, QUALITY_CHECKLIST)
61
+ - Variable Description (workDir, output_path)
62
+ - Return Format (AgentReturn interface)
63
+ - Role Definition Reference (phase/action specific agents)
64
+ ```
65
+
66
+ **Action Catalog** (`specs/action-catalog.md`, Autonomous/Hybrid only):
67
+ ```markdown
68
+ # Action Catalog
69
+ - Available Actions (table with Purpose, Preconditions, Effects)
70
+ - Action Dependencies (Mermaid diagram)
71
+ - State Transitions (state machine table)
72
+ - Selection Priority (ordered action list)
73
+ ```
74
+
75
+ ## Decision Logic
76
+
77
+ ```
78
+ Decision (execution_mode check):
79
+ ├─ mode === 'sequential' → Generate 3 files only
80
+ │ └─ Files: requirements.md, quality-standards.md, agent-base.md
81
+
82
+ ├─ mode === 'autonomous' → Generate 4 files
83
+ │ ├─ Files: requirements.md, quality-standards.md, agent-base.md
84
+ │ └─ Additional: action-catalog.md (with action dependencies)
85
+
86
+ └─ mode === 'hybrid' → Generate 4 files
87
+ ├─ Files: requirements.md, quality-standards.md, agent-base.md
88
+ └─ Additional: action-catalog.md (with hybrid logic)
89
+ ```
90
+
91
+ ## Execution Protocol
92
+
93
+ ```javascript
94
+ // Phase 4: Generate Specifications & Templates
95
+ // Reference: phases/04-specs-templates.md
96
+
97
+ // Load config and setup
98
+ const config = JSON.parse(Read(`${workDir}/skill-config.json`));
99
+ const skillDir = `.claude/skills/${config.skill_name}`;
100
+
101
+ // Ensure specs and templates directories exist (created in Phase 2)
102
+ // skillDir structure: phases/, specs/, templates/
103
+
104
+ // Step 1: Generate domain requirements
105
+ const domainRequirements = `# ${config.display_name} Requirements
106
+
107
+ ${config.description}
108
+
109
+ ## When to Use
110
+
111
+ | Phase | Usage | Reference |
112
+ |-------|-------|-----------|
113
+ ${config.execution_mode === 'sequential' ?
114
+ config.sequential_config.phases.map((p, i) =>
115
+ `| Phase ${i+1} | ${p.name} | ${p.id}.md |`
116
+ ).join('\n') :
117
+ `| Orchestrator | Action selection | orchestrator.md |
118
+ | Actions | Action execution | actions/*.md |`}
119
+
120
+ ---
121
+
122
+ ## Domain Requirements
123
+
124
+ ### Functional Requirements
125
+
126
+ - [ ] Requirement 1: TODO
127
+ - [ ] Requirement 2: TODO
128
+ - [ ] Requirement 3: TODO
129
+
130
+ ### Output Requirements
131
+
132
+ - [ ] Format: ${config.output.format}
133
+ - [ ] Location: ${config.output.location}
134
+ - [ ] Naming: ${config.output.filename_pattern}
135
+
136
+ ### Quality Requirements
137
+
138
+ - [ ] Completeness: All necessary content exists
139
+ - [ ] Consistency: Terminology and format unified
140
+ - [ ] Accuracy: Content based on actual analysis
141
+
142
+ ## Validation Function
143
+
144
+ \`\`\`javascript
145
+ function validate${toPascalCase(config.skill_name)}(output) {
146
+ const checks = [
147
+ // TODO: Add validation rules
148
+ { name: "Format correct", pass: output.format === "${config.output.format}" },
149
+ { name: "Content complete", pass: output.content?.length > 0 }
150
+ ];
151
+
152
+ return {
153
+ passed: checks.filter(c => c.pass).length,
154
+ total: checks.length,
155
+ details: checks
156
+ };
157
+ }
158
+ \`\`\`
159
+
160
+ ## Error Handling
161
+
162
+ | Error | Recovery |
163
+ |-------|----------|
164
+ | Missing input data | Return clear error message |
165
+ | Processing timeout | Reduce scope, retry |
166
+ | Output validation failure | Log issue, manual review |
167
+ `;
168
+
169
+ Write(`${skillDir}/specs/${config.skill_name}-requirements.md`, domainRequirements);
170
+
171
+ // Step 2: Generate quality standards
172
+ const qualityStandards = `# Quality Standards
173
+
174
+ Quality assessment standards for ${config.display_name}.
175
+
176
+ ## Quality Dimensions
177
+
178
+ ### 1. Completeness (Completeness) - 25%
179
+
180
+ | Requirement | Weight | Validation Method |
181
+ |------------|--------|-----------------|
182
+ | All necessary outputs exist | 10 | File check |
183
+ | Content coverage complete | 10 | Content analysis |
184
+ | No placeholder remnants | 5 | Text search |
185
+
186
+ ### 2. Consistency (Consistency) - 25%
187
+
188
+ | Aspect | Check |
189
+ |--------|-------|
190
+ | Terminology | Use same term for same concept |
191
+ | Format | Title levels, code block format consistent |
192
+ | Style | Tone and expression unified |
193
+
194
+ ### 3. Accuracy (Accuracy) - 25%
195
+
196
+ | Requirement | Description |
197
+ |-------------|------------|
198
+ | Data correct | References and data error-free |
199
+ | Logic correct | Process and relationship descriptions accurate |
200
+ | Code correct | Code examples runnable |
201
+
202
+ ### 4. Usability (Usability) - 25%
203
+
204
+ | Metric | Goal |
205
+ |--------|------|
206
+ | Readability | Clear structure, easy to understand |
207
+ | Navigability | Table of contents and links correct |
208
+ | Operability | Steps clear, executable |
209
+
210
+ ## Quality Gates
211
+
212
+ | Gate | Threshold | Action |
213
+ |------|-----------|--------|
214
+ | Pass | >= 80% | Output final deliverables |
215
+ | Review | 60-79% | Process warnings then continue |
216
+ | Fail | < 60% | Must fix |
217
+
218
+ ## Issue Classification
219
+
220
+ ### Errors (Must Fix)
221
+
222
+ - Necessary output missing
223
+ - Data error
224
+ - Code not runnable
225
+
226
+ ### Warnings (Should Fix)
227
+
228
+ - Format inconsistency
229
+ - Content depth insufficient
230
+ - Missing examples
231
+
232
+ ### Info (Nice to Have)
233
+
234
+ - Optimization suggestions
235
+ - Enhancement opportunities
236
+
237
+ ## Automated Checks
238
+
239
+ \`\`\`javascript
240
+ function runQualityChecks(workDir) {
241
+ const results = {
242
+ completeness: checkCompleteness(workDir),
243
+ consistency: checkConsistency(workDir),
244
+ accuracy: checkAccuracy(workDir),
245
+ usability: checkUsability(workDir)
246
+ };
247
+
248
+ results.overall = (
249
+ results.completeness * 0.25 +
250
+ results.consistency * 0.25 +
251
+ results.accuracy * 0.25 +
252
+ results.usability * 0.25
253
+ );
254
+
255
+ return {
256
+ score: results.overall,
257
+ gate: results.overall >= 80 ? 'pass' :
258
+ results.overall >= 60 ? 'review' : 'fail',
259
+ details: results
260
+ };
261
+ }
262
+ \`\`\`
263
+ `;
264
+
265
+ Write(`${skillDir}/specs/quality-standards.md`, qualityStandards);
266
+
267
+ // Step 3: Generate agent base template
268
+ const agentBase = `# Agent Base Template
269
+
270
+ Agent base template for ${config.display_name}.
271
+
272
+ ## Universal Prompt Structure
273
+
274
+ \`\`\`
275
+ [ROLE] You are {role}, focused on {responsibility}.
276
+
277
+ [PROJECT CONTEXT]
278
+ Skill: ${config.skill_name}
279
+ Objective: ${config.description}
280
+
281
+ [TASK]
282
+ {task description}
283
+ - Output: {output_path}
284
+ - Format: ${config.output.format}
285
+
286
+ [CONSTRAINTS]
287
+ - Constraint 1
288
+ - Constraint 2
289
+
290
+ [OUTPUT_FORMAT]
291
+ 1. Execute task
292
+ 2. Return JSON summary information
293
+
294
+ [QUALITY_CHECKLIST]
295
+ - [ ] Output format correct
296
+ - [ ] Content complete without omission
297
+ - [ ] No placeholder remnants
298
+ \`\`\`
299
+
300
+ ## Variable Description
301
+
302
+ | Variable | Source | Example |
303
+ |----------|--------|---------|
304
+ | {workDir} | Runtime | .workflow/.scratchpad/${config.skill_name}-xxx |
305
+ | {output_path} | Configuration | ${config.output.location}/${config.output.filename_pattern} |
306
+
307
+ ## Return Format
308
+
309
+ \`\`\`typescript
310
+ interface AgentReturn {
311
+ status: "completed" | "partial" | "failed";
312
+ output_file: string;
313
+ summary: string; // Max 50 chars
314
+ stats?: {
315
+ items_processed?: number;
316
+ errors?: number;
317
+ };
318
+ }
319
+ \`\`\`
320
+
321
+ ## Role Definition Reference
322
+
323
+ ${config.execution_mode === 'sequential' ?
324
+ config.sequential_config.phases.map((p, i) =>
325
+ `- **Phase ${i+1} Agent**: ${p.name} Expert`
326
+ ).join('\n') :
327
+ config.autonomous_config.actions.map(a =>
328
+ `- **${a.name} Agent**: ${a.description || a.name + ' Executor'}`
329
+ ).join('\n')}
330
+ `;
331
+
332
+ Write(`${skillDir}/templates/agent-base.md`, agentBase);
333
+
334
+ // Step 4: Conditional - Generate action catalog for autonomous/hybrid mode
335
+ if (config.execution_mode === 'autonomous' || config.execution_mode === 'hybrid') {
336
+ const actionCatalog = `# Action Catalog
337
+
338
+ Available action catalog for ${config.display_name}.
339
+
340
+ ## Available Actions
341
+
342
+ | Action | Purpose | Preconditions | Effects |
343
+ |--------|---------|---------------|---------|
344
+ ${config.autonomous_config.actions.map(a =>
345
+ `| [${a.id}](../phases/actions/${a.id}.md) | ${a.description || a.name} | ${a.preconditions?.join(', ') || '-'} | ${a.effects?.join(', ') || '-'} |`
346
+ ).join('\n')}
347
+
348
+ ## Action Dependencies
349
+
350
+ \`\`\`mermaid
351
+ graph TD
352
+ ${config.autonomous_config.actions.map((a, i, arr) => {
353
+ if (i === 0) return \` ${a.id.replace(/-/g, '_')}[${a.name}]\`;
354
+ const prev = arr[i-1];
355
+ return \` ${prev.id.replace(/-/g, '_')} --> ${a.id.replace(/-/g, '_')}[${a.name}]\`;
356
+ }).join('\n')}
357
+ \`\`\`
358
+
359
+ ## State Transitions
360
+
361
+ | From State | Action | To State |
362
+ |------------|--------|----------|
363
+ | pending | action-init | running |
364
+ ${config.autonomous_config.actions.slice(1).map(a =>
365
+ `| running | ${a.id} | running |`
366
+ ).join('\n')}
367
+ | running | action-complete | completed |
368
+ | running | action-abort | failed |
369
+
370
+ ## Selection Priority
371
+
372
+ When multiple actions' preconditions are met, select based on the following priority:
373
+
374
+ ${config.autonomous_config.actions.map((a, i) =>
375
+ \`${i + 1}. \\\`${a.id}\\\` - ${a.name}\`
376
+ ).join('\n')}
377
+ `;
378
+
379
+ Write(`${skillDir}/specs/action-catalog.md`, actionCatalog);
380
+ }
381
+
382
+ // Helper function
383
+ function toPascalCase(str) {
384
+ return str.split('-').map(s => s.charAt(0).toUpperCase() + s.slice(1)).join('');
385
+ }
386
+
387
+ // Phase output summary
388
+ console.log('Phase 4 complete: Generated specs and templates');
389
+ ```
390
+
391
+ ## Next Phase
392
+
393
+ → [Phase 5: Validation](05-validation.md)
394
+
395
+ **Data Flow to Phase 5**:
396
+ - All generated files in `specs/` and `templates/`
397
+ - skill-config.json for validation reference
398
+ - Complete skill directory structure ready for final validation