agent-teams

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Agent Teams Skill

Agent Teams 技能

Load with: base.md + code-review.md + security.md + session-management.md
Purpose: Every project initialized with claude-bootstrap runs as a coordinated team of AI agents. This is the default workflow, not optional. Teams enforce a strict TDD pipeline where no step can be skipped.
Requires:
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
environment variable.

加载依赖:base.md + code-review.md + security.md + session-management.md
用途:所有通过claude-bootstrap初始化的项目都以AI Agent协作团队的形式运行。这是默认工作流,不可选择。团队强制执行严格的TDD流程,任何步骤都无法跳过。
依赖要求:需设置环境变量
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1

Core Principle

核心原则

Every feature follows an immutable pipeline enforced by task dependencies:
┌─────────────────────────────────────────────────────────────────┐
│  STRICT FEATURE PIPELINE (IMMUTABLE)                            │
│  ──────────────────────────────────────────────────────────────  │
│                                                                  │
│  1. SPEC        Write feature specification                      │
│       ↓         (Feature Agent)                                  │
│  2. REVIEW      Quality Agent reviews spec completeness          │
│       ↓         (Quality Agent)                                  │
│  3. TESTS       Write failing tests for all acceptance criteria  │
│       ↓         (Feature Agent)                                  │
│  4. RED VERIFY  Quality Agent confirms ALL tests FAIL            │
│       ↓         (Quality Agent)                                  │
│  5. IMPLEMENT   Write minimum code to pass tests                 │
│       ↓         (Feature Agent)                                  │
│  6. GREEN VERIFY Quality Agent confirms ALL tests PASS + coverage│
│       ↓         (Quality Agent)                                  │
│  7. VALIDATE    Lint + type check + full test suite              │
│       ↓         (Feature Agent)                                  │
│  8. CODE REVIEW Multi-engine review, block on Critical/High      │
│       ↓         (Code Review Agent)                              │
│  9. SECURITY    OWASP scan, secrets detection, dependency audit  │
│       ↓         (Security Agent)                                 │
│  10. BRANCH+PR  Create feature branch, stage files, create PR    │
│                 (Merger Agent)                                    │
│                                                                  │
│  No step can be skipped. Task dependencies enforce ordering.     │
│  Quality Agent verifies RED/GREEN transitions.                   │
│  Code Review + Security Agents gate the merge path.              │
│  Merger Agent handles branching and PR creation.                 │
└─────────────────────────────────────────────────────────────────┘

每个功能都遵循由任务依赖关系强制执行的不可变流程:
┌─────────────────────────────────────────────────────────────────┐
│  STRICT FEATURE PIPELINE (IMMUTABLE)                            │
│  ──────────────────────────────────────────────────────────────  │
│                                                                  │
│  1. SPEC        Write feature specification                      │
│       ↓         (Feature Agent)                                  │
│  2. REVIEW      Quality Agent reviews spec completeness          │
│       ↓         (Quality Agent)                                  │
│  3. TESTS       Write failing tests for all acceptance criteria  │
│       ↓         (Feature Agent)                                  │
│  4. RED VERIFY  Quality Agent confirms ALL tests FAIL            │
│       ↓         (Quality Agent)                                  │
│  5. IMPLEMENT   Write minimum code to pass tests                 │
│       ↓         (Feature Agent)                                  │
│  6. GREEN VERIFY Quality Agent confirms ALL tests PASS + coverage│
│       ↓         (Quality Agent)                                  │
│  7. VALIDATE    Lint + type check + full test suite              │
│       ↓         (Feature Agent)                                  │
│  8. CODE REVIEW Multi-engine review, block on Critical/High      │
│       ↓         (Code Review Agent)                              │
│  9. SECURITY    OWASP scan, secrets detection, dependency audit  │
│       ↓         (Security Agent)                                 │
│  10. BRANCH+PR  Create feature branch, stage files, create PR    │
│                 (Merger Agent)                                    │
│                                                                  │
│  No step can be skipped. Task dependencies enforce ordering.     │
│  Quality Agent verifies RED/GREEN transitions.                   │
│  Code Review + Security Agents gate the merge path.              │
│  Merger Agent handles branching and PR creation.                 │
└─────────────────────────────────────────────────────────────────┘

Default Agent Roster

默认Agent团队成员

