tribunal-kit 4.2.0 → 4.3.1

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 (186) hide show
  1. package/.agent/ARCHITECTURE.md +21 -14
  2. package/.agent/agents/swarm-worker-contracts.md +5 -5
  3. package/.agent/agents/ui-ux-auditor.md +292 -0
  4. package/.agent/rules/GEMINI.md +8 -8
  5. package/.agent/scripts/__pycache__/_colors.cpython-311.pyc +0 -0
  6. package/.agent/scripts/__pycache__/_utils.cpython-311.pyc +0 -0
  7. package/.agent/scripts/__pycache__/case_law_manager.cpython-311.pyc +0 -0
  8. package/.agent/scripts/_colors.js +18 -0
  9. package/.agent/scripts/_utils.js +42 -0
  10. package/.agent/scripts/auto_preview.js +197 -0
  11. package/.agent/scripts/bundle_analyzer.js +290 -0
  12. package/.agent/scripts/case_law_manager.js +684 -0
  13. package/.agent/scripts/checklist.js +266 -0
  14. package/.agent/scripts/colors.js +17 -0
  15. package/.agent/scripts/compress_skills.js +141 -0
  16. package/.agent/scripts/consolidate_skills.js +149 -0
  17. package/.agent/scripts/context_broker.js +609 -0
  18. package/.agent/scripts/deep_compress.js +150 -0
  19. package/.agent/scripts/dependency_analyzer.js +272 -0
  20. package/.agent/scripts/graph_builder.js +199 -0
  21. package/.agent/scripts/graph_zoom.js +154 -0
  22. package/.agent/scripts/inner_loop_validator.js +465 -0
  23. package/.agent/scripts/lint_runner.js +187 -0
  24. package/.agent/scripts/minify_context.js +100 -0
  25. package/.agent/scripts/patch_skills_meta.js +156 -0
  26. package/.agent/scripts/patch_skills_output.js +244 -0
  27. package/.agent/scripts/schema_validator.js +297 -0
  28. package/.agent/scripts/security_scan.js +303 -0
  29. package/.agent/scripts/session_manager.js +276 -0
  30. package/.agent/scripts/skill_evolution.js +644 -0
  31. package/.agent/scripts/skill_integrator.js +313 -0
  32. package/.agent/scripts/strengthen_skills.js +193 -0
  33. package/.agent/scripts/strip_tribunal.js +47 -0
  34. package/.agent/scripts/swarm_dispatcher.js +360 -0
  35. package/.agent/scripts/test_runner.js +193 -0
  36. package/.agent/scripts/utils.js +32 -0
  37. package/.agent/scripts/verify_all.js +256 -0
  38. package/.agent/skills/agent-organizer/SKILL.md +12 -4
  39. package/.agent/skills/agentic-patterns/SKILL.md +12 -4
  40. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +12 -4
  41. package/.agent/skills/api-patterns/SKILL.md +209 -201
  42. package/.agent/skills/api-security-auditor/SKILL.md +12 -4
  43. package/.agent/skills/app-builder/SKILL.md +12 -4
  44. package/.agent/skills/app-builder/templates/SKILL.md +76 -68
  45. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +1 -1
  46. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +1 -1
  47. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +1 -1
  48. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +1 -1
  49. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +1 -1
  50. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +1 -1
  51. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +1 -1
  52. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +1 -1
  53. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +1 -1
  54. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +1 -1
  55. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +1 -1
  56. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +1 -1
  57. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +1 -1
  58. package/.agent/skills/appflow-wireframe/SKILL.md +12 -4
  59. package/.agent/skills/architecture/SKILL.md +12 -4
  60. package/.agent/skills/authentication-best-practices/SKILL.md +12 -4
  61. package/.agent/skills/bash-linux/SKILL.md +12 -4
  62. package/.agent/skills/behavioral-modes/SKILL.md +12 -4
  63. package/.agent/skills/brainstorming/SKILL.md +12 -4
  64. package/.agent/skills/building-native-ui/SKILL.md +12 -4
  65. package/.agent/skills/clean-code/SKILL.md +12 -4
  66. package/.agent/skills/code-review-checklist/SKILL.md +12 -4
  67. package/.agent/skills/config-validator/SKILL.md +12 -4
  68. package/.agent/skills/csharp-developer/SKILL.md +12 -4
  69. package/.agent/skills/data-validation-schemas/SKILL.md +290 -282
  70. package/.agent/skills/database-design/SKILL.md +202 -194
  71. package/.agent/skills/deployment-procedures/SKILL.md +12 -4
  72. package/.agent/skills/devops-engineer/SKILL.md +12 -4
  73. package/.agent/skills/devops-incident-responder/SKILL.md +12 -4
  74. package/.agent/skills/doc.md +1 -1
  75. package/.agent/skills/documentation-templates/SKILL.md +12 -4
  76. package/.agent/skills/edge-computing/SKILL.md +12 -4
  77. package/.agent/skills/error-resilience/SKILL.md +390 -382
  78. package/.agent/skills/extract-design-system/SKILL.md +12 -4
  79. package/.agent/skills/framer-motion-expert/SKILL.md +206 -199
  80. package/.agent/skills/frontend-design/SKILL.md +163 -155
  81. package/.agent/skills/game-design-expert/SKILL.md +12 -4
  82. package/.agent/skills/game-engineering-expert/SKILL.md +12 -4
  83. package/.agent/skills/geo-fundamentals/SKILL.md +12 -4
  84. package/.agent/skills/github-operations/SKILL.md +12 -4
  85. package/.agent/skills/gsap-core/SKILL.md +54 -48
  86. package/.agent/skills/gsap-frameworks/SKILL.md +54 -48
  87. package/.agent/skills/gsap-performance/SKILL.md +54 -48
  88. package/.agent/skills/gsap-plugins/SKILL.md +54 -48
  89. package/.agent/skills/gsap-react/SKILL.md +54 -48
  90. package/.agent/skills/gsap-scrolltrigger/SKILL.md +54 -48
  91. package/.agent/skills/gsap-timeline/SKILL.md +54 -48
  92. package/.agent/skills/gsap-utils/SKILL.md +54 -48
  93. package/.agent/skills/i18n-localization/SKILL.md +12 -4
  94. package/.agent/skills/intelligent-routing/SKILL.md +41 -33
  95. package/.agent/skills/knowledge-graph/SKILL.md +36 -0
  96. package/.agent/skills/lint-and-validate/SKILL.md +12 -4
  97. package/.agent/skills/llm-engineering/SKILL.md +12 -4
  98. package/.agent/skills/local-first/SKILL.md +12 -4
  99. package/.agent/skills/mcp-builder/SKILL.md +12 -4
  100. package/.agent/skills/mobile-design/SKILL.md +225 -217
  101. package/.agent/skills/monorepo-management/SKILL.md +296 -288
  102. package/.agent/skills/motion-engineering/SKILL.md +195 -187
  103. package/.agent/skills/nextjs-react-expert/SKILL.md +196 -188
  104. package/.agent/skills/nodejs-best-practices/SKILL.md +12 -4
  105. package/.agent/skills/observability/SKILL.md +12 -4
  106. package/.agent/skills/parallel-agents/SKILL.md +12 -4
  107. package/.agent/skills/performance-profiling/SKILL.md +12 -4
  108. package/.agent/skills/plan-writing/SKILL.md +12 -4
  109. package/.agent/skills/platform-engineer/SKILL.md +12 -4
  110. package/.agent/skills/playwright-best-practices/SKILL.md +12 -4
  111. package/.agent/skills/powershell-windows/SKILL.md +12 -4
  112. package/.agent/skills/project-idioms/SKILL.md +12 -4
  113. package/.agent/skills/python-patterns/SKILL.md +12 -4
  114. package/.agent/skills/python-pro/SKILL.md +285 -277
  115. package/.agent/skills/react-specialist/SKILL.md +239 -231
  116. package/.agent/skills/readme-builder/SKILL.md +12 -4
  117. package/.agent/skills/realtime-patterns/SKILL.md +12 -4
  118. package/.agent/skills/red-team-tactics/SKILL.md +12 -4
  119. package/.agent/skills/rust-pro/SKILL.md +12 -4
  120. package/.agent/skills/seo-fundamentals/SKILL.md +12 -4
  121. package/.agent/skills/server-management/SKILL.md +12 -4
  122. package/.agent/skills/shadcn-ui-expert/SKILL.md +12 -4
  123. package/.agent/skills/skill-creator/SKILL.md +12 -4
  124. package/.agent/skills/sql-pro/SKILL.md +12 -4
  125. package/.agent/skills/supabase-postgres-best-practices/SKILL.md +12 -4
  126. package/.agent/skills/swiftui-expert/SKILL.md +12 -4
  127. package/.agent/skills/systematic-debugging/SKILL.md +12 -4
  128. package/.agent/skills/tailwind-patterns/SKILL.md +12 -4
  129. package/.agent/skills/tdd-workflow/SKILL.md +12 -4
  130. package/.agent/skills/test-result-analyzer/SKILL.md +12 -4
  131. package/.agent/skills/testing-patterns/SKILL.md +12 -4
  132. package/.agent/skills/trend-researcher/SKILL.md +12 -4
  133. package/.agent/skills/typescript-advanced/SKILL.md +297 -289
  134. package/.agent/skills/ui-ux-pro-max/SKILL.md +12 -4
  135. package/.agent/skills/ui-ux-researcher/SKILL.md +12 -4
  136. package/.agent/skills/vue-expert/SKILL.md +237 -229
  137. package/.agent/skills/vulnerability-scanner/SKILL.md +12 -4
  138. package/.agent/skills/web-accessibility-auditor/SKILL.md +12 -4
  139. package/.agent/skills/web-design-guidelines/SKILL.md +12 -4
  140. package/.agent/skills/webapp-testing/SKILL.md +12 -4
  141. package/.agent/skills/whimsy-injector/SKILL.md +12 -4
  142. package/.agent/skills/workflow-optimizer/SKILL.md +12 -4
  143. package/.agent/workflows/audit.md +6 -6
  144. package/.agent/workflows/deploy.md +1 -1
  145. package/.agent/workflows/generate.md +23 -6
  146. package/.agent/workflows/session.md +5 -5
  147. package/.agent/workflows/swarm.md +2 -2
  148. package/README.md +242 -186
  149. package/bin/tribunal-kit.js +297 -57
  150. package/package.json +81 -77
  151. package/scripts/changelog.js +167 -0
  152. package/scripts/sync-version.js +81 -0
  153. package/scripts/validate-payload.js +73 -0
  154. package/.agent/scripts/__pycache__/auto_preview.cpython-311.pyc +0 -0
  155. package/.agent/scripts/__pycache__/bundle_analyzer.cpython-311.pyc +0 -0
  156. package/.agent/scripts/__pycache__/checklist.cpython-311.pyc +0 -0
  157. package/.agent/scripts/__pycache__/dependency_analyzer.cpython-311.pyc +0 -0
  158. package/.agent/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
  159. package/.agent/scripts/__pycache__/session_manager.cpython-311.pyc +0 -0
  160. package/.agent/scripts/__pycache__/skill_integrator.cpython-311.pyc +0 -0
  161. package/.agent/scripts/__pycache__/swarm_dispatcher.cpython-311.pyc +0 -0
  162. package/.agent/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
  163. package/.agent/scripts/__pycache__/verify_all.cpython-311.pyc +0 -0
  164. package/.agent/scripts/auto_preview.py +0 -180
  165. package/.agent/scripts/bundle_analyzer.py +0 -259
  166. package/.agent/scripts/case_law_manager.py +0 -755
  167. package/.agent/scripts/checklist.py +0 -209
  168. package/.agent/scripts/compress_skills.py +0 -167
  169. package/.agent/scripts/consolidate_skills.py +0 -173
  170. package/.agent/scripts/deep_compress.py +0 -202
  171. package/.agent/scripts/dependency_analyzer.py +0 -247
  172. package/.agent/scripts/lint_runner.py +0 -188
  173. package/.agent/scripts/minify_context.py +0 -80
  174. package/.agent/scripts/patch_skills_meta.py +0 -177
  175. package/.agent/scripts/patch_skills_output.py +0 -285
  176. package/.agent/scripts/schema_validator.py +0 -279
  177. package/.agent/scripts/security_scan.py +0 -224
  178. package/.agent/scripts/session_manager.py +0 -261
  179. package/.agent/scripts/skill_evolution.py +0 -563
  180. package/.agent/scripts/skill_integrator.py +0 -234
  181. package/.agent/scripts/strengthen_skills.py +0 -220
  182. package/.agent/scripts/strip_tribunal.py +0 -41
  183. package/.agent/scripts/swarm_dispatcher.py +0 -350
  184. package/.agent/scripts/test_runner.py +0 -192
  185. package/.agent/scripts/test_swarm_dispatcher.py +0 -163
  186. package/.agent/scripts/verify_all.py +0 -195
