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,417 +1,417 @@
1
- # Phase 5: Validation & Documentation
2
-
3
- Verify generated skill completeness and generate user documentation.
4
-
5
- ## Objective
6
-
7
- Comprehensive validation and documentation:
8
- - Verify all required files exist
9
- - Check file content quality and completeness
10
- - Generate validation report with issues and recommendations
11
- - Generate README.md usage documentation
12
- - Output final status and next steps
13
-
14
- ## Input
15
-
16
- **File Dependencies**:
17
- - `skill-config.json` (from Phase 1)
18
- - `.claude/skills/{skill-name}/` directory (from Phase 2)
19
- - All generated phase/action files (from Phase 3)
20
- - All generated specs/templates files (from Phase 4)
21
-
22
- **Required Information**:
23
- - Skill name, display name, description
24
- - Execution mode
25
- - Trigger words
26
- - Output configuration
27
- - Complete skill directory structure
28
-
29
- ## Output
30
-
31
- **Generated Files**:
32
-
33
- | File | Purpose | Content |
34
- |------|---------|---------|
35
- | `validation-report.json` (workDir) | Validation report with detailed checks | File completeness, content quality, issues, recommendations |
36
- | `README.md` (skillDir) | User documentation | Quick Start, Usage, Output, Directory Structure, Customization |
37
-
38
- **Validation Report Structure** (`validation-report.json`):
39
- ```json
40
- {
41
- "skill_name": "...",
42
- "execution_mode": "sequential|autonomous",
43
- "generated_at": "ISO timestamp",
44
- "file_checks": {
45
- "total": N,
46
- "existing": N,
47
- "with_content": N,
48
- "with_todos": N,
49
- "details": [...]
50
- },
51
- "content_checks": {
52
- "files_checked": N,
53
- "all_passed": true|false,
54
- "details": [...]
55
- },
56
- "summary": {
57
- "status": "PASS|REVIEW|FAIL",
58
- "issues": [...],
59
- "recommendations": [...]
60
- }
61
- }
62
- ```
63
-
64
- **README Structure** (`README.md`):
65
- ```markdown
66
- # {display_name}
67
- - Quick Start (Triggers, Execution Mode)
68
- - Usage (Examples)
69
- - Output (Format, Location, Filename)
70
- - Directory Structure (Tree view)
71
- - Customization (How to modify)
72
- - Related Documents (Links)
73
- ```
74
-
75
- **Validation Status Gates**:
76
-
77
- | Status | Condition | Meaning |
78
- |--------|-----------|---------|
79
- | PASS | All files exist + All content checks passed | Ready for use |
80
- | REVIEW | All files exist + Some content checks failed | Needs refinement |
81
- | FAIL | Missing files | Incomplete generation |
82
-
83
- ## Decision Logic
84
-
85
- ```
86
- Decision (Validation Flow):
87
- ├─ File Completeness Check
88
- │ ├─ All files exist → Continue to content checks
89
- │ └─ Missing files → Status = FAIL, collect missing file errors
90
-
91
- ├─ Content Quality Check
92
- │ ├─ Sequential mode → Check phase files for structure
93
- │ ├─ Autonomous mode → Check orchestrator + action files
94
- │ └─ Common → Check SKILL.md, specs/, templates/
95
-
96
- ├─ Status Calculation
97
- │ ├─ All files exist + All checks pass → Status = PASS
98
- │ ├─ All files exist + Some checks fail → Status = REVIEW
99
- │ └─ Missing files → Status = FAIL
100
-
101
- └─ Generate Report & README
102
- ├─ validation-report.json (with issues and recommendations)
103
- └─ README.md (with usage documentation)
104
- ```
105
-
106
- ## Execution Protocol
107
-
108
- ```javascript
109
- // Phase 5: Validation & Documentation
110
- // Reference: phases/05-validation.md
111
-
112
- // Load config and setup
113
- const config = JSON.parse(Read(`${workDir}/skill-config.json`));
114
- const skillDir = `.claude/skills/${config.skill_name}`;
115
-
116
- // Step 1: File completeness check
117
- const requiredFiles = {
118
- common: [
119
- 'SKILL.md',
120
- `specs/${config.skill_name}-requirements.md`,
121
- 'specs/quality-standards.md',
122
- 'templates/agent-base.md'
123
- ],
124
- sequential: config.sequential_config?.phases?.map(p => `phases/${p.id}.md`) || [],
125
- autonomous: [
126
- 'phases/orchestrator.md',
127
- 'phases/state-schema.md',
128
- 'specs/action-catalog.md',
129
- ...(config.autonomous_config?.actions?.map(a => `phases/actions/${a.id}.md`) || [])
130
- ]
131
- };
132
-
133
- const filesToCheck = [
134
- ...requiredFiles.common,
135
- ...(config.execution_mode === 'sequential' ? requiredFiles.sequential : requiredFiles.autonomous)
136
- ];
137
-
138
- const fileCheckResults = filesToCheck.map(file => {
139
- const fullPath = `${skillDir}/${file}`;
140
- try {
141
- const content = Read(fullPath);
142
- return {
143
- file: file,
144
- exists: true,
145
- size: content.length,
146
- hasContent: content.length > 100,
147
- hasTodo: content.includes('TODO')
148
- };
149
- } catch (e) {
150
- return {
151
- file: file,
152
- exists: false,
153
- size: 0,
154
- hasContent: false,
155
- hasTodo: false
156
- };
157
- }
158
- });
159
-
160
- // Step 2: Content quality check
161
- const contentChecks = [];
162
-
163
- // Check SKILL.md structure
164
- const skillMd = Read(`${skillDir}/SKILL.md`);
165
- contentChecks.push({
166
- file: 'SKILL.md',
167
- checks: [
168
- { name: 'Front Matter', pass: skillMd.startsWith('---') },
169
- { name: 'Architecture', pass: skillMd.includes('## Architecture') },
170
- { name: 'Execution Flow', pass: skillMd.includes('## Execution Flow') },
171
- { name: 'References', pass: skillMd.includes('## Reference Documents') }
172
- ]
173
- });
174
-
175
- // Check phase files
176
- const phaseFiles = Glob(`${skillDir}/phases/*.md`);
177
- for (const phaseFile of phaseFiles) {
178
- if (phaseFile.includes('/actions/')) continue; // Check separately
179
-
180
- const content = Read(phaseFile);
181
- contentChecks.push({
182
- file: phaseFile.replace(skillDir + '/', ''),
183
- checks: [
184
- { name: 'Objective', pass: content.includes('## Objective') },
185
- { name: 'Execution', pass: content.includes('## Execution') || content.includes('## Execution Steps') },
186
- { name: 'Output', pass: content.includes('## Output') },
187
- { name: 'Code Blocks', pass: content.includes('```') }
188
- ]
189
- });
190
- }
191
-
192
- // Check specs files
193
- const specFiles = Glob(`${skillDir}/specs/*.md`);
194
- for (const specFile of specFiles) {
195
- const content = Read(specFile);
196
- contentChecks.push({
197
- file: specFile.replace(skillDir + '/', ''),
198
- checks: [
199
- { name: 'Has Content', pass: content.length > 200 },
200
- { name: 'Has Structure', pass: content.includes('##') },
201
- { name: 'No Empty Sections', pass: !content.match(/##[^#]+\n\n##/) }
202
- ]
203
- });
204
- }
205
-
206
- // Step 3: Generate validation report
207
- const report = {
208
- skill_name: config.skill_name,
209
- execution_mode: config.execution_mode,
210
- generated_at: new Date().toISOString(),
211
-
212
- file_checks: {
213
- total: fileCheckResults.length,
214
- existing: fileCheckResults.filter(f => f.exists).length,
215
- with_content: fileCheckResults.filter(f => f.hasContent).length,
216
- with_todos: fileCheckResults.filter(f => f.hasTodo).length,
217
- details: fileCheckResults
218
- },
219
-
220
- content_checks: {
221
- files_checked: contentChecks.length,
222
- all_passed: contentChecks.every(c => c.checks.every(ch => ch.pass)),
223
- details: contentChecks
224
- },
225
-
226
- summary: {
227
- status: calculateOverallStatus(fileCheckResults, contentChecks),
228
- issues: collectIssues(fileCheckResults, contentChecks),
229
- recommendations: generateRecommendations(fileCheckResults, contentChecks)
230
- }
231
- };
232
-
233
- Write(`${workDir}/validation-report.json`, JSON.stringify(report, null, 2));
234
-
235
- // Helper functions
236
- function calculateOverallStatus(fileResults, contentResults) {
237
- const allFilesExist = fileResults.every(f => f.exists);
238
- const allContentPassed = contentResults.every(c => c.checks.every(ch => ch.pass));
239
-
240
- if (allFilesExist && allContentPassed) return 'PASS';
241
- if (allFilesExist) return 'REVIEW';
242
- return 'FAIL';
243
- }
244
-
245
- function collectIssues(fileResults, contentResults) {
246
- const issues = [];
247
-
248
- fileResults.filter(f => !f.exists).forEach(f => {
249
- issues.push({ type: 'ERROR', message: `文件缺失: ${f.file}` });
250
- });
251
-
252
- fileResults.filter(f => f.hasTodo).forEach(f => {
253
- issues.push({ type: 'WARNING', message: `包含 TODO: ${f.file}` });
254
- });
255
-
256
- contentResults.forEach(c => {
257
- c.checks.filter(ch => !ch.pass).forEach(ch => {
258
- issues.push({ type: 'WARNING', message: `${c.file}: 缺少 ${ch.name}` });
259
- });
260
- });
261
-
262
- return issues;
263
- }
264
-
265
- function generateRecommendations(fileResults, contentResults) {
266
- const recommendations = [];
267
-
268
- if (fileResults.some(f => f.hasTodo)) {
269
- recommendations.push('替换所有 TODO 占位符为实际内容');
270
- }
271
-
272
- contentResults.forEach(c => {
273
- if (c.checks.some(ch => !ch.pass)) {
274
- recommendations.push(`完善 ${c.file} 的结构`);
275
- }
276
- });
277
-
278
- return recommendations;
279
- }
280
-
281
- // Step 4: Generate README.md
282
- const readme = `# ${config.display_name}
283
-
284
- ${config.description}
285
-
286
- ## Quick Start
287
-
288
- ### 触发词
289
-
290
- ${config.triggers.map(t => `- "${t}"`).join('\n')}
291
-
292
- ### 执行模式
293
-
294
- **${config.execution_mode === 'sequential' ? 'Sequential (顺序)' : 'Autonomous (自主)'}**
295
-
296
- ${config.execution_mode === 'sequential' ?
297
- `阶段按固定顺序执行:\n${config.sequential_config.phases.map((p, i) =>
298
- `${i + 1}. ${p.name}`
299
- ).join('\n')}` :
300
- `动作由编排器动态选择:\n${config.autonomous_config.actions.map(a =>
301
- `- ${a.name}: ${a.description || ''}`
302
- ).join('\n')}`}
303
-
304
- ## Usage
305
-
306
- \`\`\`
307
- # 直接触发
308
- 用户: ${config.triggers[0]}
309
-
310
- # 或使用 Skill 名称
311
- 用户: /skill ${config.skill_name}
312
- \`\`\`
313
-
314
- ## Output
315
-
316
- - **格式**: ${config.output.format}
317
- - **位置**: \`${config.output.location}\`
318
- - **文件名**: \`${config.output.filename_pattern}\`
319
-
320
- ## Directory Structure
321
-
322
- \`\`\`
323
- .claude/skills/${config.skill_name}/
324
- ├── SKILL.md # 入口文件
325
- ├── phases/ # 执行阶段
326
- ${config.execution_mode === 'sequential' ?
327
- config.sequential_config.phases.map(p => `│ ├── ${p.id}.md`).join('\n') :
328
- `│ ├── orchestrator.md
329
- │ ├── state-schema.md
330
- │ └── actions/
331
- ${config.autonomous_config.actions.map(a => `│ ├── ${a.id}.md`).join('\n')}`}
332
- ├── specs/ # 规范文件
333
- │ ├── ${config.skill_name}-requirements.md
334
- │ ├── quality-standards.md
335
- ${config.execution_mode === 'autonomous' ? '│ └── action-catalog.md' : ''}
336
- └── templates/ # 模板文件
337
- └── agent-base.md
338
- \`\`\`
339
-
340
- ## Customization
341
-
342
- ### 修改执行逻辑
343
-
344
- 编辑 \`phases/\` 目录下的阶段文件。
345
-
346
- ### 调整质量标准
347
-
348
- 编辑 \`specs/quality-standards.md\`。
349
-
350
- ### 添加新${config.execution_mode === 'sequential' ? '阶段' : '动作'}
351
-
352
- ${config.execution_mode === 'sequential' ?
353
- `1. \`phases/\` 创建新的阶段文件 ( \`03.5-new-step.md\`)
354
- 2. 更新 SKILL.md 的执行流程` :
355
- `1. \`phases/actions/\` 创建新的动作文件
356
- 2. 更新 \`specs/action-catalog.md\`
357
- 3. \`phases/orchestrator.md\` 添加选择逻辑`}
358
-
359
- ## Related Documents
360
-
361
- - [设计规范](../_shared/SKILL-DESIGN-SPEC.md)
362
- - [执行模式规范](specs/../../../skill-generator/specs/execution-modes.md)
363
-
364
- ---
365
-
366
- *Generated by skill-generator v1.0*
367
- `;
368
-
369
- Write(`${skillDir}/README.md`, readme);
370
-
371
- // Step 5: Output final result
372
- const finalResult = {
373
- skill_name: config.skill_name,
374
- skill_path: skillDir,
375
- execution_mode: config.execution_mode,
376
-
377
- generated_files: [
378
- 'SKILL.md',
379
- 'README.md',
380
- ...filesToCheck
381
- ],
382
-
383
- validation: report.summary,
384
-
385
- next_steps: [
386
- '1. 审阅生成的文件结构',
387
- '2. 替换 TODO 占位符',
388
- '3. 根据实际需求调整阶段逻辑',
389
- '4. 测试 Skill 执行流程',
390
- '5. 更新触发词和描述'
391
- ]
392
- };
393
-
394
- console.log('=== Skill 生成完成 ===');
395
- console.log(`路径: ${skillDir}`);
396
- console.log(`模式: ${config.execution_mode}`);
397
- console.log(`状态: ${report.summary.status}`);
398
- console.log('');
399
- console.log('下一步:');
400
- finalResult.next_steps.forEach(s => console.log(s));
401
- ```
402
-
403
- ## Workflow Completion
404
-
405
- **Final Status**: Skill generation pipeline complete
406
-
407
- **Generated Artifacts**:
408
- - Complete skill directory structure in `.claude/skills/{skill-name}/`
409
- - Validation report in `{workDir}/validation-report.json`
410
- - User documentation in `{skillDir}/README.md`
411
-
412
- **Next Steps**:
413
- 1. Review validation report for any issues or recommendations
414
- 2. Replace TODO placeholders with actual implementation
415
- 3. Test skill execution with trigger words
416
- 4. Customize phase logic based on specific requirements
417
- 5. Update triggers and descriptions as needed
1
+ # Phase 5: Validation & Documentation
2
+
3
+ Verify generated skill completeness and generate user documentation.
4
+
5
+ ## Objective
6
+
7
+ Comprehensive validation and documentation:
8
+ - Verify all required files exist
9
+ - Check file content quality and completeness
10
+ - Generate validation report with issues and recommendations
11
+ - Generate README.md usage documentation
12
+ - Output final status and next steps
13
+
14
+ ## Input
15
+
16
+ **File Dependencies**:
17
+ - `skill-config.json` (from Phase 1)
18
+ - `.claude/skills/{skill-name}/` directory (from Phase 2)
19
+ - All generated phase/action files (from Phase 3)
20
+ - All generated specs/templates files (from Phase 4)
21
+
22
+ **Required Information**:
23
+ - Skill name, display name, description
24
+ - Execution mode
25
+ - Trigger words
26
+ - Output configuration
27
+ - Complete skill directory structure
28
+
29
+ ## Output
30
+
31
+ **Generated Files**:
32
+
33
+ | File | Purpose | Content |
34
+ |------|---------|---------|
35
+ | `validation-report.json` (workDir) | Validation report with detailed checks | File completeness, content quality, issues, recommendations |
36
+ | `README.md` (skillDir) | User documentation | Quick Start, Usage, Output, Directory Structure, Customization |
37
+
38
+ **Validation Report Structure** (`validation-report.json`):
39
+ ```json
40
+ {
41
+ "skill_name": "...",
42
+ "execution_mode": "sequential|autonomous",
43
+ "generated_at": "ISO timestamp",
44
+ "file_checks": {
45
+ "total": N,
46
+ "existing": N,
47
+ "with_content": N,
48
+ "with_todos": N,
49
+ "details": [...]
50
+ },
51
+ "content_checks": {
52
+ "files_checked": N,
53
+ "all_passed": true|false,
54
+ "details": [...]
55
+ },
56
+ "summary": {
57
+ "status": "PASS|REVIEW|FAIL",
58
+ "issues": [...],
59
+ "recommendations": [...]
60
+ }
61
+ }
62
+ ```
63
+
64
+ **README Structure** (`README.md`):
65
+ ```markdown
66
+ # {display_name}
67
+ - Quick Start (Triggers, Execution Mode)
68
+ - Usage (Examples)
69
+ - Output (Format, Location, Filename)
70
+ - Directory Structure (Tree view)
71
+ - Customization (How to modify)
72
+ - Related Documents (Links)
73
+ ```
74
+
75
+ **Validation Status Gates**:
76
+
77
+ | Status | Condition | Meaning |
78
+ |--------|-----------|---------|
79
+ | PASS | All files exist + All content checks passed | Ready for use |
80
+ | REVIEW | All files exist + Some content checks failed | Needs refinement |
81
+ | FAIL | Missing files | Incomplete generation |
82
+
83
+ ## Decision Logic
84
+
85
+ ```
86
+ Decision (Validation Flow):
87
+ ├─ File Completeness Check
88
+ │ ├─ All files exist → Continue to content checks
89
+ │ └─ Missing files → Status = FAIL, collect missing file errors
90
+
91
+ ├─ Content Quality Check
92
+ │ ├─ Sequential mode → Check phase files for structure
93
+ │ ├─ Autonomous mode → Check orchestrator + action files
94
+ │ └─ Common → Check SKILL.md, specs/, templates/
95
+
96
+ ├─ Status Calculation
97
+ │ ├─ All files exist + All checks pass → Status = PASS
98
+ │ ├─ All files exist + Some checks fail → Status = REVIEW
99
+ │ └─ Missing files → Status = FAIL
100
+
101
+ └─ Generate Report & README
102
+ ├─ validation-report.json (with issues and recommendations)
103
+ └─ README.md (with usage documentation)
104
+ ```
105
+
106
+ ## Execution Protocol
107
+
108
+ ```javascript
109
+ // Phase 5: Validation & Documentation
110
+ // Reference: phases/05-validation.md
111
+
112
+ // Load config and setup
113
+ const config = JSON.parse(Read(`${workDir}/skill-config.json`));
114
+ const skillDir = `.claude/skills/${config.skill_name}`;
115
+
116
+ // Step 1: File completeness check
117
+ const requiredFiles = {
118
+ common: [
119
+ 'SKILL.md',
120
+ `specs/${config.skill_name}-requirements.md`,
121
+ 'specs/quality-standards.md',
122
+ 'templates/agent-base.md'
123
+ ],
124
+ sequential: config.sequential_config?.phases?.map(p => `phases/${p.id}.md`) || [],
125
+ autonomous: [
126
+ 'phases/orchestrator.md',
127
+ 'phases/state-schema.md',
128
+ 'specs/action-catalog.md',
129
+ ...(config.autonomous_config?.actions?.map(a => `phases/actions/${a.id}.md`) || [])
130
+ ]
131
+ };
132
+
133
+ const filesToCheck = [
134
+ ...requiredFiles.common,
135
+ ...(config.execution_mode === 'sequential' ? requiredFiles.sequential : requiredFiles.autonomous)
136
+ ];
137
+
138
+ const fileCheckResults = filesToCheck.map(file => {
139
+ const fullPath = `${skillDir}/${file}`;
140
+ try {
141
+ const content = Read(fullPath);
142
+ return {
143
+ file: file,
144
+ exists: true,
145
+ size: content.length,
146
+ hasContent: content.length > 100,
147
+ hasTodo: content.includes('TODO')
148
+ };
149
+ } catch (e) {
150
+ return {
151
+ file: file,
152
+ exists: false,
153
+ size: 0,
154
+ hasContent: false,
155
+ hasTodo: false
156
+ };
157
+ }
158
+ });
159
+
160
+ // Step 2: Content quality check
161
+ const contentChecks = [];
162
+
163
+ // Check SKILL.md structure
164
+ const skillMd = Read(`${skillDir}/SKILL.md`);
165
+ contentChecks.push({
166
+ file: 'SKILL.md',
167
+ checks: [
168
+ { name: 'Front Matter', pass: skillMd.startsWith('---') },
169
+ { name: 'Architecture', pass: skillMd.includes('## Architecture') },
170
+ { name: 'Execution Flow', pass: skillMd.includes('## Execution Flow') },
171
+ { name: 'References', pass: skillMd.includes('## Reference Documents') }
172
+ ]
173
+ });
174
+
175
+ // Check phase files
176
+ const phaseFiles = Glob(`${skillDir}/phases/*.md`);
177
+ for (const phaseFile of phaseFiles) {
178
+ if (phaseFile.includes('/actions/')) continue; // Check separately
179
+
180
+ const content = Read(phaseFile);
181
+ contentChecks.push({
182
+ file: phaseFile.replace(skillDir + '/', ''),
183
+ checks: [
184
+ { name: 'Objective', pass: content.includes('## Objective') },
185
+ { name: 'Execution', pass: content.includes('## Execution') || content.includes('## Execution Steps') },
186
+ { name: 'Output', pass: content.includes('## Output') },
187
+ { name: 'Code Blocks', pass: content.includes('```') }
188
+ ]
189
+ });
190
+ }
191
+
192
+ // Check specs files
193
+ const specFiles = Glob(`${skillDir}/specs/*.md`);
194
+ for (const specFile of specFiles) {
195
+ const content = Read(specFile);
196
+ contentChecks.push({
197
+ file: specFile.replace(skillDir + '/', ''),
198
+ checks: [
199
+ { name: 'Has Content', pass: content.length > 200 },
200
+ { name: 'Has Structure', pass: content.includes('##') },
201
+ { name: 'No Empty Sections', pass: !content.match(/##[^#]+\n\n##/) }
202
+ ]
203
+ });
204
+ }
205
+
206
+ // Step 3: Generate validation report
207
+ const report = {
208
+ skill_name: config.skill_name,
209
+ execution_mode: config.execution_mode,
210
+ generated_at: new Date().toISOString(),
211
+
212
+ file_checks: {
213
+ total: fileCheckResults.length,
214
+ existing: fileCheckResults.filter(f => f.exists).length,
215
+ with_content: fileCheckResults.filter(f => f.hasContent).length,
216
+ with_todos: fileCheckResults.filter(f => f.hasTodo).length,
217
+ details: fileCheckResults
218
+ },
219
+
220
+ content_checks: {
221
+ files_checked: contentChecks.length,
222
+ all_passed: contentChecks.every(c => c.checks.every(ch => ch.pass)),
223
+ details: contentChecks
224
+ },
225
+
226
+ summary: {
227
+ status: calculateOverallStatus(fileCheckResults, contentChecks),
228
+ issues: collectIssues(fileCheckResults, contentChecks),
229
+ recommendations: generateRecommendations(fileCheckResults, contentChecks)
230
+ }
231
+ };
232
+
233
+ Write(`${workDir}/validation-report.json`, JSON.stringify(report, null, 2));
234
+
235
+ // Helper functions
236
+ function calculateOverallStatus(fileResults, contentResults) {
237
+ const allFilesExist = fileResults.every(f => f.exists);
238
+ const allContentPassed = contentResults.every(c => c.checks.every(ch => ch.pass));
239
+
240
+ if (allFilesExist && allContentPassed) return 'PASS';
241
+ if (allFilesExist) return 'REVIEW';
242
+ return 'FAIL';
243
+ }
244
+
245
+ function collectIssues(fileResults, contentResults) {
246
+ const issues = [];
247
+
248
+ fileResults.filter(f => !f.exists).forEach(f => {
249
+ issues.push({ type: 'ERROR', message: `Missing file: ${f.file}` });
250
+ });
251
+
252
+ fileResults.filter(f => f.hasTodo).forEach(f => {
253
+ issues.push({ type: 'WARNING', message: `Contains TODO: ${f.file}` });
254
+ });
255
+
256
+ contentResults.forEach(c => {
257
+ c.checks.filter(ch => !ch.pass).forEach(ch => {
258
+ issues.push({ type: 'WARNING', message: `${c.file}: Missing ${ch.name}` });
259
+ });
260
+ });
261
+
262
+ return issues;
263
+ }
264
+
265
+ function generateRecommendations(fileResults, contentResults) {
266
+ const recommendations = [];
267
+
268
+ if (fileResults.some(f => f.hasTodo)) {
269
+ recommendations.push('Replace all TODO placeholders with actual content');
270
+ }
271
+
272
+ contentResults.forEach(c => {
273
+ if (c.checks.some(ch => !ch.pass)) {
274
+ recommendations.push(`Improve structure of ${c.file}`);
275
+ }
276
+ });
277
+
278
+ return recommendations;
279
+ }
280
+
281
+ // Step 4: Generate README.md
282
+ const readme = `# ${config.display_name}
283
+
284
+ ${config.description}
285
+
286
+ ## Quick Start
287
+
288
+ ### Trigger Words
289
+
290
+ ${config.triggers.map(t => `- "${t}"`).join('\n')}
291
+
292
+ ### Execution Mode
293
+
294
+ **${config.execution_mode === 'sequential' ? 'Sequential (Sequential)' : 'Autonomous (Autonomous)'}**
295
+
296
+ ${config.execution_mode === 'sequential' ?
297
+ \`Phases execute in fixed order:\n\${config.sequential_config.phases.map((p, i) =>
298
+ \`\${i + 1}. \${p.name}\`
299
+ ).join('\n')}\` :
300
+ \`Actions selected dynamically by orchestrator:\n\${config.autonomous_config.actions.map(a =>
301
+ \`- \${a.name}: \${a.description || ''}\`
302
+ ).join('\n')}\`}
303
+
304
+ ## Usage
305
+
306
+ \`\`\`
307
+ # Direct trigger
308
+ User: ${config.triggers[0]}
309
+
310
+ # Or use Skill name
311
+ User: /skill ${config.skill_name}
312
+ \`\`\`
313
+
314
+ ## Output
315
+
316
+ - **Format**: ${config.output.format}
317
+ - **Location**: \`${config.output.location}\`
318
+ - **Filename**: \`${config.output.filename_pattern}\`
319
+
320
+ ## Directory Structure
321
+
322
+ \`\`\`
323
+ .claude/skills/${config.skill_name}/
324
+ ├── SKILL.md # Entry file
325
+ ├── phases/ # Execution phases
326
+ ${config.execution_mode === 'sequential' ?
327
+ config.sequential_config.phases.map(p => \`│ ├── \${p.id}.md\`).join('\n') :
328
+ \`│ ├── orchestrator.md
329
+ │ ├── state-schema.md
330
+ │ └── actions/
331
+ \${config.autonomous_config.actions.map(a => \`│ ├── \${a.id}.md\`).join('\n')}\`}
332
+ ├── specs/ # Specification files
333
+ │ ├── ${config.skill_name}-requirements.md
334
+ │ ├── quality-standards.md
335
+ ${config.execution_mode === 'autonomous' ? '│ └── action-catalog.md' : ''}
336
+ └── templates/ # Template files
337
+ └── agent-base.md
338
+ \`\`\`
339
+
340
+ ## Customization
341
+
342
+ ### Modify Execution Logic
343
+
344
+ Edit phase files in the \`phases/\` directory.
345
+
346
+ ### Adjust Quality Standards
347
+
348
+ Edit \`specs/quality-standards.md\`.
349
+
350
+ ### Add New ${config.execution_mode === 'sequential' ? 'Phase' : 'Action'}
351
+
352
+ ${config.execution_mode === 'sequential' ?
353
+ \`1. Create new phase file in \`phases/\` (e.g., \`03.5-new-step.md\`)
354
+ 2. Update execution flow in SKILL.md\` :
355
+ \`1. Create new action file in \`phases/actions/\`
356
+ 2. Update \`specs/action-catalog.md\`
357
+ 3. Add selection logic in \`phases/orchestrator.md\`\`}
358
+
359
+ ## Related Documents
360
+
361
+ - [Design Specification](../_shared/SKILL-DESIGN-SPEC.md)
362
+ - [Execution Modes Specification](specs/../../../skill-generator/specs/execution-modes.md)
363
+
364
+ ---
365
+
366
+ *Generated by skill-generator v1.0*
367
+ `;
368
+
369
+ Write(`${skillDir}/README.md`, readme);
370
+
371
+ // Step 5: Output final result
372
+ const finalResult = {
373
+ skill_name: config.skill_name,
374
+ skill_path: skillDir,
375
+ execution_mode: config.execution_mode,
376
+
377
+ generated_files: [
378
+ 'SKILL.md',
379
+ 'README.md',
380
+ ...filesToCheck
381
+ ],
382
+
383
+ validation: report.summary,
384
+
385
+ next_steps: [
386
+ '1. Review generated file structure',
387
+ '2. Replace TODO placeholders',
388
+ '3. Adjust phase logic based on actual requirements',
389
+ '4. Test Skill execution flow',
390
+ '5. Update trigger words and descriptions'
391
+ ]
392
+ };
393
+
394
+ console.log('=== Skill Generation Complete ===');
395
+ console.log(\`Path: \${skillDir}\`);
396
+ console.log(\`Mode: \${config.execution_mode}\`);
397
+ console.log(\`Status: \${report.summary.status}\`);
398
+ console.log('');
399
+ console.log('Next Steps:');
400
+ finalResult.next_steps.forEach(s => console.log(s));
401
+ ```
402
+
403
+ ## Workflow Completion
404
+
405
+ **Final Status**: Skill generation pipeline complete
406
+
407
+ **Generated Artifacts**:
408
+ - Complete skill directory structure in `.claude/skills/{skill-name}/`
409
+ - Validation report in `{workDir}/validation-report.json`
410
+ - User documentation in `{skillDir}/README.md`
411
+
412
+ **Next Steps**:
413
+ 1. Review validation report for any issues or recommendations
414
+ 2. Replace TODO placeholders with actual implementation
415
+ 3. Test skill execution with trigger words
416
+ 4. Customize phase logic based on specific requirements
417
+ 5. Update triggers and descriptions as needed