$npx -y skills add One-Man-Company/Skills-ContextManager --skill intelligent-routingAutomatic agent selection and intelligent task routing. Analyzes user requests and automatically selects the best specialist agent(s) without requiring explicit user mentions.
| 1 | # Intelligent Agent Routing |
| 2 | |
| 3 | **Purpose**: Automatically analyze user requests and route them to the most appropriate specialist agent(s) without requiring explicit user mentions. |
| 4 | |
| 5 | ## Core Principle |
| 6 | |
| 7 | > **The AI should act as an intelligent Project Manager**, analyzing each request and automatically selecting the best specialist(s) for the job. |
| 8 | |
| 9 | ## How It Works |
| 10 | |
| 11 | ### 1. Request Analysis |
| 12 | |
| 13 | Before responding to ANY user request, perform automatic analysis: |
| 14 | |
| 15 | ```mermaid |
| 16 | graph TD |
| 17 | A[User Request: Add login] --> B[ANALYZE] |
| 18 | B --> C[Keywords] |
| 19 | B --> D[Domains] |
| 20 | B --> E[Complexity] |
| 21 | C --> F[SELECT AGENT] |
| 22 | D --> F |
| 23 | E --> F |
| 24 | F --> G[security-auditor + backend-specialist] |
| 25 | G --> H[AUTO-INVOKE with context] |
| 26 | ``` |
| 27 | |
| 28 | ### 2. Agent Selection Matrix |
| 29 | |
| 30 | **Use this matrix to automatically select agents:** |
| 31 | |
| 32 | | User Intent | Keywords | Selected Agent(s) | Auto-invoke? | |
| 33 | | ------------------- | ------------------------------------------ | ------------------------------------------- | ------------ | |
| 34 | | **Authentication** | "login", "auth", "signup", "password" | `security-auditor` + `backend-specialist` | ✅ YES | |
| 35 | | **UI Component** | "button", "card", "layout", "style" | `frontend-specialist` | ✅ YES | |
| 36 | | **Mobile UI** | "screen", "navigation", "touch", "gesture" | `mobile-developer` | ✅ YES | |
| 37 | | **API Endpoint** | "endpoint", "route", "API", "POST", "GET" | `backend-specialist` | ✅ YES | |
| 38 | | **Database** | "schema", "migration", "query", "table" | `database-architect` + `backend-specialist` | ✅ YES | |
| 39 | | **Bug Fix** | "error", "bug", "not working", "broken" | `debugger` | ✅ YES | |
| 40 | | **Test** | "test", "coverage", "unit", "e2e" | `test-engineer` | ✅ YES | |
| 41 | | **Deployment** | "deploy", "production", "CI/CD", "docker" | `devops-engineer` | ✅ YES | |
| 42 | | **Security Review** | "security", "vulnerability", "exploit" | `security-auditor` + `penetration-tester` | ✅ YES | |
| 43 | | **Performance** | "slow", "optimize", "performance", "speed" | `performance-optimizer` | ✅ YES | |
| 44 | | **Product Def** | "requirements", "user story", "backlog", "MVP" | `product-owner` | ✅ YES | |
| 45 | | **New Feature** | "build", "create", "implement", "new app" | `orchestrator` → multi-agent | ⚠️ ASK FIRST | |
| 46 | | **Complex Task** | Multiple domains detected | `orchestrator` → multi-agent | ⚠️ ASK FIRST | |
| 47 | |
| 48 | ### 3. Automatic Routing Protocol |
| 49 | |
| 50 | ## TIER 0 - Automatic Analysis (ALWAYS ACTIVE) |
| 51 | |
| 52 | Before responding to ANY request: |
| 53 | |
| 54 | ```javascript |
| 55 | // Pseudo-code for decision tree |
| 56 | function analyzeRequest(userMessage) { |
| 57 | // 1. Classify request type |
| 58 | const requestType = classifyRequest(userMessage); |
| 59 | |
| 60 | // 2. Detect domains |
| 61 | const domains = detectDomains(userMessage); |
| 62 | |
| 63 | // 3. Determine complexity |
| 64 | const complexity = assessComplexity(domains); |
| 65 | |
| 66 | // 4. Select agent(s) |
| 67 | if (complexity === "SIMPLE" && domains.length === 1) { |
| 68 | return selectSingleAgent(domains[0]); |
| 69 | } else if (complexity === "MODERATE" && domains.length <= 2) { |
| 70 | return selectMultipleAgents(domains); |
| 71 | } else { |
| 72 | return "orchestrator"; // Complex task |
| 73 | } |
| 74 | } |
| 75 | ``` |
| 76 | |
| 77 | ## 4. Response Format |
| 78 | |
| 79 | **When auto-selecting an agent, inform the user concisely:** |
| 80 | |
| 81 | ```markdown |
| 82 | 🤖 **Applying knowledge of `@security-auditor` + `@backend-specialist`...** |
| 83 | |
| 84 | [Proceed with specialized response] |
| 85 | ``` |
| 86 | |
| 87 | **Benefits:** |
| 88 | |
| 89 | - ✅ User sees which expertise is being applied |
| 90 | - ✅ Transparent decision-making |
| 91 | - ✅ Still automatic (no /commands needed) |
| 92 | |
| 93 | ## Domain Detection Rules |
| 94 | |
| 95 | ### Single-Domain Tasks (Auto-invoke Single Agent) |
| 96 | |
| 97 | | Domain | Patterns | Agent | |
| 98 | | --------------- | ------------------------------------------ | ----------------------- | |
| 99 | | **Security** | auth, login, jwt, password, hash, token | `security-auditor` | |
| 100 | | **Frontend** | component, react, vue, css, html, tailwind | `frontend-specialist` | |
| 101 | | **Backend** | api, server, express, fastapi, node | `backend-specialist` | |
| 102 | | **Mobile** | react native, flutter, ios, android, expo | `mobile-developer` | |
| 103 | | **Database** | prisma, sql, mongodb, schema, migration | `database-architect` | |
| 104 | | **Testing** | test, jest, vitest, playwright, cypress | `test-engineer` | |
| 105 | | **DevOps** | docker, kubernetes, ci/cd, pm2, nginx | `devops-engi |