agentleFS
arpitnatharpitnath/claude-capsule-kit/skills/task-router/SKILL.md

task-router

Skill93 starsChanged 10 months agoMITView on GitHub

Decision matrix for choosing optimal approach to any task. Helps Claude decide when to delegate to sub-agents vs. working directly. Use when starting a new task or unsure of best approach.

  • Reads credentials

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. AidALL/ghost-alice★ 15same name
    2. dprakash2101/dotnet-production-agent-skills★ 4same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository7 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 6 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Don't know exact file location

    line 67
  2. Distinctive:

    Use Read, Edit, Write tools directly

    line 200
  3. Distinctive:

    Use TodoWrite for tracking if multi-step

    line 201
  4. Distinctive:

    Why: Avoid repeating work, maintain continuity

    line 250
  5. Distinctive:

    After choosing approach, verify:

    line 294
  6. Distinctive:

    Not using parallel calls for independent operations

    line 305

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Task Router Skill

This skill provides clear decision rules for choosing the optimal approach to any task.

Purpose

Problem: Claude has many tools (sub-agents, direct work, parallel calls) but no clear guidance on when to use each. Solution: Decision matrix with clear rules and examples.

When to Use

Activate this skill when:

  • Starting a new task and unsure of approach
  • Task seems complex (>30 min, >5 files)
  • User asks "what's the best way to do X?"
  • Need to validate chosen approach

Decision Matrix

🤖 Use agent-developer Sub-Agent

Trigger Conditions:

  • Building/creating mini-agents (Python with OpenAI Agents SDK)
  • Implementing executive agent configs (YAML)
  • Adding skills to skill registry
  • Writing job handlers for BullMQ
  • Integrating MCP servers
  • System Python Architecture tasks

Examples:

  • "Create a Slack notification mini-agent"
  • "Build job handler for experiment tracking"
  • "Add Google Docs skill to registry"

Why Delegate:

  • Specialized knowledge of agent patterns
  • Knows OpenAI Agents SDK deeply
  • Understands System Python Architecture
  • Has MCP integration best practices
  • 75% faster than manual implementation

How to Invoke:

Task tool with:
- subagent_type: "agent-developer"
- prompt: "Create [specific agent/handler] with [requirements]"

🔍 Use Explore Sub-Agent

Trigger Conditions:

  • Finding files by pattern/keyword
  • Understanding how a feature works
  • Locating implementation of functionality
  • Searching across multiple directories
  • Don't know exact file location

Examples:

  • "Where are errors from client handled?"
  • "Find all authentication-related code"
  • "How does the SSE streaming work?"

Why Delegate:

  • Multi-round investigation capability
  • Pattern matching across codebase
  • Faster than manual Grep/Glob
  • Systematic exploration approach

How to Invoke:

Task tool with:
- subagent_type: "Explore"
- prompt: "Find [what you're looking for]"
- Specify thoroughness: "quick", "medium", "very thorough"

🧪 Use labs-specialist Sub-Agent

Trigger Conditions:

  • Experiment tracking logic
  • Validation algorithms (Type A/B)
  • Playbook generation
  • ML service integration (Vertex AI)
  • BigQuery query logic for Labs
  • Reach/Creative intelligence features

Examples:

  • "How does experiment validation work?"
  • "Implement playbook confidence scoring"
  • "Fix experiment tracking job"

Why Delegate:

  • Expert in Labs domain logic
  • Knows validation algorithms
  • Understands ML service architecture
  • Familiar with BigQuery integration

How to Invoke:

Task tool with:
- subagent_type: "labs-specialist"
- prompt: "Explain/fix/implement [Labs-specific task]"

🗄️ Use database-navigator Sub-Agent

Trigger Conditions:

  • Understanding database schema
  • Analyzing migrations
  • Finding entity relationships
  • Query optimization
  • JSONB structure analysis
  • Foreign key dependencies

Examples:

  • "Show me the Labs database schema"
  • "What tables are related to experiments?"
  • "Explain the migration 175800000*"

Why Delegate:

  • Specialized in schema analysis
  • Understands TypeORM patterns
  • Can trace relationships
  • Migration expertise

How to Invoke:

Task tool with:
- subagent_type: "database-navigator"
- prompt: "Analyze [database/schema/migration topic]"

🏗️ Use architecture-explorer Sub-Agent

Trigger Conditions:

  • Understanding service boundaries
  • Data flow analysis
  • Integration points between services
  • API communication patterns
  • System design questions

Examples:

  • "How does Frontend talk to Cognitive Engine?"
  • "Explain the SSE streaming architecture"
  • "What's the agent execution flow?"

Why Delegate:

  • Holistic system understanding
  • Service boundary expertise
  • Data flow visualization
  • Integration pattern knowledge

How to Invoke:

Task tool with:
- subagent_type: "architecture-explorer"
- prompt: "Explain [system/integration/flow]"

