Analyzes codebases to understand structure, tech stack, patterns, and conventions. Use when onboarding to a new project, exploring unfamiliar code, or when asked "how does this work?" or "what's the architecture?"
中文简介正在准备中。当前显示原文说明。
Patterns for parallel subagent execution using the Agent tool (formerly Task). Use when coordinating multiple independent tasks, spawning dynamic subagents, or implementing features that can be parallelized.
中文简介正在准备中。当前显示原文说明。
查看安装方法安装前可以查看交给 AI 代理的指令内容。
Parallel execution spawns multiple subagents simultaneously using the Agent tool (named Task before Claude Code 2.1.63; Task still works as an alias). Subagents run in the background by default, so N tasks run concurrently, dramatically reducing total execution time.
Critical Rule: ALL Agent calls MUST be in a SINGLE assistant message for true parallelism. If the calls are in separate messages, they launch one after another.
Before spawning, verify tasks are independent:
Each subagent receives a custom prompt defining its role:
You are a [ROLE] specialist for this specific task.
Task: [CLEAR DESCRIPTION]
Context:
[RELEVANT CONTEXT ABOUT THE CODEBASE/PROJECT]
Files to work with:
[SPECIFIC FILES OR PATTERNS]
Output format:
[EXPECTED OUTPUT STRUCTURE]
Focus areas:
- [PRIORITY 1]
- [PRIORITY 2]
CRITICAL: Make ALL Agent calls in the SAME assistant message:
I'm launching N parallel subagents:
[Agent 1]
description: "Subagent A - [brief purpose]"
prompt: "[detailed instructions for subagent A]"
[Agent 2]
description: "Subagent B - [brief purpose]"
prompt: "[detailed instructions for subagent B]"
[Agent 3]
description: "Subagent C - [brief purpose]"
prompt: "[detailed instructions for subagent C]"
On Claude Code versions that still run subagents in the foreground by default, add run_in_background: true to each call.
Each subagent returns its final result to the parent conversation automatically when it finishes. Wait until every subagent has reported before synthesizing; do not poll, and do not start dependent work early. (The separate TaskOutput call is deprecated.)
Combine all subagent outputs into unified result:
When you have N tasks to implement, spawn N subagents:
Plan:
1. Implement auth module
2. Create API endpoints
3. Add database schema
4. Write unit tests
5. Update documentation
Wave 1 - spawn 3 subagents (independent of each other):
- Subagent 1: Implements auth module
- Subagent 2: Creates API endpoints
- Subagent 3: Adds database schema
Wave 2 - after wave 1 has finished (these depend on its output):
- Subagent 4: Writes unit tests
- Subagent 5: Updates documentation
Analyze multiple directories simultaneously:
Directories: src/auth, src/api, src/db
Spawn 3 subagents:
- Subagent 1: Analyzes src/auth
- Subagent 2: Analyzes src/api
- Subagent 3: Analyzes src/db
Review from multiple angles simultaneously:
Perspectives: Security, Performance, Testing, Architecture
Spawn 4 subagents:
- Subagent 1: Security review
- Subagent 2: Performance analysis
- Subagent 3: Test coverage review
- Subagent 4: Architecture assessment
When using parallel execution, task tracking (TaskCreate/TaskUpdate, or TodoWrite on older versions) differs:
Sequential execution: Only ONE task in_progress at a time
Parallel execution: MULTIPLE tasks can be in_progress simultaneously
# Before launching parallel tasks
todos = [
{ content: "Task A", status: "in_progress" },
{ content: "Task B", status: "in_progress" },
{ content: "Task C", status: "in_progress" },
{ content: "Synthesize results", status: "pending" }
]
# As each subagent reports back, mark its task completed
todos = [
{ content: "Task A", status: "completed" },
{ content: "Task B", status: "completed" },
{ content: "Task C", status: "completed" },
{ content: "Synthesize results", status: "in_progress" }
]
Good candidates:
Avoid parallelization when:
| Approach | 5 Tasks @ 30s each | Total Time |
|---|---|---|
| Sequential | 30s + 30s + 30s + 30s + 30s | ~150s |
| Parallel | All 5 run simultaneously | ~30s |
Parallel execution is approximately Nx faster where N is the number of independent tasks.
User request: "Implement user authentication with login, registration, and password reset"
Orchestrator creates plan:
Parallel execution:
Wave 1 - launching 4 subagents in parallel:
[Agent 1] Login endpoint implementation
[Agent 2] Registration endpoint implementation
[Agent 3] Password reset endpoint implementation
[Agent 4] Auth middleware implementation
[Results arrive as each subagent finishes]
Wave 2 - depends on wave 1:
[Agent 5] Integration test writing
[Synthesize into cohesive implementation]
Tasks running sequentially?
run_in_background: true is set for eachResults not available?
Conflicts in output?
还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Analyzes codebases to understand structure, tech stack, patterns, and conventions. Use when onboarding to a new project, exploring unfamiliar code, or when asked "how does this work?" or "what's the architecture?"
中文简介正在准备中。当前显示原文说明。
Convex backend development guidelines. Use when writing Convex functions, schemas, queries, mutations, actions, or any backend code in a Convex project. Triggers on tasks involving Convex database operations, real-time subscriptions, file storage, or serverless functions.
中文简介正在准备中。当前显示原文说明。
Designs database schemas, indexing strategies, query optimization, and migration patterns for SQL and NoSQL databases. Use when designing tables, optimizing queries, fixing N+1 problems, planning migrations, or when asked about database performance, normalization, ORMs, or data modeling.
中文简介正在准备中。当前显示原文说明。
Designs REST and GraphQL APIs including endpoints, error handling, versioning, and documentation. Use when creating new APIs, designing endpoints, reviewing API contracts, or when asked about REST, GraphQL, or API patterns.
中文简介正在准备中。当前显示原文说明。
Designs software architecture and selects appropriate patterns for projects. Use when designing systems, choosing architecture patterns, structuring projects, making technical decisions, or when asked about microservices, monoliths, or architectural approaches.
中文简介正在准备中。当前显示原文说明。
Designs and implements testing strategies for any codebase. Use when adding tests, improving coverage, setting up testing infrastructure, debugging test failures, or when asked about unit tests, integration tests, or E2E testing.
中文简介正在准备中。当前显示原文说明。