一键导入
agent-patterns
When to spawn agents vs work directly - parallel execution, specialization
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
When to spawn agents vs work directly - parallel execution, specialization
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.
Use when the user asks to run Codex CLI (codex exec, codex resume) or references OpenAI Codex for code analysis, refactoring, or automated editing
CONTEXT: Cognitive Order Normalized in Transformer EXtract Truncated. Cross-model context handoff via Progressive Density Layering, MLDoE expert compression, Japanese semantic density, and Negentropic Coherence Lattice validation. Creates portable carry-packets that transfer cognitive state between AI sessions. Use when context reaches 80%, switching models, ending sessions, user says save, quicksave, handoff, transfer, continue later, /qs, /context, or needs session continuity.
Use when you have a written implementation plan to execute in a separate session with review checkpoints
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Use when you have lint errors, formatting issues, or before committing code to ensure it passes CI.
| name | agent-patterns |
| description | When to spawn agents vs work directly - parallel execution, specialization |
| allowed-tools | Read, Bash, Task |
| model | sonnet |
Spawn smart, not often.
"Search for auth bugs"
→ Spawn 5 agents, one per module
→ 5x faster, same tokens
"Review this PR"
→ security-agent
→ performance-agent
→ style-agent
Each has focused expertise
❌ Agent 1 creates file
❌ Agent 2 needs that file
= Race condition, wasted tokens
✓ Do sequentially in main conversation
❌ "Spawn agent to add one line"
= Overhead > benefit
✓ Just do it directly
Task tool with subagent_type=Explore
- Fast file/code search
- Codebase questions
- Pattern finding
Task tool with subagent_type=general-purpose
- Multi-step implementation
- Complex changes
- Autonomous work
code-reviewer: Style, bugs, patterns
debugger: Error investigation
security-reviewer: Vulnerability scan
performance-reviewer: Bottleneck analysis
Single message, multiple Task calls:
Task 1: "Search auth module for bugs"
Task 2: "Search payment module for bugs"
Task 3: "Search user module for bugs"
Task 4: "Search api module for bugs"
Task 5: "Search data module for bugs"
All run simultaneously.
run_in_background: true
Start long-running work →
Continue other tasks →
Check results later with TaskOutput
Main conversation: Full codebase context
Agent: Only sees what it needs
"Search auth/"
Agent loads only auth/, not entire codebase.
Agent does extensive search →
Returns: "Found issue in auth.swift:142"
You get 1-line summary, not full exploration.
Tokens saved: 90%+
1. Explore agent finds the problem
2. Main conversation receives summary
3. You fix directly with focused context
No need to spawn another agent.
❌ "Spawn agent for each file"
= 50 agents for 50 files = chaos
✓ "Spawn agent per module" (5-10 agents)
❌ "Spawn agent to read config.json"
= 10 seconds + overhead
✓ Read tool directly = instant
❌ Spawn → Wait → Spawn → Wait
✓ Spawn all → Work on other things → Collect results
| Task | Agents | Why |
|---|---|---|
| Bug search | 5-10 | One per major module |
| PR review | 3-4 | Security, perf, style, tests |
| Refactor | 2-3 | Analyzer, transformer, validator |
| Feature build | 4 | UI, logic, tests, docs |
| Codebase exploration | 1 | Single thorough search |
Task tool with resume: "agent-id"
Agent continues with full prior context.
No need to re-explain.
Resume: Same task, more work needed
New: Different task, fresh context
# In skill frontmatter or Task call
model: haiku # Simple searches, formatting
model: sonnet # Code review, implementation
model: opus # Architecture, complex reasoning
Default to cheapest model that works.
Use when: Parallel work, specialized tasks, large codebase operations