refactor: Convert skill-generator from Chinese to English and remove emoji icons

- Convert all markdown files from Chinese to English
- Remove all emoji/icon decorations (🔧📋⚙️🏁🔍📚)
- Update all section headers, descriptions, and documentation
- Keep all content logic, structure, code examples unchanged
- Maintain template variables and file paths as-is

Files converted (9 files total):
- SKILL.md: Output structure comments
- templates/skill-md.md: All Chinese descriptions and comments
- specs/reference-docs-spec.md: All section headers and explanations
- phases/01-requirements-discovery.md through 05-validation.md (5 files)
- specs/execution-modes.md, skill-requirements.md, cli-integration.md, scripting-integration.md (4 files)
- templates/sequential-phase.md, autonomous-orchestrator.md, autonomous-action.md, code-analysis-action.md, llm-action.md, script-template.md (6 files)

All 16 files in skill-generator are now fully in English.
This commit is contained in:
catlog22
2026-01-29 15:42:46 +08:00
parent b791c09476
commit 9762445876
18 changed files with 2049 additions and 2066 deletions

View File

@@ -1,114 +1,125 @@
# Phase 1: Requirements Discovery
Collect basic skill information, configuration, and execution mode based on user input.
### Step 1: 基本信息收集
## Objective
- Collect skill basic information (name, description, trigger words)
- Determine execution mode (Sequential/Autonomous/Hybrid)
- Define phases or actions
- Generate initial configuration file
## Execution Steps
### Step 1: Basic Information Collection
```javascript
const basicInfo = await AskUserQuestion({
questions: [
{
question: "新 Skill 的名称是什么?(英文,小写-连字符格式,如 'api-docs'",
header: "Skill 名称",
question: "What is the name of the new Skill? (English, lowercase with hyphens, e.g., 'api-docs')",
header: "Skill Name",
multiSelect: false,
options: [
{ label: "自动生成", description: "根据后续描述自动生成名称" },
{ label: "手动输入", description: "现在输入自定义名称" }
{ label: "Auto-generate", description: "Generate name automatically based on description" },
{ label: "Manual Input", description: "Enter custom name now" }
]
},
{
question: "Skill 的主要用途是什么?",
header: "用途类型",
question: "What is the primary purpose of the Skill?",
header: "Purpose Type",
multiSelect: false,
options: [
{ label: "文档生成", description: "生成 Markdown/HTML 文档(如手册、报告)" },
{ label: "代码分析", description: "分析代码结构、质量、安全性" },
{ label: "交互管理", description: "管理 Issue、任务、工作流CRUD 操作)" },
{ label: "数据处理", description: "ETL、格式转换、报告生成" }
{ label: "Document Generation", description: "Generate Markdown/HTML documents (manuals, reports)" },
{ label: "Code Analysis", description: "Analyze code structure, quality, security" },
{ label: "Interactive Management", description: "Manage Issues, tasks, workflows (CRUD operations)" },
{ label: "Data Processing", description: "ETL, format conversion, report generation" }
]
}
]
});
// 如果选择手动输入,进一步询问
if (basicInfo["Skill 名称"] === "手动输入") {
// 用户会在 "Other" 中输入
// If manual input is selected, prompt further
if (basicInfo["Skill Name"] === "Manual Input") {
// User will input in "Other"
}
// 根据用途类型推断描述模板
// Infer description template based on purpose type
const purposeTemplates = {
"文档生成": "Generate {type} documents from {source}",
"代码分析": "Analyze {target} for {purpose}",
"交互管理": "Manage {entity} with interactive operations",
"数据处理": "Process {data} and generate {output}"
"Document Generation": "Generate {type} documents from {source}",
"Code Analysis": "Analyze {target} for {purpose}",
"Interactive Management": "Manage {entity} with interactive operations",
"Data Processing": "Process {data} and generate {output}"
};
```
### Step 2: 执行模式选择
### Step 2: Execution Mode Selection
```javascript
const modeInfo = await AskUserQuestion({
questions: [
{
question: "选择执行模式:",
header: "执行模式",
question: "Select execution mode:",
header: "Execution Mode",
multiSelect: false,
options: [
{
label: "Sequential (顺序模式)",
description: "阶段按固定顺序执行(收集→分析→生成),适合流水线任务(推荐)"
{
label: "Sequential (Sequential Mode)",
description: "Phases execute in fixed order (collect→analyze→generate), suitable for pipeline tasks (recommended)"
},
{
label: "Autonomous (自主模式)",
description: "动态选择执行路径,适合交互式任务(如 Issue 管理)"
{
label: "Autonomous (Autonomous Mode)",
description: "Dynamically select execution path, suitable for interactive tasks (e.g., Issue management)"
},
{
label: "Hybrid (混合模式)",
description: "初始化和收尾固定,中间交互灵活"
{
label: "Hybrid (Hybrid Mode)",
description: "Fixed initialization and finalization, flexible interaction in the middle"
}
]
}
]
});
const executionMode = modeInfo["执行模式"].includes("Sequential") ? "sequential" :
modeInfo["执行模式"].includes("Autonomous") ? "autonomous" : "hybrid";
const executionMode = modeInfo["Execution Mode"].includes("Sequential") ? "sequential" :
modeInfo["Execution Mode"].includes("Autonomous") ? "autonomous" : "hybrid";
```
### Step 3: 阶段/动作定义
### Step 3: Phase/Action Definition
#### Sequential 模式
#### Sequential Mode
```javascript
if (executionMode === "sequential") {
const phaseInfo = await AskUserQuestion({
questions: [
{
question: "需要多少个执行阶段?",
header: "阶段数量",
question: "How many execution phases are needed?",
header: "Phase Count",
multiSelect: false,
options: [
{ label: "3 阶段(简单)", description: "收集 → 处理 → 输出" },
{ label: "5 阶段(标准)", description: "收集 → 探索 → 分析 → 组装 → 验证" },
{ label: "7 阶段(完整)", description: "含并行处理、汇总、迭代优化" }
{ label: "3 Phases (Simple)", description: "Collection → Processing → Output" },
{ label: "5 Phases (Standard)", description: "Collection → Exploration → Analysis → Assembly → Validation" },
{ label: "7 Phases (Complete)", description: "Includes parallel processing, consolidation, iterative optimization" }
]
}
]
});
// 根据选择生成阶段定义
// Generate phase definitions based on selection
const phaseTemplates = {
"3 阶段": [
"3 Phases": [
{ id: "01-collection", name: "Data Collection" },
{ id: "02-processing", name: "Processing" },
{ id: "03-output", name: "Output Generation" }
],
"5 阶段": [
"5 Phases": [
{ id: "01-collection", name: "Requirements Collection" },
{ id: "02-exploration", name: "Project Exploration" },
{ id: "03-analysis", name: "Deep Analysis" },
{ id: "04-assembly", name: "Document Assembly" },
{ id: "05-validation", name: "Validation" }
],
"7 阶段": [
"7 Phases": [
{ id: "01-collection", name: "Requirements Collection" },
{ id: "02-exploration", name: "Project Exploration" },
{ id: "03-parallel", name: "Parallel Analysis" },
@@ -121,23 +132,23 @@ if (executionMode === "sequential") {
}
```
#### Autonomous 模式
#### Autonomous Mode
```javascript
if (executionMode === "autonomous") {
const actionInfo = await AskUserQuestion({
questions: [
{
question: "核心动作有哪些?(可多选)",
header: "动作定义",
question: "What are the core actions? (Multiple selection allowed)",
header: "Action Definition",
multiSelect: true,
options: [
{ label: "初始化 (init)", description: "设置初始状态" },
{ label: "列表 (list)", description: "显示当前项目列表" },
{ label: "创建 (create)", description: "创建新项目" },
{ label: "编辑 (edit)", description: "修改现有项目" },
{ label: "删除 (delete)", description: "删除项目" },
{ label: "搜索 (search)", description: "搜索/过滤项目" }
{ label: "Initialize (init)", description: "Set initial state" },
{ label: "List (list)", description: "Display current item list" },
{ label: "Create (create)", description: "Create new item" },
{ label: "Edit (edit)", description: "Modify existing item" },
{ label: "Delete (delete)", description: "Delete item" },
{ label: "Search (search)", description: "Search/filter items" }
]
}
]
@@ -145,37 +156,37 @@ if (executionMode === "autonomous") {
}
```
### Step 4: 工具和输出配置
### Step 4: Tool and Output Configuration
```javascript
const toolsInfo = await AskUserQuestion({
questions: [
{
question: "需要哪些特殊工具?(基础工具已默认包含)",
header: "工具选择",
question: "Which special tools are needed? (Basic tools are included by default)",
header: "Tool Selection",
multiSelect: true,
options: [
{ label: "用户交互 (AskUserQuestion)", description: "需要与用户对话" },
{ label: "Chrome 截图 (mcp__chrome__*)", description: "需要网页截图" },
{ label: "外部搜索 (mcp__exa__search)", description: "需要搜索外部信息" },
{ label: "无特殊需求", description: "仅使用基础工具" }
{ label: "User Interaction (AskUserQuestion)", description: "Need to dialog with user" },
{ label: "Chrome Screenshot (mcp__chrome__*)", description: "Need web page screenshots" },
{ label: "External Search (mcp__exa__search)", description: "Need to search external information" },
{ label: "No Special Requirements", description: "Use basic tools only" }
]
},
{
question: "输出格式是什么?",
header: "输出格式",
question: "What is the output format?",
header: "Output Format",
multiSelect: false,
options: [
{ label: "Markdown", description: "适合文档和报告" },
{ label: "HTML", description: "适合交互式文档" },
{ label: "JSON", description: "适合数据和配置" }
{ label: "Markdown", description: "Suitable for documents and reports" },
{ label: "HTML", description: "Suitable for interactive documents" },
{ label: "JSON", description: "Suitable for data and configuration" }
]
}
]
});
```
### Step 5: 生成配置文件
### Step 5: Generate Configuration File
```javascript
const config = {
@@ -184,41 +195,40 @@ const config = {
description: description,
triggers: triggers,
execution_mode: executionMode,
// 模式特定配置
// Mode-specific configuration
...(executionMode === "sequential" ? {
sequential_config: { phases: phases }
} : {
autonomous_config: {
autonomous_config: {
state_schema: stateSchema,
actions: actions,
termination_conditions: ["user_exit", "error_limit", "task_completed"]
}
}),
allowed_tools: [
"Task", "Read", "Write", "Glob", "Grep", "Bash",
...selectedTools
],
output: {
format: outputFormat.toLowerCase(),
location: `.workflow/.scratchpad/${skillName}-{timestamp}`,
filename_pattern: `{name}-output.${outputFormat === "HTML" ? "html" : outputFormat === "JSON" ? "json" : "md"}`
},
created_at: new Date().toISOString(),
version: "1.0.0"
};
// 写入配置文件
// Write configuration file
const workDir = `.workflow/.scratchpad/skill-gen-${timestamp}`;
Bash(`mkdir -p "${workDir}"`);
Write(`${workDir}/skill-config.json`, JSON.stringify(config, null, 2));
```
## Next Phase
→ [Phase 2: Structure Generation](02-structure-generation.md)