@@ -1,192 +1,192 @@
1
- ---
2
- name: nextjs-react-expert
3
- description: Next.js 15+ App Router mastery. Server Components, Server Actions, PPR, caching, metadata, middleware, parallel/intercepting routes. Use when building Next.js apps or optimizing Next.js performance.
4
- allowed-tools: Read, Write, Edit, Glob, Grep
5
- version: 3.1.0
6
- last-updated: 2026-04-06
7
- applies-to-model: gemini-3-1-pro, claude-3-7-sonnet
8
- ---
9
-
10
- # Next.js 15+ App Router — Dense Reference
11
-
12
- ## Hallucination Traps (Read First)
13
- - ❌ `pages/api/` or `_app.tsx` → ✅ App Router only: `app/api/route.ts`, `app/layout.tsx`
14
- - ❌ `getServerSideProps` → ✅ `async function Page()` fetches directly
15
- - ❌ `next/router` → ✅ `next/navigation` (`useRouter`, `usePathname`, `useSearchParams`)
16
- - ❌ Server Action without `"use server"` → ✅ Required at top of file or top of function
17
- - ❌ Fetch is cached by default → ✅ **Next.js 15 changed this**: `fetch()` is UNCACHED by default
18
- - ❌ `cookies()` at top of page → ✅ Opts entire route into dynamic rendering, breaking PPR. Wrap inside `<Suspense>`
19
- - ❌ Passing functions as props Server → Client → ✅ Illegal. Use Server Actions instead.
20
- - ❌ Plain `Response` in route handler → ✅ Use `NextResponse.json()`
21
-
22
- ---
23
-
24
- ## App Router Conventions
25
-
26
- ```text
27
- app/
28
- ├── layout.tsx ← Root shell (HTML/BODY)
29
- ├── page.tsx ← Route UI
30
- ├── loading.tsx ← Auto-suspense fallback
31
- ├── error.tsx ← Error boundary (Must be "use client")
32
- ├── not-found.tsx ← 404 UI
33
- ├── global-error.tsx ← Root error boundary
34
- ├── api/users/route.ts ← API Handler (GET, POST)
35
- ├── @modal/login/page.tsx ← Parallel Route (renders in same layout)
36
- └── (auth)/login/page.tsx ← Route Group (doesn't affect URL)
37
- ```
38
-
39
- ---
40
-
41
- ## Server vs Client Components
42
-
43
- - **Server Components (Default)**: Zero JS. Direct DB access. Secure env vars.
44
- - **Client Components (`"use client"`)**: Lifecycle (`useEffect`), State (`useState`), Browser APIs (`window`), Event listeners (`onClick`).
45
-
46
- ```tsx
47
- // ✅ INTERLEAVING PATTERN: Pass Server Component as children to Client Component
48
- export default function Page() {
49
- return (
50
- <ClientSidebar> {/* "use client" */}
51
- <ServerStats /> {/* Server: zero JS bundle, fetches DB */}
52
- </ClientSidebar>
53
- );
54
- }
55
- ```
56
-
57
- ---
58
-
59
- ## Server Actions (Mutations)
60
-
61
- ```tsx
62
- "use server"
63
- import { revalidatePath } from "next/cache";
64
- import { z } from "zod";
65
-
66
- const Schema = z.object({ name: z.string().min(2) });
67
-
68
- export async function createUser(prevState: any, formData: FormData) {
69
- // ❌ TRAP: ALWAYS validate formData. Never trust client input.
70
- const parsed = Schema.safeParse({ name: formData.get("name") });
71
- if (!parsed.success) return { errors: parsed.error.flatten().fieldErrors };
72
-
73
- await db.user.create({ data: parsed.data });
74
- revalidatePath("/users"); // Clears cache so next render shows new user
75
- return { success: true };
76
- }
77
- ```
78
-
79
- Client usage (React 19):
80
- ```tsx
81
- "use client"
82
- import { useActionState } from "react";
83
- import { createUser } from "./actions";
84
-
85
- export function UserForm() {
86
- const [state, formAction, isPending] = useActionState(createUser, null);
87
- return (
88
- <form action={formAction}>
89
- <input name="name" />
90
- <button disabled={isPending}>Submit</button>
91
- {state?.errors?.name && <p>{state.errors.name}</p>}
92
- </form>
93
- )
94
- }
95
- ```
96
-
97
- ---
98
-
99
- ## Data Fetching & Caching (Next.js 15)
100
-
101
- ```tsx
102
- // Next.js 15 caching defaults
103
- const dynamic = await fetch(url); // 15 default: NO CACHE
104
- const static = await fetch(url, { cache: "force-cache" }); // Static
105
- const isr = await fetch(url, { next: { revalidate: 3600 } }); // Revalidate every hour
106
- const tagged = await fetch(url, { next: { tags: ["user-1"] } }); // On-demand via revalidateTag()
107
-
108
- // DB calls without fetch
109
- import { unstable_cache } from "next/cache";
110
- const getCachedUser = unstable_cache(
111
- async (id) => db.user.findUnique({ where: { id } }),
112
- ["user-cache-key"],
113
- { revalidate: 60, tags: ["users"] }
114
- );
115
- ```
116
-
117
- ### Waterfall Elimination
118
- ```tsx
119
- // ✅ Parallel Fetching:
120
- const [user, posts] = await Promise.all([getUser(), getPosts()]);
121
-
122
- // ✅ Streaming (PPR-compatible):
123
- export default function Page() {
124
- return (
125
- <main>
126
- <FastNav />
127
- {/* Page shell loads instantly, SlowChart streams in when ready */}
128
- <Suspense fallback={<Skeleton />}>
129
- <SlowChart />
130
- </Suspense>
131
- </main>
132
- );
133
- }
134
- ```
135
-
136
- ---
137
-
138
- ## Partial Prerendering (PPR)
139
-
140
- PPR static-generates the route shell and streams dynamic parts.
141
- ```tsx
142
- // next.config.ts
143
- export default { experimental: { ppr: true } };
144
-
145
- // Any component reading cookies/headers inside a Suspense boundary becomes a dynamic hole
146
- import { cookies } from "next/headers";
147
-
148
- async function Cart() {
149
- const c = await cookies(); // Next.js 15 cookies are async!
150
- const cartId = c.get("cartId");
151
- }
152
-
153
- export default function Page() {
154
- return (
155
- <div>
156
- <StaticHeader /> {/* Cached at build time on CDN */}
157
- <Suspense fallback={<CartSkeleton />}>
158
- <Cart /> {/* Dynamic, streamed at request time */}
159
- </Suspense>
160
- </div>
161
- )
162
- }
163
- ```
164
-
165
- ---
166
-
167
- ## Middleware
168
-
169
- ```typescript
170
- // middleware.ts (Root of project)
171
- import { NextResponse } from "next/server";
172
- import type { NextRequest } from "next/server";
173
-
174
- export function middleware(req: NextRequest) {
175
- const token = req.cookies.get("auth-token");
176
- if (!token && req.nextUrl.pathname.startsWith("/dashboard")) {
177
- return NextResponse.redirect(new URL("/login", req.url));
178
- }
179
- }
180
-
181
- export const config = {
182
- matcher: ["/dashboard/:path*"], // Strict matcher is critical for performance
183
- };
184
- ```
1
+ ---
2
+ name: nextjs-react-expert
3
+ description: Next.js 15+ App Router mastery. Server Components, Server Actions, PPR, caching, metadata, middleware, parallel/intercepting routes. Use when building Next.js apps or optimizing Next.js performance.
4
+ allowed-tools: Read, Write, Edit, Glob, Grep
5
+ version: 3.1.0
6
+ last-updated: 2026-04-06
7
+ applies-to-model: gemini-3-1-pro, claude-3-7-sonnet
8
+ ---
9
+
10
+ # Next.js 15+ App Router — Dense Reference
11
+
12
+ ## Hallucination Traps (Read First)
13
+ - ❌ `pages/api/` or `_app.tsx` → ✅ App Router only: `app/api/route.ts`, `app/layout.tsx`
14
+ - ❌ `getServerSideProps` → ✅ `async function Page()` fetches directly
15
+ - ❌ `next/router` → ✅ `next/navigation` (`useRouter`, `usePathname`, `useSearchParams`)
16
+ - ❌ Server Action without `"use server"` → ✅ Required at top of file or top of function
17
+ - ❌ Fetch is cached by default → ✅ **Next.js 15 changed this**: `fetch()` is UNCACHED by default
18
+ - ❌ `cookies()` at top of page → ✅ Opts entire route into dynamic rendering, breaking PPR. Wrap inside `<Suspense>`
19
+ - ❌ Passing functions as props Server → Client → ✅ Illegal. Use Server Actions instead.
20
+ - ❌ Plain `Response` in route handler → ✅ Use `NextResponse.json()`
21
+
22
+ ---
23
+
24
+ ## App Router Conventions
25
+
26
+ ```text
27
+ app/
28
+ ├── layout.tsx ← Root shell (HTML/BODY)
29
+ ├── page.tsx ← Route UI
30
+ ├── loading.tsx ← Auto-suspense fallback
31
+ ├── error.tsx ← Error boundary (Must be "use client")
32
+ ├── not-found.tsx ← 404 UI
33
+ ├── global-error.tsx ← Root error boundary
34
+ ├── api/users/route.ts ← API Handler (GET, POST)
35
+ ├── @modal/login/page.tsx ← Parallel Route (renders in same layout)
36
+ └── (auth)/login/page.tsx ← Route Group (doesn't affect URL)
37
+ ```
38
+
39
+ ---
40
+
41
+ ## Server vs Client Components
42
+
43
+ - **Server Components (Default)**: Zero JS. Direct DB access. Secure env vars.
44
+ - **Client Components (`"use client"`)**: Lifecycle (`useEffect`), State (`useState`), Browser APIs (`window`), Event listeners (`onClick`).
45
+
46
+ ```tsx
47
+ // ✅ INTERLEAVING PATTERN: Pass Server Component as children to Client Component
48
+ export default function Page() {
49
+ return (
50
+ <ClientSidebar> {/* "use client" */}
51
+ <ServerStats /> {/* Server: zero JS bundle, fetches DB */}
52
+ </ClientSidebar>
53
+ );
54
+ }
55
+ ```
56
+
57
+ ---
58
+
59
+ ## Server Actions (Mutations)
60
+
61
+ ```tsx
62
+ "use server"
63
+ import { revalidatePath } from "next/cache";
64
+ import { z } from "zod";
65
+
66
+ const Schema = z.object({ name: z.string().min(2) });
67
+
68
+ export async function createUser(prevState: any, formData: FormData) {
69
+ // ❌ TRAP: ALWAYS validate formData. Never trust client input.
70
+ const parsed = Schema.safeParse({ name: formData.get("name") });
71
+ if (!parsed.success) return { errors: parsed.error.flatten().fieldErrors };
72
+
73
+ await db.user.create({ data: parsed.data });
74
+ revalidatePath("/users"); // Clears cache so next render shows new user
75
+ return { success: true };
76
+ }
77
+ ```
78
+
79
+ Client usage (React 19):
80
+ ```tsx
81
+ "use client"
82
+ import { useActionState } from "react";
83
+ import { createUser } from "./actions";
185
84
 
85
+ export function UserForm() {
86
+ const [state, formAction, isPending] = useActionState(createUser, null);
87
+ return (
88
+ <form action={formAction}>
89
+ <input name="name" />
90
+ <button disabled={isPending}>Submit</button>
91
+ {state?.errors?.name && <p>{state.errors.name}</p>}
92
+ </form>
93
+ )
94
+ }
95
+ ```
186
96
 
