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.
- package/.agent/.shared/ui-ux-pro-max/README.md +3 -3
- package/.agent/ARCHITECTURE.md +205 -10
- package/.agent/GEMINI.md +37 -7
- package/.agent/agents/accessibility-reviewer.md +134 -0
- package/.agent/agents/ai-code-reviewer.md +129 -0
- package/.agent/agents/frontend-specialist.md +3 -0
- package/.agent/agents/game-developer.md +21 -21
- package/.agent/agents/logic-reviewer.md +12 -0
- package/.agent/agents/mobile-reviewer.md +79 -0
- package/.agent/agents/orchestrator.md +56 -26
- package/.agent/agents/performance-reviewer.md +36 -0
- package/.agent/agents/supervisor-agent.md +156 -0
- package/.agent/agents/swarm-worker-contracts.md +166 -0
- package/.agent/agents/swarm-worker-registry.md +92 -0
- package/.agent/rules/GEMINI.md +134 -5
- package/.agent/scripts/bundle_analyzer.py +259 -0
- package/.agent/scripts/dependency_analyzer.py +247 -0
- package/.agent/scripts/lint_runner.py +188 -0
- package/.agent/scripts/patch_skills_meta.py +177 -0
- package/.agent/scripts/patch_skills_output.py +285 -0
- package/.agent/scripts/schema_validator.py +279 -0
- package/.agent/scripts/security_scan.py +224 -0
- package/.agent/scripts/session_manager.py +144 -3
- package/.agent/scripts/skill_integrator.py +234 -0
- package/.agent/scripts/strengthen_skills.py +220 -0
- package/.agent/scripts/swarm_dispatcher.py +317 -0
- package/.agent/scripts/test_runner.py +192 -0
- package/.agent/scripts/test_swarm_dispatcher.py +163 -0
- package/.agent/skills/agent-organizer/SKILL.md +132 -0
- package/.agent/skills/agentic-patterns/SKILL.md +335 -0
- package/.agent/skills/api-patterns/SKILL.md +226 -50
- package/.agent/skills/app-builder/SKILL.md +215 -52
- package/.agent/skills/architecture/SKILL.md +176 -31
- package/.agent/skills/bash-linux/SKILL.md +150 -134
- package/.agent/skills/behavioral-modes/SKILL.md +152 -160
- package/.agent/skills/brainstorming/SKILL.md +148 -101
- package/.agent/skills/brainstorming/dynamic-questioning.md +10 -0
- package/.agent/skills/clean-code/SKILL.md +139 -134
- package/.agent/skills/code-review-checklist/SKILL.md +177 -80
- package/.agent/skills/config-validator/SKILL.md +165 -0
- package/.agent/skills/csharp-developer/SKILL.md +107 -0
- package/.agent/skills/database-design/SKILL.md +252 -29
- package/.agent/skills/deployment-procedures/SKILL.md +122 -175
- package/.agent/skills/devops-engineer/SKILL.md +134 -0
- package/.agent/skills/devops-incident-responder/SKILL.md +98 -0
- package/.agent/skills/documentation-templates/SKILL.md +175 -121
- package/.agent/skills/dotnet-core-expert/SKILL.md +103 -0
- package/.agent/skills/edge-computing/SKILL.md +213 -0
- package/.agent/skills/frontend-design/SKILL.md +76 -0
- package/.agent/skills/frontend-design/color-system.md +18 -0
- package/.agent/skills/frontend-design/typography-system.md +18 -0
- package/.agent/skills/game-development/SKILL.md +69 -0
- package/.agent/skills/geo-fundamentals/SKILL.md +158 -99
- package/.agent/skills/github-operations/SKILL.md +354 -0
- package/.agent/skills/i18n-localization/SKILL.md +158 -96
- package/.agent/skills/intelligent-routing/SKILL.md +89 -285
- package/.agent/skills/intelligent-routing/router-manifest.md +65 -0
- package/.agent/skills/lint-and-validate/SKILL.md +229 -27
- package/.agent/skills/llm-engineering/SKILL.md +258 -0
- package/.agent/skills/local-first/SKILL.md +203 -0
- package/.agent/skills/mcp-builder/SKILL.md +159 -111
- package/.agent/skills/mobile-design/SKILL.md +102 -282
- package/.agent/skills/nextjs-react-expert/SKILL.md +143 -227
- package/.agent/skills/nodejs-best-practices/SKILL.md +201 -254
- package/.agent/skills/observability/SKILL.md +285 -0
- package/.agent/skills/parallel-agents/SKILL.md +124 -118
- package/.agent/skills/performance-profiling/SKILL.md +143 -89
- package/.agent/skills/plan-writing/SKILL.md +133 -97
- package/.agent/skills/platform-engineer/SKILL.md +135 -0
- package/.agent/skills/powershell-windows/SKILL.md +167 -104
- package/.agent/skills/python-patterns/SKILL.md +149 -361
- package/.agent/skills/python-pro/SKILL.md +114 -0
- package/.agent/skills/react-specialist/SKILL.md +107 -0
- package/.agent/skills/readme-builder/SKILL.md +270 -0
- package/.agent/skills/realtime-patterns/SKILL.md +296 -0
- package/.agent/skills/red-team-tactics/SKILL.md +136 -134
- package/.agent/skills/rust-pro/SKILL.md +237 -173
- package/.agent/skills/seo-fundamentals/SKILL.md +134 -82
- package/.agent/skills/server-management/SKILL.md +155 -104
- package/.agent/skills/sql-pro/SKILL.md +104 -0
- package/.agent/skills/systematic-debugging/SKILL.md +156 -79
- package/.agent/skills/tailwind-patterns/SKILL.md +163 -205
- package/.agent/skills/tdd-workflow/SKILL.md +148 -88
- package/.agent/skills/test-result-analyzer/SKILL.md +299 -0
- package/.agent/skills/testing-patterns/SKILL.md +141 -114
- package/.agent/skills/trend-researcher/SKILL.md +228 -0
- package/.agent/skills/ui-ux-pro-max/SKILL.md +107 -0
- package/.agent/skills/ui-ux-researcher/SKILL.md +234 -0
- package/.agent/skills/vue-expert/SKILL.md +118 -0
- package/.agent/skills/vulnerability-scanner/SKILL.md +228 -188
- package/.agent/skills/web-design-guidelines/SKILL.md +148 -33
- package/.agent/skills/webapp-testing/SKILL.md +171 -122
- package/.agent/skills/whimsy-injector/SKILL.md +349 -0
- package/.agent/skills/workflow-optimizer/SKILL.md +219 -0
- package/.agent/workflows/api-tester.md +279 -0
- package/.agent/workflows/audit.md +168 -0
- package/.agent/workflows/brainstorm.md +65 -19
- package/.agent/workflows/changelog.md +144 -0
- package/.agent/workflows/create.md +67 -14
- package/.agent/workflows/debug.md +122 -30
- package/.agent/workflows/deploy.md +82 -31
- package/.agent/workflows/enhance.md +59 -27
- package/.agent/workflows/fix.md +143 -0
- package/.agent/workflows/generate.md +84 -20
- package/.agent/workflows/migrate.md +163 -0
- package/.agent/workflows/orchestrate.md +66 -17
- package/.agent/workflows/performance-benchmarker.md +305 -0
- package/.agent/workflows/plan.md +76 -33
- package/.agent/workflows/preview.md +73 -17
- package/.agent/workflows/refactor.md +153 -0
- package/.agent/workflows/review-ai.md +140 -0
- package/.agent/workflows/review.md +83 -16
- package/.agent/workflows/session.md +154 -0
- package/.agent/workflows/status.md +74 -18
- package/.agent/workflows/strengthen-skills.md +99 -0
- package/.agent/workflows/swarm.md +194 -0
- package/.agent/workflows/test.md +80 -31
- package/.agent/workflows/tribunal-backend.md +55 -13
- package/.agent/workflows/tribunal-database.md +62 -18
- package/.agent/workflows/tribunal-frontend.md +58 -12
- package/.agent/workflows/tribunal-full.md +70 -11
- package/.agent/workflows/tribunal-mobile.md +123 -0
- package/.agent/workflows/tribunal-performance.md +152 -0
- package/.agent/workflows/ui-ux-pro-max.md +100 -82
- package/README.md +117 -62
- package/bin/tribunal-kit.js +542 -288
- package/package.json +10 -6
|
@@ -1,286 +1,202 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: react-
|
|
3
|
-
description:
|
|
4
|
-
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
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
|
|
10
|
+
# React v19+ & Next.js Pro-Max Performance Patterns
|
|
8
11
|
|
|
9
|
-
>
|
|
10
|
-
>
|
|
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
|
-
##
|
|
17
|
+
## Contemporary Paradigm Shifts
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
65
|
-
|
|
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
|
-
|
|
69
|
-
|
|
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
|
-
##
|
|
54
|
+
## Extreme Waterfall Elimination
|
|
75
55
|
|
|
76
|
-
|
|
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
|
-
|
|
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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
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
|
-
-
|
|
136
|
-
-
|
|
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
|
-
##
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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
|
-
##
|
|
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
|
-
**
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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
|
-
##
|
|
144
|
+
## Key Anti-Patterns
|
|
212
145
|
|
|
213
|
-
|
|
|
214
|
-
|
|
215
|
-
| `
|
|
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
|
-
##
|
|
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
|
-
|
|
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
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
264
|
-
|
|
265
|
-
**Golden Rules:**
|
|
180
|
+
## ๐๏ธ Tribunal Integration (Anti-Hallucination)
|
|
266
181
|
|
|
267
|
-
|
|
268
|
-
|
|
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
|
-
|
|
185
|
+
### โ Forbidden AI Tropes in Next.js/React
|
|
274
186
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
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
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
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
|
+
```
|