tribunal-kit 2.4.6 → 3.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/.agent/agents/accessibility-reviewer.md +220 -134
- package/.agent/agents/ai-code-reviewer.md +233 -129
- package/.agent/agents/backend-specialist.md +238 -178
- package/.agent/agents/code-archaeologist.md +181 -119
- package/.agent/agents/database-architect.md +207 -164
- package/.agent/agents/debugger.md +218 -151
- package/.agent/agents/dependency-reviewer.md +136 -55
- package/.agent/agents/devops-engineer.md +238 -175
- package/.agent/agents/documentation-writer.md +221 -137
- package/.agent/agents/explorer-agent.md +180 -142
- package/.agent/agents/frontend-reviewer.md +194 -80
- package/.agent/agents/frontend-specialist.md +237 -188
- package/.agent/agents/game-developer.md +52 -184
- package/.agent/agents/logic-reviewer.md +149 -78
- package/.agent/agents/mobile-developer.md +223 -152
- package/.agent/agents/mobile-reviewer.md +195 -79
- package/.agent/agents/orchestrator.md +211 -170
- package/.agent/agents/penetration-tester.md +174 -131
- package/.agent/agents/performance-optimizer.md +203 -139
- package/.agent/agents/performance-reviewer.md +211 -108
- package/.agent/agents/product-manager.md +162 -108
- package/.agent/agents/project-planner.md +162 -142
- package/.agent/agents/qa-automation-engineer.md +242 -138
- package/.agent/agents/security-auditor.md +194 -170
- package/.agent/agents/seo-specialist.md +213 -132
- package/.agent/agents/sql-reviewer.md +194 -73
- package/.agent/agents/supervisor-agent.md +203 -156
- package/.agent/agents/test-coverage-reviewer.md +193 -81
- package/.agent/agents/type-safety-reviewer.md +208 -65
- package/.agent/scripts/__pycache__/auto_preview.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/bundle_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/checklist.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/dependency_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/session_manager.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/skill_integrator.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/swarm_dispatcher.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/verify_all.cpython-311.pyc +0 -0
- package/.agent/skills/agent-organizer/SKILL.md +126 -132
- package/.agent/skills/ai-prompt-injection-defense/SKILL.md +155 -66
- package/.agent/skills/api-patterns/SKILL.md +289 -257
- package/.agent/skills/api-security-auditor/SKILL.md +172 -70
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +1 -1
- package/.agent/skills/appflow-wireframe/SKILL.md +107 -100
- package/.agent/skills/architecture/SKILL.md +331 -200
- package/.agent/skills/authentication-best-practices/SKILL.md +168 -67
- package/.agent/skills/bash-linux/SKILL.md +154 -215
- package/.agent/skills/brainstorming/SKILL.md +104 -210
- package/.agent/skills/building-native-ui/SKILL.md +169 -70
- package/.agent/skills/clean-code/SKILL.md +360 -206
- package/.agent/skills/config-validator/SKILL.md +141 -165
- package/.agent/skills/csharp-developer/SKILL.md +528 -107
- package/.agent/skills/database-design/SKILL.md +455 -275
- package/.agent/skills/deployment-procedures/SKILL.md +145 -188
- package/.agent/skills/devops-engineer/SKILL.md +332 -134
- package/.agent/skills/devops-incident-responder/SKILL.md +113 -98
- package/.agent/skills/edge-computing/SKILL.md +157 -213
- package/.agent/skills/extract-design-system/SKILL.md +129 -69
- package/.agent/skills/framer-motion-expert/SKILL.md +939 -0
- package/.agent/skills/game-design-expert/SKILL.md +105 -0
- package/.agent/skills/game-engineering-expert/SKILL.md +122 -0
- package/.agent/skills/geo-fundamentals/SKILL.md +124 -215
- package/.agent/skills/github-operations/SKILL.md +314 -354
- package/.agent/skills/gsap-expert/SKILL.md +901 -0
- package/.agent/skills/i18n-localization/SKILL.md +138 -216
- package/.agent/skills/intelligent-routing/SKILL.md +127 -139
- package/.agent/skills/llm-engineering/SKILL.md +357 -258
- package/.agent/skills/local-first/SKILL.md +154 -203
- package/.agent/skills/mcp-builder/SKILL.md +118 -224
- package/.agent/skills/nextjs-react-expert/SKILL.md +783 -203
- package/.agent/skills/nodejs-best-practices/SKILL.md +559 -280
- package/.agent/skills/observability/SKILL.md +330 -285
- package/.agent/skills/parallel-agents/SKILL.md +122 -181
- package/.agent/skills/performance-profiling/SKILL.md +254 -197
- package/.agent/skills/plan-writing/SKILL.md +118 -188
- package/.agent/skills/platform-engineer/SKILL.md +123 -135
- package/.agent/skills/playwright-best-practices/SKILL.md +157 -76
- package/.agent/skills/powershell-windows/SKILL.md +146 -230
- package/.agent/skills/python-pro/SKILL.md +879 -114
- package/.agent/skills/react-specialist/SKILL.md +931 -108
- package/.agent/skills/realtime-patterns/SKILL.md +304 -296
- package/.agent/skills/rust-pro/SKILL.md +701 -240
- package/.agent/skills/seo-fundamentals/SKILL.md +154 -181
- package/.agent/skills/server-management/SKILL.md +190 -212
- package/.agent/skills/shadcn-ui-expert/SKILL.md +201 -68
- package/.agent/skills/sql-pro/SKILL.md +633 -104
- package/.agent/skills/swiftui-expert/SKILL.md +171 -70
- package/.agent/skills/systematic-debugging/SKILL.md +118 -186
- package/.agent/skills/tailwind-patterns/SKILL.md +576 -232
- package/.agent/skills/tdd-workflow/SKILL.md +137 -209
- package/.agent/skills/testing-patterns/SKILL.md +573 -205
- package/.agent/skills/vue-expert/SKILL.md +964 -119
- package/.agent/skills/vulnerability-scanner/SKILL.md +269 -316
- package/.agent/skills/web-accessibility-auditor/SKILL.md +188 -71
- package/.agent/skills/webapp-testing/SKILL.md +145 -236
- package/.agent/workflows/api-tester.md +151 -279
- package/.agent/workflows/audit.md +138 -168
- package/.agent/workflows/brainstorm.md +110 -146
- package/.agent/workflows/changelog.md +112 -144
- package/.agent/workflows/create.md +124 -139
- package/.agent/workflows/debug.md +189 -196
- package/.agent/workflows/deploy.md +189 -153
- package/.agent/workflows/enhance.md +151 -139
- package/.agent/workflows/fix.md +135 -143
- package/.agent/workflows/generate.md +157 -164
- package/.agent/workflows/migrate.md +160 -163
- package/.agent/workflows/orchestrate.md +168 -151
- package/.agent/workflows/performance-benchmarker.md +123 -305
- package/.agent/workflows/plan.md +173 -151
- package/.agent/workflows/preview.md +80 -137
- package/.agent/workflows/refactor.md +183 -153
- package/.agent/workflows/review-ai.md +129 -140
- package/.agent/workflows/review.md +116 -155
- package/.agent/workflows/session.md +94 -154
- package/.agent/workflows/status.md +79 -125
- package/.agent/workflows/strengthen-skills.md +139 -99
- package/.agent/workflows/swarm.md +179 -194
- package/.agent/workflows/test.md +211 -166
- package/.agent/workflows/tribunal-backend.md +113 -111
- package/.agent/workflows/tribunal-database.md +115 -132
- package/.agent/workflows/tribunal-frontend.md +118 -115
- package/.agent/workflows/tribunal-full.md +133 -136
- package/.agent/workflows/tribunal-mobile.md +119 -123
- package/.agent/workflows/tribunal-performance.md +133 -152
- package/.agent/workflows/ui-ux-pro-max.md +143 -171
- package/README.md +11 -15
- package/package.json +1 -1
- package/.agent/skills/dotnet-core-expert/SKILL.md +0 -103
- package/.agent/skills/framer-motion-animations/SKILL.md +0 -74
- package/.agent/skills/game-development/2d-games/SKILL.md +0 -119
- package/.agent/skills/game-development/3d-games/SKILL.md +0 -135
- package/.agent/skills/game-development/SKILL.md +0 -236
- package/.agent/skills/game-development/game-art/SKILL.md +0 -185
- package/.agent/skills/game-development/game-audio/SKILL.md +0 -190
- package/.agent/skills/game-development/game-design/SKILL.md +0 -129
- package/.agent/skills/game-development/mobile-games/SKILL.md +0 -108
- package/.agent/skills/game-development/multiplayer/SKILL.md +0 -132
- package/.agent/skills/game-development/pc-games/SKILL.md +0 -144
- package/.agent/skills/game-development/vr-ar/SKILL.md +0 -123
- package/.agent/skills/game-development/web-games/SKILL.md +0 -150
|
@@ -1,216 +1,138 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: i18n-localization
|
|
3
|
-
description: Internationalization and localization
|
|
4
|
-
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
-
version:
|
|
6
|
-
last-updated: 2026-
|
|
7
|
-
applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
#
|
|
11
|
-
|
|
12
|
-
>
|
|
13
|
-
>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
---
|
|
140
|
-
|
|
141
|
-
## Detecting Hardcoded Strings (Code Audit)
|
|
142
|
-
|
|
143
|
-
Look for:
|
|
144
|
-
- JSX text content directly in tags: `<p>some text</p>` (not `<p>{t(...)}</p>`)
|
|
145
|
-
- Template literals with user-facing copy: `` `Welcome, ${name}!` ``
|
|
146
|
-
- Alert/toast calls with string literals: `toast.success('Saved!')`
|
|
147
|
-
- Error messages: `new Error('Invalid input')` shown to users
|
|
148
|
-
- `placeholder`, `aria-label`, `title` attributes hardcoded
|
|
149
|
-
|
|
150
|
-
---
|
|
151
|
-
|
|
152
|
-
## Scripts
|
|
153
|
-
|
|
154
|
-
| Script | Purpose | Run With |
|
|
155
|
-
|---|---|---|
|
|
156
|
-
| `scripts/i18n_checker.py` | Scans codebase for hardcoded strings | `python scripts/i18n_checker.py <project_path>` |
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
## Output Format
|
|
161
|
-
|
|
162
|
-
When this skill produces a recommendation or design decision, structure your output as:
|
|
163
|
-
|
|
164
|
-
```
|
|
165
|
-
━━━ I18N Localization Recommendation ━━━━━━━━━━━━━━━━
|
|
166
|
-
Decision: [what was chosen / proposed]
|
|
167
|
-
Rationale: [why — one concise line]
|
|
168
|
-
Trade-offs: [what is consciously accepted]
|
|
169
|
-
Next action: [concrete next step for the user]
|
|
170
|
-
─────────────────────────────────────────────────
|
|
171
|
-
Pre-Flight: ✅ All checks passed
|
|
172
|
-
or ❌ [blocking item that must be resolved first]
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
---
|
|
178
|
-
|
|
179
|
-
## 🤖 LLM-Specific Traps
|
|
180
|
-
|
|
181
|
-
AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
|
|
182
|
-
|
|
183
|
-
1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
|
|
184
|
-
2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
|
|
185
|
-
3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
|
|
186
|
-
4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
187
|
-
5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
|
|
188
|
-
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
## 🏛️ Tribunal Integration (Anti-Hallucination)
|
|
192
|
-
|
|
193
|
-
**Slash command: `/review` or `/tribunal-full`**
|
|
194
|
-
**Active reviewers: `logic-reviewer` · `security-auditor`**
|
|
195
|
-
|
|
196
|
-
### ❌ Forbidden AI Tropes
|
|
197
|
-
|
|
198
|
-
1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
|
|
199
|
-
2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
|
|
200
|
-
3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
201
|
-
|
|
202
|
-
### ✅ Pre-Flight Self-Audit
|
|
203
|
-
|
|
204
|
-
Review these questions before confirming output:
|
|
205
|
-
```
|
|
206
|
-
✅ Did I rely ONLY on real, verified tools and methods?
|
|
207
|
-
✅ Is this solution appropriately scoped to the user's constraints?
|
|
208
|
-
✅ Did I handle potential failure modes and edge cases?
|
|
209
|
-
✅ Have I avoided generic boilerplate that doesn't add value?
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
213
|
-
|
|
214
|
-
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
215
|
-
- ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
216
|
-
- ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
|
|
1
|
+
---
|
|
2
|
+
name: i18n-localization
|
|
3
|
+
description: Internationalization (i18n) and localization mastery. Abstracting hardcoded strings, managing JSON/YAML translation dictionaries, bidirectional routing (RTL support for Arabic/Hebrew), Pluralization algorithms, date/currency formatting, and SSR locale detection in Next.js/React. Use when preparing an application for global multilingual scaling.
|
|
4
|
+
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
+
version: 2.0.0
|
|
6
|
+
last-updated: 2026-04-02
|
|
7
|
+
applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# i18n & Localization — Global Scale Mastery
|
|
11
|
+
|
|
12
|
+
> Translating text is easy. Localizing variables, dates, plurals, and reading directions is complex.
|
|
13
|
+
> Do not build your own translation hash-map engine. It will break on Arabic plurals.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 1. The i18n Architecture (Next.js / React)
|
|
18
|
+
|
|
19
|
+
Do not hardcode strings inside UI components. Use a standardized library (e.g., `next-intl` or `react-i18next`).
|
|
20
|
+
|
|
21
|
+
### Step 1: Dictionary Abstraction
|
|
22
|
+
```json
|
|
23
|
+
// messages/en.json
|
|
24
|
+
{
|
|
25
|
+
"Dashboard": {
|
|
26
|
+
"welcomeMessage": "Welcome back, {name}!",
|
|
27
|
+
"unreadAlerts": "{count, plural, =0 {No unread alerts} one {You have 1 unread alert} other {You have # unread alerts}}"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Step 2: Component Implementation
|
|
33
|
+
```tsx
|
|
34
|
+
// ❌ BAD: Hardcoded English text and manual variable interpolation
|
|
35
|
+
export function Header({ user, alertCount }) {
|
|
36
|
+
return <h1>Welcome back, {user.name}! You have {alertCount} alerts.</h1>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// ✅ GOOD: i18n Abstraction (using next-intl)
|
|
40
|
+
import { useTranslations } from 'next-intl';
|
|
41
|
+
|
|
42
|
+
export function Header({ user, alertCount }) {
|
|
43
|
+
const t = useTranslations('Dashboard');
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<header>
|
|
47
|
+
<h1>{t('welcomeMessage', { name: user.name })}</h1>
|
|
48
|
+
<p>{t('unreadAlerts', { count: alertCount })}</p>
|
|
49
|
+
</header>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 2. Advanced Native Formatting (`Intl`)
|
|
57
|
+
|
|
58
|
+
Do not install `moment.js` or write massive regex string parsers to format currencies in Euros vs Dollars. The browser handles this natively with the `Intl` API.
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
// Data/Currency Formatting correctly tied to the active locale
|
|
62
|
+
const locale = 'de-DE';
|
|
63
|
+
|
|
64
|
+
// ✅ Currency
|
|
65
|
+
const price = new Intl.NumberFormat(locale, { style: 'currency', currency: 'EUR' }).format(1200.50);
|
|
66
|
+
// Output in Germany: "1.200,50 €"
|
|
67
|
+
|
|
68
|
+
// ✅ Dates
|
|
69
|
+
const date = new Intl.DateTimeFormat(locale, { dateStyle: 'full' }).format(new Date());
|
|
70
|
+
// Output in Germany: "Freitag, 2. April 2026"
|
|
71
|
+
|
|
72
|
+
// ✅ Relative Time
|
|
73
|
+
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: 'auto' });
|
|
74
|
+
rtf.format(-2, 'day'); // Output: "vorgestern" (the day before yesterday)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 3. Bidirectional Architecture (RTL)
|
|
80
|
+
|
|
81
|
+
For languages like Arabic and Hebrew, the UI must fundamentally flip horizontally. Right-To-Left (RTL) breaks standard CSS `marginLeft` and `marginRight`.
|
|
82
|
+
|
|
83
|
+
**The Solution:** Logical CSS Properties.
|
|
84
|
+
Tailwind v4 (and modern CSS) natively supports logical direction.
|
|
85
|
+
|
|
86
|
+
```css
|
|
87
|
+
/* ❌ BAD: Hardcoded physical space */
|
|
88
|
+
.btn { margin-left: 10px; } /* Will break layout in Hebrew */
|
|
89
|
+
|
|
90
|
+
/* ✅ GOOD: Logical spacing (Tailwind: ms-4, me-4) */
|
|
91
|
+
.btn { margin-inline-start: 10px; } /* Automatically flips in RTL mode */
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
*In React HTML tag:* `<html lang="ar" dir="rtl">`
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 4. Routing and SSR Detection
|
|
99
|
+
|
|
100
|
+
Users should not face English UI natively in Japan. Detect their browser headers at the edge routing layer.
|
|
101
|
+
|
|
102
|
+
In Next.js Middleware:
|
|
103
|
+
1. Parse the incoming `Accept-Language` header.
|
|
104
|
+
2. Intercept requests to `/dashboard`.
|
|
105
|
+
3. Rewrite URL to the detected locale (e.g., `/ja/dashboard`).
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 🤖 LLM-Specific Traps (i18n)
|
|
110
|
+
|
|
111
|
+
1. **Building Custom Maps:** AI writes generic `const dict = { en: "Hello", es: "Hola" }` and queries it via `dict[locale]`. This fundamentally fails for plurals, interpolation, and rich text. Use standard libraries.
|
|
112
|
+
2. **Ignoring Plural Rules:** English has 2 plural forms (singular, plural). Arabic has 6 (zero, one, two, few, many, other). Hallucinating `count === 1 ? 'apple' : 'apples'` logic breaks internationally. Ensure ICU message formatting.
|
|
113
|
+
3. **Physical CSS Layouts:** Writing `ml-4` or `pr-2` (margin-left, padding-right) in Tailwind. Standardize exclusively on `ms-4` (margin-start) and `pe-2` (padding-end) to guarantee RTL flip compliance.
|
|
114
|
+
4. **Hardcoded Date Formats:** AI using `date.toLocaleDateString('en-US')` globally inside an i18n abstraction library, overriding the dynamic user locality entirely.
|
|
115
|
+
5. **Component Cracking for Rich Text:** The AI tries to translate "Click *here* to login" by breaking it into 3 separate translation keys (Start, Link, End). This destroys translator context. Modern libraries support `t.rich('key', { span: (chunks) => <span>{chunks}</span> })`.
|
|
116
|
+
6. **Server vs Client Disconnect:** AI suggests using a React Context `LocaleProvider` heavily in Next.js Server Components. SSR apps must extract locale explicitly from the URL route (`params.locale`), not React Context.
|
|
117
|
+
7. **Dictionary Bloat:** Trying to load a massive 5MB `global.json` translation file on initial boot, completely destroying First Contentful Paint. AI must segment routing into domain namespaces (e.g., `Checkout.json`).
|
|
118
|
+
8. **Locale Fallbacks Missing:** Failing to set `en` as the default fallback logic when a key is missing in the requested language, causing catastrophic `undefined` crashes on runtime rendering.
|
|
119
|
+
9. **Translating Variable Identities:** Accidentally translating JSON mapping keys or CSS classes inside the codebase when attempting to internationalize display text.
|
|
120
|
+
10. **Timezone Blindness:** Assuming formatting a DateTime automatically translates the underlying timezone shift. Timezone and Locale are two distinct configurations. Displaying local time requires tracking client offset via timezone context.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## 🏛️ Tribunal Integration
|
|
125
|
+
|
|
126
|
+
### ✅ Pre-Flight Self-Audit
|
|
127
|
+
```
|
|
128
|
+
✅ Are strings fully abstracted into standard JSON/YAML dictionaries using ICU format?
|
|
129
|
+
✅ Is variable interpolation utilizing standard library bindings rather than raw string concatenation?
|
|
130
|
+
✅ Have pluralization logic been delegated to the i18n engine to support multi-form languages?
|
|
131
|
+
✅ Are physical CSS layouts stripped in favor of Logical Properties (e.g., `start`, `end`, `margin-inline`)?
|
|
132
|
+
✅ Has the `<html dir="rtl">` tag generation been integrated for Right-To-Left language requests?
|
|
133
|
+
✅ Is data formatting (dates, currency, relative time) natively executed via target-aware `Intl` APIs?
|
|
134
|
+
✅ Did I ensure Rich-Text translations (links within blocks) remain unified in one single translation key?
|
|
135
|
+
✅ Is Next.js routing actively leveraging `[locale]` parameters accurately in SSR domains?
|
|
136
|
+
✅ Are JSON translation files segmented logically by namespace to prevent massive client-side bloat?
|
|
137
|
+
✅ Did I enforce strict error-bypassing fallback logic to default language upon missing translation keys?
|
|
138
|
+
```
|
|
@@ -1,139 +1,127 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: intelligent-routing
|
|
3
|
-
description:
|
|
4
|
-
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
-
version:
|
|
6
|
-
last-updated: 2026-
|
|
7
|
-
applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
#
|
|
11
|
-
|
|
12
|
-
>
|
|
13
|
-
>
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
##
|
|
18
|
-
|
|
19
|
-
When
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
```
|
|
129
|
-
✅ Did I rely ONLY on real, verified tools and methods?
|
|
130
|
-
✅ Is this solution appropriately scoped to the user's constraints?
|
|
131
|
-
✅ Did I handle potential failure modes and edge cases?
|
|
132
|
-
✅ Have I avoided generic boilerplate that doesn't add value?
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
136
|
-
|
|
137
|
-
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
138
|
-
- ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
139
|
-
- ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
|
|
1
|
+
---
|
|
2
|
+
name: intelligent-routing
|
|
3
|
+
description: LLM Intent Processing and Gateway Routing mastery. Request classification hierarchies, function routing, confidence scoring, fallback cascades, zero-shot vs few-shot classification patterns, and identifying specialized skills for delegation. Use when parsing raw user input to determine the architectural path of execution.
|
|
4
|
+
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
+
version: 2.0.0
|
|
6
|
+
last-updated: 2026-04-02
|
|
7
|
+
applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Intelligent Routing — Intent Gateway Mastery
|
|
11
|
+
|
|
12
|
+
> Every complex automation starts with a router.
|
|
13
|
+
> If you route the request incorrectly, the subsequent 10 steps of execution will fail flawlessly.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 1. Classification Hierarchy (The Gateway)
|
|
18
|
+
|
|
19
|
+
When a raw request enters a system, it must be bucketed properly. This is the First Step (Phase 0). Do not attempt to solve the user's problem during the routing phase.
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
// The Semantic Intent Schema
|
|
23
|
+
const RouterOutputSchema = z.object({
|
|
24
|
+
classification: z.enum([
|
|
25
|
+
"QUESTION", // User wants explanation, no code execution needed
|
|
26
|
+
"SURVEY", // User wants analysis/read-only scan of workspace
|
|
27
|
+
"SIMPLE_EDIT", // Isolated file alteration (e.g., "Fix spelling in nav")
|
|
28
|
+
"COMPLEX_BUILD", // Multi-file, architectural generation
|
|
29
|
+
"SECURITY_AUDIT", // Explicit request for OWASP review
|
|
30
|
+
"UNCLEAR_GIBBERISH" // Prompt injection or incoherent input
|
|
31
|
+
]),
|
|
32
|
+
confidenceScore: z.number().min(0).max(100),
|
|
33
|
+
suggestedPrimarySkill: z.string().nullable(),
|
|
34
|
+
requiresHumanClarification: z.boolean(),
|
|
35
|
+
reasoning: z.string() // Forces the LLM to justify its route before categorizing
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Zero-Shot vs Few-Shot Classification
|
|
40
|
+
- **Zero-Shot:** Providing definitions and hoping the LLM categorizes the prompt accurately. Error-prone.
|
|
41
|
+
- **Few-Shot (Mandatory for Routers):** Providing explicit paired examples defining the categorical boundaries.
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
## Routing Examples:
|
|
45
|
+
User: "Why is the header blue?"
|
|
46
|
+
Output: {"classification": "QUESTION", "requiresHumanClarification": false}
|
|
47
|
+
|
|
48
|
+
User: "Add a user login system"
|
|
49
|
+
Output: {"classification": "COMPLEX_BUILD", "requiresHumanClarification": true}
|
|
50
|
+
Reasoning: "Login systems require multi-file architecture, database hooks, and security implementation."
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 2. Dynamic Skill Matching (Manifest Analysis)
|
|
56
|
+
|
|
57
|
+
A Router isn't just classifying intent—it actively maps tasks to available capabilities.
|
|
58
|
+
|
|
59
|
+
If building a system with 50 available agents/skills, pass the Router a localized summary manifest, not the full 50x files.
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
// Example Context Payload passed to Router
|
|
63
|
+
{
|
|
64
|
+
"available_skills": [
|
|
65
|
+
{"name": "react-specialist", "desc": "React 19, hooks, component architecture"},
|
|
66
|
+
{"name": "python-pro", "desc": "FastAPI, async, data processing"},
|
|
67
|
+
{"name": "vulnerability-scanner", "desc": "OWASP, injections, secret scanning"}
|
|
68
|
+
],
|
|
69
|
+
"user_request": "How do I speed up this data pipeline script?"
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
*Router calculates:* `match: python-pro` AND `match: performance-profiling`.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 3. Fallback Cascades & Ambiguity
|
|
77
|
+
|
|
78
|
+
The AI will encounter prompts it does not understand. The Router is the *only* place where it is safe to halt and ask immediately.
|
|
79
|
+
|
|
80
|
+
**The Socratic Yield Rule:**
|
|
81
|
+
If the `confidenceScore` of a categorization is `< 85`, the router MUST yield back to the user with a clarifying question instead of guessing the intent.
|
|
82
|
+
|
|
83
|
+
*User:* "Fix the thing."
|
|
84
|
+
*Router Action (Incorrect):* Assume they mean standard linter execution and run scripts.
|
|
85
|
+
*Router Action (Correct):* Halt. "Which file or feature are you referring to?"
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 4. Bounding the Exploder Pattern
|
|
90
|
+
|
|
91
|
+
Certain requests sound simple but require massive execution matrices (The "Exploder" pattern).
|
|
92
|
+
*User:* "Translate my entire app to French."
|
|
93
|
+
|
|
94
|
+
The Router must recognize execution scales. If an execution requires touching >10 files, the Router must switch the system into `PLANNING_MODE` to generate an itinerary, rather than attempting an outright sequential execution.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 🤖 LLM-Specific Traps (Intelligent Routing)
|
|
99
|
+
|
|
100
|
+
1. **Solving in the Router:** An LLM prompted to "Route this coding request" often replies with the actual finalized code rather than selecting the routing node. Stiffly enforce JSON outputs via schema constraint.
|
|
101
|
+
2. **Zero-Shot Halucination:** The router guesses an intent bucket that isn't functionally defined (e.g., returning `classification: "DATABASE_MODE"` when that isn't a valid system enum).
|
|
102
|
+
3. **Skill Name Invention:** Suggesting the invocation of a skill that doesn't exist (`suggestedSkill: "docker-expert"`) instead of matching against the explicitly provided manifest of available internal skills.
|
|
103
|
+
4. **Ignoring Confidence Thresholds:** Proceeding with architectural execution even when the user's prompt is completely ambiguous, resulting in 5 wasted LLM token loops.
|
|
104
|
+
5. **The God-Agent Fallback:** Categorizing complex requests into generic root workflows instead of isolating the exact specialist (e.g., dispatching `app-builder` when `playwright-best-practices` was the explicitly requested optimization).
|
|
105
|
+
6. **No Escapes for Gibberish:** Failing to identify prompt-injections or copy-paste errors, trying to parse random garbled text into a functional execution path instead of instantly rejecting it.
|
|
106
|
+
7. **Scale Blindness:** Treating "Add a console.log" and "Create an authentication system" as identical linear tasks without switching the heavier task into a designated `PLANNING_MODE` phase.
|
|
107
|
+
8. **Missing Reasoning Chain:** Categorizing an intent *before* writing the justification text. Enforcing `reasoning: string` at the *top* of the output schema forces Chain-of-Thought (CoT) and drastically improves routing accuracy.
|
|
108
|
+
9. **Single-Node Assignment:** Assuming a complex goal only requires one skill. High-order tasks require an array of skills (e.g., `[react-specialist, tailwind-patterns, web-accessibility-auditor]`).
|
|
109
|
+
10. **Losing Socratic Contact:** Halting to ask the user a question, but not tracking the context so that when the user replies "Oh I meant the login page", the router forgets the initial objective.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 🏛️ Tribunal Integration
|
|
114
|
+
|
|
115
|
+
### ✅ Pre-Flight Self-Audit
|
|
116
|
+
```
|
|
117
|
+
✅ Are routing outputs strictly constrained to JSON Enums (Zod / Schema validation)?
|
|
118
|
+
✅ Does the schema demand `reasoning` be printed *before* the definitive classification (CoT)?
|
|
119
|
+
✅ Have explicit Few-Shot examples been provided to anchor the categorical definitions?
|
|
120
|
+
✅ Are available skills mapped correctly using a localized manifest provided to the prompt?
|
|
121
|
+
✅ Does the router explicitly reject or ask for clarity against ambiguous requests?
|
|
122
|
+
✅ Is there a confidence threshold (e.g., < 85%) triggering the Socratic Gate yield?
|
|
123
|
+
✅ Does the router correctly identify 'Exploder' tasks scaling >10 files and force `PLANNING_MODE`?
|
|
124
|
+
✅ Did I prevent the LLM from attempting to solve the underlying code problem directly in the routing stage?
|
|
125
|
+
✅ Can the router match a request to *multiple* synergistic skills rather than just one?
|
|
126
|
+
✅ Are unknown/invented skill invocations automatically rejected before downstream execution?
|
|
127
|
+
```
|