187
97
  ---
188
98
 
189
- ## 🤖 LLM-Specific Traps
99
+ ## Data Fetching & Caching (Next.js 15)
100
+
101
+ ```tsx
102
+ // Next.js 15 caching defaults
103
+ const dynamic = await fetch(url); // 15 default: NO CACHE
104
+ const static = await fetch(url, { cache: "force-cache" }); // Static
105
+ const isr = await fetch(url, { next: { revalidate: 3600 } }); // Revalidate every hour
106
+ const tagged = await fetch(url, { next: { tags: ["user-1"] } }); // On-demand via revalidateTag()
107
+
108
+ // DB calls without fetch
109
+ import { unstable_cache } from "next/cache";
110
+ const getCachedUser = unstable_cache(
111
+ async (id) => db.user.findUnique({ where: { id } }),
112
+ ["user-cache-key"],
113
+ { revalidate: 60, tags: ["users"] }
114
+ );
115
+ ```
116
+
117
+ ### Waterfall Elimination
118
+ ```tsx
119
+ // ✅ Parallel Fetching:
120
+ const [user, posts] = await Promise.all([getUser(), getPosts()]);
121
+
122
+ // ✅ Streaming (PPR-compatible):
123
+ export default function Page() {
124
+ return (
125
+ <main>
126
+ <FastNav />
127
+ {/* Page shell loads instantly, SlowChart streams in when ready */}
128
+ <Suspense fallback={<Skeleton />}>
129
+ <SlowChart />
130
+ </Suspense>
131
+ </main>
132
+ );
133
+ }
134
+ ```
135
+
136
+ ---
137
+
138
+ ## Partial Prerendering (PPR)
139
+
140
+ PPR static-generates the route shell and streams dynamic parts.
141
+ ```tsx
142
+ // next.config.ts
143
+ export default { experimental: { ppr: true } };
144
+
145
+ // Any component reading cookies/headers inside a Suspense boundary becomes a dynamic hole
146
+ import { cookies } from "next/headers";
147
+
148
+ async function Cart() {
149
+ const c = await cookies(); // Next.js 15 cookies are async!
150
+ const cartId = c.get("cartId");
151
+ }
152
+
153
+ export default function Page() {
154
+ return (
155
+ <div>
156
+ <StaticHeader /> {/* Cached at build time on CDN */}
157
+ <Suspense fallback={<CartSkeleton />}>
158
+ <Cart /> {/* Dynamic, streamed at request time */}
159
+ </Suspense>
160
+ </div>
161
+ )
162
+ }
163
+ ```
164
+
165
+ ---
166
+
167
+ ## Middleware
168
+
169
+ ```typescript
170
+ // middleware.ts (Root of project)
171
+ import { NextResponse } from "next/server";
172
+ import type { NextRequest } from "next/server";
173
+
174
+ export function middleware(req: NextRequest) {
175
+ const token = req.cookies.get("auth-token");
176
+ if (!token && req.nextUrl.pathname.startsWith("/dashboard")) {
177
+ return NextResponse.redirect(new URL("/login", req.url));
178
+ }
179
+ }
180
+
181
+ export const config = {
182
+ matcher: ["/dashboard/:path*"], // Strict matcher is critical for performance
183
+ };
184
+ ```
185
+
186
+
187
+ ---
188
+
189
+
190
190
 