✋ Work Directly (No Sub-Agent)

When to Work Directly:

  • Simple file edits (<50 lines changed)
  • Quick bug fixes (known location)
  • Documentation updates
  • Configuration changes
  • Reading 1-3 specific files
  • Small refactors

Examples:

  • "Fix typo in labs.controller.ts:123"
  • "Update CLAUDE.md with new model"
  • "Change port in config"

Why Direct:

  • Faster for simple tasks
  • No delegation overhead
  • Clear, known scope

How to Execute:

  • Use Read, Edit, Write tools directly
  • Use TodoWrite for tracking if multi-step
  • Parallel tool calls if multiple independent operations

Special Cases

Parallel Tool Calls

Use When:

  • Reading multiple independent files
  • Running multiple independent commands
  • Checking multiple services
  • Validating multiple configurations

Example:

Single message with:
- Read tool (file1.ts)
- Read tool (file2.ts)
- Read tool (file3.ts)
All in one response block

Why: 3x faster than sequential reads


Plan Sub-Agent

Use When:

  • Need to plan multi-step implementation
  • Breaking down complex feature
  • Creating implementation roadmap
  • Analyzing technical approach

Example: "Plan the implementation of playbook management APIs"


Exploration Journal

Always Check When:

  • User says "continue", "resume", "pick up where we left off"
  • Starting work on familiar topic
  • Complex investigation (might have been explored before)

Location: docs/exploration/CURRENT_SESSION.md

Why: Avoid repeating work, maintain continuity


Decision Flowchart

START: New Task Received
  ↓
Is it continuation work?
  YES → Read exploration journal first
  NO  → Continue
  ↓
Is it simple (<30 min, <5 files, known location)?
  YES → Work directly
  NO  → Continue
  ↓
Is it development (agent/handler/skill)?
  YES → Use agent-developer
  NO  → Continue
  ↓
Is it exploration (find/understand/locate)?
  YES → Use Explore sub-agent
  NO  → Continue
  ↓
Is it Labs-specific?
  YES → Use labs-specialist
  NO  → Continue
  ↓
Is it database/schema?
  YES → Use database-navigator
  NO  → Continue
  ↓
Is it architecture/integration?
  YES → Use architecture-explorer
  NO  → Continue
  ↓
DEFAULT → Work directly with TodoWrite tracking

Quality Checks

After choosing approach, verify:

✅ Correct Choice If:

  • Approach matches decision matrix
  • Estimated time saved > delegation overhead
  • Sub-agent has specialized knowledge for this task
  • Task is complex enough to benefit from specialization

❌ Wrong Choice If:

  • Using sub-agent for simple 1-file edit
  • Working directly on complex multi-file feature
  • Not using parallel calls for independent operations
  • Forgetting to check exploration journal on continuation

Examples: Good vs. Bad Decisions

Example 1: Building Job Handler

Task: "Create experiment tracking job handler"

❌ Bad: Work directly

  • Why bad: 200+ lines, needs BullMQ patterns, integration knowledge
  • Result: Slow, might miss patterns, no validation

✅ Good: Use agent-developer sub-agent

  • Why good: Specialized in job handlers, knows patterns, faster
  • Result: Production-quality handler following best practices

Example 2: Finding Implementation

Task: "Where is SSE streaming implemented?"

❌ Bad: Manual Grep + Read chain

  • Why bad: Multiple rounds, trial and error, slow
  • Result: Might miss files, incomplete understanding

✅ Good: Use Explore sub-agent

  • Why good: Systematic search, multi-round investigation
  • Result: Complete findings with file paths and line numbers

Example 3: Simple Config Change

Task: "Update port in .env.example"

❌ Bad: Use agent-developer sub-agent

  • Why bad: Massive overhead for 1-line change
  • Result: Slower, overkill

✅ Good: Work directly

  • Why good: Read → Edit → Done in 30 seconds
  • Result: Fast, efficient

Example 4: Reading Multiple Files

Task: "Check these 5 files for X pattern"

❌ Bad: Sequential reads (5 separate messages)

  • Why bad: 5x slower than parallel
  • Result: Wastes time and tokens

✅ Good: Parallel tool calls (single message, 5 Read tools)

  • Why good: All reads execute simultaneously
  • Result: 5x faster

Integration with Hooks

This skill complements the hooks system:

  1. Pre-Task Analysis Hook suggests which approach to use
  2. Task Router Skill provides detailed decision matrix
  3. Quality Check Hook validates approach was optimal

User can invoke this skill manually: "What's the best way to [task]?"


Success Criteria

✅ Correct sub-agent chosen for specialized tasks ✅ Direct work used for simple operations ✅ Parallel calls used for independent operations ✅ Exploration journal checked on continuation ✅ No obvious inefficiencies in approach


Remember: The goal is OPTIMAL approach, not just ANY approach. Use sub-agents when they provide value, work directly when they don't!

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.