performance-testing
Load testing with k6, web performance auditing with Lighthouse, profiling, and benchmark analysis.
What this skill does
# Performance Testing
Load testing, web performance auditing, profiling, and benchmarking.
## Load Testing with k6
### Quick smoke test
```bash
k6 run --vus 1 --duration 10s script.js
```
### Stress test
```bash
k6 run --vus 100 --duration 5m script.js
```
### Inline script (no file needed)
```bash
k6 run -e URL=https://api.example.com - <<'EOF'
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
stages: [
{ duration: '30s', target: 10 },
{ duration: '1m', target: 50 },
{ duration: '30s', target: 0 },
],
thresholds: {
http_req_duration: ['p(95)<500'],
http_req_failed: ['rate<0.01'],
},
};
export default function () {
const res = http.get(__ENV.URL);
check(res, {
'status is 200': (r) => r.status === 200,
'response time < 500ms': (r) => r.timings.duration < 500,
});
sleep(1);
}
EOF
```
### k6 with JSON output
```bash
k6 run --out json=results.json script.js
cat results.json | jq 'select(.type=="Point" and .metric=="http_req_duration") | .data.value' | sort -n | tail -5
```
## Web Performance (Lighthouse)
### CLI audit
```bash
# Full audit
lighthouse https://example.com --output json --output html --output-path ./report
# Performance only
lighthouse https://example.com --only-categories=performance --output json | jq '{performance: .categories.performance.score, fcp: .audits["first-contentful-paint"].displayValue, lcp: .audits["largest-contentful-paint"].displayValue, cls: .audits["cumulative-layout-shift"].displayValue, tbt: .audits["total-blocking-time"].displayValue}'
# Mobile simulation (default)
lighthouse https://example.com --preset=perf --output json | jq '.categories.performance.score'
# Desktop
lighthouse https://example.com --preset=desktop --output json | jq '.categories.performance.score'
```
### Core Web Vitals extraction
```bash
lighthouse https://example.com --output json | jq '{
LCP: .audits["largest-contentful-paint"].numericValue,
FID: .audits["max-potential-fid"].numericValue,
CLS: .audits["cumulative-layout-shift"].numericValue,
FCP: .audits["first-contentful-paint"].numericValue,
TBT: .audits["total-blocking-time"].numericValue,
SI: .audits["speed-index"].numericValue
}'
```
## HTTP Benchmarking
### curl timing
```bash
# Detailed timing for single request
curl -s -o /dev/null -w "DNS: %{time_namelookup}s\nConnect: %{time_connect}s\nTLS: %{time_appconnect}s\nTTFB: %{time_starttransfer}s\nTotal: %{time_total}s\nSize: %{size_download} bytes\n" https://example.com
# Repeated measurements
for i in $(seq 1 10); do
curl -s -o /dev/null -w "%{time_total}" https://example.com
echo ""
done | awk '{sum+=$1; count++} END {print "Avg: " sum/count "s over " count " requests"}'
```
### Apache Bench (ab)
```bash
# 100 requests, 10 concurrent
ab -n 100 -c 10 https://example.com/
# With POST data
ab -n 100 -c 10 -p payload.json -T application/json https://api.example.com/endpoint
```
## Bundle Size Analysis
```bash
# Node.js bundle (webpack)
npx webpack --profile --json > stats.json
npx webpack-bundle-analyzer stats.json
# Vite
npx vite build --report
# Package size check
npx bundlephobia <package-name>
# Check what you're shipping
du -sh dist/
find dist/ -name "*.js" -exec du -sh {} \; | sort -rh | head -10
```
## Memory & CPU Profiling
```bash
# Node.js heap snapshot
node --inspect app.js
# Then open chrome://inspect in Chrome
# Node.js CPU profile
node --cpu-prof app.js
# Generates .cpuprofile file — open in Chrome DevTools
# Python profiling
python -m cProfile -s cumulative app.py | head -30
# Go profiling
go test -bench=. -cpuprofile=cpu.prof -memprofile=mem.prof
go tool pprof cpu.prof
```
## Notes
- k6 `p(95)<500` means 95th percentile response time under 500ms — a good baseline.
- Lighthouse scores vary between runs. Run 3-5 times and average.
- Always load test against staging, not production, unless you have explicit approval.
- Bundle size directly impacts page load. Track it in CI.
- Profile in production-like environments — dev mode adds overhead that skews results.
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.