tribunal-kit 1.0.0 โ†’ 2.4.2

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 (127) hide show
  1. package/.agent/.shared/ui-ux-pro-max/README.md +3 -3
  2. package/.agent/ARCHITECTURE.md +205 -10
  3. package/.agent/GEMINI.md +37 -7
  4. package/.agent/agents/accessibility-reviewer.md +134 -0
  5. package/.agent/agents/ai-code-reviewer.md +129 -0
  6. package/.agent/agents/frontend-specialist.md +3 -0
  7. package/.agent/agents/game-developer.md +21 -21
  8. package/.agent/agents/logic-reviewer.md +12 -0
  9. package/.agent/agents/mobile-reviewer.md +79 -0
  10. package/.agent/agents/orchestrator.md +56 -26
  11. package/.agent/agents/performance-reviewer.md +36 -0
  12. package/.agent/agents/supervisor-agent.md +156 -0
  13. package/.agent/agents/swarm-worker-contracts.md +166 -0
  14. package/.agent/agents/swarm-worker-registry.md +92 -0
  15. package/.agent/rules/GEMINI.md +134 -5
  16. package/.agent/scripts/bundle_analyzer.py +259 -0
  17. package/.agent/scripts/dependency_analyzer.py +247 -0
  18. package/.agent/scripts/lint_runner.py +188 -0
  19. package/.agent/scripts/patch_skills_meta.py +177 -0
  20. package/.agent/scripts/patch_skills_output.py +285 -0
  21. package/.agent/scripts/schema_validator.py +279 -0
  22. package/.agent/scripts/security_scan.py +224 -0
  23. package/.agent/scripts/session_manager.py +144 -3
  24. package/.agent/scripts/skill_integrator.py +234 -0
  25. package/.agent/scripts/strengthen_skills.py +220 -0
  26. package/.agent/scripts/swarm_dispatcher.py +317 -0
  27. package/.agent/scripts/test_runner.py +192 -0
  28. package/.agent/scripts/test_swarm_dispatcher.py +163 -0
  29. package/.agent/skills/agent-organizer/SKILL.md +132 -0
  30. package/.agent/skills/agentic-patterns/SKILL.md +335 -0
  31. package/.agent/skills/api-patterns/SKILL.md +226 -50
  32. package/.agent/skills/app-builder/SKILL.md +215 -52
  33. package/.agent/skills/architecture/SKILL.md +176 -31
  34. package/.agent/skills/bash-linux/SKILL.md +150 -134
  35. package/.agent/skills/behavioral-modes/SKILL.md +152 -160
  36. package/.agent/skills/brainstorming/SKILL.md +148 -101
  37. package/.agent/skills/brainstorming/dynamic-questioning.md +10 -0
  38. package/.agent/skills/clean-code/SKILL.md +139 -134
  39. package/.agent/skills/code-review-checklist/SKILL.md +177 -80
  40. package/.agent/skills/config-validator/SKILL.md +165 -0
  41. package/.agent/skills/csharp-developer/SKILL.md +107 -0
  42. package/.agent/skills/database-design/SKILL.md +252 -29
  43. package/.agent/skills/deployment-procedures/SKILL.md +122 -175
  44. package/.agent/skills/devops-engineer/SKILL.md +134 -0
  45. package/.agent/skills/devops-incident-responder/SKILL.md +98 -0
  46. package/.agent/skills/documentation-templates/SKILL.md +175 -121
  47. package/.agent/skills/dotnet-core-expert/SKILL.md +103 -0
  48. package/.agent/skills/edge-computing/SKILL.md +213 -0
  49. package/.agent/skills/frontend-design/SKILL.md +76 -0
  50. package/.agent/skills/frontend-design/color-system.md +18 -0
  51. package/.agent/skills/frontend-design/typography-system.md +18 -0
  52. package/.agent/skills/game-development/SKILL.md +69 -0
  53. package/.agent/skills/geo-fundamentals/SKILL.md +158 -99
  54. package/.agent/skills/github-operations/SKILL.md +354 -0
  55. package/.agent/skills/i18n-localization/SKILL.md +158 -96
  56. package/.agent/skills/intelligent-routing/SKILL.md +89 -285
  57. package/.agent/skills/intelligent-routing/router-manifest.md +65 -0
  58. package/.agent/skills/lint-and-validate/SKILL.md +229 -27
  59. package/.agent/skills/llm-engineering/SKILL.md +258 -0
  60. package/.agent/skills/local-first/SKILL.md +203 -0
  61. package/.agent/skills/mcp-builder/SKILL.md +159 -111
  62. package/.agent/skills/mobile-design/SKILL.md +102 -282
  63. package/.agent/skills/nextjs-react-expert/SKILL.md +143 -227
  64. package/.agent/skills/nodejs-best-practices/SKILL.md +201 -254
  65. package/.agent/skills/observability/SKILL.md +285 -0
  66. package/.agent/skills/parallel-agents/SKILL.md +124 -118
  67. package/.agent/skills/performance-profiling/SKILL.md +143 -89
  68. package/.agent/skills/plan-writing/SKILL.md +133 -97
  69. package/.agent/skills/platform-engineer/SKILL.md +135 -0
  70. package/.agent/skills/powershell-windows/SKILL.md +167 -104
  71. package/.agent/skills/python-patterns/SKILL.md +149 -361
  72. package/.agent/skills/python-pro/SKILL.md +114 -0
  73. package/.agent/skills/react-specialist/SKILL.md +107 -0
  74. package/.agent/skills/readme-builder/SKILL.md +270 -0
  75. package/.agent/skills/realtime-patterns/SKILL.md +296 -0
  76. package/.agent/skills/red-team-tactics/SKILL.md +136 -134
  77. package/.agent/skills/rust-pro/SKILL.md +237 -173
  78. package/.agent/skills/seo-fundamentals/SKILL.md +134 -82
  79. package/.agent/skills/server-management/SKILL.md +155 -104
  80. package/.agent/skills/sql-pro/SKILL.md +104 -0
  81. package/.agent/skills/systematic-debugging/SKILL.md +156 -79
  82. package/.agent/skills/tailwind-patterns/SKILL.md +163 -205
  83. package/.agent/skills/tdd-workflow/SKILL.md +148 -88
  84. package/.agent/skills/test-result-analyzer/SKILL.md +299 -0
  85. package/.agent/skills/testing-patterns/SKILL.md +141 -114
  86. package/.agent/skills/trend-researcher/SKILL.md +228 -0
  87. package/.agent/skills/ui-ux-pro-max/SKILL.md +107 -0
  88. package/.agent/skills/ui-ux-researcher/SKILL.md +234 -0
  89. package/.agent/skills/vue-expert/SKILL.md +118 -0
  90. package/.agent/skills/vulnerability-scanner/SKILL.md +228 -188
  91. package/.agent/skills/web-design-guidelines/SKILL.md +148 -33
  92. package/.agent/skills/webapp-testing/SKILL.md +171 -122
  93. package/.agent/skills/whimsy-injector/SKILL.md +349 -0
  94. package/.agent/skills/workflow-optimizer/SKILL.md +219 -0
  95. package/.agent/workflows/api-tester.md +279 -0
  96. package/.agent/workflows/audit.md +168 -0
  97. package/.agent/workflows/brainstorm.md +65 -19
  98. package/.agent/workflows/changelog.md +144 -0
  99. package/.agent/workflows/create.md +67 -14
  100. package/.agent/workflows/debug.md +122 -30
  101. package/.agent/workflows/deploy.md +82 -31
  102. package/.agent/workflows/enhance.md +59 -27
  103. package/.agent/workflows/fix.md +143 -0
  104. package/.agent/workflows/generate.md +84 -20
  105. package/.agent/workflows/migrate.md +163 -0
  106. package/.agent/workflows/orchestrate.md +66 -17
  107. package/.agent/workflows/performance-benchmarker.md +305 -0
  108. package/.agent/workflows/plan.md +76 -33
  109. package/.agent/workflows/preview.md +73 -17
  110. package/.agent/workflows/refactor.md +153 -0
  111. package/.agent/workflows/review-ai.md +140 -0
  112. package/.agent/workflows/review.md +83 -16
  113. package/.agent/workflows/session.md +154 -0
  114. package/.agent/workflows/status.md +74 -18
  115. package/.agent/workflows/strengthen-skills.md +99 -0
  116. package/.agent/workflows/swarm.md +194 -0
  117. package/.agent/workflows/test.md +80 -31
  118. package/.agent/workflows/tribunal-backend.md +55 -13
  119. package/.agent/workflows/tribunal-database.md +62 -18
  120. package/.agent/workflows/tribunal-frontend.md +58 -12
  121. package/.agent/workflows/tribunal-full.md +70 -11
  122. package/.agent/workflows/tribunal-mobile.md +123 -0
  123. package/.agent/workflows/tribunal-performance.md +152 -0
  124. package/.agent/workflows/ui-ux-pro-max.md +100 -82
  125. package/README.md +117 -62
  126. package/bin/tribunal-kit.js +542 -288
  127. package/package.json +10 -6
