parallel-task-execution
Skill4 starsChanged 9 months agoMITView on GitHub
Patterns for running independent tasks in parallel using multiple tool calls and Agent invocations. Use when the user has multiple independent operations, asks about fan-out/fan-in, or wants to speed up multi-step workflows.
In this repository78 other files it gives its agents.
- AGENTS.mdAGENTS.md
- rules/agents.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/claude-initial-setup.mdcCursor rule
- subagent-patternsSkill
- task-coordinationSkill
- agent-communicationSkill
- context-managementSkill
- multi-agent-orchestrationSkill
- deploy-strategiesSkill
- github-actions-guideSkill
- pipeline-patternsSkill
- anthropic-sdk-guideSkill
- prompt-engineeringSkill
- tool-use-patternsSkill
- automated-review-setupSkill
- pr-standardsSkill
- review-checklistSkill
- file-organizationSkill
- immutability-patternsSkill
- naming-conventionsSkill
- branching-strategySkill
- commit-conventionsSkill
- pr-workflowSkill
- migration-patternsSkill
- query-optimizationSkill
- schema-design-guideSkill
- error-tracingSkill
- log-analysisSkill
- systematic-debuggingSkill
- django-admin-customizationSkill
- django-orm-masterySkill
- drf-api-patternsSkill
- docker-compose-guideSkill
- dockerfile-best-practicesSkill
- multi-stage-buildsSkill
- express-error-handlingSkill
- middleware-patternsSkill
- rest-api-nodeSkill
- async-fastapiSkill
- dependency-injection-fastapiSkill
- pydantic-validationSkill
- concurrency-patterns-goSkill
- error-handling-goSkill
- idiomatic-goSkill
- automation-triggersSkill
- hook-recipesSkill
- pre-post-hooksSkill
- junit-testingSkill
- maven-gradle-guideSkill
- spring-boot-patternsSkill
- mcp-resource-patternsSkill
- mcp-server-creationSkill
- mcp-tool-designSkill
- context-optimizationSkill
- knowledge-persistenceSkill
- memory-patternsSkill
- caching-strategiesSkill
- lazy-loading-patternsSkill
- profiling-guideSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 7 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 55
All three files are read concurrently.
- Distinctive: line 82
After parallel calls complete, synthesize in the next response:
- Distinctive: line 120
When some steps depend on others but have parallel sub-branches:
- Very specific: line 135
Use run_in_background for commands that take a while:
- Distinctive: line 148
When creating multiple independent files:
- Distinctive: line 167
Ignoring partial failures: When one of several parallel operations fails, do not ignore it.
- Distinctive: line 169
Using parallel agents for tiny tasks: Do not launch a subagent to read a single file.
- Distinctive: line 184
Synthesis: Always dedicate a response to combining parallel results.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Parallel Task Execution
Claude Code can execute multiple independent tool calls in a single response. This dramatically reduces wall-clock time for tasks that do not depend on each other.
When to Use
- Multiple files need to be read, searched, or analyzed independently
- User wants to speed up a multi-step workflow
- Several subagents can investigate different aspects simultaneously
- Independent operations (read + grep + glob) can run concurrently
- User asks about fan-out/fan-in or parallel execution
Core Patterns
Identifying Independent Operations
Two operations are independent when neither needs the other's result. Test by asking: "Can I start operation B without knowing the result of operation A?"
# INDEPENDENT (run in parallel):
- Read file A and Read file B
- Grep for pattern X and Grep for pattern Y
- Analyze auth module and Analyze database module
# DEPENDENT (run sequentially):
- Find the config file, THEN read it
- Read the test file, THEN modify it based on contents
- Get the function signature, THEN find all call sitesParallel Tool Calls
Make multiple tool calls in a single response block:
# Single response with 3 parallel calls:
Call 1 - Read:
file_path: "src/auth/middleware.ts"
Call 2 - Read:
file_path: "src/auth/tokens.ts"
Call 3 - Read:
file_path: "src/auth/permissions.ts"All three files are read concurrently. Results arrive together for synthesis.
Fan-Out with Subagents
Launch multiple Agent tool calls for independent investigations:
# Fan-out: 3 parallel subagents
Agent 1:
prompt: "Analyze all React components in src/components/
for accessibility issues (missing aria labels,
no keyboard handlers). Report findings as a list."
Agent 2:
prompt: "Check all API routes in src/api/ for proper
error handling. Report which routes lack try/catch
or return generic error messages."
Agent 3:
prompt: "Review all database queries in src/db/
for N+1 query problems. Report file paths and
the specific query patterns."Fan-In: Synthesizing Results
After parallel calls complete, synthesize in the next response:
# Step 1: Parallel fan-out (3 Agent calls)
# Step 2: All results arrive
# Step 3: Synthesize
"Based on the three analyses:
- Accessibility: 4 components need aria labels (Agent 1)
- Error handling: 2 routes missing try/catch (Agent 2)
- Database: 1 N+1 query in user-posts loader (Agent 3)
Priority order: Database N+1 > Error handling > Accessibility"Mixed Parallel Operations
Combine different tool types in a single parallel batch:
# All independent, all in parallel:
Call 1 - Glob:
pattern: "src/**/*.test.ts"
Call 2 - Grep:
pattern: "TODO|FIXME|HACK"
path: "src/"
Call 3 - Read:
file_path: "package.json"
Call 4 - Bash:
command: "git log --oneline -10"Sequential Dependencies with Parallel Branches
When some steps depend on others but have parallel sub-branches:
# Step 1 (sequential): Read the config to understand the project
Read: "tsconfig.json"
# Step 2 (parallel, depends on Step 1):
# After reading tsconfig, these are independent:
Grep: pattern "import.*from" in src/ # Find all imports
Glob: "src/**/*.d.ts" # Find type declarations
Bash: "npx tsc --noEmit 2>&1 | wc -l" # Count type errorsBackground Execution for Long Tasks
Use run_in_background for commands that take a while:
Bash:
command: "npm run test:coverage"
run_in_background: true
# Continue working on other things while tests run.
# You will be notified when the background task completes.Parallel File Creation
When creating multiple independent files:
# All independent, all in parallel:
Write: "src/utils/format.ts"
content: "..."
Write: "src/utils/validate.ts"
content: "..."
Write: "src/utils/transform.ts"
content: "..."Anti-Patterns
- Parallelizing dependent operations: Reading a file and then editing it based on contents must be sequential. Making these parallel causes the edit to use stale or missing data.
- Too many parallel calls: Launching 20 subagents simultaneously can overwhelm the system. Keep parallel batches to 3-5 concurrent operations for stability.
- Ignoring partial failures: When one of several parallel operations fails, do not ignore it. Address the failure before proceeding with synthesis.
- Serializing independent work: Running 5 independent file reads one after another wastes time. If they do not depend on each other, run them in parallel.
- Using parallel agents for tiny tasks: Do not launch a subagent to read a single file. Use the Read tool directly. Subagents have overhead and are only worth it for multi-step investigations.
Quick Reference
| Pattern | When | How |
| Parallel reads | Multiple files to inspect | Multiple Read calls in one response |
| Parallel searches | Multiple patterns or directories | Multiple Grep/Glob calls in one response |
| Fan-out agents | Independent investigations | Multiple Agent calls in one response |
| Fan-in synthesis | After parallel results arrive | Single response analyzing all results |
| Background tasks | Long-running commands | run_in_background: true on Bash |
| Mixed parallel | Different tool types, independent | Mix Read + Grep + Glob + Bash in one response |
Independence test: "Can B start without A's result?" If yes, parallelize. Batch size: 3-5 concurrent operations is the sweet spot. Synthesis: Always dedicate a response to combining parallel results.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

