workflow-creator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Workflow Creator Skill

Workflow Creator Skill

Creates multi-agent orchestration workflows for complex tasks that require coordination across multiple agents and phases.
为需要跨多个Agent和阶段协调的复杂任务创建多Agent编排工作流。

ROUTER UPDATE REQUIRED (CRITICAL - DO NOT SKIP)

需要更新路由器(关键 - 请勿跳过)

After creating ANY workflow, you MUST update CLAUDE.md Section 8.6 "ENTERPRISE WORKFLOWS":
markdown
undefined
创建任何工作流后,你必须更新CLAUDE.md的8.6节“ENTERPRISE WORKFLOWS”:
markdown
undefined

{Workflow Name}

{工作流名称}

Path:
.claude/workflows/{category}/{workflow-name}.md
When to use: {Trigger conditions}
Phases:
  1. {Phase Name} - {Description} ...
Agents Involved:
  • {agent-name}
    - {Role in workflow}

**Verification:**

```bash
grep "{workflow-name}" .claude/CLAUDE.md || echo "ERROR: CLAUDE.md SECTION 8.6 NOT UPDATED!"
WHY: Workflows not in CLAUDE.md will NEVER be invoked by the Router.

路径:
.claude/workflows/{category}/{workflow-name}.md
使用场景: {触发条件}
阶段:
  1. {阶段名称} - {描述} ...
涉及的Agent:
  • {agent-name}
    - {在工作流中的角色}

**验证:**

```bash
grep "{workflow-name}" .claude/CLAUDE.md || echo "ERROR: CLAUDE.md 8.6节未更新!"
原因: 未在CLAUDE.md中记录的工作流永远不会被路由器调用。

When This Skill Is Triggered

触发此技能的场景

  1. User requests complex orchestration requiring multiple agents
  2. Repeatable multi-phase process needs standardization
  3. Router identifies workflow gap for common task pattern
  4. Existing workflow needs enhancement or customization
  1. 用户请求复杂编排,需要多个Agent参与
  2. 可重复的多阶段流程需要标准化
  3. 路由器识别到工作流缺口,针对常见任务模式
  4. 现有工作流需要增强或自定义

Quick Reference

快速参考

OperationMethod
Check existing workflows
Glob: .claude/workflows/**/*.md
Review workflow templateRead
.claude/templates/workflows/workflow-template.md
Find relevant agents
Glob: .claude/agents/**/*.md
Find relevant skills
Glob: .claude/skills/*/SKILL.md
Create workflowWrite to
.claude/workflows/<category>/<name>.md
操作方法
检查现有工作流
Glob: .claude/workflows/**/*.md
查看工作流模板读取
.claude/templates/workflows/workflow-template.md
查找相关Agent
Glob: .claude/agents/**/*.md
查找相关技能
Glob: .claude/skills/*/SKILL.md
创建工作流写入至
.claude/workflows/<category>/<name>.md

Workflow Types

工作流类型

TypeLocationPurposeExamples
Enterprise
.claude/workflows/enterprise/
Complex multi-phase developmentfeature-development, c4-architecture
Operations
.claude/workflows/operations/
Runtime procedures, incident responseincident-response, deployment
Rapid
.claude/workflows/rapid/
Quick, focused task automationfix, refactor, review
Custom
.claude/workflows/
Project-specific patternsconductor-setup
类型位置用途示例
企业级
.claude/workflows/enterprise/
复杂多阶段开发流程feature-development, c4-architecture
操作型
.claude/workflows/operations/
运行时流程、事件响应incident-response, deployment
快速型
.claude/workflows/rapid/
快速聚焦的任务自动化fix, refactor, review
自定义
.claude/workflows/
项目特定模式conductor-setup

Workflow-Agent Archetype Reference

工作流-Agent原型参考

When creating workflows, determine which agent archetypes will use the workflow. See
.claude/docs/@WORKFLOW_AGENT_MAP.md
for:
  • Section 1: Full workflow-agent matrix
  • Section 2: Archetype workflow sets (Router/Orchestrator, Implementer, Reviewer, Documenter, Researcher, Domain)
After creating a workflow, you MUST add it to both the matrix AND update affected agents'
## Related Workflows
sections.
创建工作流时,确定哪些Agent原型会使用该工作流。请查看
.claude/docs/@WORKFLOW_AGENT_MAP.md
获取:
  • 第1节: 完整的工作流-Agent矩阵
  • 第2节: 原型工作流集合(Router/Orchestrator、Implementer、Reviewer、Documenter、Researcher、Domain)
创建工作流后,必须将其添加到矩阵中,并更新受影响Agent的
## 相关工作流
部分。

Workflow Creation Process

工作流创建流程

Step 0: Existence Check and Updater Delegation (MANDATORY - FIRST STEP)

步骤0:存在性检查与更新器委托(必填 - 第一步)

BEFORE creating any workflow file, check if it already exists:
  1. Check if workflow already exists:
    bash
    test -f .claude/workflows/<category>/<workflow-name>.md && echo "EXISTS" || echo "NEW"
  2. If workflow EXISTS:
    • DO NOT proceed with creation
    • Invoke artifact-updater workflow instead:
      javascript
      Skill({
        skill: 'artifact-updater',
        args: {
          name: '<workflow-name>',
          changes: '<description of requested changes>',
          justification: 'Update requested via workflow-creator',
        },
      });
    • Return updater result and STOP
  3. If workflow is NEW:
    • Continue with Step 0.5 below

在创建任何工作流文件之前,检查它是否已存在:
  1. 检查工作流是否已存在:
    bash
    test -f .claude/workflows/<category>/<workflow-name>.md && echo "已存在" || echo "新建"
  2. 如果工作流已存在:
    • 请勿继续创建
    • 改为调用artifact-updater工作流:
      javascript
      Skill({
        skill: 'artifact-updater',
        args: {
          name: '<workflow-name>',
          changes: '<请求更改的描述>',
          justification: '通过workflow-creator请求更新',
        },
      });
    • 返回更新器结果并停止
  3. 如果工作流是新建的:
    • 继续执行下面的步骤0.5

Step 0.5: Companion Check

步骤0.5:配套检查

Before proceeding with creation, run the ecosystem companion check:
  1. Use
    companion-check.cjs
    from
    .claude/lib/creators/companion-check.cjs
  2. Call
    checkCompanions("workflow", "{workflow-name}")
    to identify companion artifacts
  3. Review the companion checklist — note which required/recommended companions are missing
  4. Plan to create or verify missing companions after this artifact is complete
  5. Include companion findings in post-creation integration notes
This step is informational (does not block creation) but ensures the full artifact ecosystem is considered.

在继续创建之前,运行生态系统配套检查:
  1. 使用
    .claude/lib/creators/companion-check.cjs
    中的
    companion-check.cjs
  2. 调用
    checkCompanions("workflow", "{workflow-name}")
    来识别配套工件
  3. 查看配套清单——记录缺少的必填/推荐配套项
  4. 计划在此工件完成后创建或验证缺失的配套项
  5. 在创建后集成说明中包含配套检查结果
此步骤为信息性步骤(不阻止创建),但确保考虑了完整的工件生态系统。

Step 1: Verify No Existing Workflow

步骤1:验证无现有工作流

bash
undefined
bash
undefined

Search for relevant workflows

搜索相关工作流

Glob: .claude/workflows/**/*.md Grep: "<topic>" in .claude/workflows/

