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.
- package/.claude/commands/view.md +367 -0
- package/.claude/commands/workflow/unified-execute-with-file.md +807 -0
- package/.claude/skills/ccw-help/SKILL.md +72 -12
- package/.claude/skills/ccw-help/command.json +922 -520
- package/.claude/skills/ccw-help/index/all-agents.json +97 -0
- package/.claude/skills/ccw-help/index/all-commands.json +805 -0
- package/.claude/skills/ccw-help/index/by-category.json +833 -0
- package/.claude/skills/ccw-help/index/by-use-case.json +819 -0
- package/.claude/skills/ccw-help/index/command-relationships.json +160 -0
- package/.claude/skills/ccw-help/index/essential-commands.json +90 -0
- package/.claude/skills/ccw-help/scripts/auto-update.py +34 -0
- package/.claude/skills/skill-generator/SKILL.md +255 -208
- package/.claude/skills/skill-generator/phases/01-requirements-discovery.md +238 -228
- package/.claude/skills/skill-generator/phases/02-structure-generation.md +261 -262
- package/.claude/skills/skill-generator/phases/03-phase-generation.md +976 -969
- package/.claude/skills/skill-generator/phases/04-specs-templates.md +398 -398
- package/.claude/skills/skill-generator/phases/05-validation.md +417 -417
- package/.claude/skills/skill-generator/specs/cli-integration.md +131 -131
- package/.claude/skills/skill-generator/specs/execution-modes.md +399 -396
- package/.claude/skills/skill-generator/specs/reference-docs-spec.md +271 -0
- package/.claude/skills/skill-generator/specs/scripting-integration.md +265 -265
- package/.claude/skills/skill-generator/specs/skill-requirements.md +466 -466
- package/.claude/skills/skill-generator/templates/autonomous-action.md +91 -88
- package/.claude/skills/skill-generator/templates/autonomous-orchestrator.md +89 -89
- package/.claude/skills/skill-generator/templates/code-analysis-action.md +148 -149
- package/.claude/skills/skill-generator/templates/llm-action.md +367 -367
- package/.claude/skills/skill-generator/templates/script-template.md +79 -79
- package/.claude/skills/skill-generator/templates/sequential-phase.md +129 -129
- package/.claude/skills/skill-generator/templates/skill-md.md +134 -75
- package/.codex/prompts/UNIFIED_EXECUTE_COMPARISON.md +205 -0
- package/.codex/prompts/unified-execute-with-file.md +722 -0
- package/.codex/skills/codex-issue-plan-execute/SKILL.md +239 -0
- package/.codex/skills/codex-issue-plan-execute/phases/actions/action-complete.md +173 -0
- package/.codex/skills/codex-issue-plan-execute/phases/actions/action-execute.md +220 -0
- package/.codex/skills/codex-issue-plan-execute/phases/actions/action-init.md +86 -0
- package/.codex/skills/codex-issue-plan-execute/phases/actions/action-list.md +165 -0
- package/.codex/skills/codex-issue-plan-execute/phases/actions/action-plan.md +170 -0
- package/.codex/skills/codex-issue-plan-execute/phases/orchestrator.md +210 -0
- package/.codex/skills/codex-issue-plan-execute/phases/state-schema.md +136 -0
- package/.codex/skills/codex-issue-plan-execute/prompts/execution-agent-system.md +136 -0
- package/.codex/skills/codex-issue-plan-execute/prompts/execution-agent.md +135 -0
- package/.codex/skills/codex-issue-plan-execute/prompts/planning-agent-system.md +107 -0
- package/.codex/skills/codex-issue-plan-execute/prompts/planning-agent.md +122 -0
- package/.codex/skills/codex-issue-plan-execute/specs/issue-handling.md +187 -0
- package/.codex/skills/codex-issue-plan-execute/specs/quality-standards.md +231 -0
- package/.codex/skills/codex-issue-plan-execute/specs/solution-schema.md +270 -0
- package/.codex/skills/codex-issue-plan-execute/specs/subagent-roles.md +268 -0
- package/ccw/dist/commands/cli.d.ts.map +1 -1
- package/ccw/dist/commands/cli.js +23 -2
- package/ccw/dist/commands/cli.js.map +1 -1
- package/ccw/dist/core/routes/help-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/help-routes.js +51 -1
- package/ccw/dist/core/routes/help-routes.js.map +1 -1
- package/ccw/dist/tools/cli-executor-core.d.ts.map +1 -1
- package/ccw/dist/tools/cli-executor-core.js +5 -3
- package/ccw/dist/tools/cli-executor-core.js.map +1 -1
- package/ccw/dist/tools/cli-executor-utils.d.ts +1 -0
- package/ccw/dist/tools/cli-executor-utils.d.ts.map +1 -1
- package/ccw/dist/tools/cli-executor-utils.js +3 -1
- package/ccw/dist/tools/cli-executor-utils.js.map +1 -1
- package/ccw/src/commands/cli.ts +26 -2
- package/ccw/src/core/routes/help-routes.ts +60 -1
- package/ccw/src/templates/dashboard-js/views/help.js +423 -1
- package/ccw/src/tools/cli-executor-core.ts +6 -3
- package/ccw/src/tools/cli-executor-utils.ts +5 -2
- 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
|
-
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
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 |
|
|
118
|
-
| Actions |
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
## Domain Requirements
|
|
123
|
-
|
|
124
|
-
###
|
|
125
|
-
|
|
126
|
-
- [ ]
|
|
127
|
-
- [ ]
|
|
128
|
-
- [ ]
|
|
129
|
-
|
|
130
|
-
###
|
|
131
|
-
|
|
132
|
-
- [ ]
|
|
133
|
-
- [ ]
|
|
134
|
-
- [ ]
|
|
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: "
|
|
149
|
-
{ name: "
|
|
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 (
|
|
179
|
-
|
|
180
|
-
|
|
|
181
|
-
|
|
182
|
-
|
|
|
183
|
-
|
|
|
184
|
-
|
|
|
185
|
-
|
|
186
|
-
### 2. Consistency (
|
|
187
|
-
|
|
188
|
-
|
|
|
189
|
-
|
|
190
|
-
|
|
|
191
|
-
|
|
|
192
|
-
|
|
|
193
|
-
|
|
194
|
-
### 3. Accuracy (
|
|
195
|
-
|
|
196
|
-
|
|
|
197
|
-
|
|
198
|
-
|
|
|
199
|
-
|
|
|
200
|
-
|
|
|
201
|
-
|
|
202
|
-
### 4. Usability (
|
|
203
|
-
|
|
204
|
-
|
|
|
205
|
-
|
|
206
|
-
|
|
|
207
|
-
|
|
|
208
|
-
|
|
|
209
|
-
|
|
210
|
-
## Quality Gates
|
|
211
|
-
|
|
212
|
-
| Gate | Threshold | Action |
|
|
213
|
-
|------|-----------|--------|
|
|
214
|
-
| Pass |
|
|
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}
|
|
271
|
-
|
|
272
|
-
##
|
|
273
|
-
|
|
274
|
-
\`\`\`
|
|
275
|
-
[ROLE]
|
|
276
|
-
|
|
277
|
-
[PROJECT CONTEXT]
|
|
278
|
-
Skill: ${config.skill_name}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
[TASK]
|
|
282
|
-
{
|
|
283
|
-
-
|
|
284
|
-
-
|
|
285
|
-
|
|
286
|
-
[CONSTRAINTS]
|
|
287
|
-
-
|
|
288
|
-
-
|
|
289
|
-
|
|
290
|
-
[OUTPUT_FORMAT]
|
|
291
|
-
1.
|
|
292
|
-
2.
|
|
293
|
-
|
|
294
|
-
[QUALITY_CHECKLIST]
|
|
295
|
-
- [ ]
|
|
296
|
-
- [ ]
|
|
297
|
-
- [ ]
|
|
298
|
-
\`\`\`
|
|
299
|
-
|
|
300
|
-
##
|
|
301
|
-
|
|
302
|
-
|
|
|
303
|
-
|
|
304
|
-
| {workDir} |
|
|
305
|
-
| {output_path} |
|
|
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
|
|
354
|
-
const prev = arr[i-1];
|
|
355
|
-
return
|
|
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
|
-
|
|
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
|