View File

@@ -1,41 +1,40 @@
# Phase 2: Structure Generation
根据配置创建 Skill 目录结构和入口文件。
Create Skill directory structure and entry file based on configuration.
## Objective
- 创建标准目录结构
- 生成 SKILL.md 入口文件
- 根据执行模式创建对应的子目录
- Create standard directory structure
- Generate SKILL.md entry file
- Create corresponding subdirectories based on execution mode
## Execution Steps
### Step 1: 读取配置
### Step 1: Read Configuration
```javascript
const config = JSON.parse(Read(`${workDir}/skill-config.json`));
const skillDir = `.claude/skills/${config.skill_name}`;
```
### Step 2: 创建目录结构
### Step 2: Create Directory Structure
#### 基础目录(所有模式)
#### Base Directories (All Modes)
```javascript
// 基础架构
// Base infrastructure
Bash(`mkdir -p "${skillDir}/{phases,specs,templates,scripts}"`);
```
#### 执行模式特定目录
#### Execution Mode-Specific Directories
```
config.execution_mode
├─ "sequential"
│ ↓ Creates:
│ └─ phases/ (基础目录已包含)
│ └─ phases/ (base directory already included)
│ ├─ _orchestrator.md
│ └─ workflow.json
@@ -43,36 +42,36 @@ config.execution_mode
↓ Creates:
└─ phases/actions/
├─ state-schema.md
└─ *.md (动作文件)
└─ *.md (action files)
```
```javascript
// Autonomous/Hybrid 模式额外目录
// Additional directories for Autonomous/Hybrid mode
if (config.execution_mode === 'autonomous' || config.execution_mode === 'hybrid') {
Bash(`mkdir -p "${skillDir}/phases/actions"`);
}
```
#### Context Strategy 特定目录 (P0 增强)
#### Context Strategy-Specific Directories (P0 Enhancement)
```javascript
// ========== P0: 根据上下文策略创建目录 ==========
// ========== P0: Create directories based on context strategy ==========
const contextStrategy = config.context_strategy || 'file';
if (contextStrategy === 'file') {
// 文件策略:创建上下文持久化目录
// File strategy: Create persistent context directory
Bash(`mkdir -p "${skillDir}/.scratchpad-template/context"`);
// 创建上下文模板文件
// Create context template file
Write(
`${skillDir}/.scratchpad-template/context/.gitkeep`,
"# Runtime context storage for file-based strategy"
);
}
// 内存策略无需创建目录 (in-memory only)
// Memory strategy does not require directory creation (in-memory only)
```
**目录树视图**:
**Directory Tree View**:
```
Sequential + File Strategy:
@@ -83,7 +82,7 @@ Sequential + File Strategy:
│ ├── 01-*.md
│ └── 02-*.md
├── .scratchpad-template/
│ └── context/ File strategy persistent storage
│ └── context/ <- File strategy persistent storage
└── specs/
Autonomous + Memory Strategy:
@@ -96,7 +95,7 @@ Autonomous + Memory Strategy:
└── specs/
```
### Step 3: 生成 SKILL.md
### Step 3: Generate SKILL.md
```javascript
const skillMdTemplate = `---
@@ -130,8 +129,8 @@ const timestamp = new Date().toISOString().slice(0,19).replace(/[-:T]/g, '');
const workDir = \`${config.output.location.replace('{timestamp}', '${timestamp}')}\`;
Bash(\`mkdir -p "\${workDir}"\`);
${config.execution_mode === 'sequential' ?
`Bash(\`mkdir -p "\${workDir}/sections"\`);` :
${config.execution_mode === 'sequential' ?
`Bash(\`mkdir -p "\${workDir}/sections"\`);` :
`Bash(\`mkdir -p "\${workDir}/state"\`);`}
\`\`\`
@@ -149,53 +148,53 @@ ${generateReferenceTable(config)}
Write(`${skillDir}/SKILL.md`, skillMdTemplate);
```
### Step 4: 架构图生成函数
### Step 4: Architecture Diagram Generation Functions
```javascript
function generateArchitectureDiagram(config) {
if (config.execution_mode === 'sequential') {
return config.sequential_config.phases.map((p, i) =>
return config.sequential_config.phases.map((p, i) =>
`│ Phase ${i+1}: ${p.name.padEnd(15)}${p.output || 'output-' + (i+1) + '.json'}${' '.repeat(10)}`
).join('\n│ ↓' + ' '.repeat(45) + '│\n');
} else {
return `
┌─────────────────────────────────────────────────────────────────┐
│ Orchestrator (状态驱动决策)
│ Orchestrator (State-driven decision-making)
└───────────────┬─────────────────────────────────────────────────┘
┌───────────┼───────────┐
↓ ↓ ↓
${config.autonomous_config.actions.slice(0, 3).map(a =>
${config.autonomous_config.actions.slice(0, 3).map(a =>
`┌─────────┐ `).join('')}
${config.autonomous_config.actions.slice(0, 3).map(a =>
${config.autonomous_config.actions.slice(0, 3).map(a =>
`${a.name.slice(0, 7).padEnd(7)}`).join('')}
${config.autonomous_config.actions.slice(0, 3).map(a =>
${config.autonomous_config.actions.slice(0, 3).map(a =>
`└─────────┘ `).join('')}`;
}
}
function generateDesignPrinciples(config) {
const common = [
"1. **规范遵循**: 严格遵循 `_shared/SKILL-DESIGN-SPEC.md`",
"2. **简要返回**: Agent 返回路径+摘要,避免上下文溢出"
"1. **Specification Compliance**: Strictly follow `_shared/SKILL-DESIGN-SPEC.md`",
"2. **Brief Return**: Agent returns path+summary, avoiding context overflow"
];
if (config.execution_mode === 'sequential') {
return [...common,
"3. **阶段隔离**: 每个阶段独立可测",
"4. **链式输出**: 阶段产出作为下阶段输入"
"3. **Phase Isolation**: Each phase is independently testable",
"4. **Chained Output**: Phase output becomes next phase input"
].join('\n');
} else {
return [...common,
"3. **状态驱动**: 显式状态管理,动态决策",
"4. **动作独立**: 每个动作无副作用依赖"
"3. **State-driven**: Explicit state management, dynamic decision-making",
"4. **Action Independence**: Each action has no side-effect dependencies"
].join('\n');
}
}
function generateExecutionFlow(config) {
if (config.execution_mode === 'sequential') {
return '```\n' + config.sequential_config.phases.map((p, i) =>
return '```\n' + config.sequential_config.phases.map((p, i) =>
`├─ Phase ${i+1}: ${p.name}\n│ → Output: ${p.output || 'output.json'}`
).join('\n') + '\n```';
} else {
@@ -216,9 +215,9 @@ function generateExecutionFlow(config) {
function generateOutputStructure(config) {
const base = `${config.output.location}/
├── ${config.execution_mode === 'sequential' ? 'sections/' : 'state.json'}`;
if (config.execution_mode === 'sequential') {
return base + '\n' + config.sequential_config.phases.map(p =>
return base + '\n' + config.sequential_config.phases.map(p =>
`│ └── ${p.output || 'section-' + p.id + '.md'}`
).join('\n') + `\n└── ${config.output.filename_pattern}`;
} else {
@@ -230,22 +229,22 @@ function generateOutputStructure(config) {
function generateReferenceTable(config) {
const rows = [];
if (config.execution_mode === 'sequential') {
config.sequential_config.phases.forEach(p => {
rows.push(`| [phases/${p.id}.md](phases/${p.id}.md) | ${p.name} |`);
});
} else {
rows.push(`| [phases/orchestrator.md](phases/orchestrator.md) | 编排器 |`);
rows.push(`| [phases/state-schema.md](phases/state-schema.md) | 状态定义 |`);
rows.push(`| [phases/orchestrator.md](phases/orchestrator.md) | Orchestrator |`);
rows.push(`| [phases/state-schema.md](phases/state-schema.md) | State Definition |`);
config.autonomous_config.actions.forEach(a => {
rows.push(`| [phases/actions/${a.id}.md](phases/actions/${a.id}.md) | ${a.name} |`);
});
}
rows.push(`| [specs/${config.skill_name}-requirements.md](specs/${config.skill_name}-requirements.md) | 领域规范 |`);
rows.push(`| [specs/quality-standards.md](specs/quality-standards.md) | 质量标准 |`);
rows.push(`| [specs/${config.skill_name}-requirements.md](specs/${config.skill_name}-requirements.md) | Domain Requirements |`);
rows.push(`| [specs/quality-standards.md](specs/quality-standards.md) | Quality Standards |`);
return `| Document | Purpose |\n|----------|---------||\n` + rows.join('\n');
}
```

File diff suppressed because it is too large Load Diff

View File

@@ -40,7 +40,7 @@ Generate comprehensive specifications and templates:
```markdown
# {display_name} Requirements
- When to Use (phase/action reference table)
- Domain Requirements (功能要求, 输出要求, 质量要求)
- Domain Requirements (Functional requirements, Output requirements, Quality requirements)
- Validation Function (JavaScript code)
- Error Handling (recovery strategies)
```
@@ -57,10 +57,10 @@ Generate comprehensive specifications and templates:
**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)
- Universal Prompt Structure (ROLE, PROJECT CONTEXT, TASK, CONSTRAINTS, OUTPUT_FORMAT, QUALITY_CHECKLIST)
- Variable Description (workDir, output_path)
- Return Format (AgentReturn interface)
- Role Definition Reference (phase/action specific agents)
```
**Action Catalog** (`specs/action-catalog.md`, Autonomous/Hybrid only):
@@ -114,39 +114,39 @@ ${config.execution_mode === 'sequential' ?
config.sequential_config.phases.map((p, i) =>
`| Phase ${i+1} | ${p.name} | ${p.id}.md |`
).join('\n') :
`| Orchestrator | 动作选择 | orchestrator.md |
| Actions | 动作执行 | actions/*.md |`}
`| Orchestrator | Action selection | orchestrator.md |
| Actions | Action execution | actions/*.md |`}
---
## Domain Requirements
### 功能要求
### Functional Requirements
- [ ] 要求1: TODO
- [ ] 要求2: TODO
- [ ] 要求3: TODO
- [ ] Requirement 1: TODO
- [ ] Requirement 2: TODO
- [ ] Requirement 3: TODO
### 输出要求
### Output Requirements
- [ ] 格式: ${config.output.format}
- [ ] 位置: ${config.output.location}
- [ ] 命名: ${config.output.filename_pattern}
- [ ] Format: ${config.output.format}
- [ ] Location: ${config.output.location}
- [ ] Naming: ${config.output.filename_pattern}
### 质量要求
### Quality Requirements
- [ ] 完整性: 所有必需内容存在
- [ ] 一致性: 术语和格式统一
- [ ] 准确性: 内容基于实际分析
- [ ] Completeness: All necessary content exists
- [ ] Consistency: Terminology and format unified
- [ ] Accuracy: Content based on actual analysis
## Validation Function
\`\`\`javascript
function validate${toPascalCase(config.skill_name)}(output) {
const checks = [
// TODO: 添加验证规则
{ name: "格式正确", pass: output.format === "${config.output.format}" },
{ name: "内容完整", pass: output.content?.length > 0 }
// TODO: Add validation rules
{ name: "Format correct", pass: output.format === "${config.output.format}" },
{ name: "Content complete", pass: output.content?.length > 0 }
];
return {
@@ -161,9 +161,9 @@ function validate${toPascalCase(config.skill_name)}(output) {
| Error | Recovery |
|-------|----------|
| 输入数据缺失 | 返回明确错误信息 |
| 处理超时 | 缩小范围,重试 |
| 输出验证失败 | 记录问题,人工审核 |
| Missing input data | Return clear error message |
| Processing timeout | Reduce scope, retry |
| Output validation failure | Log issue, manual review |
`;
Write(`${skillDir}/specs/${config.skill_name}-requirements.md`, domainRequirements);
@@ -171,68 +171,68 @@ Write(`${skillDir}/specs/${config.skill_name}-requirements.md`, domainRequiremen
// Step 2: Generate quality standards
const qualityStandards = `# Quality Standards
${config.display_name} 的质量评估标准。
Quality assessment standards for ${config.display_name}.
## Quality Dimensions
### 1. Completeness (完整性) - 25%
### 1. Completeness (Completeness) - 25%
| 要求 | 权重 | 检查方式 |
|------|------|----------|
| 所有必需输出存在 | 10 | 文件检查 |
| 内容覆盖完整 | 10 | 内容分析 |
| 无占位符残留 | 5 | 文本搜索 |
| Requirement | Weight | Validation Method |
|------------|--------|-----------------|
| All necessary outputs exist | 10 | File check |
| Content coverage complete | 10 | Content analysis |
| No placeholder remnants | 5 | Text search |
### 2. Consistency (一致性) - 25%
### 2. Consistency (Consistency) - 25%
| 方面 | 检查 |
|------|------|
| 术语 | 同一概念使用相同术语 |
| 格式 | 标题层级、代码块格式一致 |
| 风格 | 语气和表达方式统一 |
| Aspect | Check |
|--------|-------|
| Terminology | Use same term for same concept |
| Format | Title levels, code block format consistent |
| Style | Tone and expression unified |
### 3. Accuracy (准确性) - 25%
### 3. Accuracy (Accuracy) - 25%
| 要求 | 说明 |
|------|------|
| 数据正确 | 引用和数据无错误 |
| 逻辑正确 | 流程和关系描述准确 |
| 代码正确 | 代码示例可运行 |
| Requirement | Description |
|-------------|------------|
| Data correct | References and data error-free |
| Logic correct | Process and relationship descriptions accurate |
| Code correct | Code examples runnable |
### 4. Usability (可用性) - 25%
### 4. Usability (Usability) - 25%
| 指标 | 目标 |
|------|------|
| 可读性 | 结构清晰,易于理解 |
| 可导航 | 目录和链接正确 |
| 可操作 | 步骤明确,可执行 |
| Metric | Goal |
|--------|------|
| Readability | Clear structure, easy to understand |
| Navigability | Table of contents and links correct |
| Operability | Steps clear, executable |
## Quality Gates
| Gate | Threshold | Action |
|------|-----------|--------|
| Pass | 80% | 输出最终产物 |
| Review | 60-79% | 处理警告后继续 |
| Fail | < 60% | 必须修复 |
| Pass | >= 80% | Output final deliverables |
| Review | 60-79% | Process warnings then continue |
| Fail | < 60% | Must fix |
## Issue Classification
### Errors (Must Fix)
- 必需输出缺失
- 数据错误
- 代码不可运行
- Necessary output missing
- Data error
- Code not runnable
### Warnings (Should Fix)
- 格式不一致
- 内容深度不足
- 缺少示例
- Format inconsistency
- Content depth insufficient
- Missing examples
### Info (Nice to Have)
- 优化建议
- 增强机会
- Optimization suggestions
- Enhancement opportunities
## Automated Checks
@@ -267,44 +267,44 @@ Write(`${skillDir}/specs/quality-standards.md`, qualityStandards);
// Step 3: Generate agent base template
const agentBase = `# Agent Base Template
${config.display_name} 的 Agent 基础模板。
Agent base template for ${config.display_name}.
## 通用 Prompt 结构
## Universal Prompt Structure
\`\`\`
[ROLE] 你是{角色},专注于{职责}。
[ROLE] You are {role}, focused on {responsibility}.
[PROJECT CONTEXT]
Skill: ${config.skill_name}
目标: ${config.description}
Objective: ${config.description}
[TASK]
{任务描述}
- 输出: {output_path}
- 格式: ${config.output.format}
{task description}
- Output: {output_path}
- Format: ${config.output.format}
[CONSTRAINTS]
- 约束1
- 约束2
- Constraint 1
- Constraint 2
[OUTPUT_FORMAT]
1. 执行任务
2. 返回 JSON 简要信息
1. Execute task
2. Return JSON summary information
[QUALITY_CHECKLIST]
- [ ] 输出格式正确
- [ ] 内容完整无遗漏
- [ ] 无占位符残留
- [ ] Output format correct
- [ ] Content complete without omission
- [ ] No placeholder remnants
\`\`\`
## 变量说明
## Variable Description
| 变量 | 来源 | 示例 |
|------|------|------|
| {workDir} | 运行时 | .workflow/.scratchpad/${config.skill_name}-xxx |
| {output_path} | 配置 | ${config.output.location}/${config.output.filename_pattern} |
| Variable | Source | Example |
|----------|--------|---------|
| {workDir} | Runtime | .workflow/.scratchpad/${config.skill_name}-xxx |
| {output_path} | Configuration | ${config.output.location}/${config.output.filename_pattern} |
## 返回格式
## Return Format
\`\`\`typescript
interface AgentReturn {
@@ -318,14 +318,14 @@ interface AgentReturn {
}
\`\`\`
## 角色定义参考
## Role Definition Reference
${config.execution_mode === 'sequential' ?
config.sequential_config.phases.map((p, i) =>
`- **Phase ${i+1} Agent**: ${p.name} 专家`
`- **Phase ${i+1} Agent**: ${p.name} Expert`
).join('\n') :
config.autonomous_config.actions.map(a =>
`- **${a.name} Agent**: ${a.description || a.name + ' 执行者'}`
`- **${a.name} Agent**: ${a.description || a.name + ' Executor'}`
).join('\n')}
`;
@@ -335,7 +335,7 @@ Write(`${skillDir}/templates/agent-base.md`, agentBase);
if (config.execution_mode === 'autonomous' || config.execution_mode === 'hybrid') {
const actionCatalog = `# Action Catalog
${config.display_name} 的可用动作目录。
Available action catalog for ${config.display_name}.
## Available Actions
@@ -350,9 +350,9 @@ ${config.autonomous_config.actions.map(a =>
\`\`\`mermaid
graph TD
${config.autonomous_config.actions.map((a, i, arr) => {
if (i === 0) return ` ${a.id.replace(/-/g, '_')}[${a.name}]`;
if (i === 0) return \` ${a.id.replace(/-/g, '_')}[${a.name}]\`;
const prev = arr[i-1];
return ` ${prev.id.replace(/-/g, '_')} --> ${a.id.replace(/-/g, '_')}[${a.name}]`;
return \` ${prev.id.replace(/-/g, '_')} --> ${a.id.replace(/-/g, '_')}[${a.name}]\`;
}).join('\n')}
\`\`\`
@@ -369,10 +369,10 @@ ${config.autonomous_config.actions.slice(1).map(a =>
## Selection Priority
当多个动作的前置条件都满足时,按以下优先级选择:
When multiple actions' preconditions are met, select based on the following priority:
${config.autonomous_config.actions.map((a, i) =>
`${i + 1}. \`${a.id}\` - ${a.name}`
\`${i + 1}. \\\`${a.id}\\\` - ${a.name}\`
).join('\n')}
`;

View File

@@ -246,16 +246,16 @@ function collectIssues(fileResults, contentResults) {
const issues = [];
fileResults.filter(f => !f.exists).forEach(f => {
issues.push({ type: 'ERROR', message: `文件缺失: ${f.file}` });
issues.push({ type: 'ERROR', message: `Missing file: ${f.file}` });
});
fileResults.filter(f => f.hasTodo).forEach(f => {
issues.push({ type: 'WARNING', message: `包含 TODO: ${f.file}` });
issues.push({ type: 'WARNING', message: `Contains TODO: ${f.file}` });
});
contentResults.forEach(c => {
c.checks.filter(ch => !ch.pass).forEach(ch => {
issues.push({ type: 'WARNING', message: `${c.file}: 缺少 ${ch.name}` });
issues.push({ type: 'WARNING', message: `${c.file}: Missing ${ch.name}` });
});
});
@@ -266,12 +266,12 @@ function generateRecommendations(fileResults, contentResults) {
const recommendations = [];
if (fileResults.some(f => f.hasTodo)) {
recommendations.push('替换所有 TODO 占位符为实际内容');
recommendations.push('Replace all TODO placeholders with actual content');
}
contentResults.forEach(c => {
if (c.checks.some(ch => !ch.pass)) {
recommendations.push(`完善 ${c.file} 的结构`);
recommendations.push(`Improve structure of ${c.file}`);
}
});
@@ -285,81 +285,81 @@ ${config.description}
## Quick Start
### 触发词
### Trigger Words
${config.triggers.map(t => `- "${t}"`).join('\n')}
### 执行模式
### Execution Mode
**${config.execution_mode === 'sequential' ? 'Sequential (顺序)' : 'Autonomous (自主)'}**
**${config.execution_mode === 'sequential' ? 'Sequential (Sequential)' : 'Autonomous (Autonomous)'}**
${config.execution_mode === 'sequential' ?
`阶段按固定顺序执行:\n${config.sequential_config.phases.map((p, i) =>
`${i + 1}. ${p.name}`
).join('\n')}` :
`动作由编排器动态选择:\n${config.autonomous_config.actions.map(a =>
`- ${a.name}: ${a.description || ''}`
).join('\n')}`}
\`Phases execute in fixed order:\n\${config.sequential_config.phases.map((p, i) =>
\`\${i + 1}. \${p.name}\`
).join('\n')}\` :
\`Actions selected dynamically by orchestrator:\n\${config.autonomous_config.actions.map(a =>
\`- \${a.name}: \${a.description || ''}\`
).join('\n')}\`}
## Usage
\`\`\`
# 直接触发
用户: ${config.triggers[0]}
# Direct trigger
User: ${config.triggers[0]}
# 或使用 Skill 名称
用户: /skill ${config.skill_name}
# Or use Skill name
User: /skill ${config.skill_name}
\`\`\`
## Output
- **格式**: ${config.output.format}
- **位置**: \`${config.output.location}\`
- **文件名**: \`${config.output.filename_pattern}\`
- **Format**: ${config.output.format}
- **Location**: \`${config.output.location}\`
- **Filename**: \`${config.output.filename_pattern}\`
## Directory Structure
\`\`\`
.claude/skills/${config.skill_name}/
├── SKILL.md # 入口文件
├── phases/ # 执行阶段
├── SKILL.md # Entry file
├── phases/ # Execution phases
${config.execution_mode === 'sequential' ?
config.sequential_config.phases.map(p => `│ ├── ${p.id}.md`).join('\n') :
`│ ├── orchestrator.md
config.sequential_config.phases.map(p => \`│ ├── \${p.id}.md\`).join('\n') :
\`│ ├── orchestrator.md
│ ├── state-schema.md
│ └── actions/
${config.autonomous_config.actions.map(a => `│ ├── ${a.id}.md`).join('\n')}`}
├── specs/ # 规范文件
\${config.autonomous_config.actions.map(a => \`│ ├── \${a.id}.md\`).join('\n')}\`}
├── specs/ # Specification files
│ ├── ${config.skill_name}-requirements.md
│ ├── quality-standards.md
${config.execution_mode === 'autonomous' ? '│ └── action-catalog.md' : ''}
└── templates/ # 模板文件
└── templates/ # Template files
└── agent-base.md
\`\`\`
## Customization
### 修改执行逻辑
### Modify Execution Logic
编辑 \`phases/\` 目录下的阶段文件。
Edit phase files in the \`phases/\` directory.
### 调整质量标准
### Adjust Quality Standards
编辑 \`specs/quality-standards.md\`
Edit \`specs/quality-standards.md\`.
### 添加新${config.execution_mode === 'sequential' ? '阶段' : '动作'}
### Add New ${config.execution_mode === 'sequential' ? 'Phase' : 'Action'}
${config.execution_mode === 'sequential' ?
`1. \`phases/\` 创建新的阶段文件 (如 \`03.5-new-step.md\`)
2. 更新 SKILL.md 的执行流程` :
`1. \`phases/actions/\` 创建新的动作文件
2. 更新 \`specs/action-catalog.md\`
3. \`phases/orchestrator.md\` 添加选择逻辑`}
\`1. Create new phase file in \`phases/\` (e.g., \`03.5-new-step.md\`)
2. Update execution flow in SKILL.md\` :
\`1. Create new action file in \`phases/actions/\`
2. Update \`specs/action-catalog.md\`
3. Add selection logic in \`phases/orchestrator.md\`\`}
## Related Documents
- [设计规范](../_shared/SKILL-DESIGN-SPEC.md)
- [执行模式规范](specs/../../../skill-generator/specs/execution-modes.md)
- [Design Specification](../_shared/SKILL-DESIGN-SPEC.md)
- [Execution Modes Specification](specs/../../../skill-generator/specs/execution-modes.md)
---
@@ -383,20 +383,20 @@ const finalResult = {
validation: report.summary,
next_steps: [
'1. 审阅生成的文件结构',
'2. 替换 TODO 占位符',
'3. 根据实际需求调整阶段逻辑',
'4. 测试 Skill 执行流程',
'5. 更新触发词和描述'
'1. Review generated file structure',
'2. Replace TODO placeholders',
'3. Adjust phase logic based on actual requirements',
'4. Test Skill execution flow',
'5. Update trigger words and descriptions'
]
};
console.log('=== Skill 生成完成 ===');
console.log(`路径: ${skillDir}`);
console.log(`模式: ${config.execution_mode}`);
console.log(`状态: ${report.summary.status}`);
console.log('=== Skill Generation Complete ===');
console.log(\`Path: \${skillDir}\`);
console.log(\`Mode: \${config.execution_mode}\`);
console.log(\`Status: \${report.summary.status}\`);
console.log('');
console.log('下一步:');
console.log('Next Steps:');
finalResult.next_steps.forEach(s => console.log(s));
```