If a suitable workflow exists, consider enhancing it instead of creating a duplicate.
Glob: .claude/workflows/**/*.md Grep: "<topic>" in .claude/workflows/

如果存在合适的工作流,考虑增强它而不是创建重复项。

Step 2.5: Workflow Pattern Research (MANDATORY)

步骤2.5:工作流模式研究(必填)

Before creating a workflow, research existing patterns.
1. Check existing workflows:
bash
Glob: .claude/workflows/**/*.md
2. Research workflow patterns (minimum 2 queries):
javascript
WebSearch({ query: '[workflow-type] orchestration best practices' });
WebSearch({ query: '[domain] multi-agent workflow patterns' });
3. Document patterns found in workflow comments
BLOCKING: Workflow creation cannot proceed without pattern research. This ensures workflows follow established patterns rather than reinventing solutions.
在创建工作流之前,研究现有模式。
1. 检查现有工作流:
bash
Glob: .claude/workflows/**/*.md
2. 研究工作流模式(至少2次查询):
javascript
WebSearch({ query: '[workflow-type] orchestration best practices' });
WebSearch({ query: '[domain] multi-agent workflow patterns' });
3. 在工作流注释中记录找到的模式
阻塞项: 未完成模式研究则无法继续创建工作流。这确保工作流遵循已建立的模式而非重新发明方案。

Step 2: Identify Phases and Agents

步骤2:确定阶段和Agent

Analyze the process to break into phases:
QuestionDetermines
What are the distinct stages?Phase boundaries
Which agent handles each stage?Agent assignments
Can any stages run in parallel?Parallel execution opportunities
What outputs feed into next stage?Data flow and handoffs
What can go wrong at each stage?Error recovery procedures
Common Phase Patterns:
PatternPhasesWhen to Use
Discovery -> Design -> Review -> ImplementFeature development
Analyze -> Fix -> Test -> DeployBug fix workflow
Explore -> Plan -> ReviewPlanning workflow
Triage -> Investigate -> Resolve -> DocumentIncident response
Code -> Component -> Container -> ContextC4 architecture documentation
分析流程以拆分为多个阶段:
问题决定内容
有哪些不同的阶段?阶段边界
哪个Agent处理每个阶段?Agent分配
哪些阶段可以并行运行?并行执行机会
哪些输出会进入下一个阶段?数据流与交接
每个阶段可能出现什么问题?错误恢复程序
常见阶段模式:
模式阶段使用场景
发现 -> 设计 -> 评审 -> 实现功能开发
分析 -> 修复 -> 测试 -> 部署Bug修复工作流
探索 -> 规划 -> 评审规划工作流
分类 -> 调查 -> 解决 -> 记录事件响应
代码 -> 组件 -> 容器 -> 上下文C4架构文档

Step 3: Define Agent Handoffs

步骤3:定义Agent交接

For each phase transition, specify:
markdown
undefined
对于每个阶段过渡,指定:
markdown
undefined

Phase 1 -> Phase 2 Handoff

阶段1 -> 阶段2 交接

Output from Phase 1: .claude/context/plans/phase1-output.md Input to Phase 2: Read output from Phase 1 Handoff validation: [Check output exists and is valid]
undefined
阶段1输出: .claude/context/plans/phase1-output.md 阶段2输入: 读取阶段1的输出 交接验证: [检查输出是否存在且有效]
undefined

Step 4: Generate Workflow Definition

步骤4:生成工作流定义

Write to
.claude/workflows/<category>/<workflow-name>.md
:
markdown
---
name: { workflow-name }
description: { Brief description of workflow purpose }
version: 1.0.0
agents:
  - { agent-1 }
  - { agent-2 }
tags: [{ tag1 }, { tag2 }, workflow]
---
写入至
.claude/workflows/<category>/<workflow-name>.md
:
markdown
---
name: { workflow-name }
description: { 工作流用途的简要描述 }
version: 1.0.0
agents:
  - { agent-1 }
  - { agent-2 }
tags: [{ tag1 }, { tag2 }, workflow]
---

{Workflow Title}

{工作流标题}

{Brief description of workflow purpose and when to use it.}
Extended Thinking: {Detailed explanation of workflow rationale, approach, and design decisions.}
{工作流用途和使用场景的简要描述。}
扩展思考: {工作流原理、方法和设计决策的详细说明。}

Overview

概述

{Detailed description of what this workflow accomplishes.}
{此工作流实现功能的详细描述。}

Configuration Options

配置选项

{Option Category 1}

{选项类别1}

  • {value_1}: {Description}
  • {value_2}: {Description}
  • {value_1}: {描述}
  • {value_2}: {描述}

Phase 1: {Phase Name}

阶段1: {阶段名称}

Step 1: {Step Name}

步骤1: {步骤名称}

Agent: {agent-name}
Task Spawn:
javascript
Task({
  task_id: 'task-1',
  subagent_type: 'general-purpose',
  description: '{Task description}',
  prompt: `You are the {AGENT_NAME} agent.
Agent: {agent-name}
任务生成:
javascript
Task({
  task_id: 'task-1',
  subagent_type: 'general-purpose',
  description: '{任务描述}',
  prompt: `You are the {AGENT_NAME} agent.

Task

Task

{Task description}
{Task description}

Instructions

Instructions

  1. Read your agent definition: .claude/agents/{category}/{agent}.md
  2. Invoke skills: Skill({ skill: "{skill-name}" })
  3. {Additional instructions}
  4. Save output to: .claude/context/{output-path}
  1. Read your agent definition: .claude/agents/{category}/{agent}.md
  2. Invoke skills: Skill({ skill: "{skill-name}" })
  3. {Additional instructions}
  4. Save output to: .claude/context/{output-path}

Context

Context

  • {Context item 1}
  • {Context item 2}
  • {Context item 1}
  • {Context item 2}

Memory Protocol

Memory Protocol

  1. Read .claude/context/memory/learnings.md first
  2. Record decisions to .claude/context/memory/decisions.md `, });
undefined
Expected Output: {Description of expected output}
  1. Read .claude/context/memory/learnings.md first
  2. Record decisions to .claude/context/memory/decisions.md `, });
undefined
预期输出: {预期输出的描述}

Phase 2: {Phase Name}

阶段2: {阶段名称}

Step 2: {Step Name} (Parallel)

步骤2: {步骤名称}(并行)

Agents: {agent-a} + {agent-b} (spawned in parallel)
Task Spawn:
javascript
// Spawn both agents in parallel for efficiency
Task({
  task_id: 'task-2',
  subagent_type: 'general-purpose',
  description: '{Agent A task}',
  prompt: `You are {AGENT_A}...`,
});

Task({
  task_id: 'task-3',
  subagent_type: 'general-purpose',
  description: '{Agent B task}',
  prompt: `You are {AGENT_B}...`,
});
Expected Output: {Description}
Agents: {agent-a} + {agent-b}(并行生成)
任务生成:
javascript
// 为提高效率,并行生成两个Agent
Task({
  task_id: 'task-2',
  subagent_type: 'general-purpose',
  description: '{Agent A的任务}',
  prompt: `You are {AGENT_A}...`,
});