191
191
  AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
192
192
 
@@ -198,7 +198,7 @@ AI coding assistants often fall into specific bad habits when dealing with this
198
198
 
199
199
  ---
200
200
 
201
- ## 🏛️ Tribunal Integration (Anti-Hallucination)
201
+
202
202
 
203
203
  **Slash command: `/review` or `/tribunal-full`**
204
204
  **Active reviewers: `logic-reviewer` · `security-auditor`**
@@ -209,7 +209,7 @@ AI coding assistants often fall into specific bad habits when dealing with this
209
209
  2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
210
210
  3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
211
211
 
212
- ### ✅ Pre-Flight Self-Audit
212
+
213
213
 
214
214
  Review these questions before confirming output:
215
215
  ```
@@ -223,4 +223,12 @@ Review these questions before confirming output:
223
223
 
224
224
  **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
225
225
  - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
226
- - ✅ **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.
226
+ - ✅ **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.
227
+
228
+
229
+ ## Pre-Flight Checklist
230
+ - [ ] Have I reviewed the user's specific constraints and requests?
231
+ - [ ] Have I checked the environment for relevant existing implementations?
232
+
233
+ ## VBC Protocol (Verification-Before-Completion)
234
+ You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
@@ -500,7 +500,7 @@ if (isMainThread) {
500
500
 
501
501
  ---
502
502
 
503
- ## 🤖 LLM-Specific Traps
503
+
504
504
 
505
505
  AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
506
506
 
@@ -512,7 +512,7 @@ AI coding assistants often fall into specific bad habits when dealing with this
512
512
 
513
513
  ---
514
514
 
515
- ## 🏛️ Tribunal Integration (Anti-Hallucination)
515
+
516
516
 
517
517
  **Slash command: `/review` or `/tribunal-full`**
518
518
  **Active reviewers: `logic-reviewer` · `security-auditor`**
@@ -523,7 +523,7 @@ AI coding assistants often fall into specific bad habits when dealing with this
523
523
  2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
524
524
  3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
525
525
 
526
- ### ✅ Pre-Flight Self-Audit
526
+
527
527
 
528
528
  Review these questions before confirming output:
529
529
  ```
