AgentSkillsCN

implement-agents

当用户要求“并行实现”、“同时运行各阶段”、“并行实施”、“让代理 X 与代理 Y 同时执行第 X 阶段与第 Y 阶段”时,或希望协调多个代理同时运行/实施时,应使用此技能。

SKILL.md
--- frontmatter
name: implement-agents
description: This skill should be used when the user asks to "implement in parallel", "run phases concurrently", "parallel implement", "implement-agents phase X phase Y", or wants to orchestrate multiple agents running /implement simultaneously.

Implement with Agents

Orchestrate multiple agents to run /implement in parallel.

User Input

ARGUMENTS = $ARGUMENTS

Accept one or more phases, task IDs, or task ranges. Examples:

bash
# Single (runs one agent)
/implement-agents "Phase 3"
/implement-agents "T011-T014"

# Multiple (runs parallel agents)
/implement-agents "Phase 3" "Phase 5"
/implement-agents "T011-T014" "T018-T023"

Execution Flow

code
/implement-agents "Phase 3" "Phase 5"
              │
              ▼
    ┌─────────────────────┐
    │  Parse Arguments    │
    │  → ["Phase 3",      │
    │     "Phase 5"]      │
    └─────────┬───────────┘
              │
              ▼
    ┌─────────────────────┐
    │  Spawn Agents       │
    │  (parallel)         │
    └─────────┬───────────┘
              │
     ┌────────┴────────┐
     ▼                 ▼
┌─────────┐      ┌─────────┐
│ Agent A │      │ Agent B │
│         │      │         │
│ Runs:   │      │ Runs:   │
│/implement│      │/implement│
│"Phase 3"│      │"Phase 5"│
└────┬────┘      └────┬────┘
     │                 │
     └────────┬────────┘
              ▼
    ┌─────────────────────┐
    │  Wait & Report      │
    └─────────────────────┘

Step 1: Parse Arguments

Parse ARGUMENTS into a list of work units:

code
Input: "Phase 3" "Phase 5"
Output: ["Phase 3", "Phase 5"]

Input: "Phase 3" "T018-T023"
Output: ["Phase 3", "T018-T023"]

Input: "Phase 3"
Output: ["Phase 3"]

Step 2: Spawn Parallel Agents

For each work unit, spawn a background agent that runs /implement:

CRITICAL: Use the Skill tool to invoke /implement within each agent.

code
For each WORK_UNIT in parsed arguments:

  Task(
    subagent_type: "general-purpose",
    description: "Implement {WORK_UNIT}",
    prompt: """
Run /implement for {WORK_UNIT}.

Use the Skill tool:
  skill: "implement"
  args: "{WORK_UNIT}"
""",
    run_in_background: true
  )

IMPORTANT: Spawn ALL agents in a single message with multiple Task tool calls to ensure true parallelism.

Step 3: Monitor Progress

Check agent progress periodically:

bash
# Read output files returned by Task tool
tail -100 {output_file_A}
tail -100 {output_file_B}

Or use TaskOutput with block: false for non-blocking status checks.

Step 4: Wait for Completion

Wait for all agents to finish:

code
TaskOutput(task_id: agent_A_id, block: true, timeout: 600000)
TaskOutput(task_id: agent_B_id, block: true, timeout: 600000)

Step 5: Report Results

After all agents complete, summarize what happened:

code
✅ Phase 3: Complete (T011-T014)
✅ Phase 5: Complete (T018-T023)

Optionally check tasks.md and git log to confirm.

Error Handling

If an agent fails:

  1. Report which agent failed and what work unit it was assigned
  2. Show the error from the agent's output
  3. Check tasks.md for partial progress
  4. Ask user how to proceed:
    • Retry failed agent
    • Continue with remaining agents
    • Abort and investigate

Conflict Detection

Before spawning agents, check for potential conflicts:

code
Phase 3 files: proto/aegis.proto, src/grpc/service.rs
Phase 5 files: src/controller/tools/*.rs

Overlap: None → Safe to parallelize

If files overlap, warn the user:

code
⚠️ Phase 3 and Phase 4 both modify src/controller/mcp/manager.rs

Options:
1. Run sequentially (Phase 3 first, then Phase 4)
2. Proceed anyway (may cause merge conflicts)

When to Use

Good for parallelization:

  • Independent phases touching different files
  • Multiple task ranges in different modules
  • Large features where throughput matters

Run sequentially instead (/implement twice):

  • Phases with dependencies
  • Tasks that modify the same files
  • When review between phases is needed

Example Session

code
User: /implement-agents "Phase 3" "Phase 5"

Claude: Spawning 2 agents in parallel...
- Agent A: /implement "Phase 3"
- Agent B: /implement "Phase 5"

[Waits for completion]

✅ Phase 3: Complete
✅ Phase 5: Complete

Notes

  • Each agent runs /progress via /implement, so no additional progress logging needed
  • If an agent fails, its output file shows what went wrong