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.
Files changed (142) hide show
  1. package/.agent/agents/accessibility-reviewer.md +220 -134
  2. package/.agent/agents/ai-code-reviewer.md +233 -129
  3. package/.agent/agents/backend-specialist.md +238 -178
  4. package/.agent/agents/code-archaeologist.md +181 -119
  5. package/.agent/agents/database-architect.md +207 -164
  6. package/.agent/agents/debugger.md +218 -151
  7. package/.agent/agents/dependency-reviewer.md +136 -55
  8. package/.agent/agents/devops-engineer.md +238 -175
  9. package/.agent/agents/documentation-writer.md +221 -137
  10. package/.agent/agents/explorer-agent.md +180 -142
  11. package/.agent/agents/frontend-reviewer.md +194 -80
  12. package/.agent/agents/frontend-specialist.md +237 -188
  13. package/.agent/agents/game-developer.md +52 -184
  14. package/.agent/agents/logic-reviewer.md +149 -78
  15. package/.agent/agents/mobile-developer.md +223 -152
  16. package/.agent/agents/mobile-reviewer.md +195 -79
  17. package/.agent/agents/orchestrator.md +211 -170
  18. package/.agent/agents/penetration-tester.md +174 -131
  19. package/.agent/agents/performance-optimizer.md +203 -139
  20. package/.agent/agents/performance-reviewer.md +211 -108
  21. package/.agent/agents/product-manager.md +162 -108
  22. package/.agent/agents/project-planner.md +162 -142
  23. package/.agent/agents/qa-automation-engineer.md +242 -138
  24. package/.agent/agents/security-auditor.md +194 -170
  25. package/.agent/agents/seo-specialist.md +213 -132
  26. package/.agent/agents/sql-reviewer.md +194 -73
  27. package/.agent/agents/supervisor-agent.md +203 -156
  28. package/.agent/agents/test-coverage-reviewer.md +193 -81
  29. package/.agent/agents/type-safety-reviewer.md +208 -65
  30. package/.agent/scripts/__pycache__/auto_preview.cpython-311.pyc +0 -0
  31. package/.agent/scripts/__pycache__/bundle_analyzer.cpython-311.pyc +0 -0
  32. package/.agent/scripts/__pycache__/checklist.cpython-311.pyc +0 -0
  33. package/.agent/scripts/__pycache__/dependency_analyzer.cpython-311.pyc +0 -0
  34. package/.agent/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
  35. package/.agent/scripts/__pycache__/session_manager.cpython-311.pyc +0 -0
  36. package/.agent/scripts/__pycache__/skill_integrator.cpython-311.pyc +0 -0
  37. package/.agent/scripts/__pycache__/swarm_dispatcher.cpython-311.pyc +0 -0
  38. package/.agent/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
  39. package/.agent/scripts/__pycache__/verify_all.cpython-311.pyc +0 -0
  40. package/.agent/skills/agent-organizer/SKILL.md +126 -132
  41. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +155 -66
  42. package/.agent/skills/api-patterns/SKILL.md +289 -257
  43. package/.agent/skills/api-security-auditor/SKILL.md +172 -70
  44. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +1 -1
  45. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +1 -1
  46. package/.agent/skills/appflow-wireframe/SKILL.md +107 -100
  47. package/.agent/skills/architecture/SKILL.md +331 -200
  48. package/.agent/skills/authentication-best-practices/SKILL.md +168 -67
  49. package/.agent/skills/bash-linux/SKILL.md +154 -215
  50. package/.agent/skills/brainstorming/SKILL.md +104 -210
  51. package/.agent/skills/building-native-ui/SKILL.md +169 -70
  52. package/.agent/skills/clean-code/SKILL.md +360 -206
  53. package/.agent/skills/config-validator/SKILL.md +141 -165
  54. package/.agent/skills/csharp-developer/SKILL.md +528 -107
  55. package/.agent/skills/database-design/SKILL.md +455 -275
  56. package/.agent/skills/deployment-procedures/SKILL.md +145 -188
  57. package/.agent/skills/devops-engineer/SKILL.md +332 -134
  58. package/.agent/skills/devops-incident-responder/SKILL.md +113 -98
  59. package/.agent/skills/edge-computing/SKILL.md +157 -213
  60. package/.agent/skills/extract-design-system/SKILL.md +129 -69
  61. package/.agent/skills/framer-motion-expert/SKILL.md +939 -0
  62. package/.agent/skills/game-design-expert/SKILL.md +105 -0
  63. package/.agent/skills/game-engineering-expert/SKILL.md +122 -0
  64. package/.agent/skills/geo-fundamentals/SKILL.md +124 -215
  65. package/.agent/skills/github-operations/SKILL.md +314 -354
  66. package/.agent/skills/gsap-expert/SKILL.md +901 -0
  67. package/.agent/skills/i18n-localization/SKILL.md +138 -216
  68. package/.agent/skills/intelligent-routing/SKILL.md +127 -139
  69. package/.agent/skills/llm-engineering/SKILL.md +357 -258
  70. package/.agent/skills/local-first/SKILL.md +154 -203
  71. package/.agent/skills/mcp-builder/SKILL.md +118 -224
  72. package/.agent/skills/nextjs-react-expert/SKILL.md +783 -203
  73. package/.agent/skills/nodejs-best-practices/SKILL.md +559 -280
  74. package/.agent/skills/observability/SKILL.md +330 -285
  75. package/.agent/skills/parallel-agents/SKILL.md +122 -181
  76. package/.agent/skills/performance-profiling/SKILL.md +254 -197
  77. package/.agent/skills/plan-writing/SKILL.md +118 -188
  78. package/.agent/skills/platform-engineer/SKILL.md +123 -135
  79. package/.agent/skills/playwright-best-practices/SKILL.md +157 -76
  80. package/.agent/skills/powershell-windows/SKILL.md +146 -230
  81. package/.agent/skills/python-pro/SKILL.md +879 -114
  82. package/.agent/skills/react-specialist/SKILL.md +931 -108
  83. package/.agent/skills/realtime-patterns/SKILL.md +304 -296
  84. package/.agent/skills/rust-pro/SKILL.md +701 -240
  85. package/.agent/skills/seo-fundamentals/SKILL.md +154 -181
  86. package/.agent/skills/server-management/SKILL.md +190 -212
  87. package/.agent/skills/shadcn-ui-expert/SKILL.md +201 -68
  88. package/.agent/skills/sql-pro/SKILL.md +633 -104
  89. package/.agent/skills/swiftui-expert/SKILL.md +171 -70
  90. package/.agent/skills/systematic-debugging/SKILL.md +118 -186
  91. package/.agent/skills/tailwind-patterns/SKILL.md +576 -232
  92. package/.agent/skills/tdd-workflow/SKILL.md +137 -209
  93. package/.agent/skills/testing-patterns/SKILL.md +573 -205
  94. package/.agent/skills/vue-expert/SKILL.md +964 -119
  95. package/.agent/skills/vulnerability-scanner/SKILL.md +269 -316
  96. package/.agent/skills/web-accessibility-auditor/SKILL.md +188 -71
  97. package/.agent/skills/webapp-testing/SKILL.md +145 -236
  98. package/.agent/workflows/api-tester.md +151 -279
  99. package/.agent/workflows/audit.md +138 -168
  100. package/.agent/workflows/brainstorm.md +110 -146
  101. package/.agent/workflows/changelog.md +112 -144
  102. package/.agent/workflows/create.md +124 -139
  103. package/.agent/workflows/debug.md +189 -196
  104. package/.agent/workflows/deploy.md +189 -153
  105. package/.agent/workflows/enhance.md +151 -139
  106. package/.agent/workflows/fix.md +135 -143
  107. package/.agent/workflows/generate.md +157 -164
  108. package/.agent/workflows/migrate.md +160 -163
  109. package/.agent/workflows/orchestrate.md +168 -151
  110. package/.agent/workflows/performance-benchmarker.md +123 -305
  111. package/.agent/workflows/plan.md +173 -151
  112. package/.agent/workflows/preview.md +80 -137
  113. package/.agent/workflows/refactor.md +183 -153
  114. package/.agent/workflows/review-ai.md +129 -140
  115. package/.agent/workflows/review.md +116 -155
  116. package/.agent/workflows/session.md +94 -154
  117. package/.agent/workflows/status.md +79 -125
  118. package/.agent/workflows/strengthen-skills.md +139 -99
  119. package/.agent/workflows/swarm.md +179 -194
  120. package/.agent/workflows/test.md +211 -166
  121. package/.agent/workflows/tribunal-backend.md +113 -111
  122. package/.agent/workflows/tribunal-database.md +115 -132
  123. package/.agent/workflows/tribunal-frontend.md +118 -115
  124. package/.agent/workflows/tribunal-full.md +133 -136
  125. package/.agent/workflows/tribunal-mobile.md +119 -123
  126. package/.agent/workflows/tribunal-performance.md +133 -152
  127. package/.agent/workflows/ui-ux-pro-max.md +143 -171
  128. package/README.md +11 -15
  129. package/package.json +1 -1
  130. package/.agent/skills/dotnet-core-expert/SKILL.md +0 -103
  131. package/.agent/skills/framer-motion-animations/SKILL.md +0 -74
  132. package/.agent/skills/game-development/2d-games/SKILL.md +0 -119
  133. package/.agent/skills/game-development/3d-games/SKILL.md +0 -135
  134. package/.agent/skills/game-development/SKILL.md +0 -236
  135. package/.agent/skills/game-development/game-art/SKILL.md +0 -185
  136. package/.agent/skills/game-development/game-audio/SKILL.md +0 -190
  137. package/.agent/skills/game-development/game-design/SKILL.md +0 -129
  138. package/.agent/skills/game-development/mobile-games/SKILL.md +0 -108
  139. package/.agent/skills/game-development/multiplayer/SKILL.md +0 -132
  140. package/.agent/skills/game-development/pc-games/SKILL.md +0 -144
  141. package/.agent/skills/game-development/vr-ar/SKILL.md +0 -123
  142. 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 patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.