Every project spawns 5 permanent agents + N feature agents:
┌─────────────────────────────────────────────────────────────────┐
│  DEFAULT TEAM ROSTER                                             │
│  ──────────────────────────────────────────────────────────────  │
│                                                                  │
│  PERMANENT AGENTS (always present)                               │
│  ─────────────────────────────────                               │
│  Team Lead        Orchestration, task breakdown, assignment      │
│                   Uses delegate mode - NEVER writes code         │
│                                                                  │
│  Quality Agent    TDD verification (RED/GREEN phases)            │
│                   Coverage gates (>= 80%)                        │
│                   Spec completeness review                       │
│                                                                  │
│  Security Agent   OWASP scanning, secrets detection              │
│                   Dependency audit, .env validation               │
│                   Blocks on Critical/High                        │
│                                                                  │
│  Code Review Agent  Multi-engine code review                     │
│                     Claude / Codex / Gemini / All                │
│                     Blocks on Critical/High                      │
│                                                                  │
│  Merger Agent     Creates feature branches                       │
│                   Stages feature-specific files only              │
│                   Creates PRs via gh CLI                          │
│                   NEVER merges - only creates PRs                │
│                                                                  │
│  DYNAMIC AGENTS (one per feature)                                │
│  ────────────────────────────────                                │
│  Feature Agent    Implements one feature end-to-end              │
│  (x N features)   Follows strict pipeline above                  │
│                   Uses Ralph loops for implementation             │
│                                                                  │
└─────────────────────────────────────────────────────────────────┘
AgentRolePlan ModeCan Edit Code
team-leadOrchestration, task breakdown, assignmentNo (delegate mode)No
quality-agentTDD verification, coverage gatesYesNo (read-only)
security-agentOWASP scanning, secrets detectionYesNo (read-only)
review-agentMulti-engine code reviewYesNo (read-only)
merger-agentBranch creation, PR managementNoNo (git only)
feature-{name}Feature implementation (one per feature)NoYes

每个项目会生成5个永久Agent + N个Feature Agent:
┌─────────────────────────────────────────────────────────────────┐
│  DEFAULT TEAM ROSTER                                             │
│  ──────────────────────────────────────────────────────────────  │
│                                                                  │
│  PERMANENT AGENTS (always present)                               │
│  ─────────────────────────────────                               │
│  Team Lead        Orchestration, task breakdown, assignment      │
│                   Uses delegate mode - NEVER writes code         │
│                                                                  │
│  Quality Agent    TDD verification (RED/GREEN phases)            │
│                   Coverage gates (>= 80%)                        │
│                   Spec completeness review                       │
│                                                                  │
│  Security Agent   OWASP scanning, secrets detection              │
│                   Dependency audit, .env validation               │
│                   Blocks on Critical/High                        │
│                                                                  │
│  Code Review Agent  Multi-engine code review                     │
│                     Claude / Codex / Gemini / All                │
│                     Blocks on Critical/High                      │
│                                                                  │
│  Merger Agent     Creates feature branches                       │
│                   Stages feature-specific files only              │
│                   Creates PRs via gh CLI                          │
│                   NEVER merges - only creates PRs                │
│                                                                  │
│  DYNAMIC AGENTS (one per feature)                                │
│  ────────────────────────────────                                │
│  Feature Agent    Implements one feature end-to-end              │
│  (x N features)   Follows strict pipeline above                  │
│                   Uses Ralph loops for implementation             │
│                                                                  │
└─────────────────────────────────────────────────────────────────┘
Agent角色规划模式可编辑代码
team-lead编排、任务拆分、分配否(委托模式)
quality-agentTDD验证(RED/GREEN阶段)、覆盖率门禁否(只读)
security-agentOWASP扫描、敏感信息检测否(只读)
review-agent多引擎代码审查否(只读)
merger-agent分支创建、PR管理否(仅操作git)
feature-{name}功能实现(每个功能对应一个)

Team Lead Responsibilities

团队负责人职责