@@ -537,4 +537,12 @@ Review these questions before confirming output:
537
537
 
538
538
  **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
539
539
  - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
540
- - ✅ **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.
540
+ - ✅ **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.
541
+
542
+
543
+ ## Pre-Flight Checklist
544
+ - [ ] Have I reviewed the user's specific constraints and requests?
545
+ - [ ] Have I checked the environment for relevant existing implementations?
546
+
547
+ ## VBC Protocol (Verification-Before-Completion)
548
+ You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
@@ -295,7 +295,7 @@ Alert design rules:
295
295
 
296
296
  ---
297
297
 
298
- ## 🤖 LLM-Specific Traps
298
+
299
299
 
300
300
  AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
301
301
 
@@ -307,7 +307,7 @@ AI coding assistants often fall into specific bad habits when dealing with this
307
307
 
308
308
  ---
309
309
 
310
- ## 🏛️ Tribunal Integration (Anti-Hallucination)
310
+
311
311
 
312
312
  **Slash command: `/review` or `/tribunal-full`**
313
313
  **Active reviewers: `logic-reviewer` · `security-auditor`**
@@ -318,7 +318,7 @@ AI coding assistants often fall into specific bad habits when dealing with this
318
318
  2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
319
319
  3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
320
320
 
321
- ### ✅ Pre-Flight Self-Audit
321
+
322
322
 
