@istmx/skills 1.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/README.md +49 -0
- package/bin/cli.js +251 -0
- package/istm/SKILL.md +65 -0
- package/istm-animate/SKILL.md +87 -0
- package/istm-animate/animations/animation_utils.md +280 -0
- package/istm-animate/animations/animations.md +220 -0
- package/istm-animate/animations/core_motion.md +250 -0
- package/istm-animate/animations/examples/README.md +29 -0
- package/istm-animate/animations/examples/nuxt/app/app.vue +3 -0
- package/istm-animate/animations/examples/nuxt/app/composables/useGSAP.ts +91 -0
- package/istm-animate/animations/examples/nuxt/app/pages/index.vue +55 -0
- package/istm-animate/animations/examples/nuxt/nuxt.config.ts +4 -0
- package/istm-animate/animations/examples/nuxt/package.json +18 -0
- package/istm-animate/animations/examples/react/App.jsx +46 -0
- package/istm-animate/animations/examples/react/index.html +12 -0
- package/istm-animate/animations/examples/react/main.jsx +9 -0
- package/istm-animate/animations/examples/react/package.json +21 -0
- package/istm-animate/animations/examples/react/vite.config.js +7 -0
- package/istm-animate/animations/examples/vanilla/index.html +33 -0
- package/istm-animate/animations/examples/vanilla/main.js +36 -0
- package/istm-animate/animations/examples/vue/app.vue +47 -0
- package/istm-animate/animations/examples/vue/index.html +15 -0
- package/istm-animate/animations/examples/vue/main.js +9 -0
- package/istm-animate/animations/examples/vue/package.json +19 -0
- package/istm-animate/animations/examples/vue/vite.config.js +7 -0
- package/istm-animate/animations/framework_motion.md +262 -0
- package/istm-animate/animations/motion.csv +17 -0
- package/istm-animate/animations/motion.md +11 -0
- package/istm-animate/animations/motion_catalog.json +226 -0
- package/istm-animate/animations/motion_performance.md +75 -0
- package/istm-animate/animations/motion_plugins.md +429 -0
- package/istm-animate/animations/react_animations.md +132 -0
- package/istm-animate/animations/scroll_trigger_effects.md +291 -0
- package/istm-animate/animations/timeline_sequencing.md +103 -0
- package/istm-architecture/SKILL.md +109 -0
- package/istm-architecture/frameworks/angular.csv +51 -0
- package/istm-architecture/frameworks/astro.csv +54 -0
- package/istm-architecture/frameworks/avalonia.csv +57 -0
- package/istm-architecture/frameworks/flutter.csv +53 -0
- package/istm-architecture/frameworks/javafx.csv +76 -0
- package/istm-architecture/frameworks/jetpack-compose.csv +53 -0
- package/istm-architecture/frameworks/laravel.csv +51 -0
- package/istm-architecture/frameworks/nextjs.csv +53 -0
- package/istm-architecture/frameworks/nuxtjs.csv +59 -0
- package/istm-architecture/frameworks/react-native.csv +52 -0
- package/istm-architecture/frameworks/react.csv +54 -0
- package/istm-architecture/frameworks/svelte.csv +54 -0
- package/istm-architecture/frameworks/swiftui.csv +51 -0
- package/istm-architecture/frameworks/uwp.csv +56 -0
- package/istm-architecture/frameworks/vue.csv +50 -0
- package/istm-architecture/frameworks/winui.csv +60 -0
- package/istm-architecture/frameworks/wpf.csv +57 -0
- package/istm-architecture/templates/agents.md +229 -0
- package/istm-architecture/templates/architecture.md +111 -0
- package/istm-architecture/templates/design.md +138 -0
- package/istm-architecture/templates/project-overview.md +215 -0
- package/istm-awwward-designer/SKILL.md +43 -0
- package/istm-awwward-designer/libraries/threejs.csv +54 -0
- package/istm-awwward-designer/references/accessibility.md +774 -0
- package/istm-awwward-designer/references/anim-anti-patterns.md +576 -0
- package/istm-awwward-designer/references/animation-map.md +166 -0
- package/istm-awwward-designer/references/animation-standards.md +86 -0
- package/istm-awwward-designer/references/anti-patterns.md +191 -0
- package/istm-awwward-designer/references/color-systems.md +604 -0
- package/istm-awwward-designer/references/css-performance.md +477 -0
- package/istm-awwward-designer/references/descender-safety.md +490 -0
- package/istm-awwward-designer/references/design-audit.md +93 -0
- package/istm-awwward-designer/references/font-loading.md +378 -0
- package/istm-awwward-designer/references/image-optimization.md +440 -0
- package/istm-awwward-designer/references/invention-gate.md +356 -0
- package/istm-awwward-designer/references/micro-interactions.md +825 -0
- package/istm-awwward-designer/references/page-transitions.md +365 -0
- package/istm-awwward-designer/references/performance-standards.md +79 -0
- package/istm-awwward-designer/references/quality-gate.md +103 -0
- package/istm-awwward-designer/references/responsive-design.md +778 -0
- package/istm-awwward-designer/references/scoring-guide.md +201 -0
- package/istm-awwward-designer/references/scroll-patterns.md +668 -0
- package/istm-awwward-designer/references/stitch-brief.md +124 -0
- package/istm-awwward-designer/references/tech-stack.md +204 -0
- package/istm-awwward-designer/references/technical-audit.md +133 -0
- package/istm-awwward-designer/references/technique-families.md +293 -0
- package/istm-awwward-designer/references/testing.md +535 -0
- package/istm-awwward-designer/references/text-animation.md +585 -0
- package/istm-awwward-designer/references/typography.md +504 -0
- package/istm-awwward-designer/references/usability-audit.md +108 -0
- package/istm-awwward-designer/references/visual-standards.md +97 -0
- package/istm-design/SKILL.md +98 -0
- package/istm-design/colors/color_theory.md +293 -0
- package/istm-design/colors/colors.csv +193 -0
- package/istm-design/colors/colors_catalog.json +4034 -0
- package/istm-design/colors/palette.json +21 -0
- package/istm-design/styles/design_system.md +288 -0
- package/istm-design/styles/html-tailwind.csv +56 -0
- package/istm-design/styles/nuxt-ui.csv +71 -0
- package/istm-design/styles/product_design.md +55 -0
- package/istm-design/styles/shadcn.csv +61 -0
- package/istm-design/styles/style.md +12 -0
- package/istm-design/styles/styles.csv +85 -0
- package/istm-design/styles/styles_catalog.json +2018 -0
- package/istm-design/styles/ui-reasoning.csv +162 -0
- package/istm-design/styles/uno.csv +60 -0
- package/istm-design/typography/font_and_font.md +10 -0
- package/istm-design/typography/google-fonts.csv +1924 -0
- package/istm-design/typography/sans_serif_fonts.md +112 -0
- package/istm-design/typography/typography.csv +75 -0
- package/istm-design/typography/typography_catalog.json +964 -0
- package/istm-design/ux/app-interface.csv +31 -0
- package/istm-design/ux/charts.csv +26 -0
- package/istm-design/ux/icons.csv +106 -0
- package/istm-design/ux/landing.csv +35 -0
- package/istm-design/ux/products.csv +193 -0
- package/istm-design/ux/react-performance.csv +45 -0
- package/istm-design/ux/responsive_rules.md +62 -0
- package/istm-design/ux/storytelling.md +47 -0
- package/istm-design/ux/ux-guidelines.csv +100 -0
- package/istm-design/ux/ux_guidelines.json +1190 -0
- package/istm-system-design/SKILL.md +88 -0
- package/istm-system-design/principles/01-architecture-patterns.md +24 -0
- package/istm-system-design/principles/02-database-selection.md +32 -0
- package/istm-system-design/principles/03-api-design.md +25 -0
- package/istm-system-design/principles/04-authentication-security.md +23 -0
- package/istm-system-design/principles/05-caching-performance.md +21 -0
- package/istm-system-design/principles/06-asynchronous-processing.md +17 -0
- package/istm-system-design/principles/07-infrastructure-deployment.md +22 -0
- package/istm-system-design/principles/08-low-level-design.md +35 -0
- package/istm-system-design/principles/09-state-management.md +14 -0
- package/istm-system-design/principles/10-error-handling-and-logging.md +26 -0
- package/istm-system-design/principles/11-testing-strategy.md +18 -0
- package/istm-system-design/principles/12-seo-and-web-vitals.md +18 -0
- package/istm-system-design/stacks/SETUP.md +82 -0
- package/istm-system-design/stacks/STACK.md +67 -0
- package/istm-system-design/stacks/WORKFLOW.md +84 -0
- package/istm-system-design/templates/api-route.ts.template +32 -0
- package/istm-system-design/templates/migrations.md.template +30 -0
- package/istm-system-design/templates/schema.drizzle.ts.template +17 -0
- package/istm-system-design/templates/schema.prisma.template +28 -0
- package/istm-system-design/templates/trpc-router.ts.template +22 -0
- package/istm-system-design/templates/zod-validators.ts.template +14 -0
- package/istm-workflow/istm-audit/SKILL.md +108 -0
- package/istm-workflow/istm-audit/agent-prompt.md +393 -0
- package/istm-workflow/istm-audit/agents/openai.yaml +7 -0
- package/istm-workflow/istm-audit/modes/area.md +19 -0
- package/istm-workflow/istm-audit/modes/gapfill.md +12 -0
- package/istm-workflow/istm-audit/modes/greenfield.md +24 -0
- package/istm-workflow/istm-audit/modes/tool-skills.md +39 -0
- package/istm-workflow/istm-audit/modes/whole-repo.md +5 -0
- package/istm-workflow/istm-audit/patterns/clean-architecture.md +15 -0
- package/istm-workflow/istm-audit/patterns/domain-driven.md +16 -0
- package/istm-workflow/istm-audit/patterns/functional.md +16 -0
- package/istm-workflow/istm-audit/patterns/solid-oop.md +17 -0
- package/istm-workflow/istm-check/SKILL.md +52 -0
- package/istm-workflow/istm-check/agents/openai.yaml +7 -0
- package/istm-workflow/istm-check/modes/review.md +156 -0
- package/istm-workflow/istm-check/modes/verify.md +197 -0
- package/istm-workflow/istm-check/review-agent-prompt.md +57 -0
- package/istm-workflow/istm-check/review-guide.md +133 -0
- package/istm-workflow/istm-craft/SKILL.md +37 -0
- package/istm-workflow/istm-craft/agent-modes/architecture.md +73 -0
- package/istm-workflow/istm-craft/agent-modes/cross-cutting.md +65 -0
- package/istm-workflow/istm-craft/agent-modes/enhancement.md +45 -0
- package/istm-workflow/istm-craft/agent-modes/feature.md +85 -0
- package/istm-workflow/istm-craft/agent-prompt.md +249 -0
- package/istm-workflow/istm-craft/agents/openai.yaml +7 -0
- package/istm-workflow/istm-craft/internal/after-subagent.md +90 -0
- package/istm-workflow/istm-craft/internal/design-conversation.md +140 -0
- package/istm-workflow/istm-craft/internal/tool-discovery.md +58 -0
- package/istm-workflow/istm-craft/spec-template.md +278 -0
- package/istm-workflow/istm-debug/SKILL.md +102 -0
- package/istm-workflow/istm-debug/agents/openai.yaml +7 -0
- package/istm-workflow/istm-develop/SKILL.md +144 -0
- package/istm-workflow/istm-develop/agents/openai.yaml +7 -0
- package/istm-workflow/istm-develop/checklist.md +95 -0
- package/istm-workflow/istm-develop/flow/build.md +133 -0
- package/istm-workflow/istm-develop/flow/git.md +34 -0
- package/istm-workflow/istm-develop/logical-guide.md +99 -0
- package/istm-workflow/istm-develop/ui/existing.md +23 -0
- package/istm-workflow/istm-develop/ui/generate.md +131 -0
- package/istm-workflow/istm-develop/ui/image.md +41 -0
- package/istm-workflow/istm-develop/ui/implementation.md +281 -0
- package/istm-workflow/istm-develop/ui/mcp.md +11 -0
- package/istm-workflow/istm-develop/ui-guide.md +164 -0
- package/istm-workflow/istm-document/SKILL.md +123 -0
- package/istm-workflow/istm-document/agent-prompt.md +57 -0
- package/istm-workflow/istm-document/agents/openai.yaml +7 -0
- package/istm-workflow/istm-document/templates/changelog.md +54 -0
- package/istm-workflow/istm-document/templates/postmortem.md +58 -0
- package/istm-workflow/istm-document/templates/pr.md +43 -0
- package/istm-workflow/istm-document/templates/release-note.md +41 -0
- package/istm-workflow/istm-scope/SKILL.md +100 -0
- package/istm-workflow/istm-scope/agents/openai.yaml +7 -0
- package/istm-workflow/istm-scope/approaches/facade.md +33 -0
- package/istm-workflow/istm-scope/approaches/journey.md +31 -0
- package/istm-workflow/istm-scope/approaches/skateboard.md +33 -0
- package/istm-workflow/istm-scope/approaches/tracer-bullet.md +34 -0
- package/istm-workflow/istm-scope/modes/add.md +14 -0
- package/istm-workflow/istm-scope/modes/plan-brownfield.md +11 -0
- package/istm-workflow/istm-scope/modes/plan-greenfield.md +20 -0
- package/istm-workflow/istm-scope/modes/plan-monorepo.md +8 -0
- package/istm-workflow/istm-scope/modes/plan.md +120 -0
- package/istm-workflow/istm-scope/modes/replan.md +13 -0
- package/istm-workflow/istm-scope/scope-template.md +148 -0
- package/istm-workflow/istm-sync/SKILL.md +166 -0
- package/istm-workflow/istm-sync/agent-prompt.md +211 -0
- package/istm-workflow/istm-sync/agents/openai.yaml +7 -0
- package/istm-workflow/istm-test/SKILL.md +233 -0
- package/istm-workflow/istm-test/agent-prompt.md +62 -0
- package/istm-workflow/istm-test/agents/openai.yaml +7 -0
- package/istm-workflow/istm-test/modes/setup.md +97 -0
- package/istm-workflow/istm-test/writing-guide.md +196 -0
- package/package.json +35 -0
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
# Testing — Deep Dive
|
|
2
|
+
|
|
3
|
+
Performance that isn't measured is performance that isn't controlled. This guide covers lab testing (Lighthouse, WebPageTest), field testing (CrUX, RUM), CI enforcement, and regression detection.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Lighthouse Audit Walkthrough
|
|
8
|
+
|
|
9
|
+
Lighthouse is your first stop for diagnosing performance issues. It runs in Chrome DevTools, CLI, or PageSpeed Insights.
|
|
10
|
+
|
|
11
|
+
### Running Lighthouse (Chrome DevTools)
|
|
12
|
+
|
|
13
|
+
1. Open Chrome DevTools (`F12` or `Cmd+Opt+I`)
|
|
14
|
+
2. Navigate to the **Lighthouse** panel
|
|
15
|
+
3. Select **Navigation** (for page load) or **Timespan** (for interactions)
|
|
16
|
+
4. Check **Performance** (and optionally Accessibility, Best Practices, SEO)
|
|
17
|
+
5. Choose **Device**: Mobile (default, throttled) or Desktop
|
|
18
|
+
6. Click **Analyze page load**
|
|
19
|
+
|
|
20
|
+
### Reading the Lighthouse Report
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
Performance: 85/100
|
|
24
|
+
|
|
25
|
+
Core Web Vitals:
|
|
26
|
+
LCP: 2.3s [orange] ← Needs Work
|
|
27
|
+
TBT: 180ms [green] ← Good
|
|
28
|
+
CLS: 0.05 [green] ← Good
|
|
29
|
+
FCP: 1.1s [green] ← Good
|
|
30
|
+
|
|
31
|
+
Opportunities:
|
|
32
|
+
⚠ Serve images in AVIF/WebP savings: 420KB
|
|
33
|
+
⚠ Properly size images savings: 280KB
|
|
34
|
+
⚠ Defer offscreen images savings: 150KB
|
|
35
|
+
⚠ Eliminate render-blocking CSS savings: 45ms
|
|
36
|
+
|
|
37
|
+
Diagnostics:
|
|
38
|
+
⚠ Largest Contentful Paint element: <img class="hero">
|
|
39
|
+
⚠ Has a `<link rel="preload">` for LCP image
|
|
40
|
+
⚠ Avoid large layout shifts CLS elements: 2
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Lighthouse CLI (CI / Automation)
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Install
|
|
47
|
+
bun add -g lighthouse
|
|
48
|
+
|
|
49
|
+
# Run
|
|
50
|
+
lighthouse https://yoursite.com \
|
|
51
|
+
--output=html \
|
|
52
|
+
--output-path=./lighthouse-report.html \
|
|
53
|
+
--only-categories=performance \
|
|
54
|
+
--preset=desktop
|
|
55
|
+
|
|
56
|
+
# JSON output for programmatic use
|
|
57
|
+
lighthouse https://yoursite.com \
|
|
58
|
+
--output=json \
|
|
59
|
+
--output-path=./lighthouse-report.json
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Lighthouse CI (Automated Checks)
|
|
63
|
+
|
|
64
|
+
```yaml
|
|
65
|
+
# .lighthouserc.yml
|
|
66
|
+
ci:
|
|
67
|
+
collect:
|
|
68
|
+
url: [
|
|
69
|
+
'https://yoursite.com/',
|
|
70
|
+
'https://yoursite.com/about',
|
|
71
|
+
'https://yoursite.com/work'
|
|
72
|
+
]
|
|
73
|
+
numberOfRuns: 3
|
|
74
|
+
settings:
|
|
75
|
+
preset: desktop
|
|
76
|
+
throttlingMethod: simulate
|
|
77
|
+
assert:
|
|
78
|
+
assertions:
|
|
79
|
+
categories:performance:
|
|
80
|
+
minScore: 0.9
|
|
81
|
+
"first-contentful-paint":
|
|
82
|
+
maxNumericValue: 1800
|
|
83
|
+
"largest-contentful-paint":
|
|
84
|
+
maxNumericValue: 2500
|
|
85
|
+
"cumulative-layout-shift":
|
|
86
|
+
maxNumericValue: 0.1
|
|
87
|
+
"total-blocking-time":
|
|
88
|
+
maxNumericValue: 300
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## WebPageTest
|
|
94
|
+
|
|
95
|
+
WebPageTest is the definitive tool for waterfall analysis, filmstrip views, and custom testing scenarios that Lighthouse can't handle.
|
|
96
|
+
|
|
97
|
+
### Key Features
|
|
98
|
+
|
|
99
|
+
- **Waterfall chart** — See every request, timing, size, and order
|
|
100
|
+
- **Filmstrip view** — Visual playback of page loading frame by frame
|
|
101
|
+
- **Custom throttling** — Simulate 3G, 4G, slow 4G, cable, custom
|
|
102
|
+
- **Multiple runs** — Capture consistency, not just one sample
|
|
103
|
+
- **Geographic testing** — Test from real locations worldwide
|
|
104
|
+
- **Video comparison** — Side-by-side A/B testing
|
|
105
|
+
|
|
106
|
+
### Reading the Waterfall
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
Timeline:
|
|
110
|
+
0ms DNS lookup (bar: teal)
|
|
111
|
+
50ms TCP connect (bar: orange)
|
|
112
|
+
100ms SSL handshake (bar: purple)
|
|
113
|
+
150ms TTFB (bar: green)
|
|
114
|
+
200ms Content download (bar: blue)
|
|
115
|
+
400ms DOM interactive (bar: red marker)
|
|
116
|
+
800ms Onload (bar: blue marker)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Key WebPageTest Metrics
|
|
120
|
+
|
|
121
|
+
| Metric | What It Tells You |
|
|
122
|
+
|--------|------------------|
|
|
123
|
+
| **TTFB** | Server responsiveness (aim < 400ms) |
|
|
124
|
+
| **Start Render** | When something first appears (aim < 1.5s) |
|
|
125
|
+
| **FCP** | First contentful paint (aim < 1.8s) |
|
|
126
|
+
| **LCP** | Largest contentful paint (aim < 1.8s) |
|
|
127
|
+
| **CLS** | Cumulative layout shift |
|
|
128
|
+
| **Speed Index** | Overall visual completeness over time |
|
|
129
|
+
| **Fully Loaded** | When all resources finished loading |
|
|
130
|
+
| **CPU Busy** | Main thread utilization |
|
|
131
|
+
| **Main Thread** | Breakdown of JS execution |
|
|
132
|
+
|
|
133
|
+
### WebPageTest Config
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
URL: https://yoursite.com
|
|
137
|
+
Location: us-east-1 (Chrome, throttled)
|
|
138
|
+
Connection: Cable (5 Mbps down, 1 Mbps up, 28ms RTT)
|
|
139
|
+
Viewport: 1366x768
|
|
140
|
+
Repeat View: first view only (or cached)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Filmstrip Analysis
|
|
144
|
+
|
|
145
|
+
Use the filmstrip to identify:
|
|
146
|
+
1. **When does LCP happen?** — Is it on the hero image, text, or background?
|
|
147
|
+
2. **Is there a blank screen before first paint?** — Means render-blocking resources
|
|
148
|
+
3. **Does content jump during load?** — CLS from late-loading content
|
|
149
|
+
4. **Is the loading experience smooth?** — No jarring transitions
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## PageSpeed Insights
|
|
154
|
+
|
|
155
|
+
PageSpeed Insights (PSI) combines **field data** (real users, CrUX) with **lab data** (Lighthouse).
|
|
156
|
+
|
|
157
|
+
### Using PageSpeed Insights
|
|
158
|
+
|
|
159
|
+
1. Go to [pagespeed.web.dev](https://pagespeed.web.dev)
|
|
160
|
+
2. Enter URL
|
|
161
|
+
3. Get field + lab analysis side by side
|
|
162
|
+
|
|
163
|
+
### Field Data (CrUX — 75th Percentile)
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
Field Data (Chrome UX Report):
|
|
167
|
+
LCP: 2.1s [Good]
|
|
168
|
+
INP: 145ms [Good]
|
|
169
|
+
CLS: 0.03 [Good]
|
|
170
|
+
FCP: 1.1s [Good]
|
|
171
|
+
TTFB: 380ms [Good]
|
|
172
|
+
|
|
173
|
+
Top 75% of observations fall below these values
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Lab Data (Lighthouse)
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
Lab Data:
|
|
180
|
+
LCP: 1.9s [Good]
|
|
181
|
+
CLS: 0.02 [Good]
|
|
182
|
+
TBT: 120ms [Good]
|
|
183
|
+
FCP: 0.9s [Good]
|
|
184
|
+
|
|
185
|
+
Performance: 95
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### When Field and Lab Disagree
|
|
189
|
+
|
|
190
|
+
| Scenario | Cause | Action |
|
|
191
|
+
|----------|-------|--------|
|
|
192
|
+
| Lab good, Field bad | Real-world network/device variability | Test on real devices, optimize server |
|
|
193
|
+
| Lab bad, Field good | Test environment is slower than average user | Ignore lab, field is ground truth |
|
|
194
|
+
| Both bad | Real problem | Fix the metrics |
|
|
195
|
+
| Both good | You're doing well | Maintain and monitor |
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Real Device Testing
|
|
200
|
+
|
|
201
|
+
Lab testing is simulation. Real device testing is reality.
|
|
202
|
+
|
|
203
|
+
### Why Browser DevTools Lie
|
|
204
|
+
|
|
205
|
+
- Desktop DevTools uses desktop-class CPU
|
|
206
|
+
- Throttling is software-based (inaccurate)
|
|
207
|
+
- Network throttling is crude (doesn't simulate TCP slow start, TLS handshakes)
|
|
208
|
+
- No GPU throttling simulation
|
|
209
|
+
|
|
210
|
+
### Real Device Options
|
|
211
|
+
|
|
212
|
+
| Option | Cost | Devices | Best For |
|
|
213
|
+
|--------|------|---------|----------|
|
|
214
|
+
| BrowserStack | Paid | 3000+ | Full automation + manual |
|
|
215
|
+
| Sauce Labs | Paid | 1000+ | CI integration |
|
|
216
|
+
| LambdaTest | Paid | 3000+ | CI + manual |
|
|
217
|
+
| WebPageTest Real Devices | Free (limited) | 40+ | Lab-quality on real hardware |
|
|
218
|
+
| Local physical devices | Free | Your devices | Quick checks |
|
|
219
|
+
|
|
220
|
+
### Testing on Real Devices
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
# WebPageTest real device testing
|
|
224
|
+
# Use the "Real Devices" option in the advanced settings
|
|
225
|
+
# Select: Moto G4, Pixel 5, iPhone 12, Galaxy S20
|
|
226
|
+
|
|
227
|
+
# Or via API
|
|
228
|
+
curl "https://www.webpagetest.org/runtest.php" \
|
|
229
|
+
-d "url=https://yoursite.com" \
|
|
230
|
+
-d "location=Mobile_US:Ericsson" \
|
|
231
|
+
-d "bwDown=4000" \
|
|
232
|
+
-d "bwUp=1500" \
|
|
233
|
+
-d "latency=40" \
|
|
234
|
+
-d "video=1" \
|
|
235
|
+
-d "f=json"
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Mobile Performance Checklist
|
|
239
|
+
|
|
240
|
+
```plaintext
|
|
241
|
+
□ Test on a low-end Android (Moto G4 equivalent or slower)
|
|
242
|
+
□ Test on iPhone 12 or older iPhone
|
|
243
|
+
□ Test on 3G (1.6 Mbps down, 750 Kbps up, 150ms RTT)
|
|
244
|
+
□ Test with 6 tabs open (memory pressure)
|
|
245
|
+
□ Test with Dark Mode (some devices throttle in dark mode)
|
|
246
|
+
□ Test with Smooth Scroll enabled vs disabled
|
|
247
|
+
□ Test touch targets are at least 48x48px
|
|
248
|
+
□ Test no hover states on mobile (causes tap delay)
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Field Data vs Lab Data
|
|
254
|
+
|
|
255
|
+
| Aspect | Field Data | Lab Data |
|
|
256
|
+
|--------|-----------|----------|
|
|
257
|
+
| Source | Real users (CrUX) | Synthetic (Lighthouse) |
|
|
258
|
+
| Variability | Reflects real conditions | Single snapshot |
|
|
259
|
+
| 75th percentile | Top 75% of user experiences | One simulated scenario |
|
|
260
|
+
| Device | User's actual devices | Browser DevTools |
|
|
261
|
+
| Network | User's actual connection | Throttled simulation |
|
|
262
|
+
| Frequency | Updated monthly | Every test |
|
|
263
|
+
| **Ground truth?** | **Yes** | No (proxy) |
|
|
264
|
+
|
|
265
|
+
**Rule:** If you're optimizing for real users, field data is the source of truth. Lab data is useful for debugging and regression detection.
|
|
266
|
+
|
|
267
|
+
### CrUX API (BigQuery)
|
|
268
|
+
|
|
269
|
+
```sql
|
|
270
|
+
-- Get CrUX data via BigQuery (for detailed analysis)
|
|
271
|
+
SELECT
|
|
272
|
+
date,
|
|
273
|
+
form_factor,
|
|
274
|
+
metrics.largest_contentful_paint.p75 AS lcp_p75,
|
|
275
|
+
metrics.cumulative_layout_shift.p75 AS cls_p75,
|
|
276
|
+
metrics.interaction_to_next_paint.p75 AS inp_p75
|
|
277
|
+
FROM
|
|
278
|
+
`chrome-ux-report.materialized.device_histogram`
|
|
279
|
+
WHERE
|
|
280
|
+
yyyymm = 202501
|
|
281
|
+
AND origin = 'https://yoursite.com'
|
|
282
|
+
ORDER BY date
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## Performance Budget Enforcement in CI
|
|
288
|
+
|
|
289
|
+
### Lighthouse CI Setup
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
bun add -d @lhci/cli
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
```yaml
|
|
296
|
+
# .lighthouserc.yml
|
|
297
|
+
ci:
|
|
298
|
+
collect:
|
|
299
|
+
staticDistDir: ./dist
|
|
300
|
+
url: [
|
|
301
|
+
'http://localhost/'
|
|
302
|
+
]
|
|
303
|
+
settings:
|
|
304
|
+
preset: desktop
|
|
305
|
+
throttling:
|
|
306
|
+
rttMs: 40
|
|
307
|
+
throughputKbps: 10240
|
|
308
|
+
cpuSlowdownMultiplier: 1
|
|
309
|
+
assert:
|
|
310
|
+
preset: lighthouse:recommended
|
|
311
|
+
assertions:
|
|
312
|
+
# Core Web Vitals
|
|
313
|
+
categories:performance:
|
|
314
|
+
minScore: 0.9
|
|
315
|
+
first-contentful-paint:
|
|
316
|
+
maxNumericValue: 1800
|
|
317
|
+
largest-contentful-paint:
|
|
318
|
+
maxNumericValue: 2500
|
|
319
|
+
cumulative-layout-shift:
|
|
320
|
+
maxNumericValue: 0.1
|
|
321
|
+
total-blocking-time:
|
|
322
|
+
maxNumericValue: 300
|
|
323
|
+
speed-index:
|
|
324
|
+
maxNumericValue: 3400
|
|
325
|
+
|
|
326
|
+
# Budgets
|
|
327
|
+
uses-optimized-images:
|
|
328
|
+
mode: warn
|
|
329
|
+
unused-javascript:
|
|
330
|
+
maxNumericValue: 0
|
|
331
|
+
render-blocking-resources:
|
|
332
|
+
maxNumericValue: 0
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### GitHub Actions Integration
|
|
336
|
+
|
|
337
|
+
```yaml
|
|
338
|
+
# .github/workflows/lighthouse.yml
|
|
339
|
+
name: Lighthouse CI
|
|
340
|
+
|
|
341
|
+
on: [push, pull_request]
|
|
342
|
+
|
|
343
|
+
jobs:
|
|
344
|
+
lighthouse:
|
|
345
|
+
runs-on: ubuntu-latest
|
|
346
|
+
steps:
|
|
347
|
+
- uses: actions/checkout@v4
|
|
348
|
+
|
|
349
|
+
- name: Setup Bun
|
|
350
|
+
uses: oven-sh/setup-bun@v2
|
|
351
|
+
with:
|
|
352
|
+
bun-version: latest
|
|
353
|
+
|
|
354
|
+
- name: Install dependencies
|
|
355
|
+
run: bun install --frozen-lockfile
|
|
356
|
+
|
|
357
|
+
- name: Build
|
|
358
|
+
run: bun run build
|
|
359
|
+
|
|
360
|
+
- name: Run Lighthouse CI
|
|
361
|
+
run: |
|
|
362
|
+
bun add -g @lhci/cli
|
|
363
|
+
lhci autorun
|
|
364
|
+
env:
|
|
365
|
+
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### Bundle Size Budget (Bundlesize)
|
|
369
|
+
|
|
370
|
+
```json
|
|
371
|
+
// .bundlesizerc
|
|
372
|
+
{
|
|
373
|
+
"*.js": {
|
|
374
|
+
"maxSize": "120kB"
|
|
375
|
+
},
|
|
376
|
+
"critical.js": {
|
|
377
|
+
"maxSize": "20kB"
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
```bash
|
|
383
|
+
# package.json
|
|
384
|
+
{
|
|
385
|
+
"scripts": {
|
|
386
|
+
"bundlesize": "bundlesize",
|
|
387
|
+
"build": "vite build && bundlesize"
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
## Core Web Vitals Measurement Tools Comparison
|
|
395
|
+
|
|
396
|
+
| Tool | Core Web Vitals | Field | Lab | Real Devices | API | CI |
|
|
397
|
+
|------|----------------|-------|-----|--------------|-----|-----|
|
|
398
|
+
| **Lighthouse** | All (except INP) | No | Yes | No | CLI | Yes |
|
|
399
|
+
| **PageSpeed Insights** | All | Yes | Yes | No | REST API | Via CI |
|
|
400
|
+
| **WebPageTest** | All | No | Yes | Yes | REST API | Via CI |
|
|
401
|
+
| **Chrome DevTools** | All | No | Yes | No | No | No |
|
|
402
|
+
| **web-vitals.js** | All | Yes | No | N/A | No | No |
|
|
403
|
+
| **CrUX Dashboard** | All | Yes | No | N/A | BigQuery | No |
|
|
404
|
+
| **GTmetrix** | Most | No | Yes | No | REST API | Via CI |
|
|
405
|
+
| **Calibre** | All | Yes | Yes | Yes | Yes | Yes |
|
|
406
|
+
| **SpeedCurve** | All | Yes | Yes | No | Yes | Yes |
|
|
407
|
+
|
|
408
|
+
### web-vitals.js (Real User Monitoring)
|
|
409
|
+
|
|
410
|
+
```html
|
|
411
|
+
<script type="module">
|
|
412
|
+
import { onCLS, onINP, onLCP, onFCP, onTTFB } from 'https://unpkg.com/web-vitals@4?module';
|
|
413
|
+
|
|
414
|
+
function sendToAnalytics({ name, value, id, rating }) {
|
|
415
|
+
// Send to your analytics endpoint
|
|
416
|
+
navigator.sendBeacon('/analytics', JSON.stringify({
|
|
417
|
+
metric: name,
|
|
418
|
+
value: Math.round(name === 'CLS' ? value * 1000 : value),
|
|
419
|
+
rating, // 'good' | 'needs-improvement' | 'poor'
|
|
420
|
+
id
|
|
421
|
+
}));
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
onLCP(sendToAnalytics, { reportAllChanges: false });
|
|
425
|
+
onINP(sendToAnalytics, { reportAllChanges: false });
|
|
426
|
+
onCLS(sendToAnalytics, { reportAllChanges: false });
|
|
427
|
+
onFCP(sendToAnalytics, { reportAllChanges: false });
|
|
428
|
+
onTTFB(sendToAnalytics, { reportAllChanges: false });
|
|
429
|
+
</script>
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
---
|
|
433
|
+
|
|
434
|
+
## Performance Regression Detection
|
|
435
|
+
|
|
436
|
+
### Automated Regression Detection
|
|
437
|
+
|
|
438
|
+
```yaml
|
|
439
|
+
# .github/workflows/perf-regression.yml
|
|
440
|
+
name: Performance Regression Check
|
|
441
|
+
|
|
442
|
+
on:
|
|
443
|
+
pull_request:
|
|
444
|
+
paths:
|
|
445
|
+
- 'src/**'
|
|
446
|
+
- 'package.json'
|
|
447
|
+
- 'vite.config.js'
|
|
448
|
+
|
|
449
|
+
jobs:
|
|
450
|
+
lighthouse:
|
|
451
|
+
runs-on: ubuntu-latest
|
|
452
|
+
steps:
|
|
453
|
+
- uses: actions/checkout@v4
|
|
454
|
+
|
|
455
|
+
- name: Setup Bun
|
|
456
|
+
uses: oven-sh/setup-bun@v2
|
|
457
|
+
with:
|
|
458
|
+
bun-version: latest
|
|
459
|
+
|
|
460
|
+
- name: Install
|
|
461
|
+
run: bun install --frozen-lockfile
|
|
462
|
+
|
|
463
|
+
- name: Build
|
|
464
|
+
run: bun run build
|
|
465
|
+
|
|
466
|
+
- name: Run Lighthouse
|
|
467
|
+
run: bunx lighthouse https://staging.yoursite.com \
|
|
468
|
+
--output=json \
|
|
469
|
+
--output-path=lighthouse-result.json
|
|
470
|
+
|
|
471
|
+
- name: Parse and check scores
|
|
472
|
+
run: |
|
|
473
|
+
node -e "
|
|
474
|
+
const results = require('./lighthouse-result.json');
|
|
475
|
+
const perf = results.categories.performance.score * 100;
|
|
476
|
+
const lcp = results.audits['largest-contentful-paint'].numericValue;
|
|
477
|
+
const cls = results.audits['cumulative-layout-shift'].numericValue;
|
|
478
|
+
|
|
479
|
+
if (perf < 85) {
|
|
480
|
+
console.error('Performance score ' + perf + ' < 85 — REGRESSION');
|
|
481
|
+
process.exit(1);
|
|
482
|
+
}
|
|
483
|
+
if (lcp > 1800) {
|
|
484
|
+
console.error('LCP ' + lcp + 'ms > 1800ms — REGRESSION (Awwwards target: <1.8s)');
|
|
485
|
+
process.exit(1);
|
|
486
|
+
}
|
|
487
|
+
if (cls > 0.05) {
|
|
488
|
+
console.error('CLS ' + cls + ' > 0.05 — REGRESSION (Awwwards target: <0.05)');
|
|
489
|
+
process.exit(1);
|
|
490
|
+
}
|
|
491
|
+
console.log('All checks passed');
|
|
492
|
+
"
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
### Tracking Performance Over Time
|
|
496
|
+
|
|
497
|
+
```
|
|
498
|
+
Performance Score History (Lighthouse Desktop):
|
|
499
|
+
Jan 1: ████████████████████ 92 ✓
|
|
500
|
+
Jan 8: ████████████████████ 94 ✓
|
|
501
|
+
Jan 15: ███████████████████ 89 ✗ ← Regression detected!
|
|
502
|
+
Jan 22: ████████████████████ 93 ✓ ← Fixed
|
|
503
|
+
|
|
504
|
+
Action: PR #142 added a heavy analytics library → 3 point drop
|
|
505
|
+
Fix: Lazy load the analytics SDK → Score recovered
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
### Regression Detection Strategies
|
|
509
|
+
|
|
510
|
+
1. **Lighthouse CI on every PR** — Block merges below threshold
|
|
511
|
+
2. **Bundle size tracking** — Alert on >10% increase
|
|
512
|
+
3. **CrUX monitoring** — Alert when field metrics worsen
|
|
513
|
+
4. **Synthetic monitoring** — Periodic tests from multiple locations
|
|
514
|
+
5. **RUM alerting** — Real-time alerts when p75 exceeds thresholds
|
|
515
|
+
|
|
516
|
+
---
|
|
517
|
+
|
|
518
|
+
## Testing Checklist
|
|
519
|
+
|
|
520
|
+
```plaintext
|
|
521
|
+
□ Lighthouse Performance 90+ on mobile and desktop
|
|
522
|
+
□ Core Web Vitals green in PageSpeed Insights field data
|
|
523
|
+
□ WebPageTest waterfall: no render-blocking on critical path
|
|
524
|
+
□ WebPageTest filmstrip: no blank screens, no CLS jumps
|
|
525
|
+
□ Real device testing on low-end Android
|
|
526
|
+
□ Real device testing on older iPhone (iPhone 11 or older)
|
|
527
|
+
□ Bundle size within tier budget (run bundlesize)
|
|
528
|
+
□ No new render-blocking resources in PR
|
|
529
|
+
□ Performance budget enforced in CI (.lighthouserc.yml)
|
|
530
|
+
□ web-vitals.js RUM running in production
|
|
531
|
+
□ Performance regression detected and alerted
|
|
532
|
+
□ CrUX data reviewed monthly
|
|
533
|
+
□ TTFB < 800ms (server-side check)
|
|
534
|
+
□ Accessibility audit alongside performance audit
|
|
535
|
+
```
|