feat: Add phases for document consolidation, assembly, and compliance refinement

- Introduced Phase 2.5: Consolidation Agent to summarize analysis outputs and generate design overviews.
- Added Phase 4: Document Assembly to create index-style documents linking chapter files.
- Implemented Phase 5: Compliance Review & Iterative Refinement for CPCC compliance checks and updates.
- Established CPCC Compliance Requirements document outlining mandatory sections and validation functions.
- Created a base template for analysis agents to ensure consistency and efficiency in execution.
This commit is contained in:
catlog22
2026-01-28 19:57:24 +08:00
parent 4c78f53bcc
commit 0cc5101c0e
34 changed files with 888 additions and 466 deletions

View File

@@ -12,26 +12,24 @@ Meta-skill for creating new Claude Code skills with configurable execution modes
```
┌─────────────────────────────────────────────────────────────────┐
Skill Generator Architecture
├─────────────────────────────────────────────────────────────────┤
Skill Generator
│ │
⚠️ Phase 0: Specification → 阅读并理解设计规范 (强制前置)
Study SKILL-DESIGN-SPEC.md + 模板
│ Phase 1: Requirements → skill-config.json
Discovery (name, type, mode, agents)
Phase 2: Structure → 目录结构 + 核心文件骨架
Generation
Phase 3: Phase → phases/*.md (根据 mode 生成)
Generation Sequential | Autonomous
Phase 4: Specs & → specs/*.md + templates/*.md
Templates
Phase 5: Validation → 验证完整性 + 生成使用说明
│ & Documentation │
Input: User Request (skill name, purpose, mode)
┌─────────────────────────────────────────────────────────┐
│ Phase 0-5: Sequential Pipeline
┌────┐ ┌────┐ ┌────┐ ┌────┐ ┌────┐ ┌────┐ │
│ │ P0 │→│ P1 │→│ P2 │→│ P3 │→│ P4 │→│ P5 │
│ │Spec│ │Req │ │Dir │ │Gen │ │Spec│ │Val │
│ └────┘ └────┘ └────┘ └─┬──┘ └────┘ └────┘
│ ┌────┴────┐ │
↓ ↓
│ Sequential Autonomous
│ (phases/) (actions/)
└─────────────────────────────────────────────────────────┘
Output: .claude/skills/{skill-name}/ (complete package)
│ │
└─────────────────────────────────────────────────────────────────┘
```
@@ -134,93 +132,289 @@ Phase 01 → Phase 02 → Phase 03 → ... → Phase N
## Execution Flow
```
┌─────────────────────────────────────────────────────────────────┐
⚠️ Phase 0: Specification Study (强制前置 - 禁止跳过) │
│ → Read: ../_shared/SKILL-DESIGN-SPEC.md (通用设计规范) │
│ → Read: templates/*.md (所有相关模板文件) │
│ → 理解: Skill 结构规范、命名约定、质量标准 │
→ Output: 内化规范要求,确保后续生成符合标准 │
⛔ 未完成 Phase 0 禁止进入 Phase 1 │
├─────────────────────────────────────────────────────────────────┤
│ Phase 1: Requirements Discovery │
│ → AskUserQuestion: Skill 名称、目标、执行模式 │
│ → Output: skill-config.json │
├─────────────────────────────────────────────────────────────────┤
Phase 2: Structure Generation
→ 创建目录结构: phases/, specs/, templates/, scripts/ │
│ → 生成 SKILL.md 入口文件
│ → Output: 完整目录结构
├─────────────────────────────────────────────────────────────────┤
Phase 3: Phase Generation │
→ Sequential: 生成 01-xx.md, 02-xx.md, ... │
→ Autonomous: 生成 orchestrator.md + actions/*.md │
→ Output: phases/*.md │
├─────────────────────────────────────────────────────────────────┤
Phase 4: Specs & Templates │
│ → 生成领域规范: specs/{domain}-requirements.md │
│ → 生成质量标准: specs/quality-standards.md │
→ 生成模板: templates/agent-base.md │
│ → Output: specs/*.md, templates/*.md │
├─────────────────────────────────────────────────────────────────┤
│ Phase 5: Validation & Documentation │
│ → 验证文件完整性 │
→ 生成 README.md 使用说明 │
│ → Output: 验证报告 + README.md │
└─────────────────────────────────────────────────────────────────┘
Input Parsing:
└─ Convert user request to structured format (skill-name/purpose/mode)
Phase 0: Specification Study (⚠️ MANDATORY - 禁止跳过)
└─ Read specification documents
├─ Load: ../_shared/SKILL-DESIGN-SPEC.md
├─ Load: All templates/*.md files
├─ Understand: Structure rules, naming conventions, quality standards
└─ Output: Internalized requirements (in-memory, no file output)
└─ Validation: ⛔ MUST complete before Phase 1
Phase 1: Requirements Discovery
└─ Gather skill requirements via user interaction
├─ Tool: AskUserQuestion
├─ Prompt: Skill name, purpose, execution mode
├─ Prompt: Phase/Action definition
│ └─ Prompt: Tool dependencies, output format
├─ Process: Generate configuration object
└─ Output: skill-config.json → ${workDir}/
├─ skill_name: string
├─ execution_mode: "sequential" | "autonomous"
├─ phases/actions: array
└─ allowed_tools: array
Phase 2: Structure Generation
└─ Create directory structure and entry file
├─ Input: skill-config.json (from Phase 1)
├─ Tool: Bash
│ └─ Execute: mkdir -p .claude/skills/{skill-name}/{phases,specs,templates,scripts}
├─ Tool: Write
│ └─ Generate: SKILL.md (entry point with architecture diagram)
└─ Output: Complete directory structure
├─ .claude/skills/{skill-name}/SKILL.md
├─ .claude/skills/{skill-name}/phases/
├─ .claude/skills/{skill-name}/specs/
├─ .claude/skills/{skill-name}/templates/
└─ .claude/skills/{skill-name}/scripts/
Phase 3: Phase/Action Generation
└─ Decision (execution_mode check):
├─ execution_mode === "sequential" → Generate Sequential Phases
│ ├─ Tool: Read (template: templates/sequential-phase.md)
│ ├─ Loop: For each phase in config.sequential_config.phases
│ │ ├─ Generate: phases/{phase-id}.md
│ │ └─ Link: Previous phase output → Current phase input
│ ├─ Tool: Write (orchestrator: phases/_orchestrator.md)
│ ├─ Tool: Write (workflow definition: workflow.json)
│ └─ Output: phases/01-{name}.md, phases/02-{name}.md, ...
└─ execution_mode === "autonomous" → Generate Orchestrator + Actions
├─ Tool: Read (template: templates/autonomous-orchestrator.md)
├─ Tool: Write (state schema: phases/state-schema.md)
├─ Tool: Write (orchestrator: phases/orchestrator.md)
├─ Tool: Write (action catalog: specs/action-catalog.md)
├─ Loop: For each action in config.autonomous_config.actions
│ ├─ Tool: Read (template: templates/autonomous-action.md)
│ └─ Generate: phases/actions/{action-id}.md
└─ Output: phases/orchestrator.md, phases/actions/*.md
Phase 4: Specs & Templates
└─ Generate domain specifications and templates
├─ Input: skill-config.json (domain context)
├─ Tool: Write
│ ├─ Generate: specs/{domain}-requirements.md
│ ├─ Generate: specs/quality-standards.md
│ └─ Generate: templates/agent-base.md (if needed)
└─ Output: Domain-specific documentation
├─ specs/{skill-name}-requirements.md
├─ specs/quality-standards.md
└─ templates/agent-base.md
Phase 5: Validation & Documentation
└─ Verify completeness and generate usage guide
├─ Input: All generated files from previous phases
├─ Tool: Glob + Read
│ └─ Check: Required files exist and contain proper structure
├─ Tool: Write
│ ├─ Generate: README.md (usage instructions)
│ └─ Generate: validation-report.json (completeness check)
└─ Output: Final documentation
├─ README.md (how to use this skill)
└─ validation-report.json (quality gate results)
Return:
└─ Summary with skill location and next steps
├─ Skill path: .claude/skills/{skill-name}/
├─ Status: ✅ All phases completed
└─ Suggestion: "Review SKILL.md and customize phase files as needed"
```
## Directory Setup
**Execution Protocol**:
```javascript
const skillName = config.skill_name;
const skillDir = `.claude/skills/${skillName}`;
// Phase 0: Read specifications (in-memory)
Read('.claude/skills/_shared/SKILL-DESIGN-SPEC.md');
Read('.claude/skills/skill-generator/templates/*.md'); // All templates
// 创建目录结构
Bash(`mkdir -p "${skillDir}/phases"`);
Bash(`mkdir -p "${skillDir}/specs"`);
Bash(`mkdir -p "${skillDir}/templates"`);
// Phase 1: Gather requirements
const answers = AskUserQuestion({
questions: [
{ question: "Skill name?", header: "Name", options: [...] },
{ question: "Execution mode?", header: "Mode", options: ["Sequential", "Autonomous"] }
]
});
// Autonomous 模式额外目录
if (config.execution_mode === 'autonomous') {
Bash(`mkdir -p "${skillDir}/phases/actions"`);
const config = generateConfig(answers);
const workDir = `.workflow/.scratchpad/skill-gen-${timestamp}`;
Write(`${workDir}/skill-config.json`, JSON.stringify(config));
// Phase 2: Create structure
const skillDir = `.claude/skills/${config.skill_name}`;
Bash(`mkdir -p "${skillDir}/phases" "${skillDir}/specs" "${skillDir}/templates"`);
Write(`${skillDir}/SKILL.md`, generateSkillEntry(config));
// Phase 3: Generate phases (mode-dependent)
if (config.execution_mode === 'sequential') {
Write(`${skillDir}/phases/_orchestrator.md`, generateOrchestrator(config));
Write(`${skillDir}/workflow.json`, generateWorkflowDef(config));
config.sequential_config.phases.forEach(phase => {
Write(`${skillDir}/phases/${phase.id}.md`, generatePhase(phase, config));
});
} else {
Write(`${skillDir}/phases/orchestrator.md`, generateAutonomousOrchestrator(config));
Write(`${skillDir}/phases/state-schema.md`, generateStateSchema(config));
config.autonomous_config.actions.forEach(action => {
Write(`${skillDir}/phases/actions/${action.id}.md`, generateAction(action, config));
});
}
// Phase 4: Generate specs
Write(`${skillDir}/specs/${config.skill_name}-requirements.md`, generateRequirements(config));
Write(`${skillDir}/specs/quality-standards.md`, generateQualityStandards(config));
// Phase 5: Validate & Document
const validation = validateStructure(skillDir);
Write(`${skillDir}/validation-report.json`, JSON.stringify(validation));
Write(`${skillDir}/README.md`, generateReadme(config, validation));
```
---
## Phase Reference Guide
Navigation and entry points for each execution phase:
### Phase 0: Specification Study (Mandatory)
**Document**: 🔗 [SKILL-DESIGN-SPEC.md](../_shared/SKILL-DESIGN-SPEC.md)
**Purpose**: Understand skill design standards before generating
**What to Read**:
- Skill structure conventions
- Naming standards
- Quality criteria
- Output format specifications
---
### Phase 1: Requirements Discovery
**Document**: 🔗 [phases/01-requirements-discovery.md](phases/01-requirements-discovery.md)
| Attribute | Value |
|-----------|-------|
| **Purpose** | Gather configuration from user via interactive prompts |
| **Input** | User responses (Skill name, purpose, execution mode) |
| **Output** | `skill-config.json` (configuration file) |
| **Key Decision** | Execution mode: Sequential vs Autonomous vs Hybrid |
---
### Phase 2: Structure Generation
**Document**: 🔗 [phases/02-structure-generation.md](phases/02-structure-generation.md)
| Attribute | Value |
|-----------|-------|
| **Purpose** | Create directory structure and entry file |
| **Input** | `skill-config.json` (from Phase 1) |
| **Output** | `.claude/skills/{skill-name}/` directory + `SKILL.md` |
---
### Phase 3: Phase/Action Generation
**Document**: 🔗 [phases/03-phase-generation.md](phases/03-phase-generation.md)
| Attribute | Value |
|-----------|-------|
| **Purpose** | Generate execution phases or actions based on mode |
| **Input** | `skill-config.json` + Templates |
| **Output** | Sequential: `phases/01-*.md` ... OR Autonomous: `phases/orchestrator.md` + `actions/*.md` |
**Decision Logic**:
```
IF execution_mode === "sequential":
└─ Generate sequential phases with linear flow
ELSE IF execution_mode === "autonomous":
└─ Generate orchestrator + independent actions
```
---
### Phase 4: Specs & Templates
**Document**: 🔗 [phases/04-specs-templates.md](phases/04-specs-templates.md)
| Attribute | Value |
|-----------|-------|
| **Purpose** | Generate domain specifications and template files |
| **Input** | `skill-config.json` (domain context) |
| **Output** | `specs/{skill-name}-requirements.md`, `specs/quality-standards.md` |
---
### Phase 5: Validation & Documentation
**Document**: 🔗 [phases/05-validation.md](phases/05-validation.md)
| Attribute | Value |
|-----------|-------|
| **Purpose** | Verify completeness and generate usage documentation |
| **Input** | All files from previous phases |
| **Output** | `README.md`, `validation-report.json` |
---
## Template Reference
| Template | Generated For | When Used |
|----------|--------------|-----------|
| [skill-md.md](templates/skill-md.md) | SKILL.md entry file | Phase 2 |
| [sequential-phase.md](templates/sequential-phase.md) | Sequential phase files | Phase 3 |
| [autonomous-orchestrator.md](templates/autonomous-orchestrator.md) | Orchestrator (autonomous) | Phase 3 |
| [autonomous-action.md](templates/autonomous-action.md) | Action files | Phase 3 |
| [code-analysis-action.md](templates/code-analysis-action.md) | Code analysis actions | Phase 3 |
| [llm-action.md](templates/llm-action.md) | LLM-powered actions | Phase 3 |
| [script-bash.md](templates/script-bash.md) | Bash scripts | Phase 3/4 |
| [script-python.md](templates/script-python.md) | Python scripts | Phase 3/4 |
## Output Structure
### Sequential Mode
```
.claude/skills/{skill-name}/
├── SKILL.md
├── SKILL.md # 入口文件
├── phases/
│ ├── 01-{step-one}.md
│ ├── 02-{step-two}.md
── 03-{step-three}.md
│ ├── _orchestrator.md # 声明式编排器
│ ├── workflow.json # 工作流定义
── 01-{step-one}.md # 阶段 1
│ ├── 02-{step-two}.md # 阶段 2
│ └── 03-{step-three}.md # 阶段 3
├── specs/
│ ├── {domain}-requirements.md
│ ├── {skill-name}-requirements.md
│ └── quality-standards.md
── templates/
└── agent-base.md
── templates/
└── agent-base.md
├── scripts/
└── README.md
```
### Autonomous Mode
```
.claude/skills/{skill-name}/
├── SKILL.md
├── SKILL.md # 入口文件
├── phases/
│ ├── orchestrator.md # 编排器:读取状态 → 选择动作
│ ├── state-schema.md # 状态结构定义
│ └── actions/ # 独立动作(无顺序)
│ ├── action-{a}.md
│ ├── action-{b}.md
│ └── action-{c}.md
│ ├── orchestrator.md # 编排器 (状态驱动)
│ ├── state-schema.md # 状态结构定义
│ └── actions/
│ ├── action-init.md
│ ├── action-create.md
│ └── action-list.md
├── specs/
│ ├── {domain}-requirements.md
│ ├── action-catalog.md # 动作目录(描述、前置条件、效果)
│ ├── {skill-name}-requirements.md
│ ├── action-catalog.md
│ └── quality-standards.md
── templates/
├── orchestrator-base.md # 编排器模板
└── action-base.md # 动作模板
```
── templates/
├── orchestrator-base.md
└── action-base.md
├── scripts/
└── README.md
```

View File

@@ -1,15 +1,4 @@
# Phase 1: Requirements Discovery
收集新 Skill 的需求信息,生成配置文件。
## Objective
- 收集 Skill 基本信息(名称、描述、触发词)
- 确定执行模式Sequential / Autonomous
- 定义阶段/动作
- 配置工具依赖和输出格式
## Execution Steps
### Step 1: 基本信息收集
@@ -228,12 +217,4 @@ Bash(`mkdir -p "${workDir}"`);
Write(`${workDir}/skill-config.json`, JSON.stringify(config, null, 2));
```
## Output
- **File**: `skill-config.json`
- **Location**: `.workflow/.scratchpad/skill-gen-{timestamp}/`
- **Format**: JSON
## Next Phase
→ [Phase 2: Structure Generation](02-structure-generation.md)