@@ -1,286 +1,202 @@
1
1
  ---
2
- name: react-best-practices
3
- description: React and Next.js performance optimization from Vercel Engineering. Use when building React components, optimizing performance, eliminating waterfalls, reducing bundle size, reviewing code for performance issues, or implementing server/client-side optimizations.
4
- allowed-tools: Read, Write, Edit, Glob, Grep, Bash
2
+ name: nextjs-react-expert
3
+ description: Next.js App Router and React v19+ performance optimization from Vercel Engineering. Use when building React components, optimizing performance, implementing React Compiler patterns, eliminating waterfalls, reducing JS payload, or implementing Streaming/PPR optimizations.
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
5
8
  ---
6
9
 
7
- # Next.js & React Performance Expert
10
+ # React v19+ & Next.js Pro-Max Performance Patterns
8
11
 
9
- > **From Vercel Engineering** - 57 optimization rules prioritized by impact
10
- > **Philosophy:** Eliminate waterfalls first, optimize bundles second, then micro-optimize.
12
+ > The fastest code is code that doesn't run.
13
+ > The second fastest is code that runs on the edge and streams the result.
11
14
 
12
15
  ---
13
16
 
14
- ## ๐ŸŽฏ Selective Reading Rule (MANDATORY)
17
+ ## Contemporary Paradigm Shifts
15
18
 
