subagent-driven-development

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Subagent-Driven Development

Subagent驱动开发

Core Principle

核心原则

Fresh context per task. Review between tasks.
Each task gets a clean subagent with no accumulated confusion. You review between tasks.
每个任务使用全新上下文。任务间进行审查。
每个任务都会分配一个全新的Subagent,不会累积混淆信息。您需要在任务之间进行审查。

How It Works

工作流程

  1. Load the implementation plan
  2. For each task:
    • Dispatch fresh subagent
    • Subagent implements ONLY that task
    • Review the changes
    • Approve or request fixes
    • Move to next task
  1. 加载实施计划
  2. 针对每个任务:
    • 调度全新的Subagent
    • Subagent仅执行该任务
    • 审查变更内容
    • 批准或要求修复
    • 进入下一个任务

Benefits

优势

  • Clean Context: Each subagent starts fresh
  • Focused Work: One task at a time
  • Review Points: Catch issues early
  • Controlled Progress: You stay in charge
  • 纯净上下文:每个Subagent都从全新状态开始
  • 专注工作:一次处理一个任务
  • 审查节点:尽早发现问题
  • 可控进度:始终由您掌控

Execution Flow

执行流程

Step 1: Load the Plan

步骤1:加载计划

markdown
Loading plan from: docs/plans/YYYY-MM-DD-feature-name.md

Tasks identified:
1. [ ] Task 1: Description
2. [ ] Task 2: Description
3. [ ] Task 3: Description

Starting with Task 1...
markdown
Loading plan from: docs/plans/YYYY-MM-DD-feature-name.md

Tasks identified:
1. [ ] Task 1: Description
2. [ ] Task 2: Description
3. [ ] Task 3: Description

Starting with Task 1...

Step 2: Dispatch Subagent

步骤2:调度Subagent

For each task, create a focused prompt:
markdown
undefined
针对每个任务,创建聚焦式提示:
markdown
undefined

Task: [Task Name]

Task: [Task Name]

Context

Context

  • Project: [brief description]
  • Current branch: [branch name]
  • Dependencies: [relevant info]
  • Project: [brief description]
  • Current branch: [branch name]
  • Dependencies: [relevant info]

Instructions

Instructions

[Exact instructions from plan]
[Exact instructions from plan]

Files to Modify

Files to Modify

  • path/to/file.ts
  • path/to/file.ts

Test to Write First

Test to Write First

[Test code from plan]
[Test code from plan]

Implementation

Implementation

[Implementation code from plan]
[Implementation code from plan]

Success Criteria

Success Criteria

  • Test passes
  • No other tests broken
  • Code follows project style
undefined
  • Test passes
  • No other tests broken
  • Code follows project style
undefined

Step 3: Review Changes

步骤3:审查变更

After subagent completes:
markdown
undefined
Subagent完成任务后:
markdown
undefined

Task 1 Complete

Task 1 Complete

Changes Made:

Changes Made:

  • Modified:
    path/to/file.ts
    (+25/-3)
  • Added:
    path/to/file.test.ts
    (+40)
  • Modified:
    path/to/file.ts
    (+25/-3)
  • Added:
    path/to/file.test.ts
    (+40)

Test Results:

Test Results:

✅ All tests passing (47 total)
✅ All tests passing (47 total)

Review Checklist:

Review Checklist:

  • Test covers the requirement
  • Implementation is correct
  • No unnecessary changes
  • Code style matches project
Approve and continue to Task 2?
undefined
  • Test covers the requirement
  • Implementation is correct
  • No unnecessary changes
  • Code style matches project
Approve and continue to Task 2?
undefined

Step 4: Handle Issues

步骤4:处理问题

If review finds problems:
markdown
undefined
如果审查发现问题:
markdown
undefined

Issues Found in Task 1

Issues Found in Task 1

  1. Test doesn't cover edge case X
  2. Missing error handling for Y
Options: A) Request fixes from subagent B) Fix manually C) Skip and note for later
Which approach?
undefined
  1. Test doesn't cover edge case X
  2. Missing error handling for Y
Options: A) Request fixes from subagent B) Fix manually C) Skip and note for later
Which approach?
undefined

Subagent Guidelines

Subagent指南

What Subagents Should Do

Subagent应执行的操作

  • Follow the plan exactly
  • Write tests first
  • Make minimal changes
  • Report what was done
  • 严格遵循计划
  • 先编写测试
  • 进行最小化变更
  • 报告执行内容

What Subagents Should NOT Do

Subagent不应执行的操作

  • Make "improvements" outside scope
  • Skip tests
  • Refactor unrelated code
  • Change the plan
  • 进行超出范围的“改进”
  • 跳过测试
  • 重构无关代码
  • 修改计划

Progress Tracking

进度跟踪

Maintain task status:
markdown
undefined
维护任务状态:
markdown
undefined

Progress: Feature Name

Progress: Feature Name

  • Task 1: Setup database schema ✅
  • Task 2: Create API endpoint ✅
  • Task 3: Add validation (IN PROGRESS)
  • Task 4: Write integration tests
  • Task 5: Update documentation
Current: Task 3 of 5
undefined
  • Task 1: Setup database schema ✅
  • Task 2: Create API endpoint ✅
  • Task 3: Add validation (IN PROGRESS)
  • Task 4: Write integration tests
  • Task 5: Update documentation
Current: Task 3 of 5
undefined

Checkpoints

检查点

After Each Task

每个任务完成后

  • Run all tests
  • Review diff
  • Commit if approved
  • 运行所有测试
  • 审查差异
  • 若批准则提交

After All Tasks

所有任务完成后

  • Run integration tests
  • Manual verification
  • Final review
  • 运行集成测试
  • 手动验证
  • 最终审查

Rollback

回滚

If things go wrong:
bash
undefined
如果出现问题:
bash
undefined

Revert last task

Revert last task

git revert HEAD
git revert HEAD

Or reset to checkpoint

Or reset to checkpoint

git reset --hard <commit-before-task>
undefined
git reset --hard <commit-before-task>
undefined

Communication Pattern

沟通模式

Starting

启动时

"I'm using subagent-driven-development to implement [feature]. I'll dispatch a fresh subagent for each task and review between them."
“我正在使用Subagent驱动开发来实现[功能]。我会为每个任务调度一个全新的Subagent,并在任务之间进行审查。”

Between Tasks

任务间

"Task [N] complete. Changes: [summary]. Ready to review before Task [N+1]?"
“任务[N]完成。变更内容:[摘要]。是否准备好审查后进入任务[N+1]?”

Completing

完成时

"All [N] tasks complete. Running final verification..."
“所有[N]个任务已完成。正在进行最终验证...”