@iamnishankhan/opencode-kit-grok 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +46 -0
- package/kit/.opencode/AGENTS.md +392 -0
- package/kit/.opencode/README.md +71 -0
- package/kit/.opencode/USAGE.md +405 -0
- package/kit/.opencode/agents/backend-specialist.md +278 -0
- package/kit/.opencode/agents/code-archaeologist.md +114 -0
- package/kit/.opencode/agents/database-architect.md +233 -0
- package/kit/.opencode/agents/debugger.md +234 -0
- package/kit/.opencode/agents/devops-engineer.md +252 -0
- package/kit/.opencode/agents/documentation-writer.md +111 -0
- package/kit/.opencode/agents/explorer-agent.md +83 -0
- package/kit/.opencode/agents/frontend-specialist.md +606 -0
- package/kit/.opencode/agents/game-developer.md +169 -0
- package/kit/.opencode/agents/mobile-developer.md +385 -0
- package/kit/.opencode/agents/orchestrator.md +213 -0
- package/kit/.opencode/agents/penetration-tester.md +197 -0
- package/kit/.opencode/agents/performance-optimizer.md +194 -0
- package/kit/.opencode/agents/product-manager.md +120 -0
- package/kit/.opencode/agents/product-owner.md +103 -0
- package/kit/.opencode/agents/project-planner.md +418 -0
- package/kit/.opencode/agents/qa-automation-engineer.md +113 -0
- package/kit/.opencode/agents/security-auditor.md +179 -0
- package/kit/.opencode/agents/seo-specialist.md +119 -0
- package/kit/.opencode/agents/test-engineer.md +169 -0
- package/kit/.opencode/commands/brainstorm.md +113 -0
- package/kit/.opencode/commands/coordinate.md +72 -0
- package/kit/.opencode/commands/create.md +63 -0
- package/kit/.opencode/commands/debug.md +102 -0
- package/kit/.opencode/commands/deploy.md +175 -0
- package/kit/.opencode/commands/enhance.md +62 -0
- package/kit/.opencode/commands/orchestrate.md +241 -0
- package/kit/.opencode/commands/plan.md +89 -0
- package/kit/.opencode/commands/preview.md +80 -0
- package/kit/.opencode/commands/remember.md +67 -0
- package/kit/.opencode/commands/status.md +86 -0
- package/kit/.opencode/commands/test.md +143 -0
- package/kit/.opencode/commands/verify.md +71 -0
- package/kit/.opencode/memory/MEMORY.md +6 -0
- package/kit/.opencode/memory/feedback-history.md +9 -0
- package/kit/.opencode/memory/project-conventions.md +16 -0
- package/kit/.opencode/memory/tech-decisions.md +10 -0
- package/kit/.opencode/memory/user-preferences.md +9 -0
- package/kit/.opencode/opencode.json +15 -0
- package/kit/.opencode/scripts/README.md +95 -0
- package/kit/.opencode/scripts/auto_preview.py +149 -0
- package/kit/.opencode/scripts/checklist.py +75 -0
- package/kit/.opencode/scripts/component_registry.py +238 -0
- package/kit/.opencode/scripts/dependency_graph.py +73 -0
- package/kit/.opencode/scripts/generate_manifest.py +44 -0
- package/kit/.opencode/scripts/session_manager.py +120 -0
- package/kit/.opencode/scripts/tests/test_toolkit.py +238 -0
- package/kit/.opencode/scripts/validate_kit.py +397 -0
- package/kit/.opencode/scripts/validation_runner.py +216 -0
- package/kit/.opencode/scripts/verify_all.py +85 -0
- package/kit/.opencode/skills/api-patterns/SKILL.md +83 -0
- package/kit/.opencode/skills/api-patterns/api-style.md +42 -0
- package/kit/.opencode/skills/api-patterns/auth.md +24 -0
- package/kit/.opencode/skills/api-patterns/documentation.md +26 -0
- package/kit/.opencode/skills/api-patterns/graphql.md +41 -0
- package/kit/.opencode/skills/api-patterns/rate-limiting.md +31 -0
- package/kit/.opencode/skills/api-patterns/response.md +37 -0
- package/kit/.opencode/skills/api-patterns/rest.md +40 -0
- package/kit/.opencode/skills/api-patterns/scripts/api_validator.py +211 -0
- package/kit/.opencode/skills/api-patterns/security-testing.md +122 -0
- package/kit/.opencode/skills/api-patterns/trpc.md +41 -0
- package/kit/.opencode/skills/api-patterns/versioning.md +22 -0
- package/kit/.opencode/skills/app-builder/SKILL.md +78 -0
- package/kit/.opencode/skills/app-builder/agent-coordination.md +71 -0
- package/kit/.opencode/skills/app-builder/feature-building.md +53 -0
- package/kit/.opencode/skills/app-builder/project-detection.md +45 -0
- package/kit/.opencode/skills/app-builder/scaffolding.md +110 -0
- package/kit/.opencode/skills/app-builder/tech-stack.md +41 -0
- package/kit/.opencode/skills/app-builder/templates/SKILL.md +39 -0
- package/kit/.opencode/skills/app-builder/templates/astro-static/TEMPLATE.md +78 -0
- package/kit/.opencode/skills/app-builder/templates/chrome-extension/TEMPLATE.md +96 -0
- package/kit/.opencode/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
- package/kit/.opencode/skills/app-builder/templates/electron-desktop/TEMPLATE.md +97 -0
- package/kit/.opencode/skills/app-builder/templates/express-api/TEMPLATE.md +89 -0
- package/kit/.opencode/skills/app-builder/templates/flutter-app/TEMPLATE.md +93 -0
- package/kit/.opencode/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +97 -0
- package/kit/.opencode/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +126 -0
- package/kit/.opencode/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +125 -0
- package/kit/.opencode/skills/app-builder/templates/nextjs-static/TEMPLATE.md +174 -0
- package/kit/.opencode/skills/app-builder/templates/nuxt-app/TEMPLATE.md +127 -0
- package/kit/.opencode/skills/app-builder/templates/python-fastapi/TEMPLATE.md +94 -0
- package/kit/.opencode/skills/app-builder/templates/react-native-app/TEMPLATE.md +121 -0
- package/kit/.opencode/skills/architecture/SKILL.md +57 -0
- package/kit/.opencode/skills/architecture/context-discovery.md +43 -0
- package/kit/.opencode/skills/architecture/examples.md +94 -0
- package/kit/.opencode/skills/architecture/pattern-selection.md +68 -0
- package/kit/.opencode/skills/architecture/patterns-reference.md +50 -0
- package/kit/.opencode/skills/architecture/trade-off-analysis.md +77 -0
- package/kit/.opencode/skills/bash-linux/SKILL.md +201 -0
- package/kit/.opencode/skills/batch-operations/SKILL.md +105 -0
- package/kit/.opencode/skills/behavioral-modes/SKILL.md +253 -0
- package/kit/.opencode/skills/brainstorming/SKILL.md +178 -0
- package/kit/.opencode/skills/brainstorming/dynamic-questioning.md +350 -0
- package/kit/.opencode/skills/clean-code/SKILL.md +201 -0
- package/kit/.opencode/skills/code-review-checklist/SKILL.md +111 -0
- package/kit/.opencode/skills/code-review-graph/SKILL.md +305 -0
- package/kit/.opencode/skills/context-compression/SKILL.md +145 -0
- package/kit/.opencode/skills/coordinator-mode/SKILL.md +208 -0
- package/kit/.opencode/skills/database-design/SKILL.md +54 -0
- package/kit/.opencode/skills/database-design/database-selection.md +43 -0
- package/kit/.opencode/skills/database-design/indexing.md +39 -0
- package/kit/.opencode/skills/database-design/migrations.md +48 -0
- package/kit/.opencode/skills/database-design/optimization.md +36 -0
- package/kit/.opencode/skills/database-design/orm-selection.md +30 -0
- package/kit/.opencode/skills/database-design/schema-design.md +56 -0
- package/kit/.opencode/skills/database-design/scripts/schema_validator.py +172 -0
- package/kit/.opencode/skills/deployment-procedures/SKILL.md +243 -0
- package/kit/.opencode/skills/design-spec/SKILL.md +185 -0
- package/kit/.opencode/skills/design-spec/collection.md +106 -0
- package/kit/.opencode/skills/documentation-templates/SKILL.md +196 -0
- package/kit/.opencode/skills/frontend-architecture/SKILL.md +245 -0
- package/kit/.opencode/skills/frontend-design/SKILL.md +1222 -0
- package/kit/.opencode/skills/frontend-design/redesign.md +178 -0
- package/kit/.opencode/skills/frontend-design/scripts/accessibility_checker.py +145 -0
- package/kit/.opencode/skills/frontend-design/scripts/ux_audit.py +722 -0
- package/kit/.opencode/skills/frontend-design/style-brutalist.md +92 -0
- package/kit/.opencode/skills/frontend-design/style-minimalist.md +85 -0
- package/kit/.opencode/skills/game-development/2d-games/SKILL.md +118 -0
- package/kit/.opencode/skills/game-development/3d-games/SKILL.md +134 -0
- package/kit/.opencode/skills/game-development/SKILL.md +169 -0
- package/kit/.opencode/skills/game-development/game-art/SKILL.md +184 -0
- package/kit/.opencode/skills/game-development/game-audio/SKILL.md +189 -0
- package/kit/.opencode/skills/game-development/game-design/SKILL.md +128 -0
- package/kit/.opencode/skills/game-development/mobile-games/SKILL.md +107 -0
- package/kit/.opencode/skills/game-development/multiplayer/SKILL.md +131 -0
- package/kit/.opencode/skills/game-development/pc-games/SKILL.md +143 -0
- package/kit/.opencode/skills/game-development/vr-ar/SKILL.md +122 -0
- package/kit/.opencode/skills/game-development/web-games/SKILL.md +149 -0
- package/kit/.opencode/skills/geo-fundamentals/SKILL.md +158 -0
- package/kit/.opencode/skills/geo-fundamentals/scripts/geo_checker.py +273 -0
- package/kit/.opencode/skills/i18n-localization/SKILL.md +156 -0
- package/kit/.opencode/skills/i18n-localization/scripts/i18n_checker.py +223 -0
- package/kit/.opencode/skills/intelligent-routing/SKILL.md +337 -0
- package/kit/.opencode/skills/lint-and-validate/SKILL.md +47 -0
- package/kit/.opencode/skills/lint-and-validate/scripts/lint_runner.py +184 -0
- package/kit/.opencode/skills/lint-and-validate/scripts/type_coverage.py +245 -0
- package/kit/.opencode/skills/mcp-builder/SKILL.md +205 -0
- package/kit/.opencode/skills/memory-system/SKILL.md +181 -0
- package/kit/.opencode/skills/mobile-design/SKILL.md +396 -0
- package/kit/.opencode/skills/mobile-design/decision-trees.md +516 -0
- package/kit/.opencode/skills/mobile-design/mobile-backend.md +491 -0
- package/kit/.opencode/skills/mobile-design/mobile-color-system.md +420 -0
- package/kit/.opencode/skills/mobile-design/mobile-debugging.md +122 -0
- package/kit/.opencode/skills/mobile-design/mobile-design-thinking.md +357 -0
- package/kit/.opencode/skills/mobile-design/mobile-navigation.md +458 -0
- package/kit/.opencode/skills/mobile-design/mobile-performance.md +767 -0
- package/kit/.opencode/skills/mobile-design/mobile-testing.md +356 -0
- package/kit/.opencode/skills/mobile-design/mobile-typography.md +433 -0
- package/kit/.opencode/skills/mobile-design/platform-android.md +666 -0
- package/kit/.opencode/skills/mobile-design/platform-ios.md +561 -0
- package/kit/.opencode/skills/mobile-design/scripts/mobile_audit.py +670 -0
- package/kit/.opencode/skills/mobile-design/touch-psychology.md +537 -0
- package/kit/.opencode/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +351 -0
- package/kit/.opencode/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +240 -0
- package/kit/.opencode/skills/nextjs-react-expert/3-server-server-side-performance.md +490 -0
- package/kit/.opencode/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +264 -0
- package/kit/.opencode/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -0
- package/kit/.opencode/skills/nextjs-react-expert/6-rendering-rendering-performance.md +432 -0
- package/kit/.opencode/skills/nextjs-react-expert/7-js-javascript-performance.md +684 -0
- package/kit/.opencode/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +150 -0
- package/kit/.opencode/skills/nextjs-react-expert/9-cache-components.md +103 -0
- package/kit/.opencode/skills/nextjs-react-expert/SKILL.md +293 -0
- package/kit/.opencode/skills/nextjs-react-expert/scripts/convert_rules.py +222 -0
- package/kit/.opencode/skills/nextjs-react-expert/scripts/react_performance_checker.py +281 -0
- package/kit/.opencode/skills/nodejs-best-practices/SKILL.md +336 -0
- package/kit/.opencode/skills/parallel-agents/SKILL.md +192 -0
- package/kit/.opencode/skills/performance-profiling/SKILL.md +145 -0
- package/kit/.opencode/skills/performance-profiling/scripts/bundle_analyzer.py +120 -0
- package/kit/.opencode/skills/performance-profiling/scripts/lighthouse_audit.py +108 -0
- package/kit/.opencode/skills/plan-writing/SKILL.md +153 -0
- package/kit/.opencode/skills/powershell-windows/SKILL.md +169 -0
- package/kit/.opencode/skills/python-patterns/SKILL.md +443 -0
- package/kit/.opencode/skills/red-team-tactics/SKILL.md +201 -0
- package/kit/.opencode/skills/rust-pro/SKILL.md +177 -0
- package/kit/.opencode/skills/seo-fundamentals/SKILL.md +131 -0
- package/kit/.opencode/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
- package/kit/.opencode/skills/server-management/SKILL.md +163 -0
- package/kit/.opencode/skills/simplify-code/SKILL.md +131 -0
- package/kit/.opencode/skills/skillify/SKILL.md +115 -0
- package/kit/.opencode/skills/systematic-debugging/SKILL.md +111 -0
- package/kit/.opencode/skills/tailwind-patterns/SKILL.md +271 -0
- package/kit/.opencode/skills/tdd-workflow/SKILL.md +151 -0
- package/kit/.opencode/skills/testing-patterns/SKILL.md +180 -0
- package/kit/.opencode/skills/testing-patterns/scripts/test_runner.py +219 -0
- package/kit/.opencode/skills/verify-changes/SKILL.md +127 -0
- package/kit/.opencode/skills/vulnerability-scanner/SKILL.md +278 -0
- package/kit/.opencode/skills/vulnerability-scanner/checklists.md +124 -0
- package/kit/.opencode/skills/vulnerability-scanner/scripts/dependency_analyzer.py +144 -0
- package/kit/.opencode/skills/vulnerability-scanner/scripts/security_scan.py +410 -0
- package/kit/.opencode/skills/web-design-guidelines/SKILL.md +56 -0
- package/kit/.opencode/skills/webapp-testing/SKILL.md +189 -0
- package/kit/.opencode/skills/webapp-testing/scripts/playwright_runner.py +123 -0
- package/lib/init.js +61 -0
- package/package.json +21 -0
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: intelligent-routing
|
|
3
|
+
description: Automatic agent selection and intelligent task routing. Analyzes user requests and automatically selects the best specialist agent(s) without requiring explicit user mentions.
|
|
4
|
+
compatibility: opencode
|
|
5
|
+
metadata:
|
|
6
|
+
when_to_use: "\"Always active. Automatically selects the best specialist agent for each user request without explicit user mentions.\""
|
|
7
|
+
version: "1.1.0"
|
|
8
|
+
---
|
|
9
|
+
# Intelligent Agent Routing
|
|
10
|
+
|
|
11
|
+
**Purpose**: Automatically analyze user requests and route them to the most appropriate specialist agent(s) without requiring explicit user mentions.
|
|
12
|
+
|
|
13
|
+
## Core Principle
|
|
14
|
+
|
|
15
|
+
> **The AI should act as an intelligent Project Manager**, analyzing each request and automatically selecting the best specialist(s) for the job.
|
|
16
|
+
|
|
17
|
+
## How It Works
|
|
18
|
+
|
|
19
|
+
### 1. Request Analysis
|
|
20
|
+
|
|
21
|
+
Before responding to ANY user request, perform automatic analysis:
|
|
22
|
+
|
|
23
|
+
```mermaid
|
|
24
|
+
graph TD
|
|
25
|
+
A[User Request: Add login] --> B[ANALYZE]
|
|
26
|
+
B --> C[Keywords]
|
|
27
|
+
B --> D[Domains]
|
|
28
|
+
B --> E[Complexity]
|
|
29
|
+
C --> F[SELECT AGENT]
|
|
30
|
+
D --> F
|
|
31
|
+
E --> F
|
|
32
|
+
F --> G[security-auditor + backend-specialist]
|
|
33
|
+
G --> H[AUTO-INVOKE with context]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 2. Agent Selection Matrix
|
|
37
|
+
|
|
38
|
+
**Use this matrix to automatically select agents:**
|
|
39
|
+
|
|
40
|
+
| User Intent | Keywords | Selected Agent(s) | Auto-invoke? |
|
|
41
|
+
| ------------------- | ------------------------------------------ | ------------------------------------------- | ------------ |
|
|
42
|
+
| **Authentication** | "login", "auth", "signup", "password" | `security-auditor` + `backend-specialist` | ✅ YES |
|
|
43
|
+
| **UI Component** | "button", "card", "layout", "style" | `frontend-specialist` | ✅ YES |
|
|
44
|
+
| **Mobile UI** | "screen", "navigation", "touch", "gesture" | `mobile-developer` | ✅ YES |
|
|
45
|
+
| **API Endpoint** | "endpoint", "route", "API", "POST", "GET" | `backend-specialist` | ✅ YES |
|
|
46
|
+
| **Database** | "schema", "migration", "query", "table" | `database-architect` + `backend-specialist` | ✅ YES |
|
|
47
|
+
| **Bug Fix** | "error", "bug", "not working", "broken" | `debugger` | ✅ YES |
|
|
48
|
+
| **Test** | "test", "coverage", "unit", "e2e" | `test-engineer` | ✅ YES |
|
|
49
|
+
| **Deployment** | "deploy", "production", "CI/CD", "docker" | `devops-engineer` | ✅ YES |
|
|
50
|
+
| **Security Review** | "security", "vulnerability", "exploit" | `security-auditor` + `penetration-tester` | ✅ YES |
|
|
51
|
+
| **Performance** | "slow", "optimize", "performance", "speed" | `performance-optimizer` | ✅ YES |
|
|
52
|
+
| **Product Def** | "requirements", "user story", "backlog", "MVP" | `product-owner` | ✅ YES |
|
|
53
|
+
| **New Feature** | "build", "create", "implement", "new app" | `orchestrator` → multi-agent | ⚠️ ASK FIRST |
|
|
54
|
+
| **Complex Task** | Multiple domains detected | `orchestrator` → multi-agent | ⚠️ ASK FIRST |
|
|
55
|
+
|
|
56
|
+
### 3. Automatic Routing Protocol
|
|
57
|
+
|
|
58
|
+
## TIER 0 - Automatic Analysis (ALWAYS ACTIVE)
|
|
59
|
+
|
|
60
|
+
Before responding to ANY request:
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
// Pseudo-code for decision tree
|
|
64
|
+
function analyzeRequest(userMessage) {
|
|
65
|
+
// 1. Classify request type
|
|
66
|
+
const requestType = classifyRequest(userMessage);
|
|
67
|
+
|
|
68
|
+
// 2. Detect domains
|
|
69
|
+
const domains = detectDomains(userMessage);
|
|
70
|
+
|
|
71
|
+
// 3. Determine complexity
|
|
72
|
+
const complexity = assessComplexity(domains);
|
|
73
|
+
|
|
74
|
+
// 4. Select agent(s)
|
|
75
|
+
if (complexity === "SIMPLE" && domains.length === 1) {
|
|
76
|
+
return selectSingleAgent(domains[0]);
|
|
77
|
+
} else if (complexity === "MODERATE" && domains.length <= 2) {
|
|
78
|
+
return selectMultipleAgents(domains);
|
|
79
|
+
} else {
|
|
80
|
+
return "orchestrator"; // Complex task
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## 4. Response Format
|
|
86
|
+
|
|
87
|
+
**When auto-selecting an agent, inform the user concisely:**
|
|
88
|
+
|
|
89
|
+
```markdown
|
|
90
|
+
🤖 **Applying knowledge of `@security-auditor` + `@backend-specialist`...**
|
|
91
|
+
|
|
92
|
+
[Proceed with specialized response]
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Benefits:**
|
|
96
|
+
|
|
97
|
+
- ✅ User sees which expertise is being applied
|
|
98
|
+
- ✅ Transparent decision-making
|
|
99
|
+
- ✅ Still automatic (no /commands needed)
|
|
100
|
+
|
|
101
|
+
## Domain Detection Rules
|
|
102
|
+
|
|
103
|
+
### Single-Domain Tasks (Auto-invoke Single Agent)
|
|
104
|
+
|
|
105
|
+
| Domain | Patterns | Agent |
|
|
106
|
+
| --------------- | ------------------------------------------ | ----------------------- |
|
|
107
|
+
| **Security** | auth, login, jwt, password, hash, token | `security-auditor` |
|
|
108
|
+
| **Frontend** | component, react, vue, css, html, tailwind | `frontend-specialist` |
|
|
109
|
+
| **Backend** | api, server, express, fastapi, node | `backend-specialist` |
|
|
110
|
+
| **Mobile** | react native, flutter, ios, android, expo | `mobile-developer` |
|
|
111
|
+
| **Database** | prisma, sql, mongodb, schema, migration | `database-architect` |
|
|
112
|
+
| **Testing** | test, jest, vitest, playwright, cypress | `test-engineer` |
|
|
113
|
+
| **DevOps** | docker, kubernetes, ci/cd, pm2, nginx | `devops-engineer` |
|
|
114
|
+
| **Debug** | error, bug, crash, not working, issue | `debugger` |
|
|
115
|
+
| **Performance** | slow, lag, optimize, cache, performance | `performance-optimizer` |
|
|
116
|
+
| **SEO** | seo, meta, analytics, sitemap, robots | `seo-specialist` |
|
|
117
|
+
| **Game** | unity, godot, phaser, game, multiplayer | `game-developer` |
|
|
118
|
+
|
|
119
|
+
### Multi-Domain Tasks (Auto-invoke Orchestrator)
|
|
120
|
+
|
|
121
|
+
If request matches **2+ domains from different categories**, automatically use `orchestrator`:
|
|
122
|
+
|
|
123
|
+
```text
|
|
124
|
+
Example: "Create a secure login system with dark mode UI"
|
|
125
|
+
→ Detected: Security + Frontend
|
|
126
|
+
→ Auto-invoke: orchestrator
|
|
127
|
+
→ Orchestrator will handle: security-auditor, frontend-specialist, test-engineer
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Complexity Assessment
|
|
131
|
+
|
|
132
|
+
### SIMPLE (Direct agent invocation)
|
|
133
|
+
|
|
134
|
+
- Single file edit
|
|
135
|
+
- Clear, specific task
|
|
136
|
+
- One domain only
|
|
137
|
+
- Example: "Fix the login button style"
|
|
138
|
+
|
|
139
|
+
**Action**: Auto-invoke respective agent
|
|
140
|
+
|
|
141
|
+
### MODERATE (2-3 agents)
|
|
142
|
+
|
|
143
|
+
- 2-3 files affected
|
|
144
|
+
- Clear requirements
|
|
145
|
+
- 2 domains max
|
|
146
|
+
- Example: "Add API endpoint for user profile"
|
|
147
|
+
|
|
148
|
+
**Action**: Auto-invoke relevant agents sequentially
|
|
149
|
+
|
|
150
|
+
### COMPLEX (Orchestrator required)
|
|
151
|
+
|
|
152
|
+
- Multiple files/domains
|
|
153
|
+
- Architectural decisions needed
|
|
154
|
+
- Unclear requirements
|
|
155
|
+
- Example: "Build a social media app"
|
|
156
|
+
|
|
157
|
+
**Action**: Auto-invoke `orchestrator` → will ask Socratic questions
|
|
158
|
+
|
|
159
|
+
## Implementation Rules
|
|
160
|
+
|
|
161
|
+
### Rule 1: Silent Analysis
|
|
162
|
+
|
|
163
|
+
#### DO NOT announce "I'm analyzing your request..."
|
|
164
|
+
|
|
165
|
+
- ✅ Analyze silently
|
|
166
|
+
- ✅ Inform which agent is being applied
|
|
167
|
+
- ❌ Avoid verbose meta-commentary
|
|
168
|
+
|
|
169
|
+
### Rule 2: Inform Agent Selection
|
|
170
|
+
|
|
171
|
+
**DO inform which expertise is being applied:**
|
|
172
|
+
|
|
173
|
+
```markdown
|
|
174
|
+
🤖 **Applying knowledge of `@frontend-specialist`...**
|
|
175
|
+
|
|
176
|
+
I will create the component with the following characteristics:
|
|
177
|
+
[Continue with specialized response]
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Rule 3: Seamless Experience
|
|
181
|
+
|
|
182
|
+
**The user should not notice a difference from talking to the right specialist directly.**
|
|
183
|
+
|
|
184
|
+
### Rule 4: Override Capability
|
|
185
|
+
|
|
186
|
+
**User can still explicitly mention agents:**
|
|
187
|
+
|
|
188
|
+
```text
|
|
189
|
+
User: "Use @backend-specialist to review this"
|
|
190
|
+
→ Override auto-selection
|
|
191
|
+
→ Use explicitly mentioned agent
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Edge Cases
|
|
195
|
+
|
|
196
|
+
### Case 1: Generic Question
|
|
197
|
+
|
|
198
|
+
```text
|
|
199
|
+
User: "How does React work?"
|
|
200
|
+
→ Type: QUESTION
|
|
201
|
+
→ No agent needed
|
|
202
|
+
→ Respond directly with explanation
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Case 2: Extremely Vague Request
|
|
206
|
+
|
|
207
|
+
```text
|
|
208
|
+
User: "Make it better"
|
|
209
|
+
→ Complexity: UNCLEAR
|
|
210
|
+
→ Action: Ask clarifying questions first
|
|
211
|
+
→ Then route to appropriate agent
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Case 3: Contradictory Patterns
|
|
215
|
+
|
|
216
|
+
```text
|
|
217
|
+
User: "Add mobile support to the web app"
|
|
218
|
+
→ Conflict: mobile vs web
|
|
219
|
+
→ Action: Ask: "Do you want responsive web or native mobile app?"
|
|
220
|
+
→ Then route accordingly
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Integration with Existing Workflows
|
|
224
|
+
|
|
225
|
+
### With /orchestrate Command
|
|
226
|
+
|
|
227
|
+
- **User types `/orchestrate`**: Explicit orchestration mode
|
|
228
|
+
- **AI detects complex task**: Auto-invoke orchestrator (same result)
|
|
229
|
+
|
|
230
|
+
**Difference**: User doesn't need to know the command exists.
|
|
231
|
+
|
|
232
|
+
### With Socratic Gate
|
|
233
|
+
|
|
234
|
+
- **Auto-routing does NOT bypass Socratic Gate**
|
|
235
|
+
- If task is unclear, still ask questions first
|
|
236
|
+
- Then route to appropriate agent
|
|
237
|
+
|
|
238
|
+
### With Workspace Rules
|
|
239
|
+
|
|
240
|
+
- **Priority**: Workspace rules (`.opencode/rules/`) > intelligent-routing
|
|
241
|
+
- If a workspace rule specifies explicit routing, follow it
|
|
242
|
+
- Intelligent routing is the DEFAULT when no explicit rule exists
|
|
243
|
+
|
|
244
|
+
## Testing the System
|
|
245
|
+
|
|
246
|
+
### Test Cases
|
|
247
|
+
|
|
248
|
+
#### Test 1: Simple Frontend Task
|
|
249
|
+
|
|
250
|
+
```text
|
|
251
|
+
User: "Create a dark mode toggle button"
|
|
252
|
+
Expected: Auto-invoke frontend-specialist
|
|
253
|
+
Verify: Response shows "Using @frontend-specialist"
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
#### Test 2: Security Task
|
|
257
|
+
|
|
258
|
+
```text
|
|
259
|
+
User: "Review the authentication flow for vulnerabilities"
|
|
260
|
+
Expected: Auto-invoke security-auditor
|
|
261
|
+
Verify: Security-focused analysis
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
#### Test 3: Complex Multi-Domain
|
|
265
|
+
|
|
266
|
+
```text
|
|
267
|
+
User: "Build a chat application with real-time notifications"
|
|
268
|
+
Expected: Auto-invoke orchestrator
|
|
269
|
+
Verify: Multiple agents coordinated (backend, frontend, test)
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
#### Test 4: Bug Fix
|
|
273
|
+
|
|
274
|
+
```text
|
|
275
|
+
User: "Login is not working, getting 401 error"
|
|
276
|
+
Expected: Auto-invoke debugger
|
|
277
|
+
Verify: Systematic debugging approach
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## Performance Considerations
|
|
281
|
+
|
|
282
|
+
### Token Usage
|
|
283
|
+
|
|
284
|
+
- Analysis adds ~50-100 tokens per request
|
|
285
|
+
- Tradeoff: Better accuracy vs slight overhead
|
|
286
|
+
- Overall SAVES tokens by reducing back-and-forth
|
|
287
|
+
|
|
288
|
+
### Response Time
|
|
289
|
+
|
|
290
|
+
- Analysis is instant (pattern matching)
|
|
291
|
+
- No additional API calls required
|
|
292
|
+
- Agent selection happens before first response
|
|
293
|
+
|
|
294
|
+
## User Education
|
|
295
|
+
|
|
296
|
+
### Optional: First-Time Explanation
|
|
297
|
+
|
|
298
|
+
If this is the first interaction in a project:
|
|
299
|
+
|
|
300
|
+
```markdown
|
|
301
|
+
💡 **Tip**: I am configured with automatic specialist agent selection.
|
|
302
|
+
I will always choose the most suitable specialist for your task. You can
|
|
303
|
+
still mention agents explicitly with `@agent-name` if you prefer.
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Debugging Agent Selection
|
|
307
|
+
|
|
308
|
+
### Enable Debug Mode (for development)
|
|
309
|
+
|
|
310
|
+
Add to a workspace rule file (`.opencode/rules/`) temporarily:
|
|
311
|
+
|
|
312
|
+
```markdown
|
|
313
|
+
## DEBUG: Intelligent Routing
|
|
314
|
+
|
|
315
|
+
Show selection reasoning:
|
|
316
|
+
|
|
317
|
+
- Detected domains: [list]
|
|
318
|
+
- Selected agent: [name]
|
|
319
|
+
- Reasoning: [why]
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
## Summary
|
|
323
|
+
|
|
324
|
+
**intelligent-routing skill enables:**
|
|
325
|
+
|
|
326
|
+
✅ Zero-command operation (no need for `/orchestrate`)
|
|
327
|
+
✅ Automatic specialist selection based on request analysis
|
|
328
|
+
✅ Transparent communication of which expertise is being applied
|
|
329
|
+
✅ Seamless integration with existing workflows
|
|
330
|
+
✅ Override capability for explicit agent mentions
|
|
331
|
+
✅ Fallback to orchestrator for complex tasks
|
|
332
|
+
|
|
333
|
+
**Result**: User gets specialist-level responses without needing to know the system architecture.
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
**Next Steps**: Integrate this skill into the workspace rules (`.opencode/rules/request-routing.md`).
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lint-and-validate
|
|
3
|
+
description: "Automatic quality control, linting, and static analysis procedures. Use after every code modification to ensure syntax correctness and project standards. Triggers on keywords: lint, format, check, validate, types, static analysis."
|
|
4
|
+
compatibility: opencode
|
|
5
|
+
metadata:
|
|
6
|
+
when_to_use: "\"When running linters, type checkers, or code formatters. After any code change that needs quality validation.\""
|
|
7
|
+
version: "1.0.0"
|
|
8
|
+
---
|
|
9
|
+
# Lint and Validate Skill
|
|
10
|
+
|
|
11
|
+
> **MANDATORY:** Run appropriate validation tools after EVERY code change. Do not finish a task until the code is error-free.
|
|
12
|
+
|
|
13
|
+
### Procedures by Ecosystem
|
|
14
|
+
|
|
15
|
+
#### Node.js / TypeScript
|
|
16
|
+
1. **Lint/Fix:** `npm run lint` or `npx eslint "path" --fix`
|
|
17
|
+
2. **Types:** `npx tsc --noEmit`
|
|
18
|
+
3. **Security:** `npm audit --audit-level=high`
|
|
19
|
+
|
|
20
|
+
#### Python
|
|
21
|
+
1. **Linter (Ruff):** `ruff check "path" --fix` (Fast & Modern)
|
|
22
|
+
2. **Security (Bandit):** `bandit -r "path" -ll`
|
|
23
|
+
3. **Types (MyPy):** `mypy "path"`
|
|
24
|
+
|
|
25
|
+
## The Quality Loop
|
|
26
|
+
1. **Write/Edit Code**
|
|
27
|
+
2. **Run Audit:** `npm run lint && npx tsc --noEmit`
|
|
28
|
+
3. **Analyze Report:** Check the "FINAL AUDIT REPORT" section.
|
|
29
|
+
4. **Fix & Repeat:** Submitting code with "FINAL AUDIT" failures is NOT allowed.
|
|
30
|
+
|
|
31
|
+
## Error Handling
|
|
32
|
+
- If `lint` fails: Fix the style or syntax issues immediately.
|
|
33
|
+
- If `tsc` fails: Correct type mismatches before proceeding.
|
|
34
|
+
- If no tool is configured: Check the project root for `.eslintrc`, `tsconfig.json`, `pyproject.toml` and suggest creating one.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
**Strict Rule:** No code should be committed or reported as "done" without passing these checks.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Scripts
|
|
42
|
+
|
|
43
|
+
| Script | Purpose | Command |
|
|
44
|
+
|--------|---------|---------|
|
|
45
|
+
| `.opencode/scripts/lint_runner.py` | Unified lint check | `python .opencode/scripts/lint_runner.py <project_path>` |
|
|
46
|
+
| `.opencode/scripts/type_coverage.py` | Type coverage analysis | `python .opencode/scripts/type_coverage.py <project_path>` |
|
|
47
|
+
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Lint Runner - Unified linting and type checking
|
|
4
|
+
Runs appropriate linters based on project type.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
python lint_runner.py <project_path>
|
|
8
|
+
|
|
9
|
+
Supports:
|
|
10
|
+
- Node.js: npm run lint, npx tsc --noEmit
|
|
11
|
+
- Python: ruff check, mypy
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import subprocess
|
|
15
|
+
import sys
|
|
16
|
+
import json
|
|
17
|
+
import platform
|
|
18
|
+
import shutil
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
from datetime import datetime
|
|
21
|
+
|
|
22
|
+
# Fix Windows console encoding
|
|
23
|
+
try:
|
|
24
|
+
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
|
|
25
|
+
except:
|
|
26
|
+
pass
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def detect_project_type(project_path: Path) -> dict:
|
|
30
|
+
"""Detect project type and available linters."""
|
|
31
|
+
result = {
|
|
32
|
+
"type": "unknown",
|
|
33
|
+
"linters": []
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
# Node.js project
|
|
37
|
+
package_json = project_path / "package.json"
|
|
38
|
+
if package_json.exists():
|
|
39
|
+
result["type"] = "node"
|
|
40
|
+
try:
|
|
41
|
+
pkg = json.loads(package_json.read_text(encoding='utf-8'))
|
|
42
|
+
scripts = pkg.get("scripts", {})
|
|
43
|
+
deps = {**pkg.get("dependencies", {}), **pkg.get("devDependencies", {})}
|
|
44
|
+
|
|
45
|
+
# Check for lint script
|
|
46
|
+
if "lint" in scripts:
|
|
47
|
+
result["linters"].append({"name": "npm lint", "cmd": ["npm", "run", "lint"]})
|
|
48
|
+
elif "eslint" in deps:
|
|
49
|
+
result["linters"].append({"name": "eslint", "cmd": ["npx", "eslint", "."]})
|
|
50
|
+
|
|
51
|
+
# Check for TypeScript
|
|
52
|
+
if "typescript" in deps or (project_path / "tsconfig.json").exists():
|
|
53
|
+
result["linters"].append({"name": "tsc", "cmd": ["npx", "tsc", "--noEmit"]})
|
|
54
|
+
|
|
55
|
+
except:
|
|
56
|
+
pass
|
|
57
|
+
|
|
58
|
+
# Python project
|
|
59
|
+
if (project_path / "pyproject.toml").exists() or (project_path / "requirements.txt").exists():
|
|
60
|
+
result["type"] = "python"
|
|
61
|
+
|
|
62
|
+
# Check for ruff
|
|
63
|
+
result["linters"].append({"name": "ruff", "cmd": ["ruff", "check", "."]})
|
|
64
|
+
|
|
65
|
+
# Check for mypy
|
|
66
|
+
if (project_path / "mypy.ini").exists() or (project_path / "pyproject.toml").exists():
|
|
67
|
+
result["linters"].append({"name": "mypy", "cmd": ["mypy", "."]})
|
|
68
|
+
|
|
69
|
+
return result
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def run_linter(linter: dict, cwd: Path) -> dict:
|
|
73
|
+
"""Run a single linter and return results."""
|
|
74
|
+
result = {
|
|
75
|
+
"name": linter["name"],
|
|
76
|
+
"passed": False,
|
|
77
|
+
"output": "",
|
|
78
|
+
"error": ""
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
try:
|
|
82
|
+
cmd = linter["cmd"]
|
|
83
|
+
|
|
84
|
+
# Windows compatibility for npm/npx
|
|
85
|
+
if platform.system() == "Windows":
|
|
86
|
+
if cmd[0] in ["npm", "npx"]:
|
|
87
|
+
# Force .cmd extension on Windows
|
|
88
|
+
if not cmd[0].lower().endswith(".cmd"):
|
|
89
|
+
cmd[0] = f"{cmd[0]}.cmd"
|
|
90
|
+
|
|
91
|
+
proc = subprocess.run(
|
|
92
|
+
cmd,
|
|
93
|
+
cwd=str(cwd),
|
|
94
|
+
capture_output=True,
|
|
95
|
+
text=True,
|
|
96
|
+
encoding='utf-8',
|
|
97
|
+
errors='replace',
|
|
98
|
+
timeout=120,
|
|
99
|
+
shell=platform.system() == "Windows" # Shell=True often helps with path resolution on Windows
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
result["output"] = proc.stdout[:2000] if proc.stdout else ""
|
|
103
|
+
result["error"] = proc.stderr[:500] if proc.stderr else ""
|
|
104
|
+
result["passed"] = proc.returncode == 0
|
|
105
|
+
|
|
106
|
+
except FileNotFoundError:
|
|
107
|
+
result["error"] = f"Command not found: {linter['cmd'][0]}"
|
|
108
|
+
except subprocess.TimeoutExpired:
|
|
109
|
+
result["error"] = "Timeout after 120s"
|
|
110
|
+
except Exception as e:
|
|
111
|
+
result["error"] = str(e)
|
|
112
|
+
|
|
113
|
+
return result
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def main():
|
|
117
|
+
project_path = Path(sys.argv[1] if len(sys.argv) > 1 else ".").resolve()
|
|
118
|
+
|
|
119
|
+
print(f"\n{'='*60}")
|
|
120
|
+
print(f"[LINT RUNNER] Unified Linting")
|
|
121
|
+
print(f"{'='*60}")
|
|
122
|
+
print(f"Project: {project_path}")
|
|
123
|
+
print(f"Time: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
|
124
|
+
|
|
125
|
+
# Detect project type
|
|
126
|
+
project_info = detect_project_type(project_path)
|
|
127
|
+
print(f"Type: {project_info['type']}")
|
|
128
|
+
print(f"Linters: {len(project_info['linters'])}")
|
|
129
|
+
print("-"*60)
|
|
130
|
+
|
|
131
|
+
if not project_info["linters"]:
|
|
132
|
+
print("No linters found for this project type.")
|
|
133
|
+
output = {
|
|
134
|
+
"script": "lint_runner",
|
|
135
|
+
"project": str(project_path),
|
|
136
|
+
"type": project_info["type"],
|
|
137
|
+
"checks": [],
|
|
138
|
+
"passed": True,
|
|
139
|
+
"message": "No linters configured"
|
|
140
|
+
}
|
|
141
|
+
print(json.dumps(output, indent=2))
|
|
142
|
+
sys.exit(0)
|
|
143
|
+
|
|
144
|
+
# Run each linter
|
|
145
|
+
results = []
|
|
146
|
+
all_passed = True
|
|
147
|
+
|
|
148
|
+
for linter in project_info["linters"]:
|
|
149
|
+
print(f"\nRunning: {linter['name']}...")
|
|
150
|
+
result = run_linter(linter, project_path)
|
|
151
|
+
results.append(result)
|
|
152
|
+
|
|
153
|
+
if result["passed"]:
|
|
154
|
+
print(f" [PASS] {linter['name']}")
|
|
155
|
+
else:
|
|
156
|
+
print(f" [FAIL] {linter['name']}")
|
|
157
|
+
if result["error"]:
|
|
158
|
+
print(f" Error: {result['error'][:200]}")
|
|
159
|
+
all_passed = False
|
|
160
|
+
|
|
161
|
+
# Summary
|
|
162
|
+
print("\n" + "="*60)
|
|
163
|
+
print("SUMMARY")
|
|
164
|
+
print("="*60)
|
|
165
|
+
|
|
166
|
+
for r in results:
|
|
167
|
+
icon = "[PASS]" if r["passed"] else "[FAIL]"
|
|
168
|
+
print(f"{icon} {r['name']}")
|
|
169
|
+
|
|
170
|
+
output = {
|
|
171
|
+
"script": "lint_runner",
|
|
172
|
+
"project": str(project_path),
|
|
173
|
+
"type": project_info["type"],
|
|
174
|
+
"checks": results,
|
|
175
|
+
"passed": all_passed
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
print("\n" + json.dumps(output, indent=2))
|
|
179
|
+
|
|
180
|
+
sys.exit(0 if all_passed else 1)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
if __name__ == "__main__":
|
|
184
|
+
main()
|