Task({
  task_id: 'task-3',
  subagent_type: 'general-purpose',
  description: '{Agent B的任务}',
  prompt: `You are {AGENT_B}...`,
});
预期输出: {描述}

Error Recovery

错误恢复

If Phase 1 fails:

如果阶段1失败:

  1. {Recovery step}
  2. Restart Phase 1
  1. {恢复步骤}
  2. 重启阶段1

If Phase 2 review finds blockers:

如果阶段2评审发现阻塞项:

  1. {Recovery step}
  2. Re-run reviews
  1. {恢复步骤}
  2. 重新运行评审

Success Criteria

成功标准

  • {Criterion 1}
  • {Criterion 2}
  • All agents completed their phases
  • Memory files updated
  • {标准1}
  • {标准2}
  • 所有Agent完成其阶段
  • 内存文件已更新

Usage Example

使用示例

javascript
// Router spawning workflow orchestrator
Task({
  task_id: 'task-4',
  subagent_type: 'general-purpose',
  description: 'Orchestrating {workflow-name} workflow',
  prompt: `Execute {workflow-name} workflow.
javascript
// 路由器调用工作流编排器
Task({
  task_id: 'task-4',
  subagent_type: 'general-purpose',
  description: '编排{workflow-name}工作流',
  prompt: `执行{workflow-name}工作流。

Parameters

参数

  • {Parameter 1}
  • {Parameter 2}
  • {参数1}
  • {参数2}

Instructions

说明

Follow the phased workflow in: .claude/workflows/{category}/{workflow-name}.md `, });
undefined
按照以下路径中的分阶段工作流执行: .claude/workflows/{category}/{workflow-name}.md `, });
undefined

Step 5: Validate Workflow References (BLOCKING)

步骤5:验证工作流引用(阻塞项)

Before writing workflow file, verify ALL references are valid:
ReferenceValidation
Agent filesAll agents in
agents:
array exist in
.claude/agents/
SkillsAll skills referenced in prompts exist in
.claude/skills/
Output pathsAll output directories exist or will be created
Context filesAll context files referenced are accessible
Validation checklist before writing:

[ ] All referenced agents exist
[ ] All referenced skills exist
[ ] Output paths are valid
[ ] Error recovery procedures are complete
[ ] Success criteria are measurable
BLOCKING: Do not write workflow file if any reference is invalid.
在写入工作流文件之前,验证所有引用是否有效:
引用验证方式
Agent文件
agents:
数组中的所有Agent都存在于
.claude/agents/
技能提示中引用的所有技能都存在于
.claude/skills/
输出路径所有输出目录已存在或将被创建
上下文文件所有引用的上下文文件都可访问
写入前的验证清单:

[ ] 所有引用的Agent都存在
[ ] 所有引用的技能都存在
[ ] 输出路径有效
[ ] 错误恢复程序完整
[ ] 成功标准可衡量
阻塞项: 如果任何引用无效,请勿写入工作流文件。

Step 5.5: Model and Tool Validation (CRITICAL)

步骤5.5:模型与工具验证(关键)

Model Validation for Agent Spawns (CRITICAL):
When workflow templates spawn agents via Task tool:
  • model field MUST be base name only:
    haiku
    ,
    sonnet
    , or
    opus
  • DO NOT use dated versions like
    claude-opus-4-5-20251101
  • Choose model based on task complexity:
    • haiku
      : Quick validation, simple tasks
    • sonnet
      : Standard work (default)
    • opus
      : Complex reasoning, architecture
Example:
javascript
// CORRECT
Task({
  task_id: 'task-5',
  model: 'sonnet',
  // ...
});

// WRONG - causes validation failures
Task({
  task_id: 'task-6',
  model: 'claude-sonnet-4-20250514',
  // ...
});
Tools Array Validation:
When specifying allowed_tools for spawned agents:
  • Use standard tools: Read, Write, Edit, Bash, TaskUpdate, TaskList, etc.
  • DO NOT include MCP tools (mcp__*) unless whitelisted in routing-table.cjs
  • MCP tools cause router enforcement failures
Allowed tools (standard):
javascript
allowed_tools: [
  'Read',
  'Write',
  'Edit',
  'Bash',
  'TaskUpdate',
  'TaskList',
  'TaskCreate',
  'TaskGet',
  'Skill',
];
Restricted tools (require explicit whitelisting):
  • mcp__Exa__*
    - Only for evolution-orchestrator
  • mcp__github__*
    - Only for specific GitHub operations
  • Other MCP tools - Must be whitelisted in routing-table.cjs
Validation checklist for agent spawns:
[ ] Model field uses base name (haiku/sonnet/opus)
[ ] allowed_tools contains only standard tools OR explicitly whitelisted MCP tools
[ ] No dated model versions (e.g., claude-opus-4-5-20251101)
Agent生成的模型验证(关键):
当工作流模板通过Task工具生成Agent时:
  • model字段必须仅使用基础名称:
    haiku
    ,
    sonnet
    , 或
    opus
  • 请勿使用带日期的版本,如
    claude-opus-4-5-20251101
  • 根据任务复杂度选择模型:
    • haiku
      : 快速验证、简单任务
    • sonnet
      : 标准工作(默认)
    • opus
      : 复杂推理、架构设计
示例:
javascript
// 正确
Task({
  task_id: 'task-5',
  model: 'sonnet',
  // ...
});

// 错误 - 会导致验证失败
Task({
  task_id: 'task-6',
  model: 'claude-sonnet-4-20250514',
  // ...
});
工具数组验证:
为生成的Agent指定allowed_tools时:
  • 使用标准工具: Read, Write, Edit, Bash, TaskUpdate, TaskList等
  • 除非在routing-table.cjs中被白名单允许,否则请勿包含MCP工具(mcp__*)
  • MCP工具会导致路由器执行失败
允许的工具(标准):
javascript
allowed_tools: [
  'Read',
  'Write',
  'Edit',
  'Bash',
  'TaskUpdate',
  'TaskList',
  'TaskCreate',
  'TaskGet',
  'Skill',
];
受限工具(需要显式白名单):
  • mcp__Exa__*
    - 仅适用于evolution-orchestrator
  • mcp__github__*
    - 仅适用于特定GitHub操作
  • 其他MCP工具 - 必须在routing-table.cjs中被白名单允许
Agent生成的验证清单:
[ ] Model字段使用基础名称(haiku/sonnet/opus)
[ ] allowed_tools仅包含标准工具或显式白名单的MCP工具
[ ] 未使用带日期的模型版本(如claude-opus-4-5-20251101)

Step 6: Update CLAUDE.md Section 8.6 (MANDATORY - BLOCKING)

步骤6:更新CLAUDE.md 8.6节(必填 - 阻塞项)

This step is AUTOMATIC and BLOCKING. Do not skip.
After workflow file is written, you MUST update CLAUDE.md:
  1. Find Section 8.6 ("ENTERPRISE WORKFLOWS")
  2. Generate workflow entry in this format:
