task-coordination-strategies

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Task Coordination Strategies

任务协调策略

Strategies for decomposing complex tasks into parallelizable units, designing dependency graphs, writing effective task descriptions, and monitoring workload across agent teams.
将复杂任务分解为可并行处理的单元、设计依赖关系图、撰写有效的任务描述,以及监控Agent团队间工作负载的策略。

When to Use This Skill

何时使用此技能

  • Breaking down a complex task for parallel execution
  • Designing task dependency relationships (blockedBy/blocks)
  • Writing task descriptions with clear acceptance criteria
  • Monitoring and rebalancing workload across teammates
  • Identifying the critical path in a multi-task workflow
  • 将复杂任务拆分为可并行执行的模块
  • 设计任务依赖关系(blockedBy/blocks)
  • 撰写包含明确验收标准的任务描述
  • 监控并重新平衡团队成员的工作负载
  • 识别多任务工作流中的关键路径

Task Decomposition Strategies

任务分解策略

By Layer

按层级拆分

Split work by architectural layer:
  • Frontend components
  • Backend API endpoints
  • Database migrations/models
  • Test suites
Best for: Full-stack features, vertical slices
按架构层级拆分工作:
  • 前端组件
  • 后端API端点
  • 数据库迁移/模型
  • 测试套件
最适用于:全栈功能、垂直切片开发

By Component

按组件拆分

Split work by functional component:
  • Authentication module
  • User profile module
  • Notification module
Best for: Microservices, modular architectures
按功能组件拆分工作:
  • 认证模块
  • 用户资料模块
  • 通知模块
最适用于:微服务、模块化架构

By Concern

按关注点拆分

Split work by cross-cutting concern:
  • Security review
  • Performance review
  • Architecture review
Best for: Code reviews, audits
按横切关注点拆分工作:
  • 安全审查
  • 性能审查
  • 架构审查
最适用于:代码审查、审计

By File Ownership

按文件所有权拆分

Split work by file/directory boundaries:
  • src/components/
    — Implementer 1
  • src/api/
    — Implementer 2
  • src/utils/
    — Implementer 3
Best for: Parallel implementation, conflict avoidance
按文件/目录边界拆分工作:
  • src/components/
    — 开发者1
  • src/api/
    — 开发者2
  • src/utils/
    — 开发者3
最适用于:并行开发、避免冲突

Dependency Graph Design

依赖关系图设计

Principles

原则

  1. Minimize chain depth — Prefer wide, shallow graphs over deep chains
  2. Identify the critical path — The longest chain determines minimum completion time
  3. Use blockedBy sparingly — Only add dependencies that are truly required
  4. Avoid circular dependencies — Task A blocks B blocks A is a deadlock
  1. 最小化链深度 — 优先选择宽而浅的图,而非深链
  2. 识别关键路径 — 最长的任务链决定最短完成时间
  3. 谨慎使用blockedBy — 仅添加真正必要的依赖
  4. 避免循环依赖 — 任务A阻塞B,B又阻塞A会导致死锁

Patterns

模式

Independent (Best parallelism):
Task A ─┐
Task B ─┼─→ Integration
Task C ─┘
Sequential (Necessary dependencies):
Task A → Task B → Task C
Diamond (Mixed):
        ┌→ Task B ─┐
Task A ─┤          ├→ Task D
        └→ Task C ─┘
独立型(最佳并行性)
Task A ─┐
Task B ─┼─→ Integration
Task C ─┘
顺序型(必要依赖)
Task A → Task B → Task C
钻石型(混合模式)
        ┌→ Task B ─┐
Task A ─┤          ├→ Task D
        └→ Task C ─┘

Using blockedBy/blocks

使用blockedBy/blocks