16
- **Read ONLY sections relevant to your task!** Check the content map below and load what you need.
17
-
18
- > ๐Ÿ”ด **For performance reviews: Start with CRITICAL sections (1-2), then move to HIGH/MEDIUM.**
19
+ | Legacy (React 18 / Next.js Pages) | Modern (React 19 / Next.js App Router) |
20
+ |---|---|
21
+ | Manual `useMemo()` / `useCallback()` | **React Compiler** handles memoization natively |
22
+ | `getServerSideProps` / Client Fetching | **React Server Components (RSC)** default |
23
+ | `useActionState` custom hooks | **Server Actions** native mutations |
24
+ | Loading spinners on client | **Streaming UI** & `Suspense` boundaries |
25
+ | Static *or* Dynamic pages | **Partial Prerendering (PPR)** (Static shell, dynamic guts) |
19
26
 
20
27
  ---
21
28
 
22
- ## ๐Ÿ“‘ Content Map
23
-
24
- | File | Impact | Rules | When to Read |
25
- | --------------------------------------- | ------------------ | -------- | --------------------------------------------------------------- |
26
- | `1-async-eliminating-waterfalls.md` | ๐Ÿ”ด **CRITICAL** | 5 rules | Slow page loads, sequential API calls, data fetching waterfalls |
27
- | `2-bundle-bundle-size-optimization.md` | ๐Ÿ”ด **CRITICAL** | 5 rules | Large bundle size, slow Time to Interactive, First Load issues |
28
- | `3-server-server-side-performance.md` | ๐ŸŸ  **HIGH** | 7 rules | Slow SSR, API route optimization, server-side waterfalls |
29
- | `4-client-client-side-data-fetching.md` | ๐ŸŸก **MEDIUM-HIGH** | 4 rules | Client data management, SWR patterns, deduplication |
30
- | `5-rerender-re-render-optimization.md` | ๐ŸŸก **MEDIUM** | 12 rules | Excessive re-renders, React performance, memoization |
31
- | `6-rendering-rendering-performance.md` | ๐ŸŸก **MEDIUM** | 9 rules | Rendering bottlenecks, virtualization, image optimization |
32
- | `7-js-javascript-performance.md` | โšช **LOW-MEDIUM** | 12 rules | Micro-optimizations, caching, loop performance |
33
- | `8-advanced-advanced-patterns.md` | ๐Ÿ”ต **VARIABLE** | 3 rules | Advanced React patterns, useLatest, init-once |
29
+ ## Core Architecture Decision Framework
34
30
 