4
- allowed-tools: Read, Write, Edit, Glob, Grep
5
- version: 1.0.0
6
- last-updated: 2026-03-12
7
- applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
8
- ---
9
-
10
- # Internationalization & Localization
11
-
12
- > Internationalization (i18n) is preparing code to support multiple languages.
13
- > Localization (l10n) is the work of adapting to a specific locale.
14
- > Do i18n once, properly. Do l10n for each market.
15
-
16
- ---
17
-
18
- ## The Core Rule: No Hardcoded Strings
19
-
20
- Every user-visible string in the source code is a localization problem waiting to happen.
21
-
22
- ```ts
23
- // ❌ Hardcoded — untranslatable
24
- <button>Save Changes</button>
25
- <p>You have {count} messages</p>
26
- <p>Error: Invalid email address</p>
27
-
28
- // ✅ Key-referenced — translatable
29
- <button>{t('common.save')}</button>
30
- <p>{t('inbox.messageCount', { count })}</p>
31
- <p>{t('errors.invalidEmail')}</p>
32
- ```
33
-
34
- ---
35
-
36
- ## Translation File Structure
37
-
38
- Organize translation keys hierarchically — flat files become unmaintainable past ~50 keys:
39
-
40
- ```json
41
- // en.json
42
- {
43
- "common": {
44
- "save": "Save Changes",
45
- "cancel": "Cancel",
46
- "loading": "Loading…",
47
- "error": "Something went wrong"
48
- },
49
- "auth": {
50
- "login": "Sign In",
51
- "logout": "Sign Out",
52
- "register": "Create Account",
53
- "errors": {
54
- "invalidEmail": "Enter a valid email address",
55
- "passwordTooShort": "Password must be at least {{min}} characters"
56
- }
57
- },
58
- "inbox": {
59
- "messageCount_one": "{{count}} message",
60
- "messageCount_other": "{{count}} messages"
61
- }
62
- }
63
- ```
64
-
65
- **Key naming conventions:**
66
- - `feature.element` or `feature.element.state`
67
- - Error keys under `.errors`
68
- - Never use the English text as the key (`"Save Changes": "Save Changes"`)
69
-
70
- ---
71
-
72
- ## Pluralization
73
-
74
- Pluralization rules differ per language. Use your i18n library's plural system never manual `if count > 1`:
75
-
76
- ```ts
77
- // ❌ Only works for English
78
- const label = count === 1 ? 'message' : 'messages';
79
-
80
- // ✅ i18next handles per-language plural rules
81
- t('inbox.messageCount', { count })
82
-
83
- // Translation files handle the variants:
84
- // English: { "messageCount_one": "{{count}} message", "messageCount_other": "{{count}} messages" }
85
- // Arabic: 6 plural forms (zero, one, two, few, many, other)
86
- // Russian: 3 plural forms with complex rules
87
- ```
88
-
89
- ---
90
-
91
- ## Date, Number & Currency Formatting
92
-
93
- Never format these manually. Use the browser's `Intl` API:
94
-
95
- ```ts
96
- // Date
97
- const date = new Date();
98
- new Intl.DateTimeFormat('en-US').format(date); // "2/20/2026"
99
- new Intl.DateTimeFormat('de-DE').format(date); // "20.2.2026"
100
-
101
- // Number
102
- new Intl.NumberFormat('en-US').format(1234567.89); // "1,234,567.89"
103
- new Intl.NumberFormat('de-DE').format(1234567.89); // "1.234.567,89"
104
-
105
- // Currency
106
- new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(99.99);
107
- // "$99.99"
108
- new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(99.99);
109
- // "99,99 €"
110
- ```
111
-
112
- ---
113
-
114
- ## RTL (Right-to-Left) Support
115
-
116
- Arabic, Hebrew, Persian, Urdu are RTL languages. Supporting them requires more than flipping direction.
117
-
118
- ```html
119
- <!-- Set direction on html element based on locale -->
120
- <html lang="ar" dir="rtl">
121
-
122
- <!-- Or dynamically -->
123
- <html lang={locale} dir={isRTL(locale) ? 'rtl' : 'ltr'}>
124
- ```
125
-
126
- ```css
127
- /* Use logical properties — they flip automatically with direction */
128
- /* Physical: only works for LTR */
129
- padding-left: 1rem;
130
- margin-right: 2rem;
131
- border-left: 2px solid;
132
-
133
- /* Logical: works for both LTR and RTL */
134
- padding-inline-start: 1rem;
135
- margin-inline-end: 2rem;
136
- border-inline-start: 2px solid;
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: The LLM Pre-Router. Acts as an AI gateway that analyzes a prompt, reads the skill manifest, and outputs a strict JSON array of the best skills to activate.
4
- allowed-tools: Read, Write, Edit, Glob, Grep
5
- version: 1.0.0
6
- last-updated: 2026-03-12
7
- applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
8
- ---
9
-
10
- # 🚦 Intelligent Pre-Router (LLM Gateway)
11
-
12
- > The best specialist response is useless if the wrong specialist shows up.
13
- > Routing is the first decision and it affects everything after.
14
-
15
- ---
16
-
17
- ## 🎭 Your Persona: The LLM Gateway
18
-
19
- When you are acting as the `intelligent-routing` agent, **you are a gateway, not an implementer.**
20
-
21
- Your sole purpose is to read the user's prompt, understand their core intent, and figure out which of our specialized agents and skills need to be loaded into context to solve the problem accurately.
22
-
23
- **Rules of the Gateway:**
24
- 1. **Zero Implementation:** You must never write code, propose architectures, or answer the user's technical question directly while functioning as the router.
25
- 2. **Context Minimization:** You do not read every file in the project. You only read the user's prompt and the skill manifest.
26
-
27
- ---
28
-
29
- ## 🗺️ How to Route (The Sequence)
30
-
31
- When activated to route a request, execute this exact sequence:
32
-
33
- 1. **Read the Manifest:** Read the file `.agent/skills/intelligent-routing/router-manifest.md`. This contains the condensed index of all 60+ available skills.
34
- 2. **Analyze the Prompt:** Identify the domains (e.g., UI design, database optimization, testing).
35
- 3. **Select Skills:** Choose 1 to 3 relevant skills from the manifest. Do not select more than 3 to avoid context bloating.
36
- 4. **Determine Complexity:**
37
- * If 1 skill is selected: This is a single-domain task.
38
- * If 2+ skills are selected: This is a multi-domain task requiring the `orchestrator`.
39
- 5. **Output the JSON Array:** See the output format below.
40
-
41
- ---
42
-
43
- ## 📤 Required Output Format
44
-
45
- You must output your decision strictly as a JSON array inside a markdown block. Do not add conversational fluff before or after.
46
-
47
- **Example 1: Single Domain Request ("Make this UI match apple's aesthetic")**
48
- ```json
49
- {
50
- "domains": ["UI", "Design"],
51
- "selected_skills": ["frontend-design", "ui-ux-researcher"],
52
- "requires_orchestrator": false,
53
- "rationale": "The user is asking for aesthetic design improvements, requiring specific frontend UI heuristics."
54
- }
55
- ```
56
-
57
- **Example 2: Multi-Domain Request ("Build a full-stack login page with JWTs")**
58
- ```json
59
- {
60
- "domains": ["Frontend", "Backend", "Security"],
61
- "selected_skills": ["frontend-specialist", "backend-specialist", "security-auditor"],
62
- "requires_orchestrator": true,
63
- "rationale": "Full-stack feature touching React, Express, and authentication."
64
- }
65
- ```
66
-
67
- Once you output this JSON, the host AI IDE (Cursor, Windsurf, etc.) or CLI will read it and automatically activate those specific `SKILL.md` files for the actual implementation phase.
68
-
69
- ---
70
-
71
- ## 🤖 Router-Specific Anti-Hallucination Guards
72
-
73
- As an AI, you are prone to certain hallucinations when routing tasks. Adhere strictly to these rules:
74
-
75
- 1. **No Ghost Skills:** Every string in the `selected_skills` array MUST exactly match a skill directory name found in `router-manifest.md`.
76
- * *❌ AI Trait:* Inventing a skill like `jwt-specialist` because the user asked about JWTs.
77
- * *✅ Correction:* Selecting real skills like `backend-specialist` and `security-auditor`.
78
- 2. **Strict JSON:** If your response contains anything other than the JSON block, downstream parsers will fail. Do not say "Here is the routing decision:". Just output the JSON block.
79
- 3. **Keyword Over-indexing:** Do not blindly match words. If a user says "My API is slow", you need `performance-optimizer` and `backend-specialist`, not just anything that says "API" like `api-tester`.
80
-
81
- ---
82
-
83
- ## Output Format
84
-
85
- When this skill produces a recommendation or design decision, structure your output as:
86
-
87
- ```
88
- ━━━ Intelligent Routing Recommendation ━━━━━━━━━━━━━━━━
89
- Decision: [what was chosen / proposed]
90
- Rationale: [why — one concise line]
91
- Trade-offs: [what is consciously accepted]
92
- Next action: [concrete next step for the user]
93
- ─────────────────────────────────────────────────
94
- Pre-Flight: ✅ All checks passed
95
- or ❌ [blocking item that must be resolved first]
96
- ```
97
-
98
-
99
-
100
- ---
101
-
102
- ## 🤖 LLM-Specific Traps
103
-
104
- AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
105
-
106
- 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
107
- 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
108
- 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
109
- 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
110
- 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
111
-
112
- ---
113
-
114
- ## 🏛️ Tribunal Integration (Anti-Hallucination)
115
-
116
- **Slash command: `/review` or `/tribunal-full`**
117
- **Active reviewers: `logic-reviewer` · `security-auditor`**
118
-
119
- ### Forbidden AI Tropes
120
-
121
- 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
122
- 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
123
- 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
124
-
125
- ### Pre-Flight Self-Audit
126
-
127
- Review these questions before confirming output:
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
+ ```