Intelligently routes tasks to appropriate specialized agents (github-workflows, research-agent, self-improvement, agent-builder) based on task type and requirements
Routes tasks to specialized agents based on task type and requirements.
/plugin marketplace add C0ntr0lledCha0s/claude-code-plugin-automations/plugin install project-manager@claude-code-plugin-automations[task-description]Smart task routing system that analyzes task descriptions, determines the most appropriate specialized agent to handle the work, delegates via the Task tool, monitors completion, and reports results.
$ARGUMENTS: Complete task description (all arguments combined)
When this command is invoked with /project-manager:delegate-task [task-description]:
Parse Task Description:
Categorize Task Type:
GitHub Operations:
- PR review, merge, creation
- Issue triage, labeling, organization
- Project board operations
- Commit operations
- Release management
Research & Analysis:
- Codebase investigation
- Best practice research
- Architecture analysis
- Technology comparison
- Pattern identification
Quality & Improvement:
- Code quality review
- Work critique
- Plan validation
- Improvement suggestions
Automation & Tooling:
- Agent creation
- Skill development
- Command creation
- Hook setup
- Plugin development
Planning & Coordination:
- Sprint planning
- Backlog prioritization
- Roadmap creation
- Multi-project coordination
Apply Delegation Decision Tree:
Task Type → Best Agent
GitHub Operations:
- PRs, issues, boards, commits → workflow-orchestrator
- Specifically PR reviews → pr-reviewer
- Project coordination → workflow-orchestrator
Research Tasks:
- "How does X work?" → investigator
- "Best practices for Y" → investigator
- "Compare A vs B" → investigator
- Codebase exploration → investigator
Quality Tasks:
- "Review my work" → self-critic
- "Check quality of X" → self-critic
- "Validate this plan" → self-critic
Automation Tasks:
- "Create agent/skill/command/hook" → agent-builder commands
- "Build automation for X" → agent-builder commands
- "Need custom workflow" → agent-builder commands
Planning Tasks:
- "Plan sprint" → project-coordinator (self)
- "Multi-project coordination" → project-coordinator (self)
- "Strategic planning" → project-coordinator (self)
Determine if Multiple Agents Needed:
Prepare Delegation Context:
# If task mentions PR/issue numbers, fetch details
gh pr view #123 --json title,body,state
# If task involves files, check their existence
test -f path/to/file.ts && echo "exists"
# If task is about current project, gather repo info
gh repo view --json name,description
Delegate to Selected Agent:
Use Task tool to invoke the appropriate agent:
Task tool:
- subagent_type: [selected-agent]
- description: [5-word summary]
- prompt: [detailed instructions with full context]
Monitor Delegation:
Receive and Validate Results:
Optionally Chain to Next Agent:
/project-manager:delegate-task Review PR #123 for security and code quality
Expected behavior:
Task → pr-reviewer:
"Perform comprehensive security and code quality review of PR #123.
Focus on: security vulnerabilities, code quality, test coverage, documentation."
Output:
✅ Task Delegated & Completed
Task: Review PR #123 for security and code quality
Delegated To: pr-reviewer (github-workflows plugin)
Results:
━━━━━━━━━━━━━━━━━━━━━━━━━━
PR #123: Add OAuth authentication
Quality Score: 4.2 / 5.0
Findings:
✅ Security: No critical issues
⚠️ Code Quality: 2 minor improvements suggested
✅ Tests: Good coverage (87%)
⚠️ Docs: Missing API documentation
Detailed Review: [link to review comments]
Recommendation: Approve after minor fixes
━━━━━━━━━━━━━━━━━━━━━━━━━━
Next Steps:
- Address documentation gaps
- Apply suggested code improvements
- Re-request review after fixes
/project-manager:delegate-task Research best authentication patterns for our API
Expected behavior:
Task → investigator:
"Research industry best practices for API authentication.
Focus on: security, developer experience, scalability.
Provide recommendations for our use case."
Output:
✅ Task Delegated & Completed
Task: Research best authentication patterns for our API
Delegated To: investigator (research-agent plugin)
Results:
━━━━━━━━━━━━━━━━━━━━━━━━━━
Authentication Patterns Research
Recommended Approach: OAuth 2.0 + JWT
Findings:
1. OAuth 2.0 (Industry Standard)
- Pros: Secure, flexible, widely adopted
- Cons: Complex setup
- Use Cases: Third-party integrations
2. JWT Tokens (Recommended for APIs)
- Pros: Stateless, scalable, fast
- Cons: Token revocation complexity
- Use Cases: First-party mobile/web apps
3. API Keys (Simple but Limited)
- Pros: Easy to implement
- Cons: Less secure, limited control
- Use Cases: Internal services only
Recommendation:
- Primary: OAuth 2.0 for external clients
- Secondary: JWT for first-party apps
- API Keys: Internal service-to-service only
Implementation Guide: [link to research document]
━━━━━━━━━━━━━━━━━━━━━━━━━━
Next Steps:
- Review recommendations with team
- Prototype OAuth + JWT implementation
- Plan migration strategy
/project-manager:delegate-task Implement user notification system
Expected behavior:
Output:
✅ Multi-Step Task Delegated & Completed
Task: Implement user notification system
Strategy: Sequential delegation (3 phases)
━━━━━━━━━━━━━━━━━━━━━━━━━━
Phase 1: Research (investigator)
━━━━━━━━━━━━━━━━━━━━━━━━━━
Researched:
- Notification delivery patterns
- Real-time vs batch notifications
- Technology options (WebSocket, SSE, Push API)
Recommendation: WebSocket for real-time + email for async
Research Doc: .claude-project/research/notifications-2025-03-15.md
━━━━━━━━━━━━━━━━━━━━━━━━━━
Phase 2: Planning (project-coordinator)
━━━━━━━━━━━━━━━━━━━━━━━━━━
Created Implementation Plan:
- 5 issues created for notification system
- Estimated: 23 story points total
- Timeline: 2 sprints
- Dependencies mapped
Issues:
- #201: WebSocket server setup (8 pts)
- #202: Notification data model (3 pts)
- #203: Frontend notification UI (5 pts)
- #204: Email notification service (5 pts)
- #205: Testing & documentation (2 pts)
Epic #200 created to track overall initiative
━━━━━━━━━━━━━━━━━━━━━━━━━━
Phase 3: Board Setup (workflow-orchestrator)
━━━━━━━━━━━━━━━━━━━━━━━━━━
Created:
- Project board: "Notification System"
- Added all 5 issues
- Set up dependency tracking
- Configured automation rules
Board: [link to GitHub Project]
━━━━━━━━━━━━━━━━━━━━━━━━━━
Next Steps:
1. Review implementation plan with team
2. Add to next sprint planning
3. Assign issues to team members
4. Begin work on #201 (foundation)
/project-manager:delegate-task Triage all open issues
Expected behavior:
Output:
✅ Task Delegated & Completed
Task: Triage all open issues
Delegated To: workflow-orchestrator (github-workflows plugin)
Results:
━━━━━━━━━━━━━━━━━━━━━━━━━━
Issue Triage Complete
Processed: 67 open issues
Classifications:
- Features: 35 issues
- Bugs: 18 issues (3 critical, 8 high, 7 medium)
- Tech Debt: 10 issues
- Documentation: 4 issues
Duplicates Found: 5 sets (10 issues consolidated)
Relationships Mapped:
- Blocking: 8 dependencies
- Related: 15 clusters
Labels Applied:
- Priority labels: 67 issues
- Type labels: 67 issues
- Component labels: 52 issues
Board Updated: Backlog reorganized by priority
━━━━━━━━━━━━━━━━━━━━━━━━━━
Critical Issues Identified:
- #145: Security vulnerability (requires immediate attention)
- #178: Production bug affecting 1000+ users
- #190: Data corruption risk
Next Steps:
- Address 3 critical bugs immediately
- Review duplicate consolidation
- Plan next sprint from triaged backlog
Use this command when:
Don't use when:
Decision Tree:
1. Parse task description for keywords
2. Match to agent capabilities:
Keywords: "PR", "pull request", "review PR" → pr-reviewer
Keywords: "issue", "triage", "label", "board", "project" → workflow-orchestrator
Keywords: "commit", "release", "deploy" → workflow-orchestrator
Keywords: "research", "how does", "best practice", "compare" → investigator
Keywords: "investigate", "analyze pattern", "explore" → investigator
Keywords: "review my work", "quality check", "critique" → self-critic
Keywords: "validate", "assess quality" → self-critic
Keywords: "create agent", "create skill", "create command" → agent-builder commands
Keywords: "build automation", "create hook" → agent-builder commands
Keywords: "plan sprint", "roadmap", "multi-project" → project-coordinator (self)
3. If multiple matches → choose most specific
4. If no clear match → ask user to clarify
5. If complex task → break into steps and delegate sequentially
❓ Task Unclear
The task "$ARGUMENTS" could match multiple agents:
1. investigator (research-agent) - for codebase research
2. workflow-orchestrator (github-workflows) - for GitHub operations
Please clarify or rephrase:
- For research: "Research how X works"
- For GitHub ops: "Create board for X"
Or specify agent directly:
- /github-workflows:workflow-orchestrator-invocation
- Use investigator via research-agent commands
❌ Error: Required agent not available
Task requires: investigator (research-agent plugin)
Status: Plugin not installed
Options:
1. Install research-agent plugin:
claude plugin install research-agent
2. Handle task manually
3. Use alternative agent (less optimal):
- Could use workflow-orchestrator for basic analysis
❌ Delegation Failed
Task: $ARGUMENTS
Attempted Agent: [agent-name]
Error: [error message from agent]
Options:
1. Retry with different approach
2. Delegate to alternative agent
3. Handle task manually
4. Break into smaller sub-tasks
Would you like to retry? [y/n]
✅ Task Delegated & Completed
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📋 Task: [task description]
🤖 Delegated To: [agent-name] ([plugin-name])
⏱️ Completed In: [X] seconds
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 RESULTS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[Agent-specific results formatted clearly]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔗 ARTIFACTS CREATED
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- [Link to PR/Issue/Board/Document]
- [Link to generated files]
- [Link to analysis reports]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📝 NEXT STEPS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. [Recommended action 1]
2. [Recommended action 2]
3. [Recommended action 3]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Need additional help? Use /project-manager:delegate-task for more tasks.