k6-perf-test-website
Use when the user wants to performance-test, load-test, or stress-test a public website end-to-end with k6. Produces a hybrid (protocol + browser) test suite, SLO-backed thresholds, a load-generator monitor sidecar, and a Grafana-side investigation playbook for backends the user owns. Triggers on "p
- 0
- Installs
- —
- Rating
- —
- Success rate
- 28
- Files scanned
Security scan
Scan passedNo risky patterns were found in the scanned files.
Content sha256 036d31a27cff72e5… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
SKILL.md
k6-perf-test-website
An end-to-end, opinionated workflow for performance-testing any public website with k6. The skill produces:
- A scaffolded project with one folder per user-described workflow.
- Functional protocol + browser tests (must pass before load testing).
- Hybrid load tests (protocol scenario + 1 browser VU) per test type (smoke / average / stress / spike / soak / breakpoint).
- SLO-backed thresholds with per-endpoint tagging and Web Vitals.
- A cross-platform load-generator monitor sidecar.
- Optional Grafana-side investigation when the user owns the backend.
- A structured Markdown report at the end.
This skill enforces a few opinions you should not silently override:
- Always elicit workflows first. Don't guess.
- Functional tests must be green before load tests run.
- Always monitor the load generator — server-looks-slow is often laptop-looks-slow.
- Local for validation, cloud for scale — but ask the user where to run each test type; don't hardcode.
- No shared
tests/lib/. Iteration-body duplication is preferred; each script reads cleanly on its own during incident review.
Prerequisites
- k6 ≥ v2.0.0 (
k6 version) — required for stablek6/browser,expect(), async/await iteration functions, and per-requesttags. - Node.js ≥ 20 + npm.
- Playwright with the Chromium download
(
npx playwright install chromium). har-to-k6(npm i -D har-to-k6).- Network access from the load-generator host to the target site.
Tools the skill prefers when installed:
mcp-k6— script creation, Playwright→k6/browser migration, API lookup. Prefer over hand-writing k6 boilerplate.mcp-grafana— in-session Prometheus/Loki/Tempo/Pyroscope queries during §9 backend investigation.gcx— Grafana Cloud CLI for shell-friendly queries, datasource discovery, and Grafana Cloud k6 cloud-run dispatch.k6binary — local validation runs and breakpoint hunting.k6 x docs(xk6-docs) — look up k6 API surface when writing or editing scripts withoutmcp-k6available.
If these tools are not configured the skill falls back to plain CLI
tools (k6, npx, curl) and hand-written scripts. The skill does
not own toolchain setup; defer to the user's existing setup process.
Explicit non-goals:
- Protocol-only suites (out of scope for this skill).
- API-only / non-browser apps.
- Mobile-native testing.
- Capacity planning beyond finding and tagging a breakpoint.
Workflow overview
Tick these off in order. Each step has a section below.
- Elicit workflows from the user. §1
- Scaffold the project from
assets/. §2 - Record each workflow with Playwright. §3
- Build functional protocol + browser tests; run
tests/run-all.shuntil green. §4 - Design SLO-backed thresholds and per-endpoint tags. §5
- Build hybrid load tests, one file per test type. §6
- Run validation locally with the LG sidecar. §7
- Push to Grafana Cloud k6 for the test types the user chose for cloud. §8
- Investigate the backend with Grafana (if owned). §9
- Report back to the user. §10
1. Elicit workflows
The single most important step. Without explicit workflows, every later step is guesswork.
Ask the user the questions in references/workflow-elicitation.md
and record answers in a runbook.md alongside the scaffolded project.
You must capture: 2-4 named workflows, credentials, read vs write, destructive actions to avoid during soak, worry list, existing SLOs, backend ownership and Grafana access, and per test type whether each runs locally or in Grafana Cloud k6.
If the user can't name at least one workflow, stop and clarify; do not proceed.
2. Scaffold the project
Copy the assets/ tree from this skill into the user's chosen
directory. The skill's assets/ directory is at <SKILL_DIR>/assets/,
where <SKILL_DIR> is the absolute path to this skill's directory —
your harness exposes this (e.g. opencode prefixes skill metadata with
a Base directory for this skill: line). If you can't determine
<SKILL_DIR> from context, ask the user.
cp -R "<SKILL_DIR>/assets/." "<target-dir>/"
If cp -R is blocked by sandbox permissions, copy files individually
via your agent's file-write tool.
The scaffolded layout:
<target-dir>/
├── package.json
├── .gitignore
├── README.md
├── runbook.md # you create from §1 answers
├── recordings/
│ ├── README.md
│ └── scripts/
│ └── recorder.template.js # copy per workflow → wN-<short-name>.js, …
├── tests/
│ ├── run-all.sh
│ └── workflow.template/ # copy per workflow → wN-<short-name>/, …
│ ├── from-har.js
│ ├── protocol.js
│ ├── browser.js
│ ├── smoke.js
│ ├── average.js
│ ├── stress.js
│ ├── spike.js
│ ├── soak.js
│ └── breakpoint.js
└── tools/
├── lg-monitor.sh
└── run-with-monitor.sh
For each workflow: copy recorder.template.js → recordings/scripts/wN-<short-name>.js,
copy tests/workflow.template/ → tests/wN-<short-name>/, and
replace <WORKFLOW_PLACEHOLDER> markers with the workflow's short name.
Then install:
cd <target-dir> && npm install && npx playwright install chromium
3. Record each workflow
Per workflow:
- Fill in
recordings/scripts/wN-<short-name>.js: user-action sequence,recordHar.urlFilterregex (allow-list the target host; block third-party RUM/ads — seereferences/recording-with-playwright.md), and a real ChromeuserAgent(the defaultHeadlessChromeUA triggers bot-blocking on many sites). - Run:
node recordings/scripts/wN-<short-name>.js→ writesrecordings/har/wN-<short-name>.har - Convert:
npx har-to-k6 recordings/har/wN-<short-name>.har -o tests/wN-<short-name>/from-har.js - Commit both HAR and
from-har.js(audit trail for bundle-path changes).
If the recorder fails or produces an unusable HAR (bot-blocking,
missing hydration, third-party noise), see the Recording section of
references/gotchas.md and references/recording-with-playwright.md.
Prefer mcp-k6 recording and migration tools if available.
4. Build functional tests
Per workflow:
- Hand-clean
from-har.jsintoprotocol.js— drop per-request UA headers, rename groups, parameteriseBASE_URL, replace session tokens, dropsleep(1), addexpect()on every load-bearing response. Full procedure inreferences/functional-tests.md. - Hand-write
browser.jsfrom the Playwright recorder using the 5-step procedure inreferences/functional-tests.md. - Run
./tests/run-all.sh. Do not proceed to §5 until it exits 0.
Prefer mcp-k6 migration tools for Playwright→k6/browser conversion.
5. Design SLOs and thresholds
Adjust the opinionated defaults in assets/tests/workflow.template/
to the user's stated SLOs from §1. Four layers:
- Global SLOs — overall error rate + aggregate latency.
- Per-endpoint thresholds — tag every protocol request, threshold per tag.
- Per-iteration thresholds — workflow time + iteration completion rate.
- Web Vitals — LCP/INP/CLS only (no FCP).
Default globals:
http_req_failed: ['rate<0.01'],
http_req_duration: ['p(95)<500'],
checks: ['rate>0.99'],
Per-endpoint tagging:
http.get(`${BASE_URL}/api/things`, { tags: { name: 'GetThings' } });
'http_req_duration{name:GetThings}': ['p(95)<400', 'p(99)<800'],
Web Vitals:
browser_web_vital_lcp: ['p(95)<2500'],
browser_web_vital_inp: ['p(95)<200'],
browser_web_vital_cls: ['p(95)<0.1'],
See references/slo-design.md for per-iteration tuning, the
performance.mark custom-Trend pattern, iteration_completed Rate,
breakpoint abort-on-fail thresholds, and loosening rules.
6. Build hybrid load tests
Per workflow, one file per test type. Each file has a protocol scenario (drives load) plus a single browser VU (measures Web Vitals under load). Breakpoint is protocol-only — a browser VU adds noise to the signal.
| Type | Executor | Defaults |
|---|---|---|
| smoke | constant-vus | 3 VUs × 1m |
| average | ramping-vus | 0→20→0 over 14m |
| stress | ramping-vus | 0→50→0 over 20m |
| spike | ramping-vus | 0→100→0 over 2m |
| soak | ramping-vus | 0→10→0 over 70m |
| breakpoint | ramping-arrival-rate | 5/s→500/s over 20m, abortOnFail |
Tune per workflow once you've seen smoke results. See
references/test-types.md for rationale and references/hybrid-load-design.md
for why one file per type and why duplication between files is acceptable.
7. Run locally with LG sidecar
./tools/run-with-monitor.sh tests/wN-<short-name>/smoke.js
Starts lg-monitor.sh in the background, runs k6, then prints a
summary verdict: OK (≥30% idle), NOTE (10–30%), or WARNING
(<10%). If WARNING, the laptop is the bottleneck — reduce VUs, switch
to cloud, or split across multiple LGs. See references/lg-monitoring.md.
8. Push to Grafana Cloud k6
For each test type assigned to cloud in the §1 runbook:
- Confirm
k6 cloud loginworks (the skill does not own auth setup). - Run smoke locally first to validate the script.
k6 cloud run tests/wN-<short-name>/<type>.js- Capture the run URL for the §10 report.
Cost reminder: browser VU-hours are billed 10× protocol VU-hours.
Soak and breakpoint are the most expensive. Check limits before long runs.
See references/local-vs-cloud.md.
9. Investigate the backend
Only if the user owns the backend and has Grafana access.
- Discover datasources via
mcp-grafanaorgcx datasources list. - Ask the user for service label keys — do not guess.
- Correlate the k6 run window with RED metrics, error logs, traces,
and profiles (Pyroscope — use explicit
from/tofor the run window). - Hand back specific evidence: timestamps, query strings, panel links.
See references/grafana-investigation.md for the full flow including
how to verify absence before reporting it.
10. Report back
Fill in the report template from references/reporting.md:
- Summary — workflows, test types, dates
- SLOs — pass/fail per threshold
- Findings — one paragraph per finding, ordered by severity, with specific evidence
- Evidence — k6 output paths, LG monitor CSVs, cloud run URLs, Grafana links
- Suggested next steps
Always be specific. "Latency is high" is not a finding. "GetPizza p(95) hit 1.4s at iteration ~200; correlated with sustained 100% CPU on the recommender service per Grafana panel link" is.
Reference index
references/workflow-elicitation.md— verbatim question script for §1.references/recording-with-playwright.md— HAR capture, third-party filter regex, hydration signals.references/functional-tests.md— 5-step Playwright→k6/browser conversion procedure.references/hybrid-load-design.md— protocol + 1 browser VU rationale, duplication argument.references/slo-design.md— full threshold rationale, async vs sync metric capture.references/test-types.md— definitions and defaults for all six test types.references/lg-monitoring.md— why the sidecar exists, how to read its output.references/local-vs-cloud.md— framing, cost model, per-test-type tradeoffs.references/grafana-investigation.md— generic backend investigation flow.references/gotchas.md— generic pitfalls.references/reporting.md— final report template.
Files
28- SKILL.md
3fa52f3e3213.3 KB - assets/README.md
5bd921ccf43.3 KB - assets/package.json
562a2fa8be402 B - assets/recordings/README.md
3097e8b5b72.4 KB - assets/recordings/scripts/recorder.template.js
ba704f01164.9 KB - assets/tests/run-all.sh
88f189e0e42.8 KB - assets/tests/workflow.template/average.js
e4c50b53344.0 KB - assets/tests/workflow.template/breakpoint.js
67e019733b4.0 KB - assets/tests/workflow.template/browser.js
4d7c473ab43.3 KB - assets/tests/workflow.template/from-har.js
fd2f4326861.5 KB - assets/tests/workflow.template/protocol.js
7197e269973.9 KB - assets/tests/workflow.template/smoke.js
0ba072abe08.1 KB - assets/tests/workflow.template/soak.js
36b7d438243.9 KB - assets/tests/workflow.template/spike.js
835698f2b53.4 KB - assets/tests/workflow.template/stress.js
a443c1debc3.6 KB - assets/tools/lg-monitor.sh
82abe263c76.3 KB - assets/tools/run-with-monitor.sh
f577ca1f183.9 KB - references/functional-tests.md
ed7bf003bf10.7 KB - references/gotchas.md
6e49fe87b011.4 KB - references/grafana-investigation.md
90a5e45c577.9 KB - references/hybrid-load-design.md
e8db8099875.6 KB - references/lg-monitoring.md
b8d769580c4.2 KB - references/local-vs-cloud.md
dbf8c37b4a5.2 KB - references/recording-with-playwright.md
dc6743454c5.6 KB - references/reporting.md
4ad70fb6a45.9 KB - references/slo-design.md
2cefd8a08e8.5 KB - references/test-types.md
ba21c1b99e7.4 KB - references/workflow-elicitation.md
d5a3b33cfd6.8 KB
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from grafana/skills8
Cut Grafana Cloud Metrics cost by shrinking active-series count with Adaptive Metrics aggregation rules — auto-recommendations from query history, custom exact/regex rules, label-drop config, unused-metric detection, and Alloy remote_write fallback. Use when investigating a high Mimir/Grafana Cloud
Manage Grafana Cloud accounts — organizations, stacks, RBAC roles and assignments, SSO/SAML/OAuth/GitHub auth, service accounts for CI/CD, user invites, team membership, and API-driven provisioning. Creates stacks via the Cloud API, mints service-account tokens, applies role assignments, configures
Use when the user asks to "write a validator", "add validation", "implement admission control", "write a mutating webhook", "add a mutation handler", "validate incoming resources", "implement admission logic", "add admission webhooks", "write ingress validation", or asks how to validate or mutate re
Configure Grafana Alerting, Incident Response Management (IRM), and SLOs end-to-end — provisions Grafana-managed and data-source-managed alert rules, contact points (Slack/PagerDuty/email/webhook), notification policies with hierarchical matchers, silences, mute timings, on-call schedules and escala
Build a unified telemetry pipeline with Grafana Alloy — one OpenTelemetry-compatible binary that collects metrics, logs, traces, and profiles and ships to Grafana Cloud / Prometheus / Loki / Tempo / Pyroscope. Covers the Alloy config language (blocks, `sys.env`, component refs), `prometheus.scrape`
Get RED metrics + service maps + frontend RUM + AI/LLM monitoring out of Grafana Cloud — Application Observability (`traces_spanmetrics_*` from OTel traces, p50/p95/p99 latency, exemplar-to-trace, traces-to-logs / profiles), Frontend Observability with the Faro Web SDK (Core Web Vitals, session repl
Use when starting any grafana-app-sdk work — scaffolding a Grafana app, initializing a Grafana App Platform app, picking a deployment mode (standalone operator / grafana/apps / frontend-only), wiring app-specific config, or onboarding to the SDK. Covers `grafana-app-sdk` CLI install, `project init`
Connect AI coding agents (Claude Code, Cursor, VS Code, OpenAI Codex) to Grafana Cloud via the `mcp-grafana` Model Context Protocol server. Installs the server with `go install`, generates a Grafana service-account token, wires `~/.claude/settings.json` or `~/.cursor/mcp.json` with the `command` + `
Related tooling skillsscan passed
Check Compound Engineering health and repo-local config, or scaffold a Compound Pack with `pack:<id>`.
Optimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.
Creates a new Angular app using the Angular CLI. This skill should be used whenever a user wants to create a new Angular application and contains important guidelines for how to effectively create a modern Angular application.
GAN-inspired Generator-Evaluator agent harness for building high-quality applications autonomously. Based on Anthropic's March 2026 harness design paper. Use when a feature should be built autonomously through generator and evaluator iteration until it clears a quality bar.
Enforces authenticated gh CLI workflows over unauthenticated curl, WebFetch, and MCP fetch patterns. Use when working with GitHub URLs, API access, pull requests, or issues.
Audit and improve CLAUDE.md files in repositories. Use when user asks to check, audit, update, improve, or fix CLAUDE.md files. Scans for all CLAUDE.md files, evaluates quality against templates, outputs quality report, then makes targeted updates. Also use when the user mentions "CLAUDE.md maintena