markdown
undefined
此步骤为自动且阻塞的,请勿跳过。
写入工作流文件后,必须更新CLAUDE.md:
  1. 找到8.6节("ENTERPRISE WORKFLOWS")
  2. 生成工作流条目,格式如下:
markdown
undefined

{Workflow Name}

{工作流名称}

Path:
.claude/workflows/{category}/{workflow-name}.md
When to use: {Trigger conditions - be specific}
Phases:
  1. {Phase 1 Name} - {Brief description}
  2. {Phase 2 Name} - {Brief description} ...
Configuration Options:
  • {Option category}:
    {values}
Agents Involved:
  • {agent-name}
    - {Role description}

3. **Insert in appropriate location** (alphabetical or at end of section)
4. **Verify with**:

```bash
grep "{workflow-name}" .claude/CLAUDE.md || echo "ERROR: CLAUDE.md NOT UPDATED - BLOCKING!"
BLOCKING: If CLAUDE.md update fails, workflow creation is INCOMPLETE. Do NOT proceed.
路径:
.claude/workflows/{category}/{workflow-name}.md
使用场景: {触发条件 - 请具体说明}
阶段:
  1. {阶段1名称} - {简要描述}
  2. {阶段2名称} - {简要描述} ...
配置选项:
  • {选项类别}:
    {值}
涉及的Agent:
  • {agent-name}
    - {角色描述}

3. **插入到适当位置**(按字母顺序或在节的末尾)
4. **使用以下命令验证:**

```bash
grep "{workflow-name}" .claude/CLAUDE.md || echo "错误: CLAUDE.md未更新 - 阻塞!"
阻塞项: 如果CLAUDE.md更新失败,工作流创建未完成。请勿继续。

Step 7: System Impact Analysis (BLOCKING)

步骤7:系统影响分析(阻塞项)

After creating ANY workflow, analyze and update system-wide impacts.
[WORKFLOW-CREATOR] System Impact Analysis for: <workflow-name>

1. CLAUDE.md UPDATE (MANDATORY)
   - Add entry to Section 8.6 (Enterprise Workflows)
   - Add to Section 3 (Multi-Agent Workflows) if referenced by Router
   - Verify with grep

2. AGENT COORDINATION CHECK
   - Do all agents referenced exist?
   - Do agents need new skills for this workflow?
   - Should any agent's definition reference this workflow?

3. SKILL AVAILABILITY CHECK
   - Are all skills referenced available?
   - Does this workflow need new skills? -> Invoke skill-creator
   - Should existing skills be enhanced?

4. MEMORY INTEGRATION CHECK
   - Does workflow use Memory Protocol?
   - Are output paths writable?
   - Will artifacts be properly persisted?

5. RELATED WORKFLOW CHECK
   - Does this duplicate existing workflow functionality?
   - Should existing workflows reference this one?
   - Are there workflow dependencies to document?

6. WORKFLOW-AGENT MAP UPDATED (MANDATORY)
   - Added new workflow to @WORKFLOW_AGENT_MAP.md Section 1 matrix
   - Determined which agent archetypes use this workflow
   - Updated affected agents' `## Related Workflows` sections
   - Verified: `grep "<workflow-name>" .claude/docs/@WORKFLOW_AGENT_MAP.md || echo "ERROR: Workflow not in agent map!"`
创建任何工作流后,分析并更新系统范围的影响。
[WORKFLOW-CREATOR] 工作流<workflow-name>的系统影响分析

1. CLAUDE.md更新(必填)
   - 添加条目到8.6节(企业工作流)
   - 如果被路由器引用,添加到3节(多Agent工作流)
   - 使用grep验证

2. Agent协调检查
   - 所有引用的Agent都存在吗?
   - Agent是否需要新技能来适配此工作流?
   - 是否有Agent的定义需要引用此工作流?

3. 技能可用性检查
   - 所有引用的技能都可用吗?
   - 此工作流是否需要新技能? -> 调用skill-creator
   - 现有技能是否需要增强?

4. 内存集成检查
   - 工作流是否使用内存协议?
   - 输出路径是否可写?
   - 工件是否会被正确持久化?

5. 相关工作流检查
   - 此工作流是否与现有工作流功能重复?
   - 现有工作流是否应引用此工作流?
   - 是否有需要记录的工作流依赖?

6. 工作流-Agent映射已更新(必填)
   - 将新工作流添加到@WORKFLOW_AGENT_MAP.md第1节的矩阵中
   - 确定哪些Agent原型使用此工作流
   - 更新受影响Agent的`## 相关工作流`部分
   - 验证: `grep "<workflow-name>" .claude/docs/@WORKFLOW_AGENT_MAP.md || echo "错误: 工作流未在Agent映射中!"`

Validation Checklist (Run After Every Creation) - BLOCKING

创建后验证清单(阻塞项)

bash
undefined
bash
undefined

Validate workflow file exists

验证工作流文件是否存在

ls .claude/workflows/<category>/<workflow-name>.md
ls .claude/workflows/<category>/<workflow-name>.md

Verify all referenced agents exist

验证所有引用的Agent都存在

for agent in $(grep -oE '\.claude/agents/[^"]+\.md' .claude/workflows/<category>/<workflow>.md); do [ -f "$agent" ] || echo "BROKEN: $agent" done
for agent in $(grep -oE '\.claude/agents/[^"]+\.md' .claude/workflows/<category>/<workflow>.md); do [ -f "$agent" ] || echo "损坏: $agent" done

Verify all referenced skills exist

验证所有引用的技能都存在

for skill in $(grep -oE 'skill: "[^"]+"' .claude/workflows/<category>/<workflow>.md | cut -d'"' -f2); do [ -f ".claude/skills/$skill/SKILL.md" ] || echo "BROKEN: $skill" done
for skill in $(grep -oE 'skill: "[^"]+"' .claude/workflows/<category>/<workflow>.md | cut -d'"' -f2); do [ -f ".claude/skills/$skill/SKILL.md" ] || echo "损坏: $skill" done

Check CLAUDE.md has workflow entry - MANDATORY

检查CLAUDE.md是否有工作流条目 - 必填

grep "<workflow-name>" .claude/CLAUDE.md || echo "ERROR: Not in CLAUDE.md - WORKFLOW CREATION INCOMPLETE"

**Completion Checklist** (all must be checked):
[ ] Workflow pattern research completed (Step 2.5) [ ] Workflow file created at .claude/workflows/<category>/<name>.md [ ] All referenced agents exist in .claude/agents/ [ ] All referenced skills exist in .claude/skills/ [ ] Model fields use base names only (haiku/sonnet/opus) [ ] allowed_tools arrays contain only standard or whitelisted tools [ ] CLAUDE.md Section 8.6 updated [ ] Workflow entry verified with grep [ ] Memory Protocol included in all agent prompts

**BLOCKING**: If ANY item fails, workflow creation is INCOMPLETE. Fix all issues before proceeding.
grep "<workflow-name>" .claude/CLAUDE.md || echo "错误: 未在CLAUDE.md中 - 工作流创建未完成"

