mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +08:00
- Introduced a comprehensive template for autonomous actions, detailing structure, execution, and error handling. - Added an orchestrator template to manage state and decision logic for autonomous actions. - Created a sequential phase template to outline execution steps and objectives for structured workflows. - Developed a skill documentation template to standardize the generation of skill entry files. - Implemented a Python script to compare search results between hybrid and cascade methods, analyzing ranking changes.
4.8 KiB
4.8 KiB
SKILL.md Template
用于生成新 Skill 入口文件的模板。
模板结构
---
name: {{skill_name}}
description: {{description}}. Triggers on {{triggers}}.
allowed-tools: {{allowed_tools}}
---
# {{display_name}}
{{description}}
## Architecture Overview
\`\`\`
{{architecture_diagram}}
\`\`\`
## Key Design Principles
{{design_principles}}
## Execution Flow
{{execution_flow}}
## Directory Setup
\`\`\`javascript
const timestamp = new Date().toISOString().slice(0,19).replace(/[-:T]/g, '');
const workDir = `{{output_location}}`;
Bash(`mkdir -p "${workDir}"`);
{{additional_dirs}}
\`\`\`
## Output Structure
\`\`\`
{{output_structure}}
\`\`\`
## Reference Documents
{{reference_table}}
变量说明
| 变量 | 类型 | 来源 |
|---|---|---|
{{skill_name}} |
string | config.skill_name |
{{display_name}} |
string | config.display_name |
{{description}} |
string | config.description |
{{triggers}} |
string | config.triggers.join(", ") |
{{allowed_tools}} |
string | config.allowed_tools.join(", ") |
{{architecture_diagram}} |
string | 根据 execution_mode 生成 |
{{design_principles}} |
string | 根据 execution_mode 生成 |
{{execution_flow}} |
string | 根据 phases/actions 生成 |
{{output_location}} |
string | config.output.location |
{{additional_dirs}} |
string | 根据 execution_mode 生成 |
{{output_structure}} |
string | 根据配置生成 |
{{reference_table}} |
string | 根据文件列表生成 |
生成函数
function generateSkillMd(config) {
const template = Read('templates/skill-md.md');
return template
.replace(/\{\{skill_name\}\}/g, config.skill_name)
.replace(/\{\{display_name\}\}/g, config.display_name)
.replace(/\{\{description\}\}/g, config.description)
.replace(/\{\{triggers\}\}/g, config.triggers.map(t => `"${t}"`).join(", "))
.replace(/\{\{allowed_tools\}\}/g, config.allowed_tools.join(", "))
.replace(/\{\{architecture_diagram\}\}/g, generateArchitecture(config))
.replace(/\{\{design_principles\}\}/g, generatePrinciples(config))
.replace(/\{\{execution_flow\}\}/g, generateFlow(config))
.replace(/\{\{output_location\}\}/g, config.output.location)
.replace(/\{\{additional_dirs\}\}/g, generateAdditionalDirs(config))
.replace(/\{\{output_structure\}\}/g, generateOutputStructure(config))
.replace(/\{\{reference_table\}\}/g, generateReferenceTable(config));
}
Sequential 模式示例
---
name: api-docs-generator
description: Generate API documentation from source code. Triggers on "generate api docs", "api documentation".
allowed-tools: Task, Read, Write, Glob, Grep, Bash
---
# API Docs Generator
Generate API documentation from source code.
## Architecture Overview
\`\`\`
┌─────────────────────────────────────────────────────────────────┐
│ Phase 1: Scanning → endpoints.json │
│ ↓ │
│ Phase 2: Parsing → schemas.json │
│ ↓ │
│ Phase 3: Generation → api-docs.md │
└─────────────────────────────────────────────────────────────────┘
\`\`\`
Autonomous 模式示例
---
name: task-manager
description: Interactive task management with CRUD operations. Triggers on "manage tasks", "task list".
allowed-tools: Task, AskUserQuestion, Read, Write
---
# Task Manager
Interactive task management with CRUD operations.
## Architecture Overview
\`\`\`
┌─────────────────────────────────────────────────────────────────┐
│ Orchestrator (状态驱动决策) │
└───────────────┬─────────────────────────────────────────────────┘
│
┌───────────┼───────────┬───────────┐
↓ ↓ ↓ ↓
┌───────┐ ┌───────┐ ┌───────┐ ┌───────┐
│ List │ │Create │ │ Edit │ │Delete │
└───────┘ └───────┘ └───────┘ └───────┘
\`\`\`