name: coding-agent-router description: Multi-executor task routing skill for intelligently delegating coding tasks to the right local AI coding agent CLI (claude, gemini, codex, cursor, copilot). Use when local AI coding CLIs are available and you need to decide which agent handles which subtask.
Coding Agent Router Skill
π― Purpose
When one or more local AI coding CLI tools are available (claude_execute, gemini_execute, codex_execute, cursor_execute, copilot_execute), this skill guides how to intelligently route each subtask to the right executor rather than implementing it manually.
The core principles:
- Always delegate first β before writing a single line of code yourself, check whether an available coding agent can do it.
- Match the task type to the agent's strength β use the routing table below.
- Handle single-tool and multi-tool scenarios differently (see sections below).
πΊοΈ Executor Routing Table
| Executor | Tool Name | Best For | Avoid For |
|---|---|---|---|
| Claude Code | claude_execute |
Architecture decisions, code review, complex refactoring, cross-file analysis, debugging hard logic bugs, explaining large codebases | Pure frontend pixel work |
| Gemini CLI | gemini_execute |
Frontend UI components (React/Vue/HTML/CSS), algorithm implementation, tasks needing 1M token context, multimodal (image + code) | Database schema design |
| OpenAI Codex | codex_execute |
Backend API (REST/GraphQL), database/ORM, server-side logic, CLI tools, scripts, data pipelines | UI component styling |
| Cursor | cursor_execute |
General-purpose AI coding: any coding task, file editing, shell commands, codebase search, debugging | β |
| GitHub Copilot | copilot_execute |
General-purpose AI coding: any coding task, file editing, shell commands, codebase search, debugging | β |
π Routing Decision Process
Task received
β
CHECK available tools (inspect which CLI tools are present)
β
ONE tool available?
ββ YES β Use that single tool for ALL coding tasks immediately
ββ NO (multiple tools) β continue below
β
CLASSIFY the task:
ββ Frontend UI / styling / components? β gemini_execute (if available)
ββ Backend API / DB / server logic? β codex_execute (if available)
ββ Architecture / review / refactor? β claude_execute (if available)
ββ General coding / no specialist match? β cursor_execute or copilot_execute or claude_execute
(whichever is available, in this priority order)
β
Multiple concerns (full-stack)? β split into subtasks, route each to the right specialist
β
DELEGATE with a complete self-contained prompt
β
If agent fails or is unavailable β retry with next available tool from the list
β
VERIFY the result
β
INTEGRATE and report back
π§ Single-Tool Scenario
When only one coding agent is available (e.g., only copilot_execute or only claude_execute):
- Use that tool for every coding task β writing code, fixing bugs, editing files, running commands, etc.
- Do NOT attempt to implement code yourself just because the tool is a "specialist" for a different domain.
- Example: if only
copilot_executeis available, use it for backend, frontend, refactoring, and everything else.
π Multi-Tool Scenario
When multiple coding agents are available:
- Route to the specialist first β gemini for frontend, codex for backend, claude for review/architecture.
- Use general-purpose tools (cursor_execute, copilot_execute, claude_execute) for tasks that don't fit a specialist.
- If a specialist fails β retry with a general-purpose tool rather than implementing it yourself.
- For full-stack work β split into subtasks and run specialist agents in parallel where possible.
π Task Classification Examples
Frontend β gemini_execute
- "Create a responsive login form component in React"
- "Add CSS animation to the navbar"
- "Implement a date picker with Vue 3 Composition API"
- "Build an interactive chart with D3.js"
Backend β codex_execute
- "Implement a REST endpoint for user authentication with JWT"
- "Write a database migration to add an index on the emails column"
- "Create a GraphQL resolver for paginated posts"
- "Build a CLI tool that parses CSV files and outputs JSON"
Architecture / Review β claude_execute
- "Review these 5 files for security vulnerabilities"
- "Refactor this module to reduce coupling between services"
- "Design the data flow architecture for this new feature"
- "Debug why this async race condition occurs"
General Coding β cursor_execute or copilot_execute
- Use whichever general-purpose tool is available for any coding task
- Writing code, editing files, running commands, searching the codebase
- "Fix the bug in src/api.ts"
- "Add unit tests for the UserService class"
- "Search for all usages of the deprecated method and replace them"
π¦ Full-Stack Task Splitting
For full-stack features, split into specialist subtasks and run them in parallel when dependencies allow:
Feature: "Add user profile editing"
β
Split:
ββ [gemini_execute] "Create ProfileEditForm React component with validation UI"
ββ [codex_execute] "Implement PUT /api/users/:id endpoint with validation"
ββ [claude_execute] "Review the profile update data flow for security issues"
β
Run frontend + backend in parallel (no dependency)
β
Run review after both complete
βοΈ Prompt Construction Guidelines
A good prompt to a coding agent must be self-contained β the agent has no context from the conversation.
β Good prompt
Implement a REST API endpoint `PUT /api/users/:id` in the Express app located at
./src/server.ts. The endpoint should:
1. Accept JSON body with fields: displayName (string), bio (string, max 500 chars)
2. Validate input using Zod
3. Update the user record in the SQLite database (schema in ./src/db/schema.ts)
4. Return the updated user object as JSON
5. Add a corresponding test in __tests__/api/users.test.ts
Working directory: /Users/alice/my-project
β Bad prompt
Add the user profile update endpoint
(Missing: file locations, database type, validation library, test requirements)
Template
[Action verb] [what to build] in [file/module location].
Requirements:
1. [Specific requirement]
2. [Specific requirement]
[Technologies/libraries to use]
[Any constraints or existing patterns to follow]
Working directory: [absolute path]
β‘ Parallel Execution Pattern
When tasks have no dependencies between them, delegate all in a single step using parallel tool calls:
// Parallel: frontend + backend have no dependency on each other
await Promise.all([
gemini_execute({ prompt: "...", cwd: projectDir }),
codex_execute({ prompt: "...", cwd: projectDir }),
]);
// Then sequential: review depends on both completing first
await claude_execute({ prompt: "Review the changes made to ...", cwd: projectDir });
π§ Extended Thinking for Complex claude_execute Tasks
For complex tasks routed to claude_execute, pass --extended-thinking via the args parameter to unlock Claude Code's deeper reasoning mode. This produces significantly better analysis for architecture, security, and multi-file refactoring:
// Complex tasks β use extended thinking
claude_execute({
prompt: "Review these 5 files for security vulnerabilities in the auth flow...",
args: ["--extended-thinking"],
cwd: projectDir
})
claude_execute({
prompt: "Refactor the order module to remove circular dependencies across 6 files...",
args: ["--extended-thinking"],
cwd: projectDir
})
// Simple tasks β standard mode is fine
claude_execute({
prompt: "Add JSDoc comments to the getUser function in src/services/user.ts",
cwd: projectDir
})
When to Add --extended-thinking
| Use extended thinking | Standard mode |
|---|---|
| Refactoring across 5+ files | Adding a single function |
| Architecture or data model design | Fixing a clear bug |
| Security vulnerability analysis | Adding comments or docs |
| Debugging async race conditions | Renaming a variable |
| Evaluating multiple design approaches | Adding an import |
π After Delegation: Verification Steps
After each coding agent responds:
- Check
successfield in the JSON response - Read
stdoutto see what the agent produced - Verify output files exist using
glob_filesorview_file - Run build (
execute_bash:npm run buildor equivalent) to catch compile errors - Run affected tests (
execute_bash:npm test -- --testPathPatterns="...") - Only mark the task complete when build + tests pass
β οΈ Fallback Behavior
If a specialist tool call fails or the CLI is not installed:
- Try the next available coding agent from the list (e.g., if
codex_executefails for a backend task, trycopilot_executeorclaude_execute) - Only fall back to direct file manipulation tools (
edit_file,write_file,execute_bash) as a last resort after all available coding agents have been tried - Never silently skip verification β always build and test even when falling back
π« Anti-Patterns
| Anti-pattern | Why it fails | Correct approach |
|---|---|---|
Routing all tasks to claude_execute only |
Misses Gemini's UI strength and Codex's backend depth | Use the routing table |
| Sending vague prompts ("fix the bug") | Agent lacks context to act | Write self-contained prompts with file paths and requirements |
| Not verifying output | Undetected compile errors or test failures | Always build + test after delegation |
| Doing the implementation yourself instead of delegating | Defeats the purpose of having specialist agents | Delegate first; only fall back if delegation fails |
| Ignoring a locally installed tool because it's "not the best specialist" | Any available coding agent is better than doing it manually | If a tool is available, use it β even if it's not the ideal specialist for the task |
| Assuming only one coding tool is installed | There may be multiple tools; each should be tried on failure | Enumerate all available tools and use them as a fallback chain |