parallel-coordinator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseParallel Coordinator
并行协调器
Purpose
用途
The Parallel Coordinator skill enables orchestration of multiple independent agents executing simultaneously. By leveraging Claude Sonnet 4.5's native capability to execute multiple tool calls in a single message, this skill maximizes throughput when users present requests containing multiple independent tasks.
This skill transforms sequential bottlenecks into parallel workflows, reducing overall completion time and improving user experience when handling complex, multi-faceted requests.
并行协调器技能能够协调多个独立Agent同时执行。通过利用Claude Sonnet 4.5在单条消息中执行多个工具调用的原生能力,当用户提出包含多个独立任务的请求时,该技能可以最大化吞吐量。
此技能将顺序瓶颈转化为并行工作流,在处理复杂、多方面的请求时减少整体完成时间并提升用户体验。
When to Use This Skill
何时使用此技能
Invoke the Parallel Coordinator when:
- Multiple Independent Tasks: The user's request contains 2 or more tasks that can be completed without interdependencies
- Parallelizable Operations: Tasks involve I/O-bound operations (file reading, web searches, API calls) that benefit from concurrent execution
- Multi-Domain Requests: The request spans different domains or contexts (e.g., "analyze this dataset AND review that codebase AND research this topic")
- Batch Operations: The user needs the same operation performed on multiple independent targets
在以下场景调用并行协调器:
- 多个独立任务:用户请求包含2个或更多无需依赖即可完成的任务
- 可并行操作:任务涉及I/O密集型操作(文件读取、网页搜索、API调用),这类操作能从并发执行中获益
- 多领域请求:请求跨越不同领域或上下文(例如:“分析这个数据集,同时审查那个代码库,还要研究这个主题”)
- 批量操作:用户需要对多个独立目标执行相同操作
Clear Indicators for Use
明确使用指标
- User employs conjunctions suggesting independence: "and also", "separately", "in parallel"
- Request contains numbered or bulleted lists of distinct tasks
- Tasks operate on different files, datasets, or domains
- No shared mutable state between tasks
- Results can be aggregated after completion without cross-dependencies
- 用户使用表示独立性的连词:“并且”、“分别”、“并行”
- 请求包含编号或项目符号列表形式的不同任务
- 任务针对不同文件、数据集或领域
- 任务之间无共享可变状态
- 结果可在完成后聚合,无需交叉依赖
When NOT to Use
何时不使用
Do not use this skill when:
- Tasks have sequential dependencies (Task B requires output from Task A)
- Tasks modify shared resources that could create race conditions
- A single cohesive task that happens to involve multiple steps
- User explicitly requests sequential execution
- Tasks are trivial and parallelization overhead exceeds benefits
在以下场景请勿使用此技能:
- 任务存在顺序依赖(任务B需要任务A的输出)
- 任务修改可能引发竞争条件的共享资源
- 单个内聚任务包含多个步骤
- 用户明确要求顺序执行
- 任务过于琐碎,并行化开销超过收益
Core Workflow
核心工作流
The Parallel Coordinator follows a structured four-phase approach:
并行协调器遵循结构化的四阶段方法:
Phase 1: Task Decomposition and Analysis
阶段1:任务分解与分析
Objective: Break down the user's request into discrete, analyzable units.
- Parse the Request: Identify all distinct tasks within the user's message
- Extract Requirements: For each task, determine:
- Inputs required
- Expected outputs
- Resources needed (files, APIs, tools)
- Estimated complexity
- Document Task Boundaries: Clearly define where one task ends and another begins
目标:将用户请求拆分为离散、可分析的单元。
- 解析请求:识别用户消息中的所有不同任务
- 提取需求:针对每个任务,确定:
- 所需输入
- 预期输出
- 需要的资源(文件、API、工具)
- 预估复杂度
- 记录任务边界:明确定义任务的起止范围
Phase 2: Dependency Verification
阶段2:依赖验证
Objective: Ensure tasks are truly independent and can safely execute in parallel.
- Check Data Dependencies: Verify no task requires output from another
- Identify Shared Resources: Flag any files, databases, or APIs used by multiple tasks
- Assess Resource Conflicts: Determine if shared resources are read-only (safe) or mutable (unsafe)
- Validate Independence: Confirm each task can complete successfully without waiting for others
Decision Point: If dependencies exist, either:
- Restructure into independent phases (Phase 1 tasks run parallel, then Phase 2 tasks run parallel)
- Abort parallelization and execute sequentially
目标:确保任务真正独立且可安全并行执行。
- 检查数据依赖:验证是否有任务需要其他任务的输出
- 识别共享资源:标记多个任务使用的文件、数据库或API
- 评估资源冲突:确定共享资源是只读(安全)还是可变(不安全)
- 验证独立性:确认每个任务无需等待其他任务即可成功完成
决策点:如果存在依赖,可选择:
- 重构为独立阶段(阶段1任务并行运行,然后阶段2任务并行运行)
- 终止并行化,改为顺序执行
Phase 3: Parallel Execution
阶段3:并行执行
Objective: Launch all independent tasks simultaneously using Claude Sonnet 4.5's parallel tool execution.
-
Create Task Definitions: Use TaskCreate to define each independent task with:
- Clear, actionable subject in imperative form
- Detailed description including context and acceptance criteria
- Present continuous activeForm for progress tracking
-
Execute in Single Message: Make all TaskCreate calls within one function_calls block to ensure true parallel execution
-
Monitor Progress: Track task completion status without blocking
Technical Implementation: Execute multiple tool calls simultaneously in a single function_calls block. This is Claude Sonnet 4.5's key strength - the ability to fire off multiple independent operations at once.
目标:利用Claude Sonnet 4.5的并行工具执行能力,同时启动所有独立任务。
-
创建任务定义:使用TaskCreate定义每个独立任务,包含:
- 清晰、可执行的祈使句主题
- 包含上下文和验收标准的详细描述
- 用于进度跟踪的持续活动状态
-
单消息执行:在一个function_calls块中调用所有TaskCreate,确保真正的并行执行
-
监控进度:跟踪任务完成状态,无需阻塞
技术实现:在单个function_calls块中同时执行多个工具调用。这是Claude Sonnet 4.5的核心优势——能够同时触发多个独立操作。
Phase 4: Result Integration
阶段4:结果整合
Objective: Aggregate outputs from parallel tasks into a cohesive response.
- Collect Results: Gather outputs from all completed tasks
- Identify Cross-Task Insights: Look for patterns, contradictions, or synergies across results
- Synthesize Response: Combine individual results into a unified, coherent answer
- Validate Completeness: Ensure all original user requirements are addressed
目标:将并行任务的输出聚合为连贯的响应。
- 收集结果:收集所有已完成任务的输出
- 识别跨任务洞察:寻找结果中的模式、矛盾或协同效应
- 合成响应:将单个结果组合为统一、连贯的答案
- 验证完整性:确保满足所有原始用户需求
Parallel Execution Patterns
并行执行模式
Pattern 1: Homogeneous Batch Processing
模式1:同质批量处理
Use Case: Apply the same operation to multiple independent targets.
Example: "Analyze code quality in files A.py, B.py, and C.py"
Approach:
- Create identical task templates
- Parameterize by target (file, dataset, etc.)
- Execute all instances simultaneously
- Compare results in aggregation phase
Benefits:
- Reduces total time from 3T to T (where T is single task duration)
- Enables comparative analysis across targets
使用场景:对多个独立目标执行相同操作。
示例:“分析A.py、B.py和C.py文件的代码质量”
方法:
- 创建相同的任务模板
- 按目标(文件、数据集等)参数化
- 同时执行所有实例
- 在聚合阶段比较结果
优势:
- 总时间从3T减少到T(T为单个任务的持续时间)
- 支持跨目标的比较分析
Pattern 2: Heterogeneous Multi-Domain
模式2:异构多领域
Use Case: Perform different operations across unrelated domains.
Example: "Research quantum computing papers, analyze sales data, and review frontend code"
Approach:
- Define domain-specific tasks with unique requirements
- Ensure no shared resources between domains
- Execute all tasks simultaneously
- Present results in structured, domain-separated format
Benefits:
- Maximizes throughput on diverse requests
- Reduces context switching for user
使用场景:在不相关领域执行不同操作。
示例:“研究量子计算论文、分析销售数据、审查前端代码”
方法:
- 定义具有独特需求的领域特定任务
- 确保领域之间无共享资源
- 同时执行所有任务
- 以结构化、分领域的格式呈现结果
优势:
- 最大化多样化请求的吞吐量
- 减少用户的上下文切换
Pattern 3: Fork-Join with Independent Forks
模式3:带独立分支的分叉-合并
Use Case: Parallel exploration followed by synthesis.
Example: "Search for solutions in documentation, Stack Overflow, and GitHub issues, then summarize"
Approach:
- Fork Phase: Launch parallel search tasks
- Join Phase: After all complete, synthesize findings
- Ensure fork tasks are truly independent
Benefits:
- Comprehensive exploration in minimal time
- Enables better synthesis from multiple sources
使用场景:并行探索后进行合成。
示例:“在文档、Stack Overflow和GitHub问题中搜索解决方案,然后总结”
方法:
- 分叉阶段:启动并行搜索任务
- 合并阶段:所有任务完成后,综合发现
- 确保分叉任务真正独立
优势:
- 以最短时间完成全面探索
- 支持从多个来源进行更好的合成
Pattern 4: Pipeline Parallelism
模式4:流水线并行
Use Case: Multiple independent pipelines executing simultaneously.
Example: "Process Dataset A (load, clean, analyze) AND Dataset B (load, clean, analyze) AND Dataset C (load, clean, analyze)"
Approach:
- Each pipeline is a sequential chain within itself
- Pipelines are independent of each other
- Execute all pipelines simultaneously
- Each pipeline maintains internal order while running parallel to others
Benefits:
- Parallelizes at pipeline level, not step level
- Maintains data integrity within each pipeline
使用场景:多个独立流水线同时执行。
示例:“处理数据集A(加载、清理、分析)AND 数据集B(加载、清理、分析)AND 数据集C(加载、清理、分析)”
方法:
- 每个流水线内部是顺序链
- 流水线之间相互独立
- 同时执行所有流水线
- 每个流水线在与其他流水线并行运行时保持内部顺序
优势:
- 在流水线级别而非步骤级别并行化
- 保持每个流水线内的数据完整性
Handling Shared Resources
共享资源处理
Read-Only Resources (Safe for Parallel Access)
只读资源(并行访问安全)
When multiple tasks read from the same resource without modification:
Acceptable Scenarios:
- Multiple tasks reading the same configuration file
- Parallel web searches using the same search API
- Multiple analyses of the same immutable dataset
Best Practices:
- Document shared read dependencies
- Verify resource won't change during execution
- Consider caching if resource access is expensive
当多个任务从同一资源读取而不修改时:
可接受场景:
- 多个任务读取同一配置文件
- 使用同一搜索API进行并行网页搜索
- 对同一不可变数据集进行多次分析
最佳实践:
- 记录共享读依赖
- 验证资源在执行期间不会更改
- 如果资源访问成本高,考虑缓存
Mutable Resources (Unsafe - Requires Coordination)
可变资源(不安全 - 需要协调)
When tasks might modify shared state:
Problematic Scenarios:
- Multiple tasks editing the same file
- Parallel writes to the same database
- Concurrent modifications to shared data structures
Mitigation Strategies:
- Partition Resources: Divide mutable resource into independent sections
- Sequence Critical Sections: Parallelize non-conflicting parts, sequence conflicting parts
- Abort Parallelization: Execute sequentially if conflicts are unavoidable
当任务可能修改共享状态时:
问题场景:
- 多个任务编辑同一文件
- 并行写入同一数据库
- 并发修改共享数据结构
缓解策略:
- 资源分区:将可变资源划分为独立部分
- 关键部分序列化:并行化非冲突部分,序列化冲突部分
- 终止并行化:如果冲突不可避免,则顺序执行
Examples of Effective Parallelization
有效并行化示例
Example 1: Multi-Modal Research Task
示例1:多模态研究任务
User Request: "Research recent advances in transformer architectures, analyze sentiment in customer reviews dataset, and create a visualization of our Q4 sales data"
Parallelization Strategy:
Task 1 - Research Agent:
- Subject: "Research transformer architecture advances"
- Actions: Web search, documentation review, summarization
- Resources: Web search API (read-only, shared safe)
Task 2 - Analysis Agent:
- Subject: "Analyze sentiment in customer reviews"
- Actions: Load dataset, apply sentiment analysis, generate statistics
- Resources: reviews.csv (read-only)
Task 3 - Visualization Agent:
- Subject: "Create Q4 sales visualization"
- Actions: Load sales data, generate charts, export images
- Resources: sales_q4.csv (read-only)
Independence Verification:
- No data dependencies between tasks
- All resources are read-only
- Results can be aggregated independently
Expected Outcome: Completion in time T (single task duration) vs. 3T (sequential)
用户请求:“研究Transformer架构的最新进展,分析客户评论数据集的情感,创建我们Q4销售数据的可视化”
并行化策略:
任务1 - 研究Agent:
- 主题:“研究Transformer架构进展”
- 操作:网页搜索、文档审查、总结
- 资源:网页搜索API(只读,共享安全)
任务2 - 分析Agent:
- 主题:“分析客户评论的情感”
- 操作:加载数据集、应用情感分析、生成统计数据
- 资源:reviews.csv(只读)
任务3 - 可视化Agent:
- 主题:“创建Q4销售可视化”
- 操作:加载销售数据、生成图表、导出图片
- 资源:sales_q4.csv(只读)
独立性验证:
- 任务之间无数据依赖
- 所有资源均为只读
- 结果可独立聚合
预期结果:完成时间为T(单个任务持续时间),而非3T(顺序执行)
Example 2: Parallel Literature Review
示例2:并行文献综述
User Request: "Find papers on: neural architecture search, federated learning, and explainable AI"
Parallelization Strategy:
Three Parallel Search Agents:
- Each conducts independent literature search on one topic
- No shared mutable state
- Results aggregated for comparative analysis
Benefits:
- Comprehensive coverage in 1/3 the time
- Enables cross-topic insights during synthesis
用户请求:“查找关于以下主题的论文:神经架构搜索、联邦学习、可解释AI”
并行化策略:
三个并行搜索Agent:
- 每个Agent独立搜索一个主题的文献
- 无共享可变状态
- 结果聚合用于比较分析
优势:
- 以1/3的时间完成全面覆盖
- 在合成阶段支持跨主题洞察
Example 3: Multi-Codebase Analysis
示例3:多代码库分析
User Request: "Review code quality in our auth service, payment service, and notification service"
Parallelization Strategy:
Three Parallel Review Agents:
- Each analyzes one service codebase
- Independent file systems (no conflicts)
- Consistent evaluation criteria across all agents
Synthesis Phase:
- Compare quality metrics across services
- Identify common patterns and anti-patterns
- Prioritize remediation efforts
用户请求:“审查我们的认证服务、支付服务和通知服务的代码质量”
并行化策略:
三个并行审查Agent:
- 每个Agent分析一个服务的代码库
- 文件系统独立(无冲突)
- 所有Agent使用一致的评估标准
合成阶段:
- 比较各服务的质量指标
- 识别常见模式和反模式
- 优先排序修复工作
Anti-Patterns and Common Pitfalls
反模式与常见陷阱
Anti-Pattern 1: Premature Parallelization
反模式1:过早并行化
Problem: Attempting to parallelize tasks with hidden dependencies.
Example: "Analyze file A, then use those insights to process file B" - These tasks appear independent but have implicit data dependency.
Solution: Always perform explicit dependency analysis before parallelizing.
问题:尝试并行化存在隐藏依赖的任务。
示例:“分析文件A,然后使用这些见解处理文件B”——这些任务看似独立,但存在隐式数据依赖。
解决方案:在并行化前始终执行显式依赖分析。
Anti-Pattern 2: Over-Granular Parallelization
反模式2:过度细粒度并行化
Problem: Creating too many tiny parallel tasks with high coordination overhead.
Example: Parallelizing 20 tasks that each take 2 seconds - coordination overhead exceeds benefits.
Solution: Aim for 2-5 substantial tasks. Batch small operations into larger tasks.
问题:创建过多微小的并行任务,导致协调开销过高。
示例:并行化20个各需2秒的任务——协调开销超过收益。
解决方案:目标是2-5个实质性任务。将小操作批处理为更大的任务。
Anti-Pattern 3: Ignoring Shared Mutable State
反模式3:忽略共享可变状态
Problem: Multiple tasks modifying the same resource concurrently.
Example: Three tasks appending to the same output file without coordination.
Solution: Either partition the resource or sequence the conflicting operations.
问题:多个任务并发修改同一资源。
示例:三个任务在无协调的情况下向同一输出文件追加内容。
解决方案:要么分区资源,要么序列化冲突操作。
Anti-Pattern 4: False Independence
反模式4:虚假独立性
Problem: Tasks appear independent but share implicit coupling.
Example: Two tasks analyzing the same dataset where first performs cleaning that second assumes - if second runs before first, results are incorrect.
Solution: Make all dependencies explicit. If implicit coupling exists, tasks are not independent.
问题:任务看似独立,但存在隐式耦合。
示例:两个任务分析同一数据集,第一个执行清理操作,第二个依赖该清理结果——如果第二个任务先运行,结果将不正确。
解决方案:使所有依赖显式化。如果存在隐式耦合,则任务并非独立。
Integration and Result Synthesis
集成与结果合成
Collecting Results
收集结果
After all parallel tasks complete:
- Verify Completion: Confirm all tasks reached completion state
- Check for Errors: Identify any failures or partial completions
- Gather Outputs: Collect all results, maintaining task identity
所有并行任务完成后:
- 验证完成状态:确认所有任务已完成
- 检查错误:识别任何失败或部分完成的情况
- 收集输出:收集所有结果,保留任务标识
Synthesis Strategies
合成策略
Aggregation: When results are similar in nature:
- Combine into unified list or table
- Calculate summary statistics
- Identify outliers or anomalies
Comparison: When results should be evaluated against each other:
- Highlight similarities and differences
- Rank or prioritize based on criteria
- Identify best practices or concerns
Integration: When results form parts of a larger whole:
- Identify connections between findings
- Construct comprehensive narrative
- Address user's original intent holistically
聚合:当结果性质相似时:
- 组合为统一列表或表格
- 计算汇总统计数据
- 识别异常值
比较:当结果需要相互评估时:
- 突出相似点和差异
- 根据标准排名或优先排序
- 识别最佳实践或关注点
整合:当结果构成更大整体的一部分时:
- 识别发现之间的联系
- 构建全面的叙述
- 整体回应用户的原始意图
Presenting Results
结果呈现
Structure the final response to:
- Summarize Overall Findings: High-level overview addressing user's request
- Detail Individual Results: Present each task's output with clear attribution
- Highlight Cross-Task Insights: Note patterns, contradictions, or synergies discovered
- Provide Actionable Recommendations: Based on complete picture from all tasks
最终响应的结构应:
- 总结整体发现:回应用户请求的高层概述
- 详细描述单个结果:清晰归属地呈现每个任务的输出
- 突出跨任务洞察:记录发现的模式、矛盾或协同效应
- 提供可操作建议:基于所有任务的完整情况
Technical Considerations
技术考量
Claude Sonnet 4.5 Parallel Execution
Claude Sonnet 4.5并行执行
Claude Sonnet 4.5 has native support for executing multiple tool calls in a single message. Key characteristics:
- True Parallelism: When multiple independent tool calls are provided in one function_calls block, they execute concurrently
- I/O Optimization: Particularly effective for I/O-bound operations (file reads, web requests)
- No Explicit Threading: Parallelism is handled automatically by the execution environment
- Result Ordering: Results return in completion order, not call order
Claude Sonnet 4.5原生支持在单条消息中执行多个工具调用。关键特性:
- 真正的并行性:当在一个function_calls块中提供多个独立工具调用时,它们会并发执行
- I/O优化:对I/O密集型操作(文件读取、网页请求)特别有效
- 无需显式线程:并行性由执行环境自动处理
- 结果顺序:结果按完成顺序返回,而非调用顺序
Best Practices for Tool Calls
工具调用最佳实践
- Batch Independent Calls: Group all independent tool calls in one function_calls block
- Avoid Sequential Calls: Don't make a call, wait for result, then make another if they could be parallel
- Use TaskCreate for Complex Work: For substantial tasks that may involve multiple steps, use Task tools to maintain coordination
- Monitor, Don't Block: Check task status without waiting synchronously
- 批量独立调用:将所有独立工具调用分组到一个function_calls块中
- 避免顺序调用:如果可以并行,不要先调用一个、等待结果再调用另一个
- 使用TaskCreate处理复杂工作:对于可能涉及多个步骤的实质性任务,使用Task工具保持协调
- 监控而非阻塞:无需同步等待即可检查任务状态
Performance Expectations
性能预期
Ideal Scenarios (near-linear speedup):
- File reading operations (Read tool)
- Web searches (WebSearch tool)
- Independent code analysis tasks
- Parallel API calls
Limited Speedup Scenarios:
- CPU-bound operations (computation)
- Tasks with hidden dependencies
- Very short tasks (coordination overhead dominates)
理想场景(接近线性加速):
- 文件读取操作(Read工具)
- 网页搜索(WebSearch工具)
- 独立代码分析任务
- 并行API调用
加速有限的场景:
- CPU密集型操作(计算)
- 存在隐藏依赖的任务
- 非常短的任务(协调开销占主导)
Skill Invocation Contract
技能调用契约
When this skill is invoked:
Input Requirements:
- User request containing 2+ potentially independent tasks
- Clear specification of what each task should accomplish
- Sufficient context to identify dependencies
Skill Responsibilities:
- Analyze request for parallelization opportunities
- Verify task independence through dependency analysis
- Create and launch parallel tasks using appropriate tools
- Monitor execution progress
- Integrate results into cohesive response
- Present findings in structured, actionable format
Output Guarantees:
- All independent tasks executed in parallel
- Results from all tasks included in final response
- Dependencies respected (no race conditions)
- Clear attribution of results to tasks
- Synthesis that addresses original user intent
Failure Modes:
- If dependencies detected: Restructure or abort parallelization
- If task fails: Report failure, continue with successful tasks
- If resources conflict: Sequence conflicting operations
调用此技能时:
输入要求:
- 用户请求包含2个及以上潜在独立任务
- 明确指定每个任务的目标
- 有足够上下文以识别依赖
技能职责:
- 分析请求的并行化机会
- 通过依赖分析验证任务独立性
- 使用适当工具创建并启动并行任务
- 监控执行进度
- 将结果集成为连贯响应
- 以结构化、可操作的格式呈现发现
输出保证:
- 所有独立任务并行执行
- 最终响应包含所有任务的结果
- 尊重依赖(无竞争条件)
- 结果与任务清晰对应
- 合成内容回应用户原始意图
失败模式:
- 如果检测到依赖:重构或终止并行化
- 如果任务失败:报告失败,继续处理成功的任务
- 如果资源冲突:序列化冲突操作
Conclusion
结论
The Parallel Coordinator skill unlocks Claude Sonnet 4.5's ability to execute multiple independent operations simultaneously. By carefully analyzing task dependencies, structuring parallel execution, and synthesizing results, this skill dramatically reduces completion time for multi-faceted requests.
Use this skill when independence is clear, dependencies are absent, and the user's request naturally decomposes into concurrent operations. The result is faster, more efficient responses that maintain quality while maximizing throughput.
并行协调器技能释放了Claude Sonnet 4.5同时执行多个独立操作的能力。通过仔细分析任务依赖、构建并行执行流程和合成结果,该技能显著减少了多方面请求的完成时间。
当独立性明确、无依赖且用户请求可自然分解为并发操作时,使用此技能。结果是更快、更高效的响应,在保持质量的同时最大化吞吐量。