k6 performance and load testing. Covers writing test scripts in JavaScript/TypeScript, all test types (load/stress/spike/soak/smoke/breakpoint), thresholds, checks, scenarios, executors, extensions, result analysis, k6 Cloud execution, and CI/CD integration. Use when writing k6 tests, debugging test failures, setting up load testing pipelines, choosing executors/scenarios, or interpreting k6 results.
Detected risks:
k6 is a skill for performance and load testing with Grafana k6. It covers writing test scripts in JavaScript/TypeScript, all major test types (load, stress, spike, soak, smoke, breakpoint), thresholds, checks, scenarios and executors, custom metrics, extensions, result analysis, k6 Cloud execution, and CI/CD integration. It is meant to be used when writing k6 tests, debugging test failures, setting up load-testing pipelines, choosing executors or scenarios, or interpreting k6 results, and it references the official docs at grafana.com/docs/k6/latest/.
The skill documents installation (brew, apt, choco) and running tests with k6 run, including flags like --vus, --duration, --iterations, --stage, and output options (--out json/csv/influxdb/statsd). It shows the basic script structure with an options block defining vus, duration, and thresholds (e.g. http_req_duration p(95)<500, http_req_failed rate<0.01), and the test lifecycle functions setup, default, and teardown. It covers HTTP requests (get/post/put/patch/del, http.batch, form data, file uploads with http.file), checks as soft assertions versus thresholds as hard pass/fail criteria (including tag-based thresholds and abortOnFail), and custom metrics via Counter, Gauge, Rate, and Trend from k6/metrics. Scenarios and executors are detailed — constant-vus, ramping-vus, constant-arrival-rate, per-vu-iterations — along with a test-types reference table, groups and tags, environment variables (accessed as __ENV), WebSocket testing via k6/ws, and browser testing via k6/browser with chromium.
It targets developers, QA, and SRE/performance engineers building or debugging load tests and pipelines. Additional reference files (referenced in the doc) expand on scenarios/executors and test types with full examples. The skill emphasizes practical patterns — passing variables with -e, sharing data from setup to VUs, and applying thresholds per endpoint via tags — so users can both author tests and interpret their results.
Checks are soft assertions that record pass/fail but do not stop the test on failure. Thresholds are hard pass/fail criteria defined in options (e.g. http_req_duration: ['p(95)<800']); a breached threshold fails the test, and you can add abortOnFail to stop it early.
Use scenarios with executors: constant-vus for steady load, ramping-vus with stages for ramp up/down, constant-arrival-rate for a fixed requests-per-second rate, and per-vu-iterations for a set number of iterations per VU.
Return it from the setup() function, which runs once before all VUs. The default function receives that return value as its data argument, so you can use data.token in each VU iteration. teardown() runs once after all VUs finish.
Smoke (verify the script with minimal load), Load (normal expected load), Stress (beyond normal capacity), Spike (sudden traffic surge), Soak (extended duration to find memory leaks), and Breakpoint (continuously increasing load to find limits).
Yes. WebSocket testing uses the k6/ws module with ws.connect and socket event handlers, and browser testing uses the k6/browser module with a chromium browser type via the shared-iterations executor.
Quick Setup:
.claude/skills/Repository
grafana/skills