sub-agents-patterns
Skill108 starsChanged 17 days agoMITView on GitHub
Sub-agent patterns for parallel and complex tasks. Use when splitting work across Explore/Plan/general-purpose sub-agents or running independent investigations in parallel.
In this repository61 other files it gives its agents.
- docs/AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- .claude/references/angular/CLAUDE.mdCLAUDE.md
- .claude/references/flutter/CLAUDE.mdCLAUDE.md
- .claude/references/laravel/CLAUDE.mdCLAUDE.md
- .claude/references/paperclip/CLAUDE.mdCLAUDE.md
- .claude/references/reactnative/CLAUDE.mdCLAUDE.md
- .claude/references/svelte/CLAUDE.mdCLAUDE.md
- .claude/references/symfony/CLAUDE.mdCLAUDE.md
- .claude/references/vite/CLAUDE.mdCLAUDE.md
- .claude/references/vuejs/CLAUDE.mdCLAUDE.md
- aggregatesSkill
- api-gatewaySkill
- architectSkill
- architecture-clean-dddSkill
- architectureSkill
- asyncSkill
- atomic-tasksSkill
- coding-standardsSkill
- cqrsSkill
- ddd-patternsSkill
- debug-methodicalSkill
- design-md-conventionSkill
- docker-hadolintSkill
- doctrine-extensionsSkill
- documentationSkill
- domain-eventsSkill
- dynamic-workflowsSkill
- ecosystem-toolsSkill
- edge-computingSkill
- event-drivenSkill
- git-workflowSkill
- graphqlSkill
- i18nSkill
- kiss-dry-yagniSkill
- monorepoSkill
- multitenantSkill
- navigationSkill
- observabilitySkill
- parallel-worktreesSkill
- performanceSkill
- quality-toolsSkill
- remotionSkill
- security-flutterSkill
- security-reactnativeSkill
- security-reactSkill
- securitySkill
- security-symfonySkill
- socratic-brainstormSkill
- solid-principlesSkill
- state-managementSkill
- testing-flutterSkill
- testing-pythonSkill
- testing-reactnativeSkill
- testing-reactSkill
- testingSkill
- testing-symfonySkill
- toolingSkill
- value-objectsSkill
- wasmSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 11 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
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 18
Use for fast codebase exploration and information gathering.
- Distinctive: line 33
Use for multi-step tasks requiring autonomy.
- Distinctive: line 48
Use for designing implementation strategies.
- Distinctive: line 58
Before implementing complex features
- Distinctive: line 59
When multiple approaches are possible
- Distinctive: line 86
Run different quality checks simultaneously:
- Very specific: line 98
Use run_in_background: true for long-running tasks:
- Distinctive: line 140
No mid-execution permission blocks
- Distinctive: line 163
Use Explore agent for quick searches
- Distinctive: line 164
Use background mode for long tasks
- Distinctive: line 169
Use agents for simple single-file reads
- Distinctive: line 171
Use vague prompts that require clarification
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Sub-Agents Patterns
Guide for using sub-agents effectively in Claude Code for parallel and complex tasks.
Agent Types
1. Explore Agent (Quick Research)
Use for fast codebase exploration and information gathering.
Task tool with subagent_type: "Explore"
- Quick file pattern searches
- Keyword searches in code
- Understanding codebase structureWhen to use:
- Finding files by pattern
- Searching for specific code patterns
- Answering questions about codebase organization
2. General-Purpose Agent (Complex Tasks)
Use for multi-step tasks requiring autonomy.
Task tool with subagent_type: "general-purpose"
- Complex refactoring
- Multi-file updates
- Research and implementationWhen to use:
- Tasks spanning multiple files
- Independent sub-tasks that can run in parallel
- Tasks requiring judgment and iteration
3. Plan Agent (Architecture)
Use for designing implementation strategies.
Task tool with subagent_type: "Plan"
- Implementation planning
- Architecture decisions
- Trade-off analysisWhen to use:
- Before implementing complex features
- When multiple approaches are possible
- For architectural decisions
Parallel Task Patterns
Pattern 1: Parallel Research
Launch multiple explore agents for different aspects:
# Launch in parallel (single message with multiple tool calls):
- Agent 1: Search for authentication patterns
- Agent 2: Search for API endpoints
- Agent 3: Search for database modelsPattern 2: Parallel Updates
For independent file updates across languages/modules:
# Launch in parallel:
- Agent 1: Update French templates
- Agent 2: Update Spanish templates
- Agent 3: Update German templates
- Agent 4: Update Portuguese templatesPattern 3: Parallel Quality Checks
Run different quality checks simultaneously:
# Launch in parallel:
- Agent 1: Run linter
- Agent 2: Run tests
- Agent 3: Check types
- Agent 4: Security auditBackground Agents
Use run_in_background: true for long-running tasks:
Task tool with:
run_in_background: true
Benefits:
- Continue working while agent runs
- Check progress via output file
- Notification when completeBest for:
- Test suites
- Build processes
- Large migrations
- Quality pipelines
Permission Prompting (v2.1.20+)
Background agents request permissions before launching, preventing mid-execution blocks:
Launching background task: "Analyze and fix code"
This task will need permissions for:
- Read (all files)
- Edit (src/**)
- Bash (npm run lint:fix)
Approve all? [y/N/select]Response options:
| Option | Action |
y | Approve all requested permissions |
N | Refuse and cancel launch |
select | Choose permissions individually |
Benefits:
- No mid-execution permission blocks
- Full visibility of agent actions before start
- Granular control over allowed operations
Task Tool Metrics (v2.1.30+)
Task tool results now include execution metrics:
| Metric | Description |
| Token count | Total tokens consumed by the sub-agent |
| Tool uses | Number of tool invocations during execution |
| Duration | Total elapsed time for task completion |
Benefits:
- Monitor sub-agent cost per task
- Identify expensive operations
- Optimize parallel task distribution
Best Practices
Do
- Launch independent tasks in parallel (single message, multiple tools)
- Use Explore agent for quick searches
- Use background mode for long tasks
- Provide clear, detailed prompts
Don't
- Launch dependent tasks in parallel
- Use agents for simple single-file reads
- Forget to check background agent results
- Use vague prompts that require clarification
Example: Multi-Language Update
# Task: Update all i18n templates to new format
## Parallel Execution:
1. Launch 4 agents (FR, ES, DE, PT) with run_in_background: true
2. Continue working on other phases
3. Check results when notified
## Each agent receives:
- List of files to update
- Template format to follow
- Instructions to read before writeCoordination Patterns
Sequential with Checkpoints
For tasks that have dependencies:
1. Agent A completes task A
2. Check result
3. Agent B uses result for task B
4. Check result
5. Continue...Fan-Out/Fan-In
For parallel work with combined results:
1. Fan-out: Launch N parallel agents
2. Wait: All agents complete
3. Fan-in: Combine/verify results
4. Continue with merged stateReferences
- Claude Code Task tool documentation
.claude/rules/01-workflow-analysis.mdfor analysis patterns.claude/settings.jsonfor permission configuration
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.