**完成清单**(所有项必须勾选):
[ ] 已完成工作流模式研究(步骤2.5) [ ] 工作流文件已创建于.claude/workflows/<category>/<name>.md [ ] 所有引用的Agent都存在于.claude/agents/ [ ] 所有引用的技能都存在于.claude/skills/ [ ] Model字段仅使用基础名称(haiku/sonnet/opus) [ ] allowed_tools数组仅包含标准或白名单工具 [ ] CLAUDE.md 8.6节已更新 [ ] 使用grep验证了工作流条目 [ ] 所有Agent提示中都包含内存协议

**阻塞项**: 如果任何项未通过,工作流创建未完成。在继续之前修复所有问题。

Step 8: Post-Creation Workflow Registration (Phase 3 Integration)

步骤8:创建后工作流注册(第三阶段集成)

This step is CRITICAL. After creating the workflow artifact, you MUST register it in the workflow discovery system.
Phase 3 Context: Phase 1 created tool manifests (tools), Phase 2 created skill indices (skills), Phase 3 creates workflow registries so workflows can be discovered and invoked by orchestrators.
After workflow file is written and validated:
  1. Create/Update Workflow Registry Entry in appropriate location:
    If registry doesn't exist, create
    .claude/context/artifacts/catalogs/workflow-registry.json
    :
    json
    {
      "workflows": [
        {
          "name": "{workflow-name}",
          "id": "{workflow-name}",
          "description": "{Brief description from workflow}",
          "category": "{enterprise|core|operations}",
          "version": "1.0.0",
          "triggerConditions": ["{Condition 1}", "{Condition 2}"],
          "participatingAgents": ["{agent-1}", "{agent-2}"],
          "phases": [
            { "name": "{Phase 1 Name}", "description": "{Brief description}" },
            { "name": "{Phase 2 Name}", "description": "{Brief description}" }
          ],
          "filePath": ".claude/workflows/{category}/{workflow-name}.md",
          "orchestratorReferences": []
        }
      ]
    }
  2. Register with Appropriate Orchestrator:
    Update the orchestrator that should use this workflow:
    • master-orchestrator.md: Meta-workflows coordinating other workflows
    • evolution-orchestrator.md: EVOLVE phase workflows (research, creation, validation)
    • party-orchestrator.md: Consensus/voting workflows
    • swarm-coordinator.md: Coordination workflows
    Add to orchestrator's workflow references:
    markdown
    ## Available Workflows
    
    - `{workflow-name}` (.claude/workflows/{category}/{workflow-name}.md)
  3. Document in
    .claude/docs/WORKFLOW_CATALOG.md
    :
    If catalog doesn't exist, create it. Add entry:
    markdown
    ### {Workflow Title}
    
    **Path:** `.claude/workflows/{category}/{workflow-name}.md`
    
    **When to use:** {Trigger conditions - specific scenarios}
    
    **Participating Agents:**
    
    - {agent-1}: {role in workflow}
    - {agent-2}: {role in workflow}
    
    **Phases:**
    
    1. **{Phase 1 Name}** - {Description}
    2. **{Phase 2 Name}** - {Description}
    
    **Orchestrator Integration:**
    
    - Invoked by: {orchestrator-name}
    - Trigger: {How orchestrator discovers/triggers this}
  4. Verify Workflow Discoverability:
    Test that the workflow can be discovered:
    bash
    # Check workflow registry exists and is valid JSON
    node -e "console.log(JSON.stringify(require('./.claude/context/artifacts/catalogs/workflow-registry.json'), null, 2))"
    
    # Verify orchestrator references it
    grep "{workflow-name}" .claude/agents/orchestrators/*-orchestrator.md
  5. Update Memory:
    Append to
    .claude/context/memory/learnings.md
    :
    markdown
    ## Workflow: {workflow-name}
    
    - **Purpose:** {Workflow purpose}
    - **Orchestrator:** {Which orchestrator uses it}
    - **Key Pattern:** {Key pattern discovered}
    - **Integration Notes:** {Any special integration considerations}
Why this matters: Without workflow registration:
  • Orchestrators cannot discover available workflows
  • Workflows cannot be dynamically selected for complex tasks
  • System loses visibility into workflow network
  • "Invisible artifact" pattern emerges
Phase 3 Integration: Workflow registry is the discovery mechanism for Phase 3, enabling orchestrators to query available workflows and select appropriate ones for complex multi-agent tasks.
此步骤至关重要。 创建工作流工件后,必须在工作流发现系统中注册它。
第三阶段上下文: 第一阶段创建了工具清单(tools),第二阶段创建了技能索引(skills),第三阶段创建工作流注册表,以便编排器可以发现和调用工作流。
写入并验证工作流文件后:
  1. 在适当位置创建/更新工作流注册表条目:
    如果注册表不存在,创建
    .claude/context/artifacts/catalogs/workflow-registry.json
    :
    json
    {
      "workflows": [
        {
          "name": "{workflow-name}",
          "id": "{workflow-name}",
          "description": "{工作流的简要描述}",
          "category": "{enterprise|core|operations}",
          "version": "1.0.0",
          "triggerConditions": ["{条件1}", "{条件2}"],
          "participatingAgents": ["{agent-1}", "{agent-2}"],
          "phases": [
            { "name": "{阶段1名称}", "description": "{简要描述}" },
            { "name": "{阶段2名称}", "description": "{简要描述}" }
          ],
          "filePath": ".claude/workflows/{category}/{workflow-name}.md",
          "orchestratorReferences": []
        }
      ]
    }
  2. 向适当的编排器注册:
    更新应使用此工作流的编排器:
    • master-orchestrator.md: 协调其他工作流的元工作流
    • evolution-orchestrator.md: EVOLVE阶段工作流(研究、创建、验证)
    • party-orchestrator.md: 共识/投票工作流
    • swarm-coordinator.md: 协调工作流
    添加到编排器的工作流引用中:
    markdown
    ## 可用工作流
    
    - `{workflow-name}` (.claude/workflows/{category}/{workflow-name}.md)
  3. .claude/docs/WORKFLOW_CATALOG.md
    中记录:
    如果目录不存在,创建它。添加条目:
    markdown
    ### {工作流标题}
    
    **路径:** `.claude/workflows/{category}/{workflow-name}.md`
    
    **使用场景:** {触发条件 - 具体场景}
    
    **参与的Agent:**
    
    - {agent-1}: {在工作流中的角色}
    - {agent-2}: {在工作流中的角色}
    
    **阶段:**
    
    1. **{阶段1名称}** - {描述}
    2. **{阶段2名称}** - {描述}
    
    **编排器集成:**
    
    - 调用者: {编排器名称}
    - 触发方式: {编排器如何发现/触发此工作流}
  4. 验证工作流可发现性:
    测试工作流是否可以被发现:
    bash
    # 检查工作流注册表是否存在且为有效的JSON
    node -e "console.log(JSON.stringify(require('./.claude/context/artifacts/catalogs/workflow-registry.json'), null, 2))"
    
    # 验证编排器引用了它
    grep "{workflow-name}" .claude/agents/orchestrators/*-orchestrator.md
  5. 更新内存:
    追加到
    .claude/context/memory/learnings.md
    :
    markdown
    ## 工作流: {workflow-name}
    
    - **用途:** {工作流用途}
    - **编排器:** {使用它的编排器}
    - **关键模式:** {发现的关键模式}
    - **集成说明:** {任何特殊的集成注意事项}
为什么这很重要: 没有工作流注册:
  • 编排器无法发现可用的工作流
  • 工作流无法为复杂任务动态选择
  • 系统失去对工作流网络的可见性
  • 出现“不可见工件”模式
第三阶段集成: 工作流注册表是第三阶段的发现机制,使编排器能够查询可用工作流并为复杂多Agent任务选择合适的工作流。

Step 9: Integration Verification (BLOCKING - DO NOT SKIP)

步骤9:集成验证(阻塞项 - 请勿跳过)

This step verifies the artifact is properly integrated into the ecosystem.
Before calling
TaskUpdate({ status: "completed" })
, you MUST run the Post-Creation Validation workflow:
  1. Run the 10-item integration checklist:
    bash
    node .claude/tools/cli/validate-integration.cjs .claude/workflows/<category>/<workflow-name>.md
  2. Verify exit code is 0 (all checks passed)
  3. If exit code is 1 (one or more checks failed):
    • Read the error output for specific failures
    • Fix each failure:
      • Missing CLAUDE.md entry -> Add to Section 8.6
      • Missing workflow registry -> Create registry entry (Step 8)
      • Missing orchestrator reference -> Add to orchestrator definition
      • Missing memory update -> Update learnings.md
    • Re-run validation until exit code is 0
  4. Only proceed when validation passes
This step is BLOCKING. Do NOT mark task complete until validation passes.
Why this matters: The Party Mode incident showed that fully-implemented artifacts can be invisible to the Router if integration steps are missed. This validation ensures no "invisible artifact" pattern.
Reference:
.claude/workflows/core/post-creation-validation.md

此步骤验证工件是否已正确集成到生态系统中。
在调用
TaskUpdate({ status: "completed" })
之前,必须运行创建后验证工作流:
  1. 运行10项集成清单:
    bash
    node .claude/tools/cli/validate-integration.cjs .claude/workflows/<category>/<workflow-name>.md
  2. 验证退出码为0(所有检查通过)
  3. 如果退出码为1(一项或多项检查失败):
    • 读取错误输出以了解具体失败项
    • 修复每个失败项:
      • 缺少CLAUDE.md条目 -> 添加到8.6节
      • 缺少工作流注册表 -> 创建注册表条目(步骤8)
      • 缺少编排器引用 -> 添加到编排器定义
      • 缺少内存更新 -> 更新learnings.md
    • 重新运行验证直到退出码为0
  4. 仅在验证通过后继续
此步骤为阻塞项。 在验证通过之前,请勿标记任务完成。
为什么这很重要: Party Mode事件表明,如果错过集成步骤,即使完全实现的工件也可能对路由器不可见。此验证确保不会出现“不可见工件”模式。
参考:
.claude/workflows/core/post-creation-validation.md

Iron Laws of Workflow Creation

工作流创建铁律

These rules are INVIOLABLE. Breaking them causes silent failures.
1. NO WORKFLOW WITHOUT AGENT VALIDATION
   - Every agent referenced must exist in .claude/agents/
   - Verify with: ls .claude/agents/<category>/<agent>.md

2. NO WORKFLOW WITHOUT SKILL VALIDATION
   - Every skill referenced must exist in .claude/skills/
   - Verify with: ls .claude/skills/<skill>/SKILL.md

3. NO PARALLEL EXECUTION WITHOUT INDEPENDENCE
   - Only spawn agents in parallel if their work is independent
   - Dependent work must be sequential

4. NO HANDOFF WITHOUT OUTPUT SPECIFICATION
   - Every phase must specify its output location
   - Every phase must specify what it reads from previous phases

5. NO WORKFLOW WITHOUT MEMORY PROTOCOL
   - Every agent prompt must include Memory Protocol section
   - Without it, learnings and decisions are lost

6. NO CREATION WITHOUT CLAUDE.MD UPDATE
   - After creating workflow, add to Section 8.6
   - Unregistered workflows are never invoked by Router

7. NO CREATION WITHOUT SYSTEM IMPACT ANALYSIS
   - Check if new agents are needed
   - Check if new skills are needed
   - Update @WORKFLOW_AGENT_MAP.md with new workflow row (MANDATORY)
   - Update affected agents' Related Workflows sections (MANDATORY)
   - Document all system changes made

8. NO AGENT SPAWN WITHOUT MODEL VALIDATION
   - model field MUST be base name only: haiku, sonnet, or opus
   - DO NOT use dated versions like claude-opus-4-5-20251101
   - Dated versions cause validation failures

9. NO AGENT SPAWN WITH UNRESTRICTED MCP TOOLS
   - Use standard tools: Read, Write, Edit, Bash, TaskUpdate, etc.
   - MCP tools (mcp__*) require explicit whitelisting
   - Unwhitelisted MCP tools cause router enforcement failures

10. NO WORKFLOW WITHOUT PATTERN RESEARCH
    - Research existing workflow patterns before creating new ones
    - Minimum 2 WebSearch queries for domain patterns
    - Document patterns found in workflow comments

这些规则是不可违反的,违反会导致静默失败。
1. 无Agent验证则不创建工作流
   - 每个引用的Agent必须存在于.claude/agents/
   - 验证方式: ls .claude/agents/<category>/<agent>.md

2. 无技能验证则不创建工作流
   - 每个引用的技能必须存在于.claude/skills/
   - 验证方式: ls .claude/skills/<skill>/SKILL.md

3. 无独立性则不并行执行
   - 仅当Agent的工作相互独立时才并行生成
   - 依赖工作必须按顺序执行

4. 无输出规范则不交接
   - 每个阶段必须指定其输出位置
   - 每个阶段必须指定从之前阶段读取的内容

5. 无内存协议则不创建工作流
   - 每个Agent提示必须包含内存协议部分
   - 没有它,学习成果和决策会丢失

6. 不更新CLAUDE.md则不创建
   - 创建工作流后,添加到8.6节
   - 未注册的工作流永远不会被路由器调用

7. 无系统影响分析则不创建
   - 检查是否需要新Agent
   - 检查是否需要新技能
   - 在@WORKFLOW_AGENT_MAP.md中添加新工作流行(必填)
   - 更新受影响Agent的相关工作流部分(必填)
   - 记录所有系统变更

8. 无模型验证则不生成Agent
   - model字段必须仅使用基础名称: haiku, sonnet, 或 opus
   - 请勿使用带日期的版本如claude-opus-4-5-20251101
   - 带日期的版本会导致验证失败

9. 无限制则不生成带MCP工具的Agent
   - 使用标准工具: Read, Write, Edit, Bash, TaskUpdate等
   - MCP工具(mcp__*)需要显式白名单
   - 未白名单的MCP工具会导致路由器执行失败

10. 无模式研究则不创建
    - 在创建新工作流之前研究现有工作流模式
    - 至少对领域模式进行2次WebSearch查询
    - 在工作流注释中记录找到的模式

Workflow Integration

工作流集成

This skill is part of the unified artifact lifecycle. For complete multi-agent orchestration:
Router Decision:
.claude/workflows/core/router-decision.md
  • How the Router discovers and invokes this skill's artifacts
Artifact Lifecycle:
.claude/workflows/core/skill-lifecycle.md
  • Discovery, creation, update, deprecation phases
  • Version management and registry updates
  • CLAUDE.md integration requirements
External Integration:
.claude/workflows/core/external-integration.md
  • Safe integration of external artifacts
  • Security review and validation phases

此技能是统一工件生命周期的一部分。如需完整的多Agent编排:
路由器决策:
.claude/workflows/core/router-decision.md
  • 路由器如何发现和调用此技能的工件
工件生命周期:
.claude/workflows/core/skill-lifecycle.md
  • 发现、创建、更新、弃用阶段
  • 版本管理和注册表更新
  • CLAUDE.md集成要求
外部集成:
.claude/workflows/core/external-integration.md
  • 外部工件的安全集成
  • 安全评审和验证阶段

Cross-Reference: Creator Ecosystem

交叉参考:创建者生态系统

This skill is part of the Creator Ecosystem. After creating a workflow, consider whether companion creators are needed:
CreatorWhen to UseInvocation
agent-creatorWorkflow needs agent not in
.claude/agents/
Skill({ skill: 'agent-creator' })
skill-creatorWorkflow needs skill not in
.claude/skills/
Skill({ skill: 'skill-creator' })
hook-creatorWorkflow needs entry/exit hooksCreate in
.claude/hooks/
template-creatorWorkflow needs code templatesCreate in
.claude/templates/
schema-creatorWorkflow needs validation schemasCreate in
.claude/schemas/
此技能是创建者生态系统的一部分。创建工作流后,考虑是否需要配套创建者:
创建者使用场景调用方式
agent-creator工作流需要的Agent不存在于
.claude/agents/
Skill({ skill: 'agent-creator' })
skill-creator工作流需要的技能不存在于
.claude/skills/
Skill({ skill: 'skill-creator' })
hook-creator工作流需要进入/退出钩子
.claude/hooks/
中创建
template-creator工作流需要代码模板
.claude/templates/
中创建
schema-creator工作流需要验证模式
.claude/schemas/
中创建

Integration Workflow

集成工作流

After creating a workflow that needs additional capabilities:
javascript
// 1. Workflow created but needs new agent
Skill({ skill: 'agent-creator' });
// Create the agent, then update workflow's agents: array

// 2. Workflow needs new skill
Skill({ skill: 'skill-creator' });
// Create the skill, then reference in workflow prompts

// 3. Workflow needs hooks for critical steps
// Create hooks in .claude/hooks/workflows/<workflow-name>/
// Reference in workflow's hooks: section
创建需要额外功能的工作流后:
javascript
// 1. 工作流已创建但需要新Agent
Skill({ skill: 'agent-creator' });
// 创建Agent,然后更新工作流的agents:数组

// 2. 工作流需要新技能
Skill({ skill: 'skill-creator' });
// 创建技能,然后在工作流提示中引用

// 3. 工作流需要关键步骤的钩子
// 在.claude/hooks/workflows/<workflow-name>/中创建钩子
// 在工作流的hooks:部分引用

Post-Creation Checklist for Ecosystem Integration

生态系统集成的创建后清单

After workflow is fully created and validated:
[ ] Does workflow need agents that don't exist? -> Use agent-creator
[ ] Does workflow need skills that don't exist? -> Use skill-creator
[ ] Does workflow need entry/exit hooks? -> Create hooks
[ ] Does workflow need input validation? -> Create schemas
[ ] Should workflow be part of larger orchestration? -> Update master-orchestrator
[ ] Run post-creation validation -> node .claude/tools/cli/validate-integration.cjs .claude/workflows/<category>/<workflow-name>.yaml

工作流完全创建并验证后:
[ ] 工作流是否需要不存在的Agent? -> 使用agent-creator
[ ] 工作流是否需要不存在的技能? -> 使用skill-creator
[ ] 工作流是否需要进入/退出钩子? -> 创建钩子
[ ] 工作流是否需要输入验证? -> 创建模式
[ ] 工作流是否应成为更大编排的一部分? -> 更新master-orchestrator
[ ] 运行创建后验证 -> node .claude/tools/cli/validate-integration.cjs .claude/workflows/<category>/<workflow-name>.yaml

Examples

示例

Example 1: Creating Feature Development Workflow

示例1:创建功能开发工作流

Request: "Create a workflow for end-to-end feature development"
  1. Identify phases: Discovery -> Architecture -> Implementation -> Testing -> Deployment
  2. Assign agents: planner -> architect + security-architect -> developer -> qa -> devops
  3. Define handoffs: Each phase outputs to
    .claude/context/plans/feature-<name>/
  4. Reference: See
    .claude/workflows/enterprise/feature-development-workflow.md
请求: "创建端到端功能开发的工作流"
  1. 确定阶段: 发现 -> 架构 -> 实现 -> 测试 -> 部署
  2. 分配Agent: planner -> architect + security-architect -> developer -> qa -> devops
  3. 定义交接: 每个阶段输出到
    .claude/context/plans/feature-<name>/
  4. 参考: 查看
    .claude/workflows/enterprise/feature-development-workflow.md

Example 2: Creating Incident Response Workflow

示例2:创建事件响应工作流

Request: "Create a workflow for production incident response"
  1. Identify phases: Triage -> Investigation -> Resolution -> Post-mortem
  2. Assign agents: incident-responder -> devops-troubleshooter + developer -> devops -> planner
  3. Define handoffs: Each phase outputs to
    .claude/context/incidents/
  4. Create:
    .claude/workflows/operations/incident-response.md
请求: "创建生产事件响应的工作流"
  1. 确定阶段: 分类 -> 调查 -> 解决 -> 事后分析
  2. 分配Agent: incident-responder -> devops-troubleshooter + developer -> devops -> planner
  3. 定义交接: 每个阶段输出到
    .claude/context/incidents/
  4. 创建:
    .claude/workflows/operations/incident-response.md

Example 3: Creating C4 Architecture Workflow

示例3:创建C4架构工作流

Request: "Create a workflow to document system architecture using C4 model"
  1. Identify phases: Code Analysis -> Component Synthesis -> Container Mapping -> Context Documentation
  2. Assign agents: c4-code -> c4-component -> c4-container -> c4-context
  3. Define handoffs: Bottom-up, each level builds on previous documentation
  4. Reference: See
    .claude/workflows/enterprise/c4-architecture-workflow.md

请求: "创建使用C4模型记录系统架构的工作流"
  1. 确定阶段: 代码分析 -> 组件合成 -> 容器映射 -> 上下文文档
  2. 分配Agent: c4-code -> c4-component -> c4-container -> c4-context
  3. 定义交接: 自下而上,每个层级基于之前的文档构建
  4. 参考: 查看
    .claude/workflows/enterprise/c4-architecture-workflow.md

Workflow Template Quick Reference

工作流模板快速参考

Use the template at
.claude/templates/workflows/workflow-template.md
for consistent structure.
Key sections every workflow must have:
  1. YAML Frontmatter: name, description, version, agents, tags
  2. Overview: Purpose and when to use
  3. Configuration Options: Customizable parameters
  4. Phases: Sequential or parallel execution blocks
  5. Task Spawns: Actual Task() calls with full prompts
  6. Error Recovery: What to do when phases fail
  7. Success Criteria: How to verify workflow completed successfully
  8. Usage Example: How Router should invoke the workflow

使用
.claude/templates/workflows/workflow-template.md
中的模板以保持结构一致。
每个工作流必须包含的关键部分:
  1. YAML前置元数据: name, description, version, agents, tags
  2. 概述: 用途和使用场景
  3. 配置选项: 可自定义参数
  4. 阶段: 顺序或并行执行块
  5. 任务生成: 带有完整提示的实际Task()调用
  6. 错误恢复: 阶段失败时的处理方式
  7. 成功标准: 如何验证工作流已成功完成
  8. 使用示例: 路由器应如何调用工作流

Architecture Compliance

架构合规性

File Placement (ADR-076)

文件放置(ADR-076)

  • Workflows:
    .claude/workflows/{category}/
    (core, enterprise, operations, creators)
  • Tests:
    tests/
    (NOT in .claude/)
  • Related agents:
    .claude/agents/{category}/
  • Related skills:
    .claude/skills/{name}/
  • Related templates:
    .claude/templates/
  • 工作流:
    .claude/workflows/{category}/
    (core, enterprise, operations, creators)
  • 测试:
    tests/
    (不在.claude/中)
  • 相关Agent:
    .claude/agents/{category}/
  • 相关技能:
    .claude/skills/{name}/
  • 相关模板:
    .claude/templates/

Documentation References (CLAUDE.md v2.2.1)

文档参考(CLAUDE.md v2.2.1)

  • Reference files use @notation: @ENTERPRISE_WORKFLOWS.md, @AGENT_ROUTING_TABLE.md
  • Located in:
    .claude/docs/@*.md
  • See: CLAUDE.md Section 8.6 (ENTERPRISE WORKFLOWS reference)
  • 参考文件使用@符号: @ENTERPRISE_WORKFLOWS.md, @AGENT_ROUTING_TABLE.md
  • 位置:
    .claude/docs/@*.md
  • 查看: CLAUDE.md 8.6节(ENTERPRISE WORKFLOWS参考)

Shell Security (ADR-077)

Shell安全(ADR-077)

  • Workflow spawn templates must include:
    cd "$PROJECT_ROOT" || exit 1
    for background tasks
  • Environment variables control validators (block/warn/off mode)
  • See: .claude/docs/SHELL-SECURITY-GUIDE.md
  • Apply to: agent spawn prompts, task execution examples
  • 工作流生成模板必须包含:
    cd "$PROJECT_ROOT" || exit 1
    (适用于后台任务)
  • 环境变量控制验证器(阻止/警告/关闭模式)
  • 查看: .claude/docs/SHELL-SECURITY-GUIDE.md
  • 应用于: Agent生成提示、任务执行示例

Recent ADRs

最新ADR

  • ADR-075: Router Config-Aware Model Selection
  • ADR-076: File Placement Architecture Redesign
  • ADR-077: Shell Command Security Architecture

  • ADR-075: 路由器配置感知模型选择
  • ADR-076: 文件放置架构重新设计
  • ADR-077: Shell命令安全架构

File Placement & Standards

文件放置与标准

Output Location Rules

输出位置规则

This skill outputs to:
.claude/workflows/<category>/
Categories:
  • core/
    - Essential workflows (router-decision, skill-lifecycle)
  • enterprise/
    - Complex multi-agent flows (feature-development)
  • operations/
    - Operational procedures (incident-response)
  • creators/
    - Creator workflow YAML files
此技能输出到:
.claude/workflows/<category>/
类别:
  • core/
    - 核心工作流(router-decision, skill-lifecycle)
  • enterprise/
    - 复杂多Agent流程(feature-development)
  • operations/
    - 操作流程(incident-response)
  • creators/
    - 创建者工作流YAML文件

Mandatory References

强制参考

  • File Placement: See
    .claude/docs/FILE_PLACEMENT_RULES.md
  • Developer Workflow: See
    .claude/docs/DEVELOPER_WORKFLOW.md
  • Artifact Naming: See
    .claude/docs/ARTIFACT_NAMING.md
  • 文件放置: 查看
    .claude/docs/FILE_PLACEMENT_RULES.md
  • 开发者工作流: 查看
    .claude/docs/DEVELOPER_WORKFLOW.md
  • 工件命名: 查看
    .claude/docs/ARTIFACT_NAMING.md

Enforcement

执行

File placement is enforced by
file-placement-guard.cjs
hook. Invalid placements will be blocked in production mode.

文件放置由
file-placement-guard.cjs
钩子强制执行。 在生产模式下,无效放置将被阻止。

Memory Protocol (MANDATORY)

内存协议(必填)

Before starting:
bash
cat .claude/context/memory/learnings.md
Check for:
  • Previously created workflows
  • Workflow patterns that worked well
  • Issues with existing workflows
After completing:
  • New workflow created -> Append to
    .claude/context/memory/learnings.md
  • Workflow issue found -> Append to
    .claude/context/memory/issues.md
  • Architecture decision -> Append to
    .claude/context/memory/decisions.md
ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.

开始前:
bash
cat .claude/context/memory/learnings.md
检查:
  • 之前创建的工作流
  • 运行良好的工作流模式
  • 现有工作流的问题
完成后:
  • 已创建新工作流 -> 追加到
    .claude/context/memory/learnings.md
  • 发现工作流问题 -> 追加到
    .claude/context/memory/issues.md
  • 架构决策 -> 追加到
    .claude/context/memory/decisions.md
假设会被中断: 你的上下文可能会重置。如果未记录在内存中,就相当于没发生过。

Post-Creation Integration

创建后集成

After creation completes, run the ecosystem integration checklist:
  1. Call
    runIntegrationChecklist(artifactType, artifactPath)
    from
    .claude/lib/creators/creator-commons.cjs
  2. Call
    queueCrossCreatorReview(artifactType, artifactPath)
    from
    .claude/lib/creators/creator-commons.cjs
  3. Review the impact report — address all
    mustHave
    items before marking task complete
  4. Log any
    shouldHave
    items as follow-up tasks
Integration verification:
  • Workflow added to @WORKFLOW_AGENT_MAP.md
  • Workflow referenced in CLAUDE.md (if enterprise workflow)
  • Workflow assigned to at least one agent
  • Workflow catalog entry added (if applicable)
创建完成后,运行生态系统集成清单:
  1. 调用
    .claude/lib/creators/creator-commons.cjs
    中的
    runIntegrationChecklist(artifactType, artifactPath)
  2. 调用
    .claude/lib/creators/creator-commons.cjs
    中的
    queueCrossCreatorReview(artifactType, artifactPath)
  3. 查看影响报告 — 在标记任务完成前解决所有
    mustHave
  4. 将任何
    shouldHave
    项记录为后续任务
集成验证:
  • 工作流已添加到@WORKFLOW_AGENT_MAP.md
  • 工作流已在CLAUDE.md中引用(如果是企业工作流)
  • 工作流已分配给至少一个Agent
  • 已添加工作流目录条目(如适用)