35
- **Total: 57 rules across 8 categories**
36
-
37
- ---
38
-
39
- ## ๐Ÿš€ Quick Decision Tree
40
-
41
- **What's your performance issue?**
31
+ ### Server vs. Client Component
32
+ By default, everything in Next.js App Router is a Server Component.
42
33
 
43
34
  ```
44
- ๐ŸŒ Slow page loads / Long Time to Interactive
45
- โ†’ Read Section 1: Eliminating Waterfalls
46
- โ†’ Read Section 2: Bundle Size Optimization
47
-
48
- ๐Ÿ“ฆ Large bundle size (> 200KB)
49
- โ†’ Read Section 2: Bundle Size Optimization
50
- โ†’ Check: Dynamic imports, barrel imports, tree-shaking
51
-
52
- ๐Ÿ–ฅ๏ธ Slow Server-Side Rendering
53
- โ†’ Read Section 3: Server-Side Performance
54
- โ†’ Check: Parallel data fetching, streaming
55
-
56
- ๐Ÿ”„ Too many re-renders / UI lag
57
- โ†’ Read Section 5: Re-render Optimization
58
- โ†’ Check: React.memo, useMemo, useCallback
59
-
60
- ๐ŸŽจ Rendering performance issues
61
- โ†’ Read Section 6: Rendering Performance
62
- โ†’ Check: Virtualization, layout thrashing
35
+ Default: Server Component (Zero JS sent to client)
36
+ Switch to Client ('use client') ONLY when:
37
+ - Uses browser APIs (window, localStorage, navigator)
38
+ - Needs DOM event handlers (onClick, onChange)
39
+ - Needs state/effects (useState, useEffect, useOptimistic)
40
+ ```
63
41
 
64
- ๐ŸŒ Client-side data fetching problems
65
- โ†’ Read Section 4: Client-Side Data Fetching
66
- โ†’ Check: SWR deduplication, localStorage
42
+ **The Interleaved Pattern:** Never make a layout or major shell `'use client'`.
43
+ Pass Server Components *into* Client components as `children`.
67
44
 
68
- โœจ Need advanced patterns
69
- โ†’ Read Section 8: Advanced Patterns
45
+ ```tsx
46
+ // โœ… Correct: The heavy static content stays on the server
47
+ <ClientInteractiveDrawer>
48
+ <ServerHeavyGraph data={dbData} />
49
+ </ClientInteractiveDrawer>
70
50
  ```
71
51
 
72
52
  ---
73
53
 
74
- ## ๐Ÿ“Š Impact Priority Guide
54
+ ## Extreme Waterfall Elimination
75
55
 