View File

@@ -8,9 +8,7 @@
- 生成 SKILL.md 入口文件
- 根据执行模式创建对应的子目录
## Input
- 依赖: `skill-config.json` (Phase 1 产出)
## Execution Steps
@@ -192,16 +190,4 @@ function generateReferenceTable(config) {
}
```
## Output
- **Directory**: `.claude/skills/{skill-name}/`
- **Files**:
- `SKILL.md` (入口文件)
- `phases/` (执行阶段目录)
- `specs/` (规范文档目录)
- `templates/` (模板目录)
- `scripts/` (脚本目录,存放 Python/Bash 确定性脚本)
## Next Phase
→ [Phase 3: Phase Generation](03-phase-generation.md)

View File

@@ -8,10 +8,7 @@
- Autonomous 模式:生成编排器和动作文件
- 支持 **文件上下文****内存上下文** 两种策略
## Input
- 依赖: `skill-config.json`, SKILL.md (Phase 1-2 产出)
- 模板: `templates/sequential-phase.md`, `templates/autonomous-*.md`
## 上下文策略 (P0 增强)
@@ -782,21 +779,4 @@ function getPreconditionCheck(action) {
}
```
## Output
### Sequential 模式
- `phases/_orchestrator.md` (声明式编排器)
- `workflow.json` (工作流定义)
- `phases/01-{step}.md`, `02-{step}.md`, ...
### Autonomous 模式
- `phases/orchestrator.md` (增强版编排器)
- `phases/state-schema.md`
- `specs/action-catalog.md` (声明式动作目录)
- `phases/actions/action-{name}.md` (多个)
## Next Phase
→ [Phase 4: Specs & Templates](04-specs-templates.md)