323
323
  Review these questions before confirming output:
324
324
  ```
@@ -332,4 +332,12 @@ Review these questions before confirming output:
332
332
 
333
333
  **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
334
334
  - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
335
- - ✅ **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.
335
+ - ✅ **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.
336
+
337
+
338
+ ## Pre-Flight Checklist
339
+ - [ ] Have I reviewed the user's specific constraints and requests?
340
+ - [ ] Have I checked the environment for relevant existing implementations?
341
+
342
+ ## VBC Protocol (Verification-Before-Completion)
343
+ You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
@@ -98,7 +98,7 @@ for (const result of results) {
98
98
 
99
99
  ---
100
100
 
101
- ## 🤖 LLM-Specific Traps
101
+
102
102
 
103
103
  AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
104
104
 
@@ -110,7 +110,7 @@ AI coding assistants often fall into specific bad habits when dealing with this
110
110
 
111
111
  ---
112
112
 
113
- ## 🏛️ Tribunal Integration (Anti-Hallucination)
113
+
114
114
 
115
115
  **Slash command: `/review` or `/tribunal-full`**
116
116
  **Active reviewers: `logic-reviewer` · `security-auditor`**
@@ -121,7 +121,7 @@ AI coding assistants often fall into specific bad habits when dealing with this
121
121
  2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
122
122
  3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
123
123
 
124
- ### ✅ Pre-Flight Self-Audit
124
+
125
125
 
126
126
  Review these questions before confirming output:
127
127
  ```
