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,305 +1,123 @@
1
- ---
2
- description: Run standardized performance benchmarks including Lighthouse, bundle analysis, and latency checks.
3
- ---
4
-
5
- # /performance-benchmarker — Automated Performance Audit
6
-
7
- $ARGUMENTS
8
-
9
- ---
10
-
11
- This command runs a comprehensive suite of performance benchmarks against your project and generates a structured report with numerical scores, regression detection, and prioritized actionable fixes.
12
-
13
- ---
14
-
15
- ## When to Use
16
-
17
- - Before any `/deploy` to catch performance regressions.
18
- - After adding new dependencies or large features.
19
- - When user reports "it feels slow" or asks to "check performance".
20
- - When triggered by `benchmark`, `lighthouse`, `bundle size`, or `latency` keywords.
21
-
22
- ---
23
-
24
- ## Pipeline Flow
25
-
26
- ```
27
- Request (scope: full / web-vitals / bundle / api)
28
-
29
-
30
- Environment detection — framework, build tool, package manager
31
-
32
-
33
- Tool availability check — lighthouse? build script? dev server?
34
-
35
-
36
- Benchmark execution run selected checks
37
-
38
-
39
- Score calculation weighted composite
40
-
41
-
42
- Regression detection — compare against previous baselines (if available)
43
-
44
-
45
- Report — scores, pass/fail, recommendations, fix priority
46
- ```
47
-
48
- ---
49
-
50
- ## Benchmark Suite
51
-
52
- ### 1. Web Vitals (Frontend Performance)
53
-
54
- | Metric | Good | Needs Work | Poor | Measurement |
55
- |---|---|---|---|---|
56
- | LCP (Largest Contentful Paint) | < 2.5s | 2.5-4.0s | > 4.0s | Lighthouse or `web-vitals` library |
57
- | INP (Interaction to Next Paint) | < 200ms | 200-500ms | > 500ms | Lab approximation via TBT |
58
- | CLS (Cumulative Layout Shift) | < 0.1 | 0.1-0.25 | > 0.25 | Layout shift detection |
59
- | TTFB (Time to First Byte) | < 800ms | 800-1800ms | > 1800ms | Server response timing |
60
- | FCP (First Contentful Paint) | < 1.8s | 1.8-3.0s | > 3.0s | Lighthouse |
61
- | Speed Index | < 3.4s | 3.4-5.8s | > 5.8s | Lighthouse |
62
-
63
- **How to Run:**
64
- ```bash
65
- # If lighthouse is available
66
- npx lighthouse http://localhost:3000 --output json --chrome-flags="--headless"
67
-
68
- # If web-vitals is installed, inject into page and measure
69
- # VERIFY: check if lighthouse-cli is available before running
70
- ```
71
-
72
- **Common Fixes by Metric:**
73
-
74
- | Metric | Fix | Impact |
75
- |---|---|---|
76
- | LCP slow | Preload hero image, use `fetchpriority="high"` | High |
77
- | LCP slow | Eliminate render-blocking CSS/JS | High |
78
- | INP slow | Break long tasks > 50ms into smaller chunks | High |
79
- | INP slow | Use `requestIdleCallback` for non-critical work | Medium |
80
- | CLS high | Set explicit `width`/`height` on images/embeds | High |
81
- | CLS high | Use `font-display: swap` + font preload | Medium |
82
- | TTFB slow | Add caching headers, use CDN | High |
83
- | TTFB slow | Optimize database queries, add indexes | High |
84
- | FCP slow | Inline critical CSS, defer non-critical | High |
85
-
86
- ### 2. Bundle Analysis (JavaScript/CSS)
87
-
88
- | Check | Target | Warning | Fail | Tool |
89
- |---|---|---|---|---|
90
- | Total JS (gzipped) | < 100KB | 100-200KB | > 200KB | Build output |
91
- | Largest chunk (gzipped) | < 50KB | 50-100KB | > 100KB | Build output |
92
- | CSS total | < 50KB | 50-100KB | > 100KB | Build output |
93
- | Unused CSS | < 5% | 5-15% | > 15% | PurgeCSS |
94
- | Duplicate packages | 0 | 1-2 | > 2 | Bundle analyzer |
95
- | Tree-shaking | No side-effect barrel exports | — | Side-effect imports found | Manual analysis |
96
-
97
- **How to Run:**
98
- ```bash
99
- # Build and analyze
100
- npm run build -- --stats
101
- # VERIFY: check if the build script supports --stats flag
102
-
103
- # Alternative: analyze existing build output
104
- npx source-map-explorer dist/**/*.js
105
- # VERIFY: check if source-map-explorer is available
106
- ```
107
-
108
- **Common Fixes:**
109
-
110
- | Issue | Fix | Savings |
111
- |---|---|---|
112
- | Large lodash import | `import debounce from 'lodash/debounce'` not `import { debounce } from 'lodash'` | 50-80KB |
113
- | Moment.js | Replace with `dayjs` or `date-fns` | 60-70KB |
114
- | Full icon library | Use tree-shakeable imports or individual icon files | 20-100KB |
115
- | Uncompressed images | Use WebP/AVIF, add `loading="lazy"` | 50-500KB |
116
- | CSS framework unused | PurgeCSS or `content` config in Tailwind | 30-90KB |
117
-
118
- ### 3. API Latency (Backend Performance)
119
-
120
- | Check | Target | Warning | Fail | Method |
121
- |---|---|---|---|---|
122
- | Avg response (simple GET) | < 100ms | 100-300ms | > 300ms | 10 sequential requests |
123
- | Avg response (complex query) | < 300ms | 300-800ms | > 800ms | 10 sequential requests |
124
- | P95 response | < 500ms | 500-1000ms | > 1000ms | Sort, pick 95th percentile |
125
- | P99 response | < 1000ms | 1-3s | > 3s | Sort, pick 99th percentile |
126
- | Cold start | < 1s | 1-3s | > 3s | First request after 30s idle |
127
- | Concurrent handling | Linear scaling up to 10 req | — | Exponential degradation | 10 parallel requests |
128
-
129
- **How to Run:**
130
- ```bash
131
- # Using curl timing
132
- curl -o /dev/null -s -w "time_total: %{time_total}s\n" http://localhost:3000/api/health
133
-
134
- # Loop for average
135
- for i in $(seq 1 10); do
136
- curl -o /dev/null -s -w "%{time_total}\n" http://localhost:3000/api/endpoint
137
- done
138
- ```
139
-
140
- **Common Fixes:**
141
-
142
- | Symptom | Likely Cause | Fix |
143
- |---|---|---|
144
- | Slow first request | Cold start, no connection pool | Pre-warm, use connection pooling |
145
- | Slow list endpoints | N+1 queries | Add eager loading / `include` |
146
- | Slow under load | No caching | Add Redis/in-memory cache for hot paths |
147
- | Inconsistent P95 | GC pauses | Optimize memory allocation, reduce object churn |
148
-
149
- ### 4. Build Performance (DX)
150
-
151
- | Check | Target | Warning | Fail |
152
- |---|---|---|---|
153
- | Dev server cold start | < 3s | 3-8s | > 8s |
154
- | Hot reload (HMR) | < 200ms | 200-500ms | > 500ms |
155
- | Full production build | < 30s | 30-60s | > 60s |
156
- | TypeScript type-check | < 15s | 15-30s | > 30s |
157
-
158
- ---
159
-
160
- ## Composite Score
161
-
162
- ```
163
- Performance Score = (
164
- Web_Vitals_Score × 0.35 +
165
- Bundle_Score × 0.25 +
166
- API_Score × 0.25 +
167
- Build_Score × 0.15
168
- ) × 100
169
-
170
- Grade:
171
- 90-100 → A (Ship with confidence)
172
- 75-89 → B (Minor optimizations available)
173
- 60-74 → C (Notable performance issues)
174
- 40-59 → D (Significant problems — fix before deploy)
175
- < 40 → F (Critical — likely impacts user retention)
176
- ```
177
-
178
- Each sub-score is calculated as: `(checks_passed / total_checks)` weighted by target (1.0), warning (0.6), fail (0.0).
179
-
180
- ---
181
-
182
- ## Output Format
183
-
184
- ```
185
- ━━━ Performance Benchmark Report ━━━━━━━━━
186
-
187
- Project: [name]
188
- Date: [timestamp]
189
- Score: [0-100] / 100 → Grade [A-F]
190
-
191
- ━━━ Web Vitals ━━━━━━━━━━━━━━━━━━━━━━━━━
192
-
193
- LCP: 1.8s ✅ Good (target: < 2.5s)
194
- INP: 95ms ✅ Good (target: < 200ms)
195
- CLS: 0.05 ✅ Good (target: < 0.1)
196
- TTFB: 420ms ✅ Good (target: < 800ms)
197
- FCP: 1.2s ✅ Good (target: < 1.8s)
198
- Score: 92/100
199
-
200
- ━━━ Bundle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
201
-
202
- Total JS: 156KB gzipped 🟡 Warning (target: < 100KB)
203
- Largest chunk: 82KB gzipped 🟡 Warning (target: < 50KB)
204
- CSS total: 28KB gzipped ✅ Good
205
- Unused CSS: 4.2% ✅ Good
206
- Duplicates: 0 ✅ Good
207
- Score: 72/100
208
-
209
- ━━━ API Latency ━━━━━━━━━━━━━━━━━━━━━━━━
210
-
211
- GET /api/users: avg 89ms ✅ | p95 142ms ✅
212
- POST /api/auth: avg 210ms 🟡 | p95 480ms 🟡
213
- GET /api/dashboard: avg 340ms ❌ | p95 820ms ❌
214
- Cold start: 680ms ✅
215
- Score: 58/100
216
-
217
- ━━━ Build ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
218
-
219
- Dev cold start: 2.1s ✅
220
- HMR: 89ms ✅
221
- Production build: 18s ✅
222
- Type-check: 12s ✅
223
- Score: 100/100
224
-
225
- ━━━ Fix Priority (by impact) ━━━━━━━━━━━
226
-
227
- 1. 🔴 GET /api/dashboard avg 340ms
228
- → Add database index on dashboard query joins
229
- → Expected: < 100ms (70% improvement)
230
-
231
- 2. 🟡 Total JS 156KB
232
- → Lazy-load chart library (80KB)
233
- → Expected: < 80KB initial (50% reduction)
234
-
235
- 3. 🟡 POST /api/auth avg 210ms
236
- → Cache user lookup in auth flow
237
- → Expected: < 100ms (50% improvement)
238
-
239
- ━━━ Trend (if baseline available) ━━━━━━
240
-
241
- LCP: 1.8s → 1.8s → (no change)
242
- Bundle: 140KB → 156KB ↑ (+11%) ⚠️ Regression
243
- API p95: 400ms → 480ms ↑ (+20%) ⚠️ Regression
244
- ```
245
-
246
- ---
247
-
248
- ## Regression Detection
249
-
250
- If a previous benchmark baseline exists (stored in `perf-baseline.json` or similar):
251
-
252
- | Metric | Change | Status |
253
- |---|---|---|
254
- | < 5% increase | No change | ✅ Stable |
255
- | 5-15% increase | Minor regression | 🟡 Flag |
256
- | > 15% increase | Significant regression | 🔴 Block deploy |
257
- | Any decrease | Improvement | 🎉 Celebrate |
258
-
259
- ---
260
-
261
- ## Baseline Management
262
-
263
- After a successful benchmark, save a baseline to detect future regressions:
264
-
265
- ```bash
266
- # Save current benchmark as baseline
267
- python .agent/scripts/bundle_analyzer.py . --save-baseline
268
- ```
269
-
270
- The baseline file is `perf-baseline.json` in the project root. Check it into version control so regressions are caught in CI.
271
-
272
- ---
273
-
274
- ## Cross-Workflow Navigation
275
-
276
- | After /performance-benchmarker shows... | Go to |
277
- |---|---|
278
- | Grade D or F | `/tribunal-performance` on the slowest code paths |
279
- | Bundle regression (+15%) | `/audit` for dependency analysis, then `/fix` |
280
- | API latency P95 > 500ms | `/debug` to identify the slow query or operation |
281
- | Web vitals LCP > 4s | `/enhance` to add image preloading and critical CSS |
282
- | Grade A or B, ready for deploy | `/deploy` following pre-flight checklist |
283
-
284
- ---
285
-
286
- ## Hallucination Guard
287
-
288
- - **Only run benchmarks with installed tools** — check with `which` or `npx --dry-run` first.
289
- - **Never fabricate benchmark numbers** — report "SKIPPED: [tool] not installed" if unavailable.
290
- - **Flag anomalies**: `// NOTE: unusually fast — may be cached` or `// NOTE: first run, cold start included`.
291
- - **Mark tool availability**: `// VERIFY: lighthouse-cli not detected, using fallback estimation`.
292
- - **Don't guess fixes** — only recommend fixes for issues that have measured evidence.
293
-
294
- ---
295
-
296
- ## Usage
297
-
298
- ```
299
- /performance-benchmarker full audit
300
- /performance-benchmarker web vitals only
301
- /performance-benchmarker bundle analysis
302
- /performance-benchmarker api latency for /api/users /api/posts
303
- /performance-benchmarker build performance
304
- /performance-benchmarker compare with baseline
305
- ```
1
+ ---
2
+ description: Run standardized performance benchmarks including Lighthouse CI, bundle analysis, and API latency checks. Records before/after metrics. No optimization claims without measured evidence.
3
+ ---
4
+
5
+ # /performance-benchmarker — Evidence-Based Performance Measurement
6
+
7
+ $ARGUMENTS
8
+
9
+ ---
10
+
11
+ ## When to Use /performance-benchmarker
12
+
13
+ | Use `/performance-benchmarker` when... | Use something else when... |
14
+ |:---|:---|
15
+ | Establishing performance baseline | Code optimization decisions → `/tribunal-performance` |
16
+ | After optimization — verify improvement | Memory leaks investigation → `/debug` |
17
+ | Pre-release performance gate | Bundle analysis only → run ANALYZE=true npm run build |
18
+ | Regular weekly benchmark | API review only → `/tribunal-backend` |
19
+
20
+ ---
21
+
22
+ ## Benchmark Suite (Run in Order)
23
+
24
+ ```bash
25
+ # 1. Lighthouse CI — Core Web Vitals
26
+ npx lighthouse http://localhost:3000 \
27
+ --output=json \
28
+ --output-path=./reports/lighthouse-$(date +%Y%m%d).json \
29
+ --only-categories=performance,accessibility,best-practices,seo
30
+
31
+ # 2. Bundle Analysis
32
+ ANALYZE=true npm run build
33
+
34
+ # 3. API latency (using autocannon for load test)
35
+ npx autocannon -c 10 -d 20 http://localhost:3000/api/products
36
+ # -c: 10 concurrent connections
37
+ # -d: 20 second duration
38
+
39
+ # 4. Database query analysis
40
+ # (Prisma): Add to your test route temporarily
41
+ const plan = await prisma.$queryRaw`EXPLAIN ANALYZE SELECT * FROM orders WHERE user_id = ${userId}`;
42
+ console.log(plan);
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Benchmark Report Format
48
+
49
+ ```
50
+ ━━━ Performance Benchmark — [date] ━━━━━━━━━
51
+
52
+ ━━━ Core Web Vitals (Lighthouse) ━━━━━━━━━━
53
+ LCP: [time] [✅ Good | ⚠️ Needs Work | ❌ Poor]
54
+ INP: [time] [✅ Good | ⚠️ Needs Work | Poor]
55
+ CLS: [score] [✅ Good | ⚠️ Needs Work | ❌ Poor]
56
+ FCP: [time]
57
+ TTFB: [time]
58
+
59
+ Performance Score: [N]/100
60
+
61
+ ━━━ Bundle Sizes ━━━━━━━━━━━━━━━━━━━━━━━━━
62
+ First Load JS (shared): [size]
63
+ Largest page: [size] ([route])
64
+ Largest 3 bundles:
65
+ [bundle]: [size]
66
+ [bundle]: [size]
67
+ [bundle]: [size]
68
+
69
+ ━━━ API Latency (10 concurrent, 20s) ━━━━━━
70
+ GET /api/products: avg [ms] | p99 [ms] | [req/s] req/s
71
+ POST /api/orders: avg [ms] | p99 [ms]
72
+
73
+ ━━━ Comparison (vs last run) ━━━━━━━━━━━━━━
74
+ LCP: 4.2s 1.9s ▼ IMPROVED
75
+ INP: 480ms → 140ms ▼ IMPROVED ✅
76
+ Bundle: 890kb 310kb IMPROVED
77
+ p99 latency: 230ms 89ms IMPROVED
78
+ ```
79
+
80
+ ---
81
+
82
+ ## Performance Gates (Fail Criteria)
83
+
84
+ ```
85
+ Failing these means optimization is blocking — not optional:
86
+
87
+ LCP > 4.0s → ❌ Must fix — users see blank page
88
+ INP > 500ms → Must fix UI feels unresponsive
89
+ CLS > 0.25 → ❌ Must fix — layout jumps are jarring
90
+ Bundle > 1mb → Must fix 3G users abandon
91
+ p99 API > 2000ms Must fix timeout risk on slow connections
92
+
93
+ Warning range (fix before major release):
94
+ LCP 2.5–4.0s → ⚠️
95
+ INP 200–500ms ⚠️
96
+ Bundle 500kb–1mb → ⚠️
97
+ ```
98
+
99
+ ---
100
+
101
+ ## Historical Tracking
102
+
103
+ Save every benchmark run:
104
+
105
+ ```bash
106
+ # Benchmarks should be saved with date stamps
107
+ ./reports/lighthouse-2026-04-02.json
108
+ ./reports/bundle-2026-04-02.txt
109
+ ./reports/latency-2026-04-02.txt
110
+ ```
111
+
112
+ This enables trend analysis: is performance improving or degrading over time?
113
+
114
+ ---
115
+
116
+ ## Cross-Workflow Navigation
117
+
118
+ | Benchmark shows... | Go to |
119
+ |:---|:---|
120
+ | LCP or INP failing | `/tribunal-performance` for optimization |
121
+ | Bundle too large | `/enhance` to add dynamic imports |
122
+ | API latency high | `/tribunal-backend` + check `/tribunal-database` for N+1 |
123
+ | After optimization | Re-run `/performance-benchmarker` to verify |