View File

@@ -1,26 +1,107 @@
# Phase 4: Specs & Templates Generation
# Phase 4: Specifications & Templates Generation
生成规范文件和模板文件。
Generate domain requirements, quality standards, agent templates, and action catalogs.
## Objective
- 生成领域规范 (`specs/{domain}-requirements.md`)
- 生成质量标准 (`specs/quality-standards.md`)
- 生成 Agent 模板 (`templates/agent-base.md`)
- Autonomous 模式额外生成动作目录 (`specs/action-catalog.md`)
Generate comprehensive specifications and templates:
- Domain requirements document with validation function
- Quality standards with automated check system
- Agent base template with prompt structure
- Action catalog for autonomous mode (conditional)
## Input
- 依赖: `skill-config.json`, SKILL.md, phases/*.md
**File Dependencies**:
- `skill-config.json` (from Phase 1)
- `.claude/skills/{skill-name}/` directory (from Phase 2)
- Generated phase/action files (from Phase 3)
## Execution Steps
**Required Information**:
- Skill name, display name, description
- Execution mode (determines if action-catalog.md is generated)
- Output format and location
- Phase/action definitions
### Step 1: 生成领域规范
## Output
**Generated Files**:
| File | Purpose | Generation Condition |
|------|---------|---------------------|
| `specs/{skill-name}-requirements.md` | Domain requirements with validation | Always |
| `specs/quality-standards.md` | Quality evaluation criteria | Always |
| `templates/agent-base.md` | Agent prompt template | Always |
| `specs/action-catalog.md` | Action dependency graph and selection priority | Autonomous/Hybrid mode only |
**File Structure**:
**Domain Requirements** (`specs/{skill-name}-requirements.md`):
```markdown
# {display_name} Requirements
- When to Use (phase/action reference table)
- Domain Requirements (功能要求, 输出要求, 质量要求)
- Validation Function (JavaScript code)
- Error Handling (recovery strategies)
```
**Quality Standards** (`specs/quality-standards.md`):
```markdown
# Quality Standards
- Quality Dimensions (Completeness 25%, Consistency 25%, Accuracy 25%, Usability 25%)
- Quality Gates (Pass ≥80%, Review 60-79%, Fail <60%)
- Issue Classification (Errors, Warnings, Info)
- Automated Checks (runQualityChecks function)
```
**Agent Base** (`templates/agent-base.md`):
```markdown
# Agent Base Template
- 通用 Prompt 结构 (ROLE, PROJECT CONTEXT, TASK, CONSTRAINTS, OUTPUT_FORMAT, QUALITY_CHECKLIST)
- 变量说明 (workDir, output_path)
- 返回格式 (AgentReturn interface)
- 角色定义参考 (phase/action specific agents)
```
**Action Catalog** (`specs/action-catalog.md`, Autonomous/Hybrid only):
```markdown
# Action Catalog
- Available Actions (table with Purpose, Preconditions, Effects)
- Action Dependencies (Mermaid diagram)
- State Transitions (state machine table)
- Selection Priority (ordered action list)
```
## Decision Logic
```
Decision (execution_mode check):
├─ mode === 'sequential' → Generate 3 files only
│ └─ Files: requirements.md, quality-standards.md, agent-base.md
├─ mode === 'autonomous' → Generate 4 files
│ ├─ Files: requirements.md, quality-standards.md, agent-base.md
│ └─ Additional: action-catalog.md (with action dependencies)
└─ mode === 'hybrid' → Generate 4 files
├─ Files: requirements.md, quality-standards.md, agent-base.md
└─ Additional: action-catalog.md (with hybrid logic)
```
## Execution Protocol
```javascript
// Phase 4: Generate Specifications & Templates
// Reference: phases/04-specs-templates.md
// Load config and setup
const config = JSON.parse(Read(`${workDir}/skill-config.json`));
const skillDir = `.claude/skills/${config.skill_name}`;
// Ensure specs and templates directories exist (created in Phase 2)
// skillDir structure: phases/, specs/, templates/
// Step 1: Generate domain requirements
const domainRequirements = `# ${config.display_name} Requirements
${config.description}
@@ -29,8 +110,8 @@ ${config.description}
| Phase | Usage | Reference |
|-------|-------|-----------|
${config.execution_mode === 'sequential' ?
config.sequential_config.phases.map((p, i) =>
${config.execution_mode === 'sequential' ?
config.sequential_config.phases.map((p, i) =>
`| Phase ${i+1} | ${p.name} | ${p.id}.md |`
).join('\n') :
`| Orchestrator | 动作选择 | orchestrator.md |
@@ -67,7 +148,7 @@ function validate${toPascalCase(config.skill_name)}(output) {
{ name: "格式正确", pass: output.format === "${config.output.format}" },
{ name: "内容完整", pass: output.content?.length > 0 }
];
return {
passed: checks.filter(c => c.pass).length,
total: checks.length,
@@ -86,11 +167,8 @@ function validate${toPascalCase(config.skill_name)}(output) {
`;
Write(`${skillDir}/specs/${config.skill_name}-requirements.md`, domainRequirements);
```
### Step 2: 生成质量标准
```javascript
// Step 2: Generate quality standards
const qualityStandards = `# Quality Standards
${config.display_name} 的质量评估标准。
@@ -176,7 +254,7 @@ function runQualityChecks(workDir) {
return {
score: results.overall,
gate: results.overall >= 80 ? 'pass' :
gate: results.overall >= 80 ? 'pass' :
results.overall >= 60 ? 'review' : 'fail',
details: results
};
@@ -185,11 +263,8 @@ function runQualityChecks(workDir) {
`;
Write(`${skillDir}/specs/quality-standards.md`, qualityStandards);
```
### Step 3: 生成 Agent 模板
```javascript
// Step 3: Generate agent base template
const agentBase = `# Agent Base Template
${config.display_name} 的 Agent 基础模板。
@@ -246,20 +321,17 @@ interface AgentReturn {
## 角色定义参考
${config.execution_mode === 'sequential' ?
config.sequential_config.phases.map((p, i) =>
config.sequential_config.phases.map((p, i) =>
`- **Phase ${i+1} Agent**: ${p.name} 专家`
).join('\n') :
config.autonomous_config.actions.map(a =>
config.autonomous_config.actions.map(a =>
`- **${a.name} Agent**: ${a.description || a.name + ' 执行者'}`
).join('\n')}
`;
Write(`${skillDir}/templates/agent-base.md`, agentBase);
```
### Step 4: Autonomous 模式 - 动作目录
```javascript
// Step 4: Conditional - Generate action catalog for autonomous/hybrid mode
if (config.execution_mode === 'autonomous' || config.execution_mode === 'hybrid') {
const actionCatalog = `# Action Catalog
@@ -269,7 +341,7 @@ ${config.display_name} 的可用动作目录。
| Action | Purpose | Preconditions | Effects |
|--------|---------|---------------|---------|
${config.autonomous_config.actions.map(a =>
${config.autonomous_config.actions.map(a =>
`| [${a.id}](../phases/actions/${a.id}.md) | ${a.description || a.name} | ${a.preconditions?.join(', ') || '-'} | ${a.effects?.join(', ') || '-'} |`
).join('\n')}
@@ -289,7 +361,7 @@ ${config.autonomous_config.actions.map((a, i, arr) => {
| From State | Action | To State |
|------------|--------|----------|
| pending | action-init | running |
${config.autonomous_config.actions.slice(1).map(a =>
${config.autonomous_config.actions.slice(1).map(a =>
`| running | ${a.id} | running |`
).join('\n')}
| running | action-complete | completed |
@@ -299,30 +371,28 @@ ${config.autonomous_config.actions.slice(1).map(a =>
当多个动作的前置条件都满足时,按以下优先级选择:
${config.autonomous_config.actions.map((a, i) =>
${config.autonomous_config.actions.map((a, i) =>
`${i + 1}. \`${a.id}\` - ${a.name}`
).join('\n')}
`;
Write(`${skillDir}/specs/action-catalog.md`, actionCatalog);
}
```
### Step 5: 辅助函数
```javascript
// Helper function
function toPascalCase(str) {
return str.split('-').map(s => s.charAt(0).toUpperCase() + s.slice(1)).join('');
}
// Phase output summary
console.log('Phase 4 complete: Generated specs and templates');
```
## Output
- `specs/{skill-name}-requirements.md` - 领域规范
- `specs/quality-standards.md` - 质量标准
- `specs/action-catalog.md` - 动作目录 (Autonomous 模式)
- `templates/agent-base.md` - Agent 模板
## Next Phase
→ [Phase 5: Validation](05-validation.md)
**Data Flow to Phase 5**:
- All generated files in `specs/` and `templates/`
- skill-config.json for validation reference
- Complete skill directory structure ready for final validation