TaskCreate: { subject: "Build API endpoints" }         → Task #1
TaskCreate: { subject: "Build frontend components" }    → Task #2
TaskCreate: { subject: "Integration testing" }          → Task #3
TaskUpdate: { taskId: "3", addBlockedBy: ["1", "2"] }  → #3 waits for #1 and #2
TaskCreate: { subject: "Build API endpoints" }         → Task #1
TaskCreate: { subject: "Build frontend components" }    → Task #2
TaskCreate: { subject: "Integration testing" }          → Task #3
TaskUpdate: { taskId: "3", addBlockedBy: ["1", "2"] }  → #3 waits for #1 and #2

Task Description Best Practices

任务描述最佳实践

Every task should include:
  1. Objective — What needs to be accomplished (1-2 sentences)
  2. Owned Files — Explicit list of files/directories this teammate may modify
  3. Requirements — Specific deliverables or behaviors expected
  4. Interface Contracts — How this work connects to other teammates' work
  5. Acceptance Criteria — How to verify the task is done correctly
  6. Scope Boundaries — What is explicitly out of scope
每个任务应包含:
  1. 目标 — 需要完成的内容(1-2句话)
  2. 负责文件 — 明确列出该团队成员可能修改的文件/目录
  3. 需求 — 具体的交付成果或预期行为
  4. 接口契约 — 此项工作与其他团队成员工作的衔接方式
  5. 验收标准 — 如何验证任务已正确完成
  6. 范围边界 — 明确排除在范围外的内容

Template

模板

undefined
undefined

Objective

Objective

Build the user authentication API endpoints.
Build the user authentication API endpoints.

Owned Files

Owned Files

  • src/api/auth.ts
  • src/api/middleware/auth-middleware.ts
  • src/types/auth.ts (shared — read only, do not modify)
  • src/api/auth.ts
  • src/api/middleware/auth-middleware.ts
  • src/types/auth.ts (shared — read only, do not modify)

Requirements

Requirements

  • POST /api/login — accepts email/password, returns JWT
  • POST /api/register — creates new user, returns JWT
  • GET /api/me — returns current user profile (requires auth)
  • POST /api/login — accepts email/password, returns JWT
  • POST /api/register — creates new user, returns JWT
  • GET /api/me — returns current user profile (requires auth)

Interface Contract

Interface Contract

  • Import User type from src/types/auth.ts (owned by implementer-1)
  • Export AuthResponse type for frontend consumption
  • Import User type from src/types/auth.ts (owned by implementer-1)
  • Export AuthResponse type for frontend consumption

Acceptance Criteria

Acceptance Criteria

  • All endpoints return proper HTTP status codes
  • JWT tokens expire after 24 hours
  • Passwords are hashed with bcrypt
  • All endpoints return proper HTTP status codes
  • JWT tokens expire after 24 hours
  • Passwords are hashed with bcrypt

Out of Scope

Out of Scope

  • OAuth/social login
  • Password reset flow
  • Rate limiting
undefined
  • OAuth/social login
  • Password reset flow
  • Rate limiting
undefined

Workload Monitoring

工作负载监控

Indicators of Imbalance

失衡指标

SignalMeaningAction
Teammate idle, others busyUneven distributionReassign pending tasks
Teammate stuck on one taskPossible blockerCheck in, offer help
All tasks blockedDependency issueResolve critical path first
One teammate has 3x othersOverloadedSplit tasks or reassign
信号含义行动
团队成员空闲,其他人忙碌分配不均重新分配待处理任务
团队成员卡在某一任务上可能存在阻塞点跟进情况,提供帮助
所有任务均被阻塞依赖关系问题优先解决关键路径问题
某团队成员任务量是他人3倍负载过重拆分任务或重新分配

Rebalancing Steps

重新平衡步骤

  1. Call
    TaskList
    to assess current state
  2. Identify idle or overloaded teammates
  3. Use
    TaskUpdate
    to reassign tasks
  4. Use
    SendMessage
    to notify affected teammates
  5. Monitor for improved throughput
  1. 调用
    TaskList
    评估当前状态
  2. 识别空闲或负载过重的团队成员
  3. 使用
    TaskUpdate
    重新分配任务
  4. 使用
    SendMessage
    通知受影响的团队成员
  5. 监控吞吐量是否提升