thachvd-kit 1.0.14 → 1.0.16

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.
Files changed (203) hide show
  1. package/.agent/agents/backend-specialist.md +263 -0
  2. package/.agent/agents/code-archaeologist.md +106 -0
  3. package/.agent/agents/database-architect.md +226 -0
  4. package/.agent/agents/debugger.md +225 -0
  5. package/.agent/agents/devops-engineer.md +242 -0
  6. package/.agent/agents/documentation-writer.md +104 -0
  7. package/.agent/agents/explorer-agent.md +73 -0
  8. package/.agent/agents/frontend-specialist.md +593 -0
  9. package/.agent/agents/game-developer.md +162 -0
  10. package/.agent/agents/mobile-developer.md +377 -0
  11. package/.agent/agents/orchestrator.md +416 -0
  12. package/.agent/agents/penetration-tester.md +188 -0
  13. package/.agent/agents/performance-optimizer.md +187 -0
  14. package/.agent/agents/product-manager.md +112 -0
  15. package/.agent/agents/product-owner.md +95 -0
  16. package/.agent/agents/project-planner.md +406 -0
  17. package/.agent/agents/qa-automation-engineer.md +103 -0
  18. package/.agent/agents/security-auditor.md +170 -0
  19. package/.agent/agents/seo-specialist.md +111 -0
  20. package/.agent/agents/test-engineer.md +158 -0
  21. package/.agent/docs/architecture.md +22 -0
  22. package/.agent/docs/conventions.md +21 -0
  23. package/.agent/docs/project.md +40 -0
  24. package/.agent/docs/workflow.md +24 -0
  25. package/.agent/rules/GEMINI.md +45 -0
  26. package/.agent/skills/api-design/SKILL.md +156 -0
  27. package/.agent/skills/api-patterns/SKILL.md +81 -0
  28. package/.agent/skills/api-patterns/api-style.md +42 -0
  29. package/.agent/skills/api-patterns/auth.md +24 -0
  30. package/.agent/skills/api-patterns/documentation.md +26 -0
  31. package/.agent/skills/api-patterns/graphql.md +41 -0
  32. package/.agent/skills/api-patterns/rate-limiting.md +31 -0
  33. package/.agent/skills/api-patterns/response.md +37 -0
  34. package/.agent/skills/api-patterns/rest.md +40 -0
  35. package/.agent/skills/api-patterns/scripts/api_validator.py +211 -0
  36. package/.agent/skills/api-patterns/security-testing.md +122 -0
  37. package/.agent/skills/api-patterns/trpc.md +41 -0
  38. package/.agent/skills/api-patterns/versioning.md +22 -0
  39. package/.agent/skills/app-builder/SKILL.md +75 -0
  40. package/.agent/skills/app-builder/agent-coordination.md +71 -0
  41. package/.agent/skills/app-builder/feature-building.md +53 -0
  42. package/.agent/skills/app-builder/project-detection.md +34 -0
  43. package/.agent/skills/app-builder/scaffolding.md +118 -0
  44. package/.agent/skills/app-builder/tech-stack.md +40 -0
  45. package/.agent/skills/app-builder/templates/SKILL.md +39 -0
  46. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
  47. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
  48. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
  49. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
  50. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
  51. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
  52. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
  53. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +122 -0
  54. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +122 -0
  55. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +169 -0
  56. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +134 -0
  57. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
  58. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +119 -0
  59. package/.agent/skills/architecture/SKILL.md +55 -0
  60. package/.agent/skills/architecture/context-discovery.md +43 -0
  61. package/.agent/skills/architecture/examples.md +94 -0
  62. package/.agent/skills/architecture/pattern-selection.md +68 -0
  63. package/.agent/skills/architecture/patterns-reference.md +50 -0
  64. package/.agent/skills/architecture/trade-off-analysis.md +77 -0
  65. package/.agent/skills/bash-linux/SKILL.md +199 -0
  66. package/.agent/skills/behavioral-modes/SKILL.md +242 -0
  67. package/.agent/skills/brainstorming/SKILL.md +163 -0
  68. package/.agent/skills/brainstorming/dynamic-questioning.md +350 -0
  69. package/.agent/skills/clean-code/SKILL.md +201 -0
  70. package/.agent/skills/code-review-checklist/SKILL.md +109 -0
  71. package/.agent/skills/database-design/SKILL.md +52 -0
  72. package/.agent/skills/database-design/database-selection.md +43 -0
  73. package/.agent/skills/database-design/indexing.md +39 -0
  74. package/.agent/skills/database-design/migrations.md +48 -0
  75. package/.agent/skills/database-design/optimization.md +36 -0
  76. package/.agent/skills/database-design/orm-selection.md +30 -0
  77. package/.agent/skills/database-design/schema-design.md +56 -0
  78. package/.agent/skills/database-design/scripts/schema_validator.py +172 -0
  79. package/.agent/skills/deployment-procedures/SKILL.md +241 -0
  80. package/.agent/skills/desktop-design/SKILL.md +25 -0
  81. package/.agent/skills/dispatching-parallel-agents/SKILL.md +112 -0
  82. package/.agent/skills/doc.md +177 -0
  83. package/.agent/skills/docker-patterns/SKILL.md +232 -0
  84. package/.agent/skills/documentation-templates/SKILL.md +194 -0
  85. package/.agent/skills/executing-plans/SKILL.md +61 -0
  86. package/.agent/skills/finishing-a-development-branch/SKILL.md +135 -0
  87. package/.agent/skills/frontend-design/SKILL.md +418 -0
  88. package/.agent/skills/frontend-design/animation-guide.md +331 -0
  89. package/.agent/skills/frontend-design/color-system.md +311 -0
  90. package/.agent/skills/frontend-design/decision-trees.md +418 -0
  91. package/.agent/skills/frontend-design/motion-graphics.md +306 -0
  92. package/.agent/skills/frontend-design/scripts/accessibility_checker.py +183 -0
  93. package/.agent/skills/frontend-design/scripts/ux_audit.py +722 -0
  94. package/.agent/skills/frontend-design/typography-system.md +345 -0
  95. package/.agent/skills/frontend-design/ux-psychology.md +1116 -0
  96. package/.agent/skills/frontend-design/visual-effects.md +383 -0
  97. package/.agent/skills/game-development/2d-games/SKILL.md +119 -0
  98. package/.agent/skills/game-development/3d-games/SKILL.md +135 -0
  99. package/.agent/skills/game-development/SKILL.md +167 -0
  100. package/.agent/skills/game-development/game-art/SKILL.md +185 -0
  101. package/.agent/skills/game-development/game-audio/SKILL.md +190 -0
  102. package/.agent/skills/game-development/game-design/SKILL.md +129 -0
  103. package/.agent/skills/game-development/mobile-games/SKILL.md +108 -0
  104. package/.agent/skills/game-development/multiplayer/SKILL.md +132 -0
  105. package/.agent/skills/game-development/pc-games/SKILL.md +144 -0
  106. package/.agent/skills/game-development/vr-ar/SKILL.md +123 -0
  107. package/.agent/skills/game-development/web-games/SKILL.md +150 -0
  108. package/.agent/skills/geo-fundamentals/SKILL.md +156 -0
  109. package/.agent/skills/geo-fundamentals/scripts/geo_checker.py +289 -0
  110. package/.agent/skills/golang-patterns/SKILL.md +226 -0
  111. package/.agent/skills/golang-testing/SKILL.md +182 -0
  112. package/.agent/skills/i18n-localization/SKILL.md +154 -0
  113. package/.agent/skills/i18n-localization/scripts/i18n_checker.py +241 -0
  114. package/.agent/skills/intelligent-routing/SKILL.md +335 -0
  115. package/.agent/skills/laravel-patterns/SKILL.md +224 -0
  116. package/.agent/skills/laravel-security/SKILL.md +171 -0
  117. package/.agent/skills/laravel-tdd/SKILL.md +149 -0
  118. package/.agent/skills/lint-and-validate/SKILL.md +45 -0
  119. package/.agent/skills/lint-and-validate/scripts/lint_runner.py +184 -0
  120. package/.agent/skills/lint-and-validate/scripts/type_coverage.py +173 -0
  121. package/.agent/skills/mcp-builder/SKILL.md +176 -0
  122. package/.agent/skills/mobile-design/SKILL.md +394 -0
  123. package/.agent/skills/mobile-design/decision-trees.md +516 -0
  124. package/.agent/skills/mobile-design/mobile-backend.md +491 -0
  125. package/.agent/skills/mobile-design/mobile-color-system.md +420 -0
  126. package/.agent/skills/mobile-design/mobile-debugging.md +122 -0
  127. package/.agent/skills/mobile-design/mobile-design-thinking.md +357 -0
  128. package/.agent/skills/mobile-design/mobile-navigation.md +458 -0
  129. package/.agent/skills/mobile-design/mobile-performance.md +767 -0
  130. package/.agent/skills/mobile-design/mobile-testing.md +356 -0
  131. package/.agent/skills/mobile-design/mobile-typography.md +433 -0
  132. package/.agent/skills/mobile-design/platform-android.md +666 -0
  133. package/.agent/skills/mobile-design/platform-ios.md +561 -0
  134. package/.agent/skills/mobile-design/scripts/mobile_audit.py +670 -0
  135. package/.agent/skills/mobile-design/touch-psychology.md +537 -0
  136. package/.agent/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +312 -0
  137. package/.agent/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +240 -0
  138. package/.agent/skills/nextjs-react-expert/3-server-server-side-performance.md +490 -0
  139. package/.agent/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +264 -0
  140. package/.agent/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -0
  141. package/.agent/skills/nextjs-react-expert/6-rendering-rendering-performance.md +432 -0
  142. package/.agent/skills/nextjs-react-expert/7-js-javascript-performance.md +684 -0
  143. package/.agent/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +150 -0
  144. package/.agent/skills/nextjs-react-expert/SKILL.md +286 -0
  145. package/.agent/skills/nextjs-react-expert/scripts/convert_rules.py +222 -0
  146. package/.agent/skills/nextjs-react-expert/scripts/react_performance_checker.py +252 -0
  147. package/.agent/skills/nodejs-best-practices/SKILL.md +333 -0
  148. package/.agent/skills/parallel-agents/SKILL.md +175 -0
  149. package/.agent/skills/performance-profiling/SKILL.md +143 -0
  150. package/.agent/skills/performance-profiling/scripts/lighthouse_audit.py +76 -0
  151. package/.agent/skills/plan-writing/SKILL.md +152 -0
  152. package/.agent/skills/powershell-windows/SKILL.md +167 -0
  153. package/.agent/skills/project-onboarding/SKILL.md +42 -0
  154. package/.agent/skills/python-patterns/SKILL.md +441 -0
  155. package/.agent/skills/react-frontend/SKILL.md +25 -0
  156. package/.agent/skills/receiving-code-review/SKILL.md +120 -0
  157. package/.agent/skills/red-team-tactics/SKILL.md +199 -0
  158. package/.agent/skills/requesting-code-review/SKILL.md +67 -0
  159. package/.agent/skills/rust-pro/SKILL.md +176 -0
  160. package/.agent/skills/seo-fundamentals/SKILL.md +129 -0
  161. package/.agent/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
  162. package/.agent/skills/server-management/SKILL.md +161 -0
  163. package/.agent/skills/subagent-driven-development/SKILL.md +76 -0
  164. package/.agent/skills/systematic-debugging/SKILL.md +109 -0
  165. package/.agent/skills/tailwind-patterns/SKILL.md +269 -0
  166. package/.agent/skills/tdd-workflow/SKILL.md +149 -0
  167. package/.agent/skills/testing-patterns/SKILL.md +178 -0
  168. package/.agent/skills/testing-patterns/scripts/test_runner.py +219 -0
  169. package/.agent/skills/using-git-worktrees/SKILL.md +122 -0
  170. package/.agent/skills/verification-before-completion/SKILL.md +99 -0
  171. package/.agent/skills/vulnerability-scanner/SKILL.md +276 -0
  172. package/.agent/skills/vulnerability-scanner/checklists.md +121 -0
  173. package/.agent/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
  174. package/.agent/skills/web-design-guidelines/SKILL.md +57 -0
  175. package/.agent/skills/webapp-testing/SKILL.md +187 -0
  176. package/.agent/skills/webapp-testing/scripts/playwright_runner.py +173 -0
  177. package/.agent/skills/writing-skills/SKILL.md +110 -0
  178. package/.agent/workflows/brainstorm.md +113 -0
  179. package/.agent/workflows/create.md +59 -0
  180. package/.agent/workflows/debug.md +103 -0
  181. package/.agent/workflows/deploy.md +176 -0
  182. package/.agent/workflows/enhance.md +63 -0
  183. package/.agent/workflows/orchestrate.md +237 -0
  184. package/.agent/workflows/plan.md +89 -0
  185. package/.agent/workflows/preview.md +81 -0
  186. package/.agent/workflows/status.md +86 -0
  187. package/.agent/workflows/test.md +144 -0
  188. package/.agent/workflows/ui-ux-pro-max.md +296 -0
  189. package/LICENSE +21 -21
  190. package/README.md +37 -71
  191. package/agents/frontend-specialist.md +2 -2
  192. package/agents/mobile-developer.md +4 -4
  193. package/bin/cli.js +1239 -1326
  194. package/kit/PROMPT_RECIPE.md +30 -52
  195. package/kit/README.md +29 -33
  196. package/package.json +51 -51
  197. package/rules/GEMINI.md +43 -207
  198. package/skills/desktop-design/SKILL.md +25 -25
  199. package/skills/project-onboarding/SKILL.md +42 -62
  200. package/skills/react-frontend/SKILL.md +25 -25
  201. package/PROJECT_CONTEXT.template.md +0 -68
  202. package/kit/PROJECT_CONTEXT.template.md +0 -35
  203. package/scripts/init.py +0 -1047