76
- **Use this order when doing comprehensive optimization:**
56
+ The most impactful Next.js optimization is eliminating network waterfalls.
77
57
 
58
+ ```tsx
59
+ // โŒ CRITICAL WATERFALL: 3 sequential async calls, each waits for the previous
60
+ async function Dashboard() {
61
+ const user = await getUser(); // 200ms
62
+ const posts = await getPosts(); // 200ms (waits unnecessarily)
63
+ const analytics = await getAnalytics(); // 200ms (waits unnecessarily)
64
+ // Total: 600ms (Blocked UI)
65
+ }
78
66
  ```
79
- 1๏ธโƒฃ CRITICAL (Biggest Gains - Do First):
80
- โ”œโ”€ Section 1: Eliminating Waterfalls
81
- โ”‚ โ””โ”€ Each waterfall adds full network latency (100-500ms+)
82
- โ””โ”€ Section 2: Bundle Size Optimization
83
- โ””โ”€ Affects Time to Interactive and Largest Contentful Paint
84
-
85
- 2๏ธโƒฃ HIGH (Significant Impact - Do Second):
86
- โ””โ”€ Section 3: Server-Side Performance
87
- โ””โ”€ Eliminates server-side waterfalls, faster response times
88
-
89
- 3๏ธโƒฃ MEDIUM (Moderate Gains - Do Third):
90
- โ”œโ”€ Section 4: Client-Side Data Fetching
91
- โ”œโ”€ Section 5: Re-render Optimization
92
- โ””โ”€ Section 6: Rendering Performance
93
-
94
- 4๏ธโƒฃ LOW (Polish - Do Last):
95
- โ”œโ”€ Section 7: JavaScript Performance
96
- โ””โ”€ Section 8: Advanced Patterns
97
- ```
98
-
99
- ---
100
67
 
101
- ## ๐Ÿ”— Related Skills
68
+ ### Fix 1: Parallel Fetching
69
+ ```tsx
70
+ // โœ… Parallel โ€” all 3 start at the same time
71
+ async function Dashboard() {
72
+ const [user, posts, analytics] = await Promise.all([
73
+ getUser(),
74
+ getPosts(),
75
+ getAnalytics(),
76
+ ]);
77
+ // Total: ~200ms (Blocked UI, but faster)
78
+ }
79
+ ```
102
80
 
103
- | Need | Skill |
104
- | ----------------------- | --------------------------------- |
105
- | API design patterns | `@[skills/api-patterns]` |
106
- | Database optimization | `@[skills/database-design]` |
107
- | Testing strategies | `@[skills/testing-patterns]` |
108
- | UI/UX design principles | `@[skills/frontend-design]` |
109
- | TypeScript patterns | `@[skills/typescript-expert]` |
110
- | Deployment & DevOps | `@[skills/deployment-procedures]` |
81
+ ### Fix 2: Streaming UI (The Pro-Max Way)
82
+ Do not await slow data at the page level. Wrap slow components in `<Suspense>`.
83
+
84
+ ```tsx
85
+ // ๐Ÿš€ PRO-MAX: Streaming Components
86
+ export default function Dashboard() {
87
+ return (
88
+ <main>
89
+ <FastHeader />
90
+ <Suspense fallback={<AnalyticsSkeleton />}>
91
+ {/* React streams this HTML down when the DB resolves */}
92
+ <SlowAnalyticsComponent />
93
+ </Suspense>
94
+ </main>
95
+ );
96
+ }
97
+ ```
111
98
 
112
99
  ---
113
100
 
114
- ## โœ… Performance Review Checklist
115
-
116
- Before shipping to production:
117
-
118
- **Critical (Must Fix):**
119
-
120
- - [ ] No sequential data fetching (waterfalls eliminated)
121
- - [ ] Bundle size < 200KB for main bundle
122
- - [ ] No barrel imports in app code
123
- - [ ] Dynamic imports used for large components
124
- - [ ] Parallel data fetching where possible
125
-
126
- **High Priority:**
127
-
128
- - [ ] Server components used where appropriate
129
- - [ ] API routes optimized (no N+1 queries)
130
- - [ ] Suspense boundaries for data fetching
131
- - [ ] Static generation used where possible
101
+ ## Partial Prerendering (PPR)
132
102
 
133
- **Medium Priority:**
103
+ PPR allows a single route to have both an ultra-fast static edge-cached shell, and dynamic personalized content streamed in instantly after execution.
134
104
 
135
- - [ ] Expensive computations memoized
136
- - [ ] List rendering virtualized (if > 100 items)
137
- - [ ] Images optimized with next/image
138
- - [ ] No unnecessary re-renders
139
-
140
- **Low Priority (Polish):**
141
-
142
- - [ ] Hot path loops optimized
143
- - [ ] RegExp patterns hoisted
144
- - [ ] Property access cached in loops
105
+ - Avoid using global `cookies()` or `headers()` high up in the component tree, as this forces the entire route to be dynamic.
106
+ - Isolate dynamic data fetching within a `<Suspense>` boundary so the rest of the page can be statically pre-rendered at build time.
145
107
 
146
108
  ---
147
109
 
148
- ## โŒ Anti-Patterns (Common Mistakes)
149
-
150
- **DON'T:**
151
-
152
- - โŒ Use sequential `await` for independent operations
153
- - โŒ Import entire libraries when you need one function
154
- - โŒ Use barrel exports (`index.ts` re-exports) in app code
155
- - โŒ Skip dynamic imports for large components/libraries
156
- - โŒ Fetch data in useEffect without deduplication
157
- - โŒ Forget to memoize expensive computations
158
- - โŒ Use client components when server components work
110
+ ## AI & Streaming UI Responses
159
111
 
160
- **DO:**
161
-
162
- - โœ… Fetch data in parallel with `Promise.all()`
163
- - โœ… Use dynamic imports: `const Comp = dynamic(() => import('./Heavy'))`
164
- - โœ… Import directly: `import { specific } from 'library/specific'`
165
- - โœ… Use Suspense boundaries for better UX
166
- - โœ… Leverage React Server Components
167
- - โœ… Measure performance before optimizing
168
- - โœ… Use Next.js built-in optimizations (next/image, next/font)
169
-
170
- ---
112
+ When building GenAI interfaces, waiting for complete API responses breaks the "Doherty Threshold" (400ms).
171
113
 
172
- ## ๐ŸŽฏ How to Use This Skill
114
+ - **Use the `ai` SDK (`@ai-sdk/react`)** to stream text using `useChat` or `useCompletion`.
115
+ - **Generative UI (RSC streaming):** Stream actual React Server Components back from the LLM, not just strings.
173
116
 
174
- ### For New Features:
175
-
176
- 1. Check **Section 1 & 2** while building (prevent waterfalls, keep bundle small)
177
- 2. Use server components by default (Section 3)
178
- 3. Apply memoization for expensive operations (Section 5)
179
-
180
- ### For Performance Reviews:
181
-
182
- 1. Start with **Section 1** (waterfalls = biggest impact)
183
- 2. Then **Section 2** (bundle size)
184
- 3. Then **Section 3** (server-side)
185
- 4. Finally other sections as needed
186
-
187
- ### For Debugging Slow Performance:
188
-
189
- 1. Identify the symptom (slow load, lag, etc.)
190
- 2. Use Quick Decision Tree above
191
- 3. Read relevant section
192
- 4. Apply fixes in priority order
117
+ ```tsx
118
+ // โœ… AI Generative UI response
119
+ return (
120
+ <div>
121
+ Here is the weather:
122
+ <Suspense fallback={<WeatherSkeleton />}>
123
+ <WeatherCard promise={llmTools.getWeather(location)} />
124
+ </Suspense>
125
+ </div>
126
+ )
127
+ ```
193
128
 
194
129
  ---
195
130
 
196
- ## ๐Ÿ“š Learning Path
197
-
198
- **Beginner (Focus on Critical):**
199
- โ†’ Section 1: Eliminating Waterfalls
200
- โ†’ Section 2: Bundle Size Optimization
131
+ ## Bundle Size & JS Dropping
201
132
 
202
- **Intermediate (Add High Priority):**
203
- โ†’ Section 3: Server-Side Performance
204
- โ†’ Section 5: Re-render Optimization
205
-
206
- **Advanced (Full Optimization):**
207
- โ†’ All sections + Section 8: Advanced Patterns
133
+ - **Import strictly:** Use barrel files cautiously. Ensure `package.json` `sideEffects: false` is respected so bundlers can tree-shake.
134
+ - **Client boundaries low:** Push `'use client'` as far down the component tree as mathematically possible.
135
+ - **Lazy loading heavy client deps:**
136
+ ```tsx
137
+ import dynamic from 'next/dynamic'
138
+ // Only load D3.js when the user actually opens the modal
139
+ const HeavyChart = dynamic(() => import('./HeavyChart'), { ssr: false })
140
+ ```
208
141
 
209
142
  ---
210
143
 
211
- ## ๐Ÿ” Validation Script
144
+ ## Key Anti-Patterns
212
145
 
213
- | Script | Purpose | Command |
214
- | -------------------------------------- | --------------------------- | ------------------------------------------------------------ |
215
- | `scripts/react_performance_checker.py` | Automated performance audit | `python scripts/react_performance_checker.py <project_path>` |
146
+ | Pattern | Problem | Fix |
147
+ |---|---|---|
148
+ | Fetching via `useEffect` | Client waterfall, huge CLS, breaks SSR | Fetch in RSC or use `SWR`/`React Query` |
149
+ | Manual `useMemo` everywhere | Hurts code readability; React 18 legacy | Trust **React Compiler** to optimize renders automatically |
150
+ | Missing `key` on mapped lists | Complete DOM destruction on update | Use stable unique IDs (never `index`) |
151
+ | Unhandled Server Actions | Silent errors on DB failures | Wrap in `try/catch` and return `{ error }` objects |
152
+ | Client-side secret passing | Exposes API keys | `server-only` package + Server Actions |
216
153
 
217
154
  ---
218
155
 
219
- ## ๐Ÿ“– Section Details
220
-
221
- ### Section 1: Eliminating Waterfalls (CRITICAL)
222
-
223
- **Impact:** Each waterfall adds 100-500ms+ latency
224
- **Key Concepts:** Parallel fetching, Promise.all(), Suspense boundaries, preloading
225
-
226
- ### Section 2: Bundle Size Optimization (CRITICAL)
227
-
228
- **Impact:** Directly affects Time to Interactive, Largest Contentful Paint
229
- **Key Concepts:** Dynamic imports, tree-shaking, barrel import avoidance
230
-
231
- ### Section 3: Server-Side Performance (HIGH)
156
+ ## Output Format
232
157
 
233
- **Impact:** Faster server responses, better SEO
234
- **Key Concepts:** Parallel server fetching, streaming, API route optimization
158
+ When this skill produces or reviews code, structure your output as follows:
235
159
 
236
- ### Section 4: Client-Side Data Fetching (MEDIUM-HIGH)
237
-
238
- **Impact:** Reduces redundant requests, better UX
239
- **Key Concepts:** SWR deduplication, localStorage caching, event listeners
240
-
241
- ### Section 5: Re-render Optimization (MEDIUM)
242
-
243
- **Impact:** Smoother UI, less wasted computation
244
- **Key Concepts:** React.memo, useMemo, useCallback, component structure
245
-
246
- ### Section 6: Rendering Performance (MEDIUM)
247
-
248
- **Impact:** Better rendering efficiency
249
- **Key Concepts:** Virtualization, image optimization, layout thrashing
250
-
251
- ### Section 7: JavaScript Performance (LOW-MEDIUM)
252
-
253
- **Impact:** Incremental improvements in hot paths
254
- **Key Concepts:** Loop optimization, caching, RegExp hoisting
160
+ ```
161
+ โ”โ”โ” Nextjs React Expert Report โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
162
+ Skill: Nextjs React Expert
163
+ Language: [detected language / framework]
164
+ Scope: [N files ยท N functions]
165
+ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
166
+ โœ… Passed: [checks that passed, or "All clean"]
167
+ โš ๏ธ Warnings: [non-blocking issues, or "None"]
168
+ โŒ Blocked: [blocking issues requiring fix, or "None"]
169
+ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
170
+ VBC status: PENDING โ†’ VERIFIED
171
+ Evidence: [test output / lint pass / compile success]
172
+ ```
255
173
 
256
- ### Section 8: Advanced Patterns (VARIABLE)
174
+ **VBC (Verification-Before-Completion) is mandatory.**
175
+ Do not mark status as VERIFIED until concrete terminal evidence is provided.
257
176
 
258
- **Impact:** Specific use cases
259
- **Key Concepts:** useLatest hook, init-once patterns, event handler refs
260
177
 
261
178
  ---
262
179
 
263
- ## ๐ŸŽ“ Best Practices Summary
264
-
265
- **Golden Rules:**
180
+ ## ๐Ÿ›๏ธ Tribunal Integration (Anti-Hallucination)
266
181
 
267
- 1. **Measure first** - Use React DevTools Profiler, Chrome DevTools
268
- 2. **Biggest impact first** - Waterfalls โ†’ Bundle โ†’ Server โ†’ Micro
269
- 3. **Don't over-optimize** - Focus on real bottlenecks
270
- 4. **Use platform features** - Next.js has optimizations built-in
271
- 5. **Think about users** - Real-world conditions matter
182
+ **Slash command: `/tribunal-frontend`**
183
+ **Active reviewers: `logic` ยท `security` ยท `frontend` ยท `type-safety`**
272
184
 
273
- **Performance Mindset:**
185
+ ### โŒ Forbidden AI Tropes in Next.js/React
274
186
 
275
- - Every `await` in sequence = potential waterfall
276
- - Every `import` = potential bundle bloat
277
- - Every re-render = wasted computation (if unnecessary)
278
- - Server components = less JavaScript to ship
279
- - Measure, don't guess
187
+ 1. **`"use client"` on everything** โ€” do not convert Server Components to Client unless interaction/state is strictly required.
188
+ 2. **`getServerSideProps` in App Router** โ€” never hallucinate legacy Pages router data fetching in an App Router context.
189
+ 3. **Unnecessary `useEffect` fetching** โ€” always prefer Server Components or SWR/React Query for data fetching.
190
+ 4. **Vercel clones** โ€” do not default to generic black/white Vercel aesthetics unless instructed.
191
+ 5. **Missing `key` in maps** โ€” always provide a unique, stable key. No using iteration index as the key.
280
192
 
281
- ---
193
+ ### โœ… Pre-Flight Self-Audit
282
194
 
283
- **Source:** Vercel Engineering
284
- **Date:** January 2026
285
- **Version:** 1.0.0
286
- **Total Rules:** 57 across 8 categories
195
+ Review these questions before generating React/Next.js code:
196
+ ```
197
+ โœ… Did I maximize Server Component usage and isolate `'use client'` boundaries?
198
+ โœ… Are there any sequential network calls creating a waterfall? If so, did I use `Promise.all` or `Suspense`?
199
+ โœ… Did I ensure no sensitive environment variables leak to the client?
200
+ โœ… Did I use `next/image` and `next/link` instead of raw `<img>` and `<a>` when appropriate?
201
+ โœ… Did I implement proper loading/error boundaries (`loading.tsx`, `error.tsx`)?
202
+ ```