agent-coordination-discipline
Use when deciding whether to launch an agent, selecting which agent to use, or coordinating multiple agents. Covers delegation criteria, external-model patterns, task isolation, and agent selection strategies.
What this skill does
# Agent Coordination Discipline
**Iron Law:** "NO AGENT LAUNCH WITHOUT CLEAR DELEGATION CRITERIA"
## When to Use
Use this skill when:
- Considering launching an agent with the Task tool
- Evaluating whether a task requires agent delegation
- Selecting between different agent types or external models
- Coordinating multiple agents in a workflow
- Implementing external-model for external model delegation
- Debugging agent coordination failures
This skill prevents premature agent launches, redundant agent usage, and poor task isolation that wastes thinking budget and causes coordination failures.
## Red Flags (Violation Indicators)
- [ ] **Agent for single grep** - Launching agent to run one grep/glob command (trivial-task anti-pattern)
- [ ] **Missing external-model model** - Using external-model without explicit model name specification
- [ ] **No task isolation** - Agent task description lacks independent context or success criteria
- [ ] **No success criteria** - Task description doesn't define what "done" looks like
- [ ] **Default thinking pattern** - Not considering whether task needs deep thinking vs. fast execution
- [ ] **Multiple agents without coordination** - Launching 2+ agents without clear result routing plan
- [ ] **Result not used** - Launching agent but not routing/validating its output
- [ ] **Agent for trivial decision** - Using agent to make decision you could make directly
- [ ] **No tool exhaustion check** - Launching agent before trying native tools first
- [ ] **Missing timeout consideration** - Not evaluating if task needs extended thinking time
- [ ] **No error handling plan** - Not defining what happens if agent fails or returns partial results
- [ ] **Skill gap unclear** - Not identifying what specific expertise the agent provides
## Key Concepts
### 1. Agent vs. Native Tools Decision Tree
```
Does the task require:
├─ Single tool call (grep, read, edit)?
│ └─ ✗ NO AGENT - Use native tool directly
├─ 2-3 sequential tool calls?
│ └─ ✗ NO AGENT - Use tools directly in sequence
├─ Multi-step investigation with branching logic?
│ └─ ✓ AGENT - Task tool with developer/architect agent
├─ External model expertise (Grok, DeepSeek, etc.)?
│ └─ ✓ AGENT - external-model pattern with model specification
├─ Parallel exploration of multiple code paths?
│ └─ ✓ AGENT - Multiple Task calls with coordination
└─ High-risk change needing isolation?
└─ ✓ AGENT - Task tool with sandbox/review focus
```
### 2. Task Isolation Requirements
Every agent task must be independently executable:
**Bad (not isolated):**
```
Task: "Fix the bug we discussed earlier"
```
**Good (properly isolated):**
```
Task: "Debug the TypeError in src/components/UserProfile.tsx line 42.
Context: User reports 'Cannot read property name of undefined' when viewing profile page.
Evidence: Error occurs after recent commit abc123 that changed user data structure.
Success criteria: Identify root cause, propose fix, verify with test scenario."
```
### 3. External Model Pattern
When delegating to external models via claudish CLI:
**Structure:**
```bash
claudish --model {model_id} --stdin --quiet <<EOF > output.md
{Task Description}
Context:
- {Relevant file paths}
- {Current state}
- {Related decisions}
Success Criteria:
- {What constitutes success}
- {Expected output format}
Constraints:
- {Time limits}
- {Tool restrictions}
- {Quality requirements}
EOF
```
**Example:**
```bash
claudish --model x-ai/grok-code-fast-1 --stdin --quiet <<EOF > analysis.md
Analyze the React component rendering performance issue in Dashboard.tsx.
Context:
- File: src/components/Dashboard.tsx (247 lines)
- Issue: Component re-renders 40+ times on data updates
- Recent changes: Added real-time WebSocket updates in commit f4a2c1b
Success Criteria:
- Identify unnecessary re-renders (provide line numbers)
- Propose memoization strategy
- Estimate performance improvement
Constraints:
- Max 3 minutes analysis time
- Focus on React 19 compiler-friendly patterns
EOF
```
## When to Use Agents
### Multi-Step Investigation
**Trigger:** Task requires 5+ tool calls with conditional branching
**Agent:** developer, architect
**Example:** "Trace data flow through 3 layers to find where user.email becomes null"
### External Model Expertise
**Trigger:** Need specialized model capabilities (code speed, vision, reasoning)
**Agent:** external-model with specific model
**Example:** "Use Grok Code Fast to refactor 15 files for consistency in < 2 minutes"
### Parallel Work
**Trigger:** Multiple independent tasks that can run simultaneously
**Agent:** Multiple Task calls with result aggregation
**Example:** "Analyze frontend performance (Task 1) while auditing API security (Task 2)"
### Risk Isolation
**Trigger:** High-risk changes needing review before merging to main workflow
**Agent:** review-focused agent with checkpoint
**Example:** "Evaluate if this database migration will cause downtime"
### Skill Gaps
**Trigger:** Current agent lacks specific skill that another agent has
**Agent:** specialist agent (security, performance, accessibility)
**Example:** "Launch accessibility agent to audit ARIA compliance"
## When NOT to Use Agents
### Single Grep/Glob
**Instead:** Use native Grep or Glob tool directly
```
# ✗ DON'T
Task: "Find all files using the deprecated API"
# ✓ DO
Grep("oldApiCall", output_mode: "files_with_matches", type: "js")
```
### Simple Tool Execution
**Instead:** Use tool directly
```
# ✗ DON'T
Task: "Read the config file and tell me the API URL"
# ✓ DO
Read("/path/to/config.json")
// Parse and extract apiUrl field
```
### Decision Already Made
**Instead:** Execute the decision
```
# ✗ DON'T
Task: "I think we should use React Query. What do you think?"
# ✓ DO
// Just implement React Query since decision is made
Write("src/hooks/useApiQuery.ts", reactQueryCode)
```
### Sequential Tool Calls
**Instead:** Chain tools directly
```
# ✗ DON'T
Task: "Find the function, read it, and edit it"
# ✓ DO
Grep("functionName", output_mode: "files_with_matches")
// => result: src/utils/helper.ts
Read("src/utils/helper.ts")
Edit("src/utils/helper.ts", old_string, new_string)
```
### Nuanced Context Required
**Instead:** Handle in current agent
```
# ✗ DON'T
Task: "Based on our earlier discussion about performance vs. maintainability trade-offs, decide if we should cache this"
# ✓ DO
// Current agent already has context, make decision directly
if (performanceIsCritical) {
implementCaching()
}
```
## Agent Selection Matrix
| Task Type | Best Agent | Model | Reasoning |
|-----------|------------|-------|-----------|
| **Debugging errors** | developer | sonnet-4-5 | Deep reasoning, context retention |
| **Design review** | architect | sonnet-4-5 | System thinking, trade-off evaluation |
| **Code generation** | developer | grok-code-fast | Speed for repetitive patterns |
| **Multi-codebase analysis** | developer | sonnet-4-5 | Cross-repo understanding |
| **Performance profiling** | developer + external-model | grok-code-fast | Fast scanning + specific optimization |
| **Security audit** | security (if available) | sonnet-4-5 | Nuanced threat modeling |
| **Documentation generation** | developer | grok-code-fast | Fast, straightforward task |
| **Refactoring (large scope)** | developer | sonnet-4-5 | Maintain consistency across changes |
## external-model Pattern Details
### 1. Model Selection
**Fast Execution (< 2 min):**
- `x-ai/grok-code-fast-1` - Code generation, refactoring, simple analysis
- `anthropic/claude-3-5-haiku` - Quick decisions, data transformation
**Deep Reasoning (> 2 min):**
- `anthropic/claude-sonnet-4-5` - Complex debugging, architecture design
- `google/gemini-2.0-flash-thinking-exp-01-21` - Extended thinking budget
**Specialized:**
- Vision models - Screenshot analysis, diagram interpretation
- Code models - Language-specific optimization
### 2. Context Packaging
**Minimal (< 1000 tokens):**
- File paths only
- Error message
- Success criteria
**MoRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.