The Team Lead is the orchestrator. It NEVER writes code.
  1. Read
    _project_specs/features/*.md
    to identify all features
  2. Break each feature into the 10-task dependency chain (see below)
  3. Spawn one feature agent per feature
  4. Assign initial tasks (spec-writing) to feature agents
  5. Monitor TaskList continuously for progress and blockers
  6. Handle blocked tasks and reassignment
  7. Coordinate cross-feature dependencies
  8. Send
    shutdown_request
    to all agents when all PRs are created
  9. Clean up the team when done
Delegate mode is mandatory. The team lead uses only:
  • TeamCreate, TaskCreate, TaskUpdate, TaskList, TaskGet
  • SendMessage (message, broadcast, shutdown_request)
  • Read, Glob, Grep (for monitoring)

团队负责人是编排者,绝不编写代码
  1. 读取
    _project_specs/features/*.md
    识别所有功能
  2. 将每个功能拆分为10个任务的依赖链(见下文)
  3. 为每个功能生成一个Feature Agent
  4. 为Feature Agent分配初始任务(编写规格)
  5. 持续监控任务列表以跟踪进度和阻塞情况
  6. 处理阻塞任务并重新分配
  7. 协调跨功能依赖关系
  8. 当所有PR创建完成后,向所有Agent发送
    shutdown_request
  9. 任务完成后清理团队
委托模式是强制性的。团队负责人仅使用以下操作:
  • TeamCreate、TaskCreate、TaskUpdate、TaskList、TaskGet
  • SendMessage(message、broadcast、shutdown_request)
  • Read、Glob、Grep(用于监控)

Feature Agent Workflow (MANDATORY)

Feature Agent 工作流(强制要求)

Each feature agent MUST follow this exact sequence. Task dependencies enforce ordering - a feature agent cannot start step N+1 until step N is marked complete and verified.
每个Feature Agent必须严格遵循此流程。任务依赖关系强制执行顺序——Feature Agent必须在步骤N标记为完成并通过验证后,才能开始步骤N+1。

Step 1: Write Spec

步骤1:编写规格

  • Create
    _project_specs/features/{feature-name}.md
  • Include: description, acceptance criteria, test cases table, dependencies
  • Follow the atomic TODO format from base.md skill
  • Mark task complete -> Quality Agent reviews
  • 创建
    _project_specs/features/{feature-name}.md
  • 包含:描述、验收标准、测试用例表、依赖关系
  • 遵循base.md技能中的原子TODO格式
  • 标记任务完成 → 由Quality Agent审查

Step 2: Write Tests (RED Phase)

步骤2:编写测试(RED阶段)

  • Write test files based on spec's test cases table
  • Tests MUST cover ALL acceptance criteria
  • Import modules that don't exist yet (they will fail)
  • Mark task complete -> Quality Agent verifies tests EXIST and FAIL
  • 根据规格中的测试用例表编写测试文件
  • 测试必须覆盖所有验收标准
  • 导入尚未存在的模块(测试会失败)
  • 标记任务完成 → 由Quality Agent验证测试已创建且全部失败

Step 3: Wait for RED Verification

步骤3:等待RED验证

  • Quality Agent runs tests and verifies ALL new tests fail
  • If any test passes without implementation -> rewrite tests
  • Quality Agent marks verification complete -> unlocks implementation
  • Quality Agent运行测试并确认所有新测试均失败
  • 如果任何测试在未实现代码的情况下通过 → 重写测试
  • Quality Agent标记验证完成 → 解锁实现步骤

Step 4: Implement (GREEN Phase)

步骤4:实现功能(GREEN阶段)

  • Write minimum code to make all tests pass
  • Follow simplicity rules from base.md (20 lines/function, 200 lines/file, 3 params)
  • Use Ralph loops (
    /ralph-loop
    ) for iterative implementation
  • Run tests after implementation - ALL must pass
  • Mark task complete -> Quality Agent verifies tests pass
  • 编写最少代码使所有测试通过
  • 遵循base.md中的简洁规则(每个函数≤20行、每个文件≤200行、≤3个参数)
  • 使用Ralph循环(
    /ralph-loop
    )进行迭代实现
  • 实现后运行测试——所有测试必须通过
  • 标记任务完成 → 由Quality Agent验证测试通过

Step 5: Wait for GREEN Verification

步骤5:等待GREEN验证

  • Quality Agent runs full test suite and checks coverage
  • Coverage must be >= 80%
  • If tests fail or coverage insufficient -> fix and re-request
  • Quality Agent marks verification complete -> unlocks validation
  • Quality Agent运行完整测试套件并检查覆盖率
  • 覆盖率必须≥80%
  • 如果测试失败或覆盖率不足 → 修复后重新请求验证
  • Quality Agent标记验证完成 → 解锁验证步骤

Step 6: Validate

步骤6:验证

  • Run linter (ESLint / Ruff)
  • Run type checker (TypeScript / mypy)
  • Run full test suite with coverage
  • Fix any issues
  • Mark task complete -> unlocks code review
  • 运行代码检查工具(ESLint / Ruff)
  • 运行类型检查工具(TypeScript / mypy)
  • 运行带覆盖率统计的完整测试套件
  • 修复所有问题
  • 标记任务完成 → 解锁代码审查

Step 7: Wait for Code Review

步骤7:等待代码审查

  • Code Review Agent runs
    /code-review
    on changed files
  • If Critical or High issues -> fix and re-request review
  • Code Review Agent marks complete -> unlocks security scan
  • Code Review Agent对变更文件执行
    /code-review
  • 如果发现Critical或High级别问题 → 修复后重新请求审查
  • Code Review Agent标记完成 → 解锁安全扫描

Step 8: Wait for Security Scan

步骤8:等待安全扫描

  • Security Agent runs security checks
  • If Critical or High issues -> fix and re-request scan
  • Security Agent marks complete -> unlocks merge
  • Security Agent执行安全检查
  • 如果发现Critical或High级别问题 → 修复后重新请求扫描
  • Security Agent标记完成 → 解锁合并流程

Step 9: Wait for Branch + PR

步骤9:等待分支与PR创建

  • Merger Agent creates feature branch, stages files, creates PR
  • Feature is complete when PR is created

  • Merger Agent创建功能分支、暂存文件并创建PR
  • PR创建完成即表示功能实现完成

Task Dependency Chain Model

任务依赖链模型

For each feature "X", the team lead creates these 10 tasks with strict ordering:
┌────────────────────────────────────────────────────────────────┐
│  TASK CHAIN FOR FEATURE "X"                                     │
│                                                                  │
│  Task 1:  X-spec                                                │
│           owner: feature-X                                       │
│           blockedBy: (none)                                      │
│           ↓                                                      │
│  Task 2:  X-spec-review                                         │
│           owner: quality-agent                                   │
│           blockedBy: X-spec                                      │
│           ↓                                                      │
│  Task 3:  X-tests                                               │
│           owner: feature-X                                       │
│           blockedBy: X-spec-review                               │
│           ↓                                                      │
│  Task 4:  X-tests-fail-verify                                   │
│           owner: quality-agent                                   │
│           blockedBy: X-tests                                     │
│           ↓                                                      │
│  Task 5:  X-implement                                           │
│           owner: feature-X                                       │
│           blockedBy: X-tests-fail-verify                         │
│           ↓                                                      │
│  Task 6:  X-tests-pass-verify                                   │
│           owner: quality-agent                                   │
│           blockedBy: X-implement                                 │
│           ↓                                                      │
│  Task 7:  X-validate                                            │
│           owner: feature-X                                       │
│           blockedBy: X-tests-pass-verify                         │
│           ↓                                                      │
│  Task 8:  X-code-review                                         │
│           owner: review-agent                                    │
│           blockedBy: X-validate                                  │
│           ↓                                                      │
│  Task 9:  X-security-scan                                       │
│           owner: security-agent                                  │
│           blockedBy: X-code-review                               │
│           ↓                                                      │
│  Task 10: X-branch-pr                                           │
│           owner: merger-agent                                    │
│           blockedBy: X-security-scan                             │
└────────────────────────────────────────────────────────────────┘
对于每个功能“X”,团队负责人会创建以下10个任务并强制执行严格顺序:
┌────────────────────────────────────────────────────────────────┐
│  TASK CHAIN FOR FEATURE "X"                                     │
│                                                                  │
│  Task 1:  X-spec                                                │
│           owner: feature-X                                       │
│           blockedBy: (none)                                      │
│           ↓                                                      │
│  Task 2:  X-spec-review                                         │
│           owner: quality-agent                                   │
│           blockedBy: X-spec                                      │
│           ↓                                                      │
│  Task 3:  X-tests                                               │
│           owner: feature-X                                       │
│           blockedBy: X-spec-review                               │
│           ↓                                                      │
│  Task 4:  X-tests-fail-verify                                   │
│           owner: quality-agent                                   │
│           blockedBy: X-tests                                     │
│           ↓                                                      │
│  Task 5:  X-implement                                           │
│           owner: feature-X                                       │
│           blockedBy: X-tests-fail-verify                         │
│           ↓                                                      │
│  Task 6:  X-tests-pass-verify                                   │
│           owner: quality-agent                                   │
│           blockedBy: X-implement                                 │
│           ↓                                                      │
│  Task 7:  X-validate                                            │
│           owner: feature-X                                       │
│           blockedBy: X-tests-pass-verify                         │
│           ↓                                                      │
│  Task 8:  X-code-review                                         │
│           owner: review-agent                                    │
│           blockedBy: X-validate                                  │
│           ↓                                                      │
│  Task 9:  X-security-scan                                       │
│           owner: security-agent                                  │
│           blockedBy: X-code-review                               │
│           ↓                                                      │
│  Task 10: X-branch-pr                                           │
│           owner: merger-agent                                    │
│           blockedBy: X-security-scan                             │
└────────────────────────────────────────────────────────────────┘

Parallel Feature Execution

多功能并行执行

Multiple features run their chains in parallel. Shared agents process tasks as they unblock:
Feature: auth         Feature: dashboard      Feature: payments
  auth-spec             dash-spec               pay-spec
  auth-spec-review      dash-spec-review        pay-spec-review
  auth-tests            dash-tests              pay-tests
  auth-fail-verify      dash-fail-verify        pay-fail-verify
  auth-implement        dash-implement          pay-implement
  auth-pass-verify      dash-pass-verify        pay-pass-verify
  auth-validate         dash-validate           pay-validate
  auth-code-review      dash-code-review        pay-code-review
  auth-security         dash-security           pay-security
  auth-branch-pr        dash-branch-pr          pay-branch-pr
       |                     |                       |
       v                     v                       v
   [All chains run simultaneously]
   [Quality Agent handles all verify tasks as they unblock]
   [Review Agent handles all review tasks as they unblock]
   [Security Agent handles all scan tasks as they unblock]
   [Merger Agent handles all branch-pr tasks as they unblock]

多个功能的任务链可以并行运行。共享Agent会处理已解锁的任务:
Feature: auth         Feature: dashboard      Feature: payments
  auth-spec             dash-spec               pay-spec
  auth-spec-review      dash-spec-review        pay-spec-review
  auth-tests            dash-tests              pay-tests
  auth-fail-verify      dash-fail-verify        pay-fail-verify
  auth-implement        dash-implement          pay-implement
  auth-pass-verify      dash-pass-verify        pay-pass-verify
  auth-validate         dash-validate           pay-validate
  auth-code-review      dash-code-review        pay-code-review
  auth-security         dash-security           pay-security
  auth-branch-pr        dash-branch-pr          pay-branch-pr
       |                     |                       |
       v                     v                       v
   [所有任务链同时运行]
   [Quality Agent处理所有已解锁的验证任务]
   [Review Agent处理所有已解锁的审查任务]
   [Security Agent处理所有已解锁的扫描任务]
   [Merger Agent处理所有已解锁的分支与PR任务]

Inter-Agent Communication

Agent间通信

Direct Messages (for targeted work)

直接消息(针对定向工作)

Feature Agent -> Quality Agent:  "Tests written for auth, ready for RED verify"
Quality Agent -> Feature Agent:  "All 7 tests fail as expected. Proceed to implement"
Feature Agent -> Review Agent:   "Implementation complete, ready for code review"
Review Agent  -> Feature Agent:  "2 High issues found: [details]. Fix before proceeding"
Security Agent -> Merger Agent:  "Security scan passed for auth feature"
Merger Agent  -> Team Lead:      "PR #42 created for auth feature"
Feature Agent -> Quality Agent:  "auth功能测试已编写,等待RED验证"
Quality Agent -> Feature Agent:  "7个测试全部按预期失败。可以开始实现"
Feature Agent -> Review Agent:   "实现已完成,等待代码审查"
Review Agent  -> Feature Agent:  "发现2个High级别问题:[详情]。修复后再继续"
Security Agent -> Merger Agent:  "auth功能安全扫描通过"
Merger Agent  -> Team Lead:      "已为auth功能创建PR #42"

Task List (source of truth for state)

任务列表(状态的唯一来源)

  • All agents check TaskList after completing work
  • Quality Agent claims verification tasks automatically
  • Review Agent claims code-review tasks automatically
  • Security Agent claims security-scan tasks automatically
  • Merger Agent claims branch-pr tasks automatically
  • 所有Agent完成工作后都会检查任务列表
  • Quality Agent会自动认领验证任务
  • Review Agent会自动认领代码审查任务
  • Security Agent会自动认领安全扫描任务
  • Merger Agent会自动认领分支与PR任务

Broadcast (rare - blocking issues only)

广播消息(仅用于阻塞问题)

  • Team Lead -> All: "Blocking dependency found between auth and dashboard"
  • Security Agent -> All: "Critical vulnerability in shared dependency"

  • Team Lead -> 所有Agent: "auth与dashboard功能之间发现阻塞依赖"
  • Security Agent -> 所有Agent: "共享依赖中发现严重漏洞"

Feature Agent Spawning

Feature Agent 生成机制

The team lead spawns one feature agent per feature:
  1. Read
    _project_specs/features/*.md
  2. For each feature spec, spawn a feature agent:
    • name:
      feature-{feature-name}
    • Uses
      .claude/agents/feature.md
      definition
    • Spawn prompt includes the feature name and spec location
  3. Create the full 10-task dependency chain for that feature
  4. Assign the spec-writing task to the feature agent
团队负责人为每个功能生成一个Feature Agent:
  1. 读取
    _project_specs/features/*.md
  2. 为每个功能规格生成一个Feature Agent:
    • 名称:
      feature-{feature-name}
    • 使用
      .claude/agents/feature.md
      定义
    • 生成提示包含功能名称和规格位置
  3. 为该功能创建完整的10个任务依赖链
  4. 为Feature Agent分配编写规格的初始任务

Example

示例

If project has 3 features: auth, dashboard, payments
  • Spawn:
    feature-auth
    ,
    feature-dashboard
    ,
    feature-payments
  • Create 30 tasks total (10 per feature)
  • Each feature agent starts with their spec task
  • All 3 work in parallel

如果项目有3个功能:auth、dashboard、payments
  • 生成:
    feature-auth
    feature-dashboard
    feature-payments
  • 共创建30个任务(每个功能10个)
  • 每个Feature Agent从编写规格任务开始
  • 3个功能并行工作

Branch and PR Strategy

分支与PR策略

One branch per feature. One PR per feature.
Branch naming:  feature/{feature-name}
PR title:       feat({feature-name}): {short description}
PR body:        Generated from spec + test results + review + security results
The Merger Agent:
  1. git checkout main && git pull origin main
  2. git checkout -b feature/{feature-name}
  3. Stages ONLY files changed for this feature (never
    git add -A
    )
  4. Commits with descriptive message including verification results
  5. git push -u origin feature/{feature-name}
  6. gh pr create
    with full template including:
    • Summary from feature spec
    • Test results from quality verification
    • Code review summary from review agent
    • Security scan results from security agent
    • Checklist of all pipeline steps completed

一个功能对应一个分支,一个分支对应一个PR。
分支命名:  feature/{feature-name}
PR标题:       feat({feature-name}): {简短描述}
PR正文:        由规格+测试结果+审查结果+安全结果自动生成
Merger Agent执行以下操作:
  1. git checkout main && git pull origin main
  2. git checkout -b feature/{feature-name}
  3. 仅暂存该功能变更的文件(绝不使用
    git add -A
  4. 提交包含验证结果的描述性消息
  5. git push -u origin feature/{feature-name}
  6. 通过
    gh pr create
    创建PR,包含完整模板:
    • 功能规格摘要
    • Quality Agent的测试结果
    • Review Agent的代码审查摘要
    • Security Agent的安全扫描结果
    • 所有流程步骤完成的检查清单

Quality Gates

质量门禁

Workflow Enforcement (via task dependencies)

工作流强制执行(通过任务依赖)

  • Task dependencies make it structurally impossible to skip steps
  • A feature agent cannot see "implement" until quality agent completes "tests-fail-verify"
  • This is the primary enforcement mechanism
  • 任务依赖关系使得从结构上无法跳过步骤
  • Feature Agent必须在Quality Agent完成"tests-fail-verify"后,才能看到"implement"任务
  • 这是主要的强制执行机制

Cross-Agent Verification (trust but verify)

跨Agent验证(信任但验证)

  • Quality agent independently runs tests (doesn't trust feature agent's report)
  • Security agent independently scans (doesn't trust review agent)
  • Merger agent verifies all predecessor tasks are complete before branching
  • Quality Agent独立运行测试(不依赖Feature Agent的报告)
  • Security Agent独立执行扫描(不依赖Review Agent的结果)
  • Merger Agent会在创建分支前验证所有前置任务是否完成

Blocking Rules

阻塞规则

  • Quality Agent: blocks if tests don't fail (RED) or don't pass (GREEN) or coverage < 80%
  • Code Review Agent: blocks on Critical or High severity issues
  • Security Agent: blocks on Critical or High severity findings
  • Merger Agent: refuses to branch if any predecessor task is incomplete

  • Quality Agent:如果测试未失败(RED阶段)、未通过(GREEN阶段)或覆盖率<80%,则阻塞流程
  • Code Review Agent:发现Critical或High级别问题时阻塞流程
  • Security Agent:发现Critical或High级别问题时阻塞流程
  • Merger Agent:如果任何前置任务未完成,则拒绝创建分支

Integration with Existing Skills

与现有技能的集成

Existing SkillHow Agent Teams Uses It
base.mdTDD workflow, atomic todos, simplicity rules - all agents follow
code-review.mdReview Agent executes
/code-review
per this skill
security.mdSecurity Agent follows OWASP patterns from this skill
session-management.mdEach agent maintains its own session state
iterative-development.mdFeature agents use Ralph loops for implementation
project-tooling.mdMerger Agent uses
gh
CLI for branches and PRs
team-coordination.mdSuperseded by agent-teams for automated coordination

现有技能Agent Teams 如何使用
base.mdTDD工作流、原子TODO、简洁规则——所有Agent均需遵循
code-review.mdReview Agent根据此技能执行
/code-review
security.mdSecurity Agent遵循此技能中的OWASP模式
session-management.md每个Agent维护自己的会话状态
iterative-development.mdFeature Agent使用Ralph循环进行实现
project-tooling.mdMerger Agent使用
gh
CLI处理分支和PR
team-coordination.md被agent-teams取代,用于自动化协调

Environment Setup

环境配置

Required Setting

必填设置

json
// settings.json or environment
{
  "env": {
    "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
  }
}
json
// settings.json 或环境变量
{
  "env": {
    "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
  }
}

Project Structure (created by /initialize-project)

项目结构(由/initialize-project创建)

.claude/
  agents/            # Agent definitions (from agent-teams skill)
    team-lead.md
    quality.md
    security.md
    code-review.md
    merger.md
    feature.md
  skills/
    agent-teams/     # This skill
      SKILL.md
      agents/        # Agent definition templates
    base/
    code-review/
    security/
    ...

.claude/
  agents/            # Agent定义(来自agent-teams技能)
    team-lead.md
    quality.md
    security.md
    code-review.md
    merger.md
    feature.md
  skills/
    agent-teams/     # 本技能
      SKILL.md
      agents/        # Agent定义模板
    base/
    code-review/
    security/
    ...

Spawning the Team

生成团队

Automatic (via /initialize-project)

自动生成(通过/initialize-project)

After project setup completes, Phase 6 asks for features and spawns the team automatically.
项目设置完成后,第6阶段会询问功能并自动生成团队。

Manual (via /spawn-team)

手动生成(通过/spawn-team)

For existing projects: run
/spawn-team
to spawn the team from existing feature specs.

对于现有项目:运行
/spawn-team
从现有功能规格生成团队。

Limitations

局限性

  • Experimental feature - Agent teams require the experimental env var
  • No nested teams - Teammates cannot spawn sub-teams
  • One team per session - Clean up before starting a new team
  • No session resumption - If session dies, re-run
    /spawn-team
    (tasks persist)
  • File conflicts - Features sharing files must be serialized by team lead
  • Token cost - Each agent is a separate Claude instance (5 + N instances)
  • 实验性功能 - Agent Teams需要设置实验性环境变量
  • 不支持嵌套团队 - 团队成员无法生成子团队
  • 每个会话一个团队 - 开始新团队前需清理旧团队
  • 不支持会话恢复 - 如果会话中断,需重新运行
    /spawn-team
    (任务会保留)
  • 文件冲突 - 共享文件的功能需由团队负责人串行处理
  • Token成本 - 每个Agent都是独立的Claude实例(共5+N个实例)