@@ -135,4 +135,12 @@ Review these questions before confirming output:
135
135
 
136
136
  **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
137
137
  - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
138
- - ✅ **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.
138
+ - ✅ **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.
139
+
140
+
141
+ ## Pre-Flight Checklist
142
+ - [ ] Have I reviewed the user's specific constraints and requests?
143
+ - [ ] Have I checked the environment for relevant existing implementations?
144
+
145
+ ## VBC Protocol (Verification-Before-Completion)
146
+ You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
@@ -219,7 +219,7 @@ Performance budget targets:
219
219
 
220
220
  ---
221
221
 
222
- ## 🤖 LLM-Specific Traps
222
+
223
223
 
224
224
  AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
225
225
 
@@ -231,7 +231,7 @@ AI coding assistants often fall into specific bad habits when dealing with this
231
231
 
232
232
  ---
233
233
 
234
- ## 🏛️ Tribunal Integration (Anti-Hallucination)
234
+
235
235
 
236
236
  **Slash command: `/review` or `/tribunal-full`**
237
237
  **Active reviewers: `logic-reviewer` · `security-auditor`**
@@ -242,7 +242,7 @@ AI coding assistants often fall into specific bad habits when dealing with this
242
242
  2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
243
243
  3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
244
244
 
245
- ### ✅ Pre-Flight Self-Audit
245
+
246
246
 
