{"id":"f1c9e135-a279-48df-8ad7-928e0d6ea836","shortId":"Hj89Vv","kind":"skill","title":"parallel-execution","tagline":"Patterns for parallel subagent execution using Task tool with run_in_background. Use when coordinating multiple independent tasks, spawning dynamic subagents, or implementing features that can be parallelized.","description":"# Parallel Execution Patterns\n\n### When to Load\n\n- **Trigger**: Multi-agent tasks, concurrent operations, spawning subagents, parallelizing independent work\n- **Skip**: Single-step tasks or sequential workflows with no parallelization opportunity\n\n## Core Concept\n\nParallel execution spawns multiple subagents simultaneously using the Task tool with `run_in_background: true`. This enables N tasks to run concurrently, dramatically reducing total execution time.\n\n**Critical Rule**: ALL Task calls MUST be in a SINGLE assistant message for true parallelism. If Task calls are in separate messages, they run sequentially.\n\n## Execution Protocol\n\n### Step 1: Identify Parallelizable Tasks\n\nBefore spawning, verify tasks are independent:\n\n- No task depends on another's output\n- Tasks target different files or concerns\n- Can run simultaneously without conflicts\n\n### Step 2: Prepare Dynamic Subagent Prompts\n\nEach subagent receives a custom prompt defining its role:\n\n```\nYou are a [ROLE] specialist for this specific task.\n\nTask: [CLEAR DESCRIPTION]\n\nContext:\n[RELEVANT CONTEXT ABOUT THE CODEBASE/PROJECT]\n\nFiles to work with:\n[SPECIFIC FILES OR PATTERNS]\n\nOutput format:\n[EXPECTED OUTPUT STRUCTURE]\n\nFocus areas:\n- [PRIORITY 1]\n- [PRIORITY 2]\n```\n\n### Step 3: Launch All Tasks in ONE Message\n\n**CRITICAL**: Make ALL Task calls in the SAME assistant message:\n\n```\nI'm launching N parallel subagents:\n\n[Task 1]\ndescription: \"Subagent A - [brief purpose]\"\nprompt: \"[detailed instructions for subagent A]\"\nrun_in_background: true\n\n[Task 2]\ndescription: \"Subagent B - [brief purpose]\"\nprompt: \"[detailed instructions for subagent B]\"\nrun_in_background: true\n\n[Task 3]\ndescription: \"Subagent C - [brief purpose]\"\nprompt: \"[detailed instructions for subagent C]\"\nrun_in_background: true\n```\n\n### Step 4: Retrieve Results with TaskOutput\n\nAfter launching, retrieve each result:\n\n```\n[Wait for completion, then retrieve]\n\nTaskOutput: task_1_id\nTaskOutput: task_2_id\nTaskOutput: task_3_id\n```\n\n### Step 5: Synthesize Results\n\nCombine all subagent outputs into unified result:\n\n- Merge related findings\n- Resolve conflicts between recommendations\n- Prioritize by severity/importance\n- Create actionable summary\n\n## Dynamic Subagent Patterns\n\n### Pattern 1: Task-Based Parallelization\n\nWhen you have N tasks to implement, spawn N subagents:\n\n```\nPlan:\n1. Implement auth module\n2. Create API endpoints\n3. Add database schema\n4. Write unit tests\n5. Update documentation\n\nSpawn 5 subagents (one per task):\n- Subagent 1: Implements auth module\n- Subagent 2: Creates API endpoints\n- Subagent 3: Adds database schema\n- Subagent 4: Writes unit tests\n- Subagent 5: Updates documentation\n```\n\n### Pattern 2: Directory-Based Parallelization\n\nAnalyze multiple directories simultaneously:\n\n```\nDirectories: src/auth, src/api, src/db\n\nSpawn 3 subagents:\n- Subagent 1: Analyzes src/auth\n- Subagent 2: Analyzes src/api\n- Subagent 3: Analyzes src/db\n```\n\n### Pattern 3: Perspective-Based Parallelization\n\nReview from multiple angles simultaneously:\n\n```\nPerspectives: Security, Performance, Testing, Architecture\n\nSpawn 4 subagents:\n- Subagent 1: Security review\n- Subagent 2: Performance analysis\n- Subagent 3: Test coverage review\n- Subagent 4: Architecture assessment\n```\n\n## TodoWrite Integration\n\nWhen using parallel execution, TodoWrite behavior differs:\n\n**Sequential execution**: Only ONE task `in_progress` at a time\n**Parallel execution**: MULTIPLE tasks can be `in_progress` simultaneously\n\n```\n# Before launching parallel tasks\ntodos = [\n  { content: \"Task A\", status: \"in_progress\" },\n  { content: \"Task B\", status: \"in_progress\" },\n  { content: \"Task C\", status: \"in_progress\" },\n  { content: \"Synthesize results\", status: \"pending\" }\n]\n\n# After each TaskOutput retrieval, mark as completed\ntodos = [\n  { content: \"Task A\", status: \"completed\" },\n  { content: \"Task B\", status: \"completed\" },\n  { content: \"Task C\", status: \"completed\" },\n  { content: \"Synthesize results\", status: \"in_progress\" }\n]\n```\n\n## When to Use Parallel Execution\n\n**Good candidates:**\n\n- Multiple independent analyses (code review, security, tests)\n- Multi-file processing where files are independent\n- Exploratory tasks with different perspectives\n- Verification tasks with different checks\n- Feature implementation with independent components\n\n**Avoid parallelization when:**\n\n- Tasks have dependencies (Task B needs Task A's output)\n- Sequential workflows are required (commit -> push -> PR)\n- Tasks modify the same files (risk of conflicts)\n- Order matters for correctness\n\n## Performance Benefits\n\n| Approach   | 5 Tasks @ 30s each          | Total Time |\n| ---------- | --------------------------- | ---------- |\n| Sequential | 30s + 30s + 30s + 30s + 30s | ~150s      |\n| Parallel   | All 5 run simultaneously    | ~30s       |\n\nParallel execution is approximately Nx faster where N is the number of independent tasks.\n\n## Example: Feature Implementation\n\n**User request**: \"Implement user authentication with login, registration, and password reset\"\n\n**Orchestrator creates plan**:\n\n1. Implement login endpoint\n2. Implement registration endpoint\n3. Implement password reset endpoint\n4. Add authentication middleware\n5. Write integration tests\n\n**Parallel execution**:\n\n```\nLaunching 5 subagents in parallel:\n\n[Task 1] Login endpoint implementation\n[Task 2] Registration endpoint implementation\n[Task 3] Password reset endpoint implementation\n[Task 4] Auth middleware implementation\n[Task 5] Integration test writing\n\nAll tasks run simultaneously...\n\n[Collect results via TaskOutput]\n\n[Synthesize into cohesive implementation]\n```\n\n## Troubleshooting\n\n**Tasks running sequentially?**\n\n- Verify ALL Task calls are in SINGLE message\n- Check `run_in_background: true` is set for each\n\n**Results not available?**\n\n- Use TaskOutput with correct task IDs\n- Wait for tasks to complete before retrieving\n\n**Conflicts in output?**\n\n- Ensure tasks don't modify same files\n- Add conflict resolution in synthesis step","tags":["parallel","execution","claude","workflow","cloudai-x","agent-skills","ai-agents","claude-code","codex","cursor","skills"],"capabilities":["skill","source-cloudai-x","skill-parallel-execution","topic-agent-skills","topic-ai-agents","topic-claude-code","topic-codex","topic-cursor","topic-skills","topic-workflow"],"categories":["claude-workflow-v2"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/CloudAI-X/claude-workflow-v2/parallel-execution","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add CloudAI-X/claude-workflow-v2","source_repo":"https://github.com/CloudAI-X/claude-workflow-v2","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 1352 github stars · SKILL.md body (5,974 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-03T00:52:56.130Z","embedding":null,"createdAt":"2026-04-18T21:54:58.801Z","updatedAt":"2026-05-03T00:52:56.130Z","lastSeenAt":"2026-05-03T00:52:56.130Z","tsv":"'1':119,196,224,292,330,346,372,413,444,667,696 '150s':629 '2':148,198,241,296,350,377,396,417,448,671,701 '3':200,258,300,354,382,410,421,425,452,675,706 '30s':619,624,625,626,627,628,635 '4':275,358,387,441,457,680,712 '5':303,362,366,392,617,632,684,691,717 'action':324 'add':355,383,681,780 'agent':41 'analys':554 'analysi':450 'analyz':401,414,418,422 'angl':433 'anoth':133 'api':352,379 'approach':616 'approxim':639 'architectur':439,458 'area':194 'assess':459 'assist':101,215 'auth':348,374,713 'authent':657,682 'avail':756 'avoid':582 'b':244,252,501,531,589 'background':15,77,238,255,272,748 'base':333,399,428 'behavior':467 'benefit':615 'brief':228,245,262 'c':261,269,507,536 'call':95,108,211,740 'candid':551 'check':576,745 'clear':172 'code':555 'codebase/project':179 'cohes':731 'collect':725 'combin':306 'commit':599 'complet':287,522,528,533,538,767 'compon':581 'concept':63 'concern':141 'concurr':43,85 'conflict':146,317,609,770,781 'content':493,499,505,511,524,529,534,539 'context':174,176 'coordin':18 'core':62 'correct':613,760 'coverag':454 'creat':323,351,378,665 'critic':91,207 'custom':157 'databas':356,384 'defin':159 'depend':131,587 'descript':173,225,242,259 'detail':231,248,265 'differ':138,468,570,575 'directori':398,403,405 'directory-bas':397 'document':364,394 'dramat':86 'dynam':23,150,326 'enabl':80 'endpoint':353,380,670,674,679,698,703,709 'ensur':773 'exampl':650 'execut':3,8,33,65,89,116,465,470,480,549,637,689 'expect':190 'exploratori':567 'faster':641 'featur':27,577,651 'file':139,180,185,561,564,606,779 'find':315 'focus':193 'format':189 'good':550 'id':293,297,301,762 'identifi':120 'implement':26,341,347,373,578,652,655,668,672,676,699,704,710,715,732 'independ':20,48,128,553,566,580,648 'instruct':232,249,266 'integr':461,686,718 'launch':201,219,281,489,690 'load':37 'login':659,669,697 'm':218 'make':208 'mark':520 'matter':611 'merg':313 'messag':102,112,206,216,744 'middlewar':683,714 'modifi':603,777 'modul':349,375 'multi':40,560 'multi-ag':39 'multi-fil':559 'multipl':19,67,402,432,481,552 'must':96 'n':81,220,338,343,643 'need':590 'number':646 'nx':640 'one':205,368,472 'oper':44 'opportun':61 'orchestr':664 'order':610 'output':135,188,191,309,594,772 'parallel':2,6,31,32,47,60,64,105,221,334,400,429,464,479,490,548,583,630,636,688,694 'parallel-execut':1 'paralleliz':121 'password':662,677,707 'pattern':4,34,187,328,329,395,424 'pend':515 'per':369 'perform':437,449,614 'perspect':427,435,571 'perspective-bas':426 'plan':345,666 'pr':601 'prepar':149 'priorit':320 'prioriti':195,197 'process':562 'progress':475,486,498,504,510,544 'prompt':152,158,230,247,264 'protocol':117 'purpos':229,246,263 'push':600 'receiv':155 'recommend':319 'reduc':87 'registr':660,673,702 'relat':314 'relev':175 'request':654 'requir':598 'reset':663,678,708 'resolut':782 'resolv':316 'result':277,284,305,312,513,541,726,754 'retriev':276,282,289,519,769 'review':430,446,455,556 'risk':607 'role':161,165 'rule':92 'run':13,75,84,114,143,236,253,270,633,723,735,746 'schema':357,385 'secur':436,445,557 'separ':111 'sequenti':56,115,469,595,623,736 'set':751 'severity/importance':322 'simultan':69,144,404,434,487,634,724 'singl':52,100,743 'single-step':51 'skill' 'skill-parallel-execution' 'skip':50 'source-cloudai-x' 'spawn':22,45,66,124,342,365,409,440 'specialist':166 'specif':169,184 'src/api':407,419 'src/auth':406,415 'src/db':408,423 'status':496,502,508,514,527,532,537,542 'step':53,118,147,199,274,302,785 'structur':192 'subag':7,24,46,68,151,154,222,226,234,243,251,260,268,308,327,344,367,371,376,381,386,391,411,412,416,420,442,443,447,451,456,692 'summari':325 'synthes':304,512,540,729 'synthesi':784 'target':137 'task':10,21,42,54,72,82,94,107,122,126,130,136,170,171,203,210,223,240,257,291,295,299,332,339,370,473,482,491,494,500,506,525,530,535,568,573,585,588,591,602,618,649,695,700,705,711,716,722,734,739,761,765,774 'task-bas':331 'taskoutput':279,290,294,298,518,728,758 'test':361,390,438,453,558,687,719 'time':90,478,622 'todo':492,523 'todowrit':460,466 'tool':11,73 'topic-agent-skills' 'topic-ai-agents' 'topic-claude-code' 'topic-codex' 'topic-cursor' 'topic-skills' 'topic-workflow' 'total':88,621 'trigger':38 'troubleshoot':733 'true':78,104,239,256,273,749 'unifi':311 'unit':360,389 'updat':363,393 'use':9,16,70,463,547,757 'user':653,656 'verif':572 'verifi':125,737 'via':727 'wait':285,763 'without':145 'work':49,182 'workflow':57,596 'write':359,388,685,720","prices":[{"id":"92640c8e-52b5-4857-b2eb-855f7d5e1131","listingId":"f1c9e135-a279-48df-8ad7-928e0d6ea836","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"CloudAI-X","category":"claude-workflow-v2","install_from":"skills.sh"},"createdAt":"2026-04-18T21:54:58.801Z"}],"sources":[{"listingId":"f1c9e135-a279-48df-8ad7-928e0d6ea836","source":"github","sourceId":"CloudAI-X/claude-workflow-v2/parallel-execution","sourceUrl":"https://github.com/CloudAI-X/claude-workflow-v2/tree/main/skills/parallel-execution","isPrimary":false,"firstSeenAt":"2026-04-18T21:54:58.801Z","lastSeenAt":"2026-05-03T00:52:56.130Z"}],"details":{"listingId":"f1c9e135-a279-48df-8ad7-928e0d6ea836","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"CloudAI-X","slug":"parallel-execution","github":{"repo":"CloudAI-X/claude-workflow-v2","stars":1352,"topics":["agent-skills","ai","ai-agents","claude-code","codex","cursor","skills","workflow"],"license":"mit","html_url":"https://github.com/CloudAI-X/claude-workflow-v2","pushed_at":"2026-02-14T18:09:29Z","description":"Universal Claude Code workflow plugin with agents, skills, hooks, and commands","skill_md_sha":"c7bb77f917cb46039f62bbc84a3be9fb0b66c91f","skill_md_path":"skills/parallel-execution/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/CloudAI-X/claude-workflow-v2/tree/main/skills/parallel-execution"},"layout":"multi","source":"github","category":"claude-workflow-v2","frontmatter":{"name":"parallel-execution","description":"Patterns for parallel subagent execution using Task tool with run_in_background. Use when coordinating multiple independent tasks, spawning dynamic subagents, or implementing features that can be parallelized."},"skills_sh_url":"https://skills.sh/CloudAI-X/claude-workflow-v2/parallel-execution"},"updatedAt":"2026-05-03T00:52:56.130Z"}}