Prerequisite Protocol
Environment Detection
PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || echo "unknown")
BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
echo "PROJECT: $PROJECT_ROOT"
echo "BRANCH: $BRANCH"
echo "COMMIT: $COMMIT"
Artifact Directory Initialization
mkdir -p memory/artifacts/pilot
Experience Retrieval (Recommended)
Trigger Timing: Before analyzing the task type, prepare best practices for the current task
Recommended Action: Call the experience-manager skill to retrieve relevant experience
Execution Steps:
-
Extract task keywords
从用户请求中提取: - 核心任务关键词 - 技术栈关键词 - 问题类型关键词 -
Write request artifact
Write( file_path="memory/artifacts/pilot/experience-request.json", content={ "requesting_skill": "pilot", "action": "retrieve", "task_keywords": ["关键词1", "关键词2"], "task_type": "bugfix|feature|refactor", "technologies": ["Technology1", "Technology2"] } ) -
Read experience results
result = Read("memory/artifacts/experience-manager/experience-result.json") -
Apply to skill recommendations
基于历史经验,推荐以下技能链: 1. /investigate - 快速定位问题(历史成功率 90%) 2. /first-principles - 分析根本原因(历史应用 5 次) 3. /pdca-cycle - 迭代优化 ⚠️ 预防措施(来自历史经验): - 新项目优先检查国际化配置 - 使用标准配置模板
Value: Optimize skill recommendations based on historical experience to improve the success rate.
Error Prevention (Automatic)
Trigger Timing: When a potential error risk is detected
Automatic Action: Call experience-manager to obtain prevention suggestions
Execution Steps:
-
Detect risk
在分析任务类型时,检测常见的错误风险: - 缺少配置检查 - 使用了已废弃的API - 忽略了边界情况 -
Write prevention request
Write( file_path="memory/artifacts/pilot/error-prevention-request.json", content={ "requesting_skill": "pilot", "action": "prevent", "current_step": "任务分析", "context": { "technology": "...", "feature": "...", "risk_factors": [...] } } ) -
Display prevention suggestions
## 💡 错误预防提醒 检测到潜在风险:国际化配置缺失 **预防措施**: - 优先检查 next.config.js 中的 i18n 配置 - 使用标准配置模板 **历史错误**:2026-03-20 类似错误
Value: Prevent errors in advance and avoid repeating the same pitfalls.
Overview
Intelligently analyze user requests, recommend the best methodology skill combinations, and achieve collaborative skill work.
Core Value:
- Automatically identify task types
- Recommend optimal skill chains
- Provide execution context
- Reduce decision burden
Core Principle: Let skills work collaboratively to achieve a 1+1>2 effect.
When to Use
Applicable Scenarios:
- The user initiates any task request
- The user is unsure which skill to use
- The user wants skill recommendations
- A complex task requires multiple skills to work together
Inapplicable Scenarios:
- The user has explicitly specified the skill to use
- Simple Q&A or information queries
The Process
digraph orchestrator {
rankdir=TB;
"用户请求" [shape=box, style=filled, fillcolor="#c8e6c9"];
"分析任务类型" [shape=diamond, style=filled, fillcolor="#bbdefb"];
"匹配技能模板" [shape=box, style=filled, fillcolor="#fff9c4"];
"推荐技能链" [shape=box, style=filled, fillcolor="#f8bbd0"];
"用户确认" [shape=diamond, style=filled, fillcolor="#e1bee7"];
"执行技能链" [shape=box, style=filled, fillcolor="#81c784"];
"保存工件" [shape=box, style=filled, fillcolor="#81c784"];
"用户请求" -> "分析任务类型";
"分析任务类型" -> "匹配技能模板";
"匹配技能模板" -> "推荐技能链";
"推荐技能链" -> "用户确认";
"用户确认" -> "执行技能链" [label="确认"];
"执行技能链" -> "保存工件";
}
Detailed Steps
Step 1: Analyze Task Type
Identify the task type:
- 🎯 Clear goal →
goal-oriented - 💡 Requires innovation →
first-principles - 🏗️ Architecture design →
ddd-strategic-design - 🔧 Implementation details →
ddd-tactical-design - 📦 Complex system →
mvp-first - 🔄 Continuous improvement →
pdca-cycle - 📊 Strategic analysis →
swot-analysis
Step 2: Match Skill Templates
Based on the task type, match preset skill templates:
Template 1: New System Design
goal-oriented → first-principles → ddd-strategic-design → ddd-tactical-design → mvp-first → pdca-cycle
Template 2: Performance Optimization
goal-oriented → first-principles → pdca-cycle
Template 3: Technology Selection
goal-oriented → first-principles → swot-analysis
Template 4: Architecture Refactoring
goal-oriented → first-principles → ddd-strategic-design → pdca-cycle
Step 3: Recommend Skill Chain
Based on the user request and task type, recommend the skill execution order.
Step 4: User Confirmation
Use AskUserQuestion to let the user confirm the recommended skill chain.
Step 5: Execute Skill Chain
Execute skills inline in order (skip duplicate prerequisite protocols).
Step 6: Save Artifacts
Save the orchestration results and execution records.
Skill Template Library
Template 1: New System Design (Complete Process)
Applicable: The user says "design an XX system", "build an XX from scratch"
1. /goal-oriented
- 明确系统目标和成功标准
2. /first-principles
- 从本质思考系统设计
3. /ddd-strategic-design
- 识别限界上下文
- 设计上下文关系
4. /ddd-tactical-design
- 设计聚合、实体、值对象
- 实现领域模型
5. /mvp-first
- 筛选 MVP 功能
- 优先级规划
6. /pdca-cycle
- 迭代实施
Template 2: Performance Optimization
Applicable: The user says "optimize XX performance", "improve XX speed"
1. /goal-oriented
- 明确优化目标(响应时间 < 100ms)
2. /first-principles
- 找到性能瓶颈的本质原因
3. /pdca-cycle
- Plan: 制定优化方案
- Do: 实施优化
- Check: 验证性能提升
- Act: 标准化成功做法
Template 3: Technology Selection
Applicable: The user says "choose XX technology", "XX vs YY, which is better"
1. /goal-oriented
- 明确选型目标和约束条件
2. /first-principles
- 从本质分析需求
3. /swot-analysis
- 分析各方案的优劣势
- 生成决策建议
Template 4: Architecture Refactoring
Applicable: The user says "refactor XX architecture", "optimize system structure"
1. /goal-oriented
- 明确重构目标
2. /first-principles
- 找到当前架构的根本问题
3. /ddd-strategic-design
- 重新设计限界上下文
- 优化上下文关系
4. /pdca-cycle
- 逐步迁移
- 持续验证
Template 5: Feature Development (Fast Path)
Applicable: The user says "implement XX feature", "add XX"
1. /goal-oriented
- 明确功能目标
2. /mvp-first
- 确定核心功能
- 削减非必要特性
3. /pdca-cycle
- 迭代开发
Template 6: Problem Diagnosis
Applicable: The user says "XX has a problem", "troubleshoot XX bug"
1. /goal-oriented
- 明确问题解决目标
2. /first-principles
- 找到问题的根本原因
3. /pdca-cycle
- 实施修复
- 验证解决方案
Skill Collaboration Rules
Inline Execution Protocol
When the orchestrator executes a skill chain:
-
Read The tool reads the skill file
skills/{skill-name}/SKILL.md -
Skip the following parts(to avoid duplicate initialization):
- Pre-protocol (environment detection, pre-skill check)
- Overview
- When to Use
-
Execute the core process:
- The Process
- Thinking Framework
- Necessary interactions and decisions
-
Artifact output:
- Save artifact to
memory/artifacts/{skill-name}/ - Continue to the next skill
- Save artifact to
Artifact Passing Mechanism
After each skill finishes executing, the artifact will be read by the next skill:
# 当前技能读取前置技能的工件
PREV_ARTIFACT="memory/artifacts/{previous-skill}/latest.json"
if [ -f "$PREV_ARTIFACT" ]; then
# 提取上下文信息
# 在当前技能中使用
fi
Examples
Case 1: Designing a New System from Scratch
用户:"设计一个电商平台"
编排器分析:
- 任务类型:新系统设计
- 推荐模板:模板 1(完整流程)
推荐技能链:
1. /goal-oriented - 明确系统目标
2. /first-principles - 从本质思考电商
3. /ddd-strategic-design - 战略设计
4. /ddd-tactical-design - 战术设计
5. /mvp-first - MVP 规划
是否开始执行?
- A) 按推荐顺序执行
- B) 我自己选择技能
- C) 只运行第一个技能
Case 2: Performance Optimization
用户:"数据库查询太慢,帮我优化"
编排器分析:
- 任务类型:性能优化
- 推荐模板:模板 2(性能优化)
推荐技能链:
1. /goal-oriented - 明确优化目标(响应时间 < 100ms)
2. /first-principles - 找到慢查询的本质原因
3. /pdca-cycle - PDCA 循环优化
是否开始执行?
- A) 按推荐顺序执行
- B) 我自己选择技能
- C) 只运行第一个技能
Case 3: Technology Selection
用户:"选择微服务框架,Spring Cloud 还是 Dubbo?"
编排器分析:
- 任务类型:技术选型
- 推荐模板:模板 3(技术选型)
推荐技能链:
1. /goal-oriented - 明确选型目标
2. /first-principles - 从本质分析需求
3. /swot-analysis - 分析各方案优劣势
是否开始执行?
- A) 按推荐顺序执行
- B) 我自己选择技能
- C) 只运行第一个技能
Post-protocol
Artifact output
Save the orchestration result to the artifact file:
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
ARTIFACT_FILE="memory/artifacts/pilot/result-$TIMESTAMP.json"
cat > "$ARTIFACT_FILE" <<EOF
{
"skill": "pilot",
"version": "1.0.0",
"timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
"project": "$PROJECT_ROOT",
"branch": "$BRANCH",
"commit": "$COMMIT",
"input": {
"user_request": "用户的原始请求"
},
"output": {
"task_type": "识别的任务类型",
"recommended_skills": [
"skill-1",
"skill-2"
],
"execution_result": "success"
}
}
EOF
echo "ARTIFACT SAVED: $ARTIFACT_FILE"
ln -sf "$ARTIFACT_FILE" memory/artifacts/pilot/latest.json
Target File Update
If the target file exists, record the orchestration completion.
Recommended Follow-up Skills
After the orchestrator completes, the skill chain has finished executing, and follow-up skills usually do not need to be recommended.
Common Pitfalls
Pitfall 1: Over-orchestration
Manifestation: Recommending complex skill chains for simple tasks
Correct approach:
- Simple task → short skill chain (1-2 skills)
- Complex task → complete skill chain (5-6 skills)
Pitfall 2: Ignoring User Intent
Manifestation: Mechanically recommending templates without considering the user's specific needs
Correct approach:
- Analyze the details of the user's request
- Adjust the recommended skill chain according to the specific needs
Pitfall 3: Forced Execution
Manifestation: Directly executing the skill chain without giving the user a chance to choose
Correct approach:
- Use AskUserQuestion to let the user confirm
- Provide custom options
References
- gstack skill orchestration architecture
- superpowers skill collaboration mode
- methodolog-skills skill dependency graph