247
247
  Review these questions before confirming output:
248
248
  ```
@@ -256,4 +256,12 @@ Review these questions before confirming output:
256
256
 
257
257
  **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
258
258
  - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
259
- - ✅ **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.
259
+ - ✅ **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.
260
+
261
+
262
+ ## Pre-Flight Checklist
263
+ - [ ] Have I reviewed the user's specific constraints and requests?
264
+ - [ ] Have I checked the environment for relevant existing implementations?
265
+
266
+ ## VBC Protocol (Verification-Before-Completion)
267
+ You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
@@ -94,7 +94,7 @@ Unlike the high-level `implementation_plan.md`, the `task.md` serves as the live
94
94
 
95
95
  ---
96
96
 
97
- ## 🤖 LLM-Specific Traps
97
+
98
98
 
99
99
  AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
100
100
 
@@ -106,7 +106,7 @@ AI coding assistants often fall into specific bad habits when dealing with this
106
106
 
107
107
  ---
108
108
 
109
- ## 🏛️ Tribunal Integration (Anti-Hallucination)
109
+
110
110
 
111
111
  **Slash command: `/review` or `/tribunal-full`**
112
112
  **Active reviewers: `logic-reviewer` · `security-auditor`**
@@ -117,7 +117,7 @@ AI coding assistants often fall into specific bad habits when dealing with this
117
117
  2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
118
118
  3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
119
119
 
120
- ### ✅ Pre-Flight Self-Audit
120
+
121
121
 
122
122
  Review these questions before confirming output:
123
123
  ```
@@ -131,4 +131,12 @@ Review these questions before confirming output:
131
131
 
132
132
  **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
133
133
  - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
134
- - ✅ **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.
134
+ - ✅ **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.
135
+
136
+
137
+ ## Pre-Flight Checklist
138
+ - [ ] Have I reviewed the user's specific constraints and requests?
139
+ - [ ] Have I checked the environment for relevant existing implementations?
140
+
141
+ ## VBC Protocol (Verification-Before-Completion)
142
+ You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
@@ -99,7 +99,7 @@ Ensure your infrastructure proposals abstract away the YAML mechanics. Give the
99
99
 
100
100
  ---
101
101
 
102
- ## 🤖 LLM-Specific Traps
102
+
103
103
 
104
104
  AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
105
105
 
@@ -111,7 +111,7 @@ AI coding assistants often fall into specific bad habits when dealing with this
111
111
 
112
112
  ---
113
113
 
114
- ## 🏛️ Tribunal Integration (Anti-Hallucination)
114
+
115
115
 
116
116
  **Slash command: `/review` or `/tribunal-full`**
117
117
  **Active reviewers: `logic-reviewer` · `security-auditor`**
@@ -122,7 +122,7 @@ AI coding assistants often fall into specific bad habits when dealing with this
122
122
  2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
123
123
  3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
124
124
 
125
- ### ✅ Pre-Flight Self-Audit
125
+
126
126
 
127
127
  Review these questions before confirming output:
128
128
  ```
@@ -136,4 +136,12 @@ Review these questions before confirming output:
136
136
 
137
137
  **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
138
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.
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.
140
+
141
+
142
+ ## Pre-Flight Checklist
143
+ - [ ] Have I reviewed the user's specific constraints and requests?
144
+ - [ ] Have I checked the environment for relevant existing implementations?
145
+
146
+ ## VBC Protocol (Verification-Before-Completion)
147
+ You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.