@@ -0,0 +1,335 @@
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
+ version: 1.0.0
5
+ ---
6
+
7
+ # Intelligent Agent Routing
8
+
9
+ **Purpose**: Automatically analyze user requests and route them to the most appropriate specialist agent(s) without requiring explicit user mentions.
10
+
11
+ ## Core Principle
12
+
13
+ > **The AI should act as an intelligent Project Manager**, analyzing each request and automatically selecting the best specialist(s) for the job.
14
+
15
+ ## How It Works
16
+
17
+ ### 1. Request Analysis
18
+
19
+ Before responding to ANY user request, perform automatic analysis:
20
+
21
+ ```mermaid
22
+ graph TD
23
+ A[User Request: Add login] --> B[ANALYZE]
24
+ B --> C[Keywords]
25
+ B --> D[Domains]
26
+ B --> E[Complexity]
27
+ C --> F[SELECT AGENT]
28
+ D --> F
29
+ E --> F
30
+ F --> G[security-auditor + backend-specialist]
31
+ G --> H[AUTO-INVOKE with context]
32
+ ```
33
+
34
+ ### 2. Agent Selection Matrix
35
+
36
+ **Use this matrix to automatically select agents:**
37
+
38
+ | User Intent | Keywords | Selected Agent(s) | Auto-invoke? |
39
+ | ------------------- | ------------------------------------------ | ------------------------------------------- | ------------ |
40
+ | **Authentication** | "login", "auth", "signup", "password" | `security-auditor` + `backend-specialist` | ✅ YES |
41
+ | **UI Component** | "button", "card", "layout", "style" | `frontend-specialist` | ✅ YES |
42
+ | **Mobile UI** | "screen", "navigation", "touch", "gesture" | `mobile-developer` | ✅ YES |
43
+ | **API Endpoint** | "endpoint", "route", "API", "POST", "GET" | `backend-specialist` | ✅ YES |
44
+ | **Database** | "schema", "migration", "query", "table" | `database-architect` + `backend-specialist` | ✅ YES |
45
+ | **Bug Fix** | "error", "bug", "not working", "broken" | `debugger` | ✅ YES |
46
+ | **Test** | "test", "coverage", "unit", "e2e" | `test-engineer` | ✅ YES |
47
+ | **Deployment** | "deploy", "production", "CI/CD", "docker" | `devops-engineer` | ✅ YES |
48
+ | **Security Review** | "security", "vulnerability", "exploit" | `security-auditor` + `penetration-tester` | ✅ YES |
49
+ | **Performance** | "slow", "optimize", "performance", "speed" | `performance-optimizer` | ✅ YES |
50
+ | **Product Def** | "requirements", "user story", "backlog", "MVP" | `product-owner` | ✅ YES |
51
+ | **New Feature** | "build", "create", "implement", "new app" | `orchestrator` → multi-agent | ⚠️ ASK FIRST |
52
+ | **Complex Task** | Multiple domains detected | `orchestrator` → multi-agent | ⚠️ ASK FIRST |
53
+
54
+ ### 3. Automatic Routing Protocol
55
+
56
+ ## TIER 0 - Automatic Analysis (ALWAYS ACTIVE)
57
+
58
+ Before responding to ANY request:
59
+
60
+ ```javascript
61
+ // Pseudo-code for decision tree
62
+ function analyzeRequest(userMessage) {
63
+ // 1. Classify request type
64
+ const requestType = classifyRequest(userMessage);
65
+
66
+ // 2. Detect domains
67
+ const domains = detectDomains(userMessage);
68
+
69
+ // 3. Determine complexity
70
+ const complexity = assessComplexity(domains);
71
+
72
+ // 4. Select agent(s)
73
+ if (complexity === "SIMPLE" && domains.length === 1) {
74
+ return selectSingleAgent(domains[0]);
75
+ } else if (complexity === "MODERATE" && domains.length <= 2) {
76
+ return selectMultipleAgents(domains);
77
+ } else {
78
+ return "orchestrator"; // Complex task
79
+ }
80
+ }
81
+ ```
82
+
83
+ ## 4. Response Format
84
+
85
+ **When auto-selecting an agent, inform the user concisely:**
86
+
87
+ ```markdown
88
+ 🤖 **Applying knowledge of `@security-auditor` + `@backend-specialist`...**
89
+
90
+ [Proceed with specialized response]
91
+ ```
92
+
93
+ **Benefits:**
94
+
95
+ - ✅ User sees which expertise is being applied
96
+ - ✅ Transparent decision-making
97
+ - ✅ Still automatic (no /commands needed)
98
+
99
+ ## Domain Detection Rules
100
+
101
+ ### Single-Domain Tasks (Auto-invoke Single Agent)
102
+
103
+ | Domain | Patterns | Agent |
104
+ | --------------- | ------------------------------------------ | ----------------------- |
105
+ | **Security** | auth, login, jwt, password, hash, token | `security-auditor` |
106
+ | **Frontend** | component, react, vue, css, html, tailwind | `frontend-specialist` |
107
+ | **Backend** | api, server, express, fastapi, node | `backend-specialist` |
108
+ | **Mobile** | react native, flutter, ios, android, expo | `mobile-developer` |
109
+ | **Database** | prisma, sql, mongodb, schema, migration | `database-architect` |
110
+ | **Testing** | test, jest, vitest, playwright, cypress | `test-engineer` |
111
+ | **DevOps** | docker, kubernetes, ci/cd, pm2, nginx | `devops-engineer` |
112
+ | **Debug** | error, bug, crash, not working, issue | `debugger` |
113
+ | **Performance** | slow, lag, optimize, cache, performance | `performance-optimizer` |
114
+ | **SEO** | seo, meta, analytics, sitemap, robots | `seo-specialist` |
115
+ | **Game** | unity, godot, phaser, game, multiplayer | `game-developer` |
116
+
117
+ ### Multi-Domain Tasks (Auto-invoke Orchestrator)
118
+
119
+ If request matches **2+ domains from different categories**, automatically use `orchestrator`:
120
+
121
+ ```text
122
+ Example: "Create a secure login system with dark mode UI"
123
+ → Detected: Security + Frontend
124
+ → Auto-invoke: orchestrator
125
+ → Orchestrator will handle: security-auditor, frontend-specialist, test-engineer
126
+ ```
127
+
128
+ ## Complexity Assessment
129
+
130
+ ### SIMPLE (Direct agent invocation)
131
+
132
+ - Single file edit
133
+ - Clear, specific task
134
+ - One domain only
135
+ - Example: "Fix the login button style"
136
+
137
+ **Action**: Auto-invoke respective agent
138
+
139
+ ### MODERATE (2-3 agents)
140
+
141
+ - 2-3 files affected
142
+ - Clear requirements
143
+ - 2 domains max
144
+ - Example: "Add API endpoint for user profile"
145
+
146
+ **Action**: Auto-invoke relevant agents sequentially
147
+
148
+ ### COMPLEX (Orchestrator required)
149
+
150
+ - Multiple files/domains
151
+ - Architectural decisions needed
152
+ - Unclear requirements
153
+ - Example: "Build a social media app"
154
+
155
+ **Action**: Auto-invoke `orchestrator` → will ask Socratic questions
156
+
157
+ ## Implementation Rules
158
+
159
+ ### Rule 1: Silent Analysis
160
+
161
+ #### DO NOT announce "I'm analyzing your request..."
162
+
163
+ - ✅ Analyze silently
164
+ - ✅ Inform which agent is being applied
165
+ - ❌ Avoid verbose meta-commentary
166
+
167
+ ### Rule 2: Inform Agent Selection
168
+
169
+ **DO inform which expertise is being applied:**
170
+
171
+ ```markdown
172
+ 🤖 **Applying knowledge of `@frontend-specialist`...**
173
+
174
+ I will create the component with the following characteristics:
175
+ [Continue with specialized response]
176
+ ```
177
+
178
+ ### Rule 3: Seamless Experience
179
+
180
+ **The user should not notice a difference from talking to the right specialist directly.**
181
+
182
+ ### Rule 4: Override Capability
183
+
184
+ **User can still explicitly mention agents:**
185
+
186
+ ```text
187
+ User: "Use @backend-specialist to review this"
188
+ → Override auto-selection
189
+ → Use explicitly mentioned agent
190
+ ```
191
+
192
+ ## Edge Cases
193
+
194
+ ### Case 1: Generic Question
195
+
196
+ ```text
197
+ User: "How does React work?"
198
+ → Type: QUESTION
199
+ → No agent needed
200
+ → Respond directly with explanation
201
+ ```
202
+
203
+ ### Case 2: Extremely Vague Request
204
+
205
+ ```text
206
+ User: "Make it better"
207
+ → Complexity: UNCLEAR
208
+ → Action: Ask clarifying questions first
209
+ → Then route to appropriate agent
210
+ ```
211
+
212
+ ### Case 3: Contradictory Patterns
213
+
214
+ ```text
215
+ User: "Add mobile support to the web app"
216
+ → Conflict: mobile vs web
217
+ → Action: Ask: "Do you want responsive web or native mobile app?"
218
+ → Then route accordingly
219
+ ```
220
+
221
+ ## Integration with Existing Workflows
222
+
223
+ ### With /orchestrate Command
224
+
225
+ - **User types `/orchestrate`**: Explicit orchestration mode
226
+ - **AI detects complex task**: Auto-invoke orchestrator (same result)
227
+
228
+ **Difference**: User doesn't need to know the command exists.
229
+
230
+ ### With Socratic Gate
231
+
232
+ - **Auto-routing does NOT bypass Socratic Gate**
233
+ - If task is unclear, still ask questions first
234
+ - Then route to appropriate agent
235
+
236
+ ### With GEMINI.md Rules
237
+
238
+ - **Priority**: GEMINI.md rules > intelligent-routing
239
+ - If GEMINI.md specifies explicit routing, follow it
240
+ - Intelligent routing is the DEFAULT when no explicit rule exists
241
+
242
+ ## Testing the System
243
+
244
+ ### Test Cases
245
+
246
+ #### Test 1: Simple Frontend Task
247
+
248
+ ```text
249
+ User: "Create a dark mode toggle button"
250
+ Expected: Auto-invoke frontend-specialist
251
+ Verify: Response shows "Using @frontend-specialist"
252
+ ```
253
+
254
+ #### Test 2: Security Task
255
+
256
+ ```text
257
+ User: "Review the authentication flow for vulnerabilities"
258
+ Expected: Auto-invoke security-auditor
259
+ Verify: Security-focused analysis
260
+ ```
261
+
262
+ #### Test 3: Complex Multi-Domain
263
+
264
+ ```text
265
+ User: "Build a chat application with real-time notifications"
266
+ Expected: Auto-invoke orchestrator
267
+ Verify: Multiple agents coordinated (backend, frontend, test)
268
+ ```
269
+
270
+ #### Test 4: Bug Fix
271
+
272
+ ```text
273
+ User: "Login is not working, getting 401 error"
274
+ Expected: Auto-invoke debugger
275
+ Verify: Systematic debugging approach
276
+ ```
277
+
278
+ ## Performance Considerations
279
+
280
+ ### Token Usage
281
+
282
+ - Analysis adds ~50-100 tokens per request
283
+ - Tradeoff: Better accuracy vs slight overhead
284
+ - Overall SAVES tokens by reducing back-and-forth
285
+
286
+ ### Response Time
287
+
288
+ - Analysis is instant (pattern matching)
289
+ - No additional API calls required
290
+ - Agent selection happens before first response
291
+
292
+ ## User Education
293
+
294
+ ### Optional: First-Time Explanation
295
+
296
+ If this is the first interaction in a project:
297
+
298
+ ```markdown
299
+ 💡 **Tip**: I am configured with automatic specialist agent selection.
300
+ I will always choose the most suitable specialist for your task. You can
301
+ still mention agents explicitly with `@agent-name` if you prefer.
302
+ ```
303
+
304
+ ## Debugging Agent Selection
305
+
306
+ ### Enable Debug Mode (for development)
307
+
308
+ Add to GEMINI.md temporarily:
309
+
310
+ ```markdown
311
+ ## DEBUG: Intelligent Routing
312
+
313
+ Show selection reasoning:
314
+
315
+ - Detected domains: [list]
316
+ - Selected agent: [name]
317
+ - Reasoning: [why]
318
+ ```
319
+
320
+ ## Summary
321
+
322
+ **intelligent-routing skill enables:**
323
+
324
+ ✅ Zero-command operation (no need for `/orchestrate`)
325
+ ✅ Automatic specialist selection based on request analysis
326
+ ✅ Transparent communication of which expertise is being applied
327
+ ✅ Seamless integration with existing workflows
328
+ ✅ Override capability for explicit agent mentions
329
+ ✅ Fallback to orchestrator for complex tasks
330
+
331
+ **Result**: User gets specialist-level responses without needing to know the system architecture.
332
+
333
+ ---
334
+
335
+ **Next Steps**: Integrate this skill into GEMINI.md TIER 0 rules.
@@ -0,0 +1,224 @@
1
+ ---
2
+ name: laravel-patterns
3
+ description: Production-grade Laravel architecture patterns for scalable, maintainable applications. Use when building Laravel web applications or APIs, structuring controllers/services/domain logic, working with Eloquent, designing APIs, or adding queues/events/caching.
4
+ allowed-tools: Read, Edit, Write, Bash
5
+ ---
6
+
7
+ # Laravel Development Patterns
8
+
9
+ Production-grade Laravel architecture patterns for scalable, maintainable applications.
10
+
11
+ ## Core Architecture: Controllers → Services → Actions
12
+
13
+ Keep controllers thin. Put orchestration in services and single-purpose logic in actions.
14
+
15
+ ```php
16
+ final class CreateOrderAction
17
+ {
18
+ public function __construct(private OrderRepository $orders) {}
19
+
20
+ public function handle(CreateOrderData $data): Order
21
+ {
22
+ return $this->orders->create($data);
23
+ }
24
+ }
25
+
26
+ final class OrdersController extends Controller
27
+ {
28
+ public function __construct(private CreateOrderAction $createOrder) {}
29
+
30
+ public function store(StoreOrderRequest $request): JsonResponse
31
+ {
32
+ $order = $this->createOrder->handle($request->toDto());
33
+
34
+ return response()->json([
35
+ 'success' => true,
36
+ 'data' => OrderResource::make($order),
37
+ 'error' => null,
38
+ 'meta' => null,
39
+ ], 201);
40
+ }
41
+ }
42
+ ```
43
+
44
+ ## Recommended Project Structure
45
+
46
+ ```
47
+ app/
48
+ ├── Actions/ # Single-purpose use cases
49
+ ├── Http/
50
+ │ ├── Controllers/
51
+ │ ├── Middleware/
52
+ │ ├── Requests/ # Form request validation
53
+ │ └── Resources/ # API resources
54
+ ├── Jobs/
55
+ ├── Models/
56
+ ├── Policies/
57
+ ├── Services/ # Coordinating domain services
58
+ └── Support/
59
+ ```
60
+
61
+ ## Routing
62
+
63
+ ```php
64
+ // Prefer resource controllers + scoped bindings
65
+ Route::middleware('auth:sanctum')->group(function () {
66
+ Route::apiResource('projects', ProjectController::class);
67
+ });
68
+
69
+ // Scoped bindings for nested routes (prevents cross-tenant access)
70
+ Route::scopeBindings()->group(function () {
71
+ Route::get('/accounts/{account}/projects/{project}', [ProjectController::class, 'show']);
72
+ });
73
+ ```
74
+
75
+ ## Model Configuration
76
+
77
+ ```php
78
+ final class Project extends Model
79
+ {
80
+ use HasFactory;
81
+
82
+ protected $fillable = ['name', 'owner_id', 'status'];
83
+
84
+ protected $casts = [
85
+ 'status' => ProjectStatus::class,
86
+ 'archived_at' => 'datetime',
87
+ ];
88
+
89
+ public function owner(): BelongsTo
90
+ {
91
+ return $this->belongsTo(User::class, 'owner_id');
92
+ }
93
+
94
+ public function scopeActive(Builder $query): Builder
95
+ {
96
+ return $query->whereNull('archived_at');
97
+ }
98
+ }
99
+ ```
100
+
101
+ ## Eloquent Patterns
102
+
103
+ ```php
104
+ // Eager loading to avoid N+1
105
+ $orders = Order::query()
106
+ ->with(['customer', 'items.product'])
107
+ ->latest()
108
+ ->paginate(25);
109
+
110
+ // Query objects for complex filters
111
+ final class ProjectQuery
112
+ {
113
+ public function __construct(private Builder $query) {}
114
+
115
+ public function ownedBy(int $userId): self
116
+ {
117
+ return new self((clone $this->query)->where('owner_id', $userId));
118
+ }
119
+
120
+ public function active(): self
121
+ {
122
+ return new self((clone $this->query)->whereNull('archived_at'));
123
+ }
124
+ }
125
+
126
+ // Transactions for multi-step updates
127
+ DB::transaction(function (): void {
128
+ $order->update(['status' => 'paid']);
129
+ $order->items()->update(['paid_at' => now()]);
130
+ });
131
+ ```
132
+
133
+ ## Form Requests with DTOs
134
+
135
+ ```php
136
+ final class StoreOrderRequest extends FormRequest
137
+ {
138
+ public function authorize(): bool
139
+ {
140
+ return $this->user()?->can('create', Order::class) ?? false;
141
+ }
142
+
143
+ public function rules(): array
144
+ {
145
+ return [
146
+ 'customer_id' => ['required', 'integer', 'exists:customers,id'],
147
+ 'items' => ['required', 'array', 'min:1'],
148
+ 'items.*.sku' => ['required', 'string'],
149
+ ];
150
+ }
151
+
152
+ public function toDto(): CreateOrderData
153
+ {
154
+ return new CreateOrderData(
155
+ customerId: (int) $this->validated('customer_id'),
156
+ items: $this->validated('items'),
157
+ );
158
+ }
159
+ }
160
+ ```
161
+
162
+ ## API Resources
163
+
164
+ ```php
165
+ // Consistent API response format
166
+ return response()->json([
167
+ 'success' => true,
168
+ 'data' => ProjectResource::collection($projects->items()),
169
+ 'error' => null,
170
+ 'meta' => [
171
+ 'page' => $projects->currentPage(),
172
+ 'per_page' => $projects->perPage(),
173
+ 'total' => $projects->total(),
174
+ ],
175
+ ]);
176
+ ```
177
+
178
+ ## Service Container Bindings
179
+
180
+ ```php
181
+ final class AppServiceProvider extends ServiceProvider
182
+ {
183
+ public function register(): void
184
+ {
185
+ $this->app->bind(OrderRepository::class, EloquentOrderRepository::class);
186
+ }
187
+ }
188
+ ```
189
+
190
+ ## Events, Jobs, and Queues
191
+
192
+ - Emit domain events for side effects (emails, analytics)
193
+ - Use queued jobs for slow work (reports, exports, webhooks)
194
+ - Prefer idempotent handlers with retries and backoff
195
+
196
+ ## Caching
197
+
198
+ - Cache read-heavy endpoints and expensive queries
199
+ - Invalidate caches on model events (created/updated/deleted)
200
+ - Use tags when caching related data for easy invalidation
201
+
202
+ ## Migrations
203
+
204
+ ```php
205
+ return new class extends Migration
206
+ {
207
+ public function up(): void
208
+ {
209
+ Schema::create('orders', function (Blueprint $table): void {
210
+ $table->id();
211
+ $table->foreignId('customer_id')->constrained()->cascadeOnDelete();
212
+ $table->string('status', 32)->index();
213
+ $table->unsignedInteger('total_cents');
214
+ $table->timestamps();
215
+ });
216
+ }
217
+ };
218
+ ```
219
+
220
+ ## Configuration
221
+
222
+ - Keep secrets in `.env`, config in `config/*.php`
223
+ - Use `config:cache` in production
224
+ - Per-environment config overrides via environment variables