Use when deciding whether to launch an agent, selecting which agent to use, or coordinating multiple agents...
Iron Law: "NO AGENT LAUNCH WITHOUT CLEAR DELEGATION CRITERIA"
Use this skill when:
This skill prevents premature agent launches, redundant agent usage, and poor task isolation that wastes thinking budget and causes coordination failures.
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
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."
When delegating to external models via claudish CLI:
Structure:
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:
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
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"
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"
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)"
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"
Trigger: Current agent lacks specific skill that another agent has Agent: specialist agent (security, performance, accessibility) Example: "Launch accessibility agent to audit ARIA compliance"
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")
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
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)
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)
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()
}
| 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 |
Fast Execution (< 2 min):
x-ai/grok-code-fast-1 - Code generation, refactoring, simple analysisanthropic/claude-3-5-haiku - Quick decisions, data transformationDeep Reasoning (> 2 min):
anthropic/claude-sonnet-4-5 - Complex debugging, architecture designgoogle/gemini-2.0-flash-thinking-exp-01-21 - Extended thinking budgetSpecialized:
Minimal (< 1000 tokens):
Moderate (1000-5000 tokens):
Full (5000+ tokens):
Must include:
Example:
Success Criteria:
- Output: JSON array of {file, line, issue, suggestion}
- Completeness: All React components in src/ analyzed
- Quality: Each suggestion must include before/after code
- Constraints: Complete within 5 minutes, use only Read/Grep tools
Pattern:
1. Launch agent with external-model
2. Capture result in variable or file
3. Validate result against success criteria
4. Route to next step:
- If success: Use result in main workflow
- If partial: Request clarification
- If failure: Fall back to native tools
Example:
result = Task("external-model: x-ai/grok-code-fast-1\n\nRefactor 10 components for React 19...")
if (result.contains("Refactored successfully")) {
// Apply changes to codebase
applyRefactorings(result.changes)
} else {
// Fall back to manual refactoring
manualRefactor()
}
Before launching an agent, verify:
# ā VIOLATION: Agent for single grep
Task: "Find all files importing the old database client"
# ā CORRECT: Use native tool
Grep("from old_db_client import", type: "py", output_mode: "files_with_matches")
// ā CORRECT: Multi-step investigation with agent
Task: "Debug the race condition in WebSocket message handling.
Context:
- File: src/services/websocket.ts (342 lines)
- Issue: Messages arrive out of order 5% of the time
- Environment: Production only (not reproducible in dev)
- Recent changes: Added message batching in commit a3f9c21
Success Criteria:
- Identify race condition root cause (provide line numbers)
- Propose synchronization strategy
- Verify solution handles edge cases
Constraints:
- Max 10 minutes analysis
- Use Read, Grep, and Bash tools only
- No code changes (diagnosis only)"
// ā CORRECT: Fast refactoring with Grok
external-model: x-ai/grok-code-fast-1
Refactor 15 handler functions in handlers/ to use consistent error handling pattern.
Context:
- Directory: internal/handlers/ (15 files, ~200 lines each)
- Current state: Inconsistent error responses (some use Error(), some use Errorf(), some return raw errors)
- Target pattern: Use custom AppError type with status codes and messages
Success Criteria:
- All 15 handlers use AppError consistently
- Preserve existing business logic (only change error handling)
- Provide git diff summary
Constraints:
- Complete within 3 minutes
- Use Read and Grep tools for analysis
- Return refactored code for all 15 files
Works with:
Prevents:
| Anti-Pattern | ā Without Discipline | ā With Discipline |
|---|---|---|
| Trivial task delegation | Launch agent to run single grep | Use Grep tool directly |
| Missing isolation | "Fix the bug we discussed" | "Debug TypeError in UserProfile.tsx line 42: 'Cannot read property name of undefined'. Context: ..." |
| No success criteria | "Analyze the performance issue" | "Identify re-render causes (line numbers), propose memoization, estimate improvement %" |
| Wrong model selection | Use sonnet-4-5 for simple refactoring | Use grok-code-fast for speed |
| No result validation | Launch agent, assume success | Check result against success criteria, have fallback plan |
| Coordination failure | Launch 3 agents, hope they coordinate | Define result routing: Agent 1 ā validate ā Agent 2 ā aggregate |
Detection:
Correction:
Validation:
Agent Task Checklist (all must be true):
ā Task requires 5+ tool calls OR external model expertise
ā Success criteria defined (output format, completeness, quality bar)
ā Context is self-contained (no references to earlier discussion)
ā Model selection justified (speed vs. reasoning trade-off considered)
ā Result routing planned (validation + next steps)
ā Error handling defined (fallback if agent fails)
ā Native tools attempted first (or explicitly not applicable)
Related Skills:
verification-before-completion - Validate agent resultssystematic-debugging - Multi-step debugging investigationsorchestration/multi-agent-orchestration - Complex coordination patternsVersion: 1.0.0 Last Updated: 2026-01-20