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.
- package/.agent/agents/accessibility-reviewer.md +220 -134
- package/.agent/agents/ai-code-reviewer.md +233 -129
- package/.agent/agents/backend-specialist.md +238 -178
- package/.agent/agents/code-archaeologist.md +181 -119
- package/.agent/agents/database-architect.md +207 -164
- package/.agent/agents/debugger.md +218 -151
- package/.agent/agents/dependency-reviewer.md +136 -55
- package/.agent/agents/devops-engineer.md +238 -175
- package/.agent/agents/documentation-writer.md +221 -137
- package/.agent/agents/explorer-agent.md +180 -142
- package/.agent/agents/frontend-reviewer.md +194 -80
- package/.agent/agents/frontend-specialist.md +237 -188
- package/.agent/agents/game-developer.md +52 -184
- package/.agent/agents/logic-reviewer.md +149 -78
- package/.agent/agents/mobile-developer.md +223 -152
- package/.agent/agents/mobile-reviewer.md +195 -79
- package/.agent/agents/orchestrator.md +211 -170
- package/.agent/agents/penetration-tester.md +174 -131
- package/.agent/agents/performance-optimizer.md +203 -139
- package/.agent/agents/performance-reviewer.md +211 -108
- package/.agent/agents/product-manager.md +162 -108
- package/.agent/agents/project-planner.md +162 -142
- package/.agent/agents/qa-automation-engineer.md +242 -138
- package/.agent/agents/security-auditor.md +194 -170
- package/.agent/agents/seo-specialist.md +213 -132
- package/.agent/agents/sql-reviewer.md +194 -73
- package/.agent/agents/supervisor-agent.md +203 -156
- package/.agent/agents/test-coverage-reviewer.md +193 -81
- package/.agent/agents/type-safety-reviewer.md +208 -65
- package/.agent/scripts/__pycache__/auto_preview.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/bundle_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/checklist.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/dependency_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/session_manager.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/skill_integrator.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/swarm_dispatcher.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/verify_all.cpython-311.pyc +0 -0
- package/.agent/skills/agent-organizer/SKILL.md +126 -132
- package/.agent/skills/ai-prompt-injection-defense/SKILL.md +155 -66
- package/.agent/skills/api-patterns/SKILL.md +289 -257
- package/.agent/skills/api-security-auditor/SKILL.md +172 -70
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +1 -1
- package/.agent/skills/appflow-wireframe/SKILL.md +107 -100
- package/.agent/skills/architecture/SKILL.md +331 -200
- package/.agent/skills/authentication-best-practices/SKILL.md +168 -67
- package/.agent/skills/bash-linux/SKILL.md +154 -215
- package/.agent/skills/brainstorming/SKILL.md +104 -210
- package/.agent/skills/building-native-ui/SKILL.md +169 -70
- package/.agent/skills/clean-code/SKILL.md +360 -206
- package/.agent/skills/config-validator/SKILL.md +141 -165
- package/.agent/skills/csharp-developer/SKILL.md +528 -107
- package/.agent/skills/database-design/SKILL.md +455 -275
- package/.agent/skills/deployment-procedures/SKILL.md +145 -188
- package/.agent/skills/devops-engineer/SKILL.md +332 -134
- package/.agent/skills/devops-incident-responder/SKILL.md +113 -98
- package/.agent/skills/edge-computing/SKILL.md +157 -213
- package/.agent/skills/extract-design-system/SKILL.md +129 -69
- package/.agent/skills/framer-motion-expert/SKILL.md +939 -0
- package/.agent/skills/game-design-expert/SKILL.md +105 -0
- package/.agent/skills/game-engineering-expert/SKILL.md +122 -0
- package/.agent/skills/geo-fundamentals/SKILL.md +124 -215
- package/.agent/skills/github-operations/SKILL.md +314 -354
- package/.agent/skills/gsap-expert/SKILL.md +901 -0
- package/.agent/skills/i18n-localization/SKILL.md +138 -216
- package/.agent/skills/intelligent-routing/SKILL.md +127 -139
- package/.agent/skills/llm-engineering/SKILL.md +357 -258
- package/.agent/skills/local-first/SKILL.md +154 -203
- package/.agent/skills/mcp-builder/SKILL.md +118 -224
- package/.agent/skills/nextjs-react-expert/SKILL.md +783 -203
- package/.agent/skills/nodejs-best-practices/SKILL.md +559 -280
- package/.agent/skills/observability/SKILL.md +330 -285
- package/.agent/skills/parallel-agents/SKILL.md +122 -181
- package/.agent/skills/performance-profiling/SKILL.md +254 -197
- package/.agent/skills/plan-writing/SKILL.md +118 -188
- package/.agent/skills/platform-engineer/SKILL.md +123 -135
- package/.agent/skills/playwright-best-practices/SKILL.md +157 -76
- package/.agent/skills/powershell-windows/SKILL.md +146 -230
- package/.agent/skills/python-pro/SKILL.md +879 -114
- package/.agent/skills/react-specialist/SKILL.md +931 -108
- package/.agent/skills/realtime-patterns/SKILL.md +304 -296
- package/.agent/skills/rust-pro/SKILL.md +701 -240
- package/.agent/skills/seo-fundamentals/SKILL.md +154 -181
- package/.agent/skills/server-management/SKILL.md +190 -212
- package/.agent/skills/shadcn-ui-expert/SKILL.md +201 -68
- package/.agent/skills/sql-pro/SKILL.md +633 -104
- package/.agent/skills/swiftui-expert/SKILL.md +171 -70
- package/.agent/skills/systematic-debugging/SKILL.md +118 -186
- package/.agent/skills/tailwind-patterns/SKILL.md +576 -232
- package/.agent/skills/tdd-workflow/SKILL.md +137 -209
- package/.agent/skills/testing-patterns/SKILL.md +573 -205
- package/.agent/skills/vue-expert/SKILL.md +964 -119
- package/.agent/skills/vulnerability-scanner/SKILL.md +269 -316
- package/.agent/skills/web-accessibility-auditor/SKILL.md +188 -71
- package/.agent/skills/webapp-testing/SKILL.md +145 -236
- package/.agent/workflows/api-tester.md +151 -279
- package/.agent/workflows/audit.md +138 -168
- package/.agent/workflows/brainstorm.md +110 -146
- package/.agent/workflows/changelog.md +112 -144
- package/.agent/workflows/create.md +124 -139
- package/.agent/workflows/debug.md +189 -196
- package/.agent/workflows/deploy.md +189 -153
- package/.agent/workflows/enhance.md +151 -139
- package/.agent/workflows/fix.md +135 -143
- package/.agent/workflows/generate.md +157 -164
- package/.agent/workflows/migrate.md +160 -163
- package/.agent/workflows/orchestrate.md +168 -151
- package/.agent/workflows/performance-benchmarker.md +123 -305
- package/.agent/workflows/plan.md +173 -151
- package/.agent/workflows/preview.md +80 -137
- package/.agent/workflows/refactor.md +183 -153
- package/.agent/workflows/review-ai.md +129 -140
- package/.agent/workflows/review.md +116 -155
- package/.agent/workflows/session.md +94 -154
- package/.agent/workflows/status.md +79 -125
- package/.agent/workflows/strengthen-skills.md +139 -99
- package/.agent/workflows/swarm.md +179 -194
- package/.agent/workflows/test.md +211 -166
- package/.agent/workflows/tribunal-backend.md +113 -111
- package/.agent/workflows/tribunal-database.md +115 -132
- package/.agent/workflows/tribunal-frontend.md +118 -115
- package/.agent/workflows/tribunal-full.md +133 -136
- package/.agent/workflows/tribunal-mobile.md +119 -123
- package/.agent/workflows/tribunal-performance.md +133 -152
- package/.agent/workflows/ui-ux-pro-max.md +143 -171
- package/README.md +11 -15
- package/package.json +1 -1
- package/.agent/skills/dotnet-core-expert/SKILL.md +0 -103
- package/.agent/skills/framer-motion-animations/SKILL.md +0 -74
- package/.agent/skills/game-development/2d-games/SKILL.md +0 -119
- package/.agent/skills/game-development/3d-games/SKILL.md +0 -135
- package/.agent/skills/game-development/SKILL.md +0 -236
- package/.agent/skills/game-development/game-art/SKILL.md +0 -185
- package/.agent/skills/game-development/game-audio/SKILL.md +0 -190
- package/.agent/skills/game-development/game-design/SKILL.md +0 -129
- package/.agent/skills/game-development/mobile-games/SKILL.md +0 -108
- package/.agent/skills/game-development/multiplayer/SKILL.md +0 -132
- package/.agent/skills/game-development/pc-games/SKILL.md +0 -144
- package/.agent/skills/game-development/vr-ar/SKILL.md +0 -123
- 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 —
|
|
6
|
-
|
|
7
|
-
$ARGUMENTS
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
|
121
|
-
|
|
122
|
-
|
|
|
123
|
-
|
|
|
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 |
|