consensys/ask-o11y-plugin/writing-k6-tests
Claude Code and agent skill by consensys/ask-o11y-plugin
- community
Checking that the SKILL.md file is still in the repository.
Author k6 load-test scripts and Grafana Synthetic Monitoring checks — HTTP/WebSocket/gRPC/browser scripts, executor selection, thresholds, checks vs expect(), smoke/stress/spike/soak patterns, and SM scripted-check semantics. Use when the user says "load test this API", "stress test", "smoke test", "soak test", "spike test", "write a k6 script", "synthetic monitoring check", or asks about ramping/arrival-rate executors or probe uptime checks.
Install
npx vskill@latest install consensys/ask-o11y-plugin/writing-k6-testsSKILL.md
Write complete, runnable k6 scripts for load testing or Grafana Synthetic Monitoring (SM) checks. You have no k6 execution tools — authoring is the deliverable; give the user the exact run command.
Decide the goal first
- Load/perf test (throughput, latency under load, breaking point): full k6 script with load profile. This is the default reading of "load test".
- Synthetic Monitoring check (uptime, "does the user journey work right now"): one iteration, one VU, fixed schedule. No load idioms —
vus,stages,iterationsare ignored by SM andthresholdsare not supported. Say "check", "probe", "execution" — never "VUs" or "ramp".
A script can serve both, but the options shape differs. Ask only if the goal is genuinely unclear.
Load-test skeleton (start here, adapt endpoints and profile)
Executor cheat sheet
| Goal | Executor | |
|---|---|---|
| Realistic traffic curve / breakpoint test | ramping-arrival-rate (ramp offered load, not VUs — closed models throttle themselves and mask the breaking point) | |
| Constant RPS over time | constant-arrival-rate | |
| Simulate N concurrent users | ramping-vus | |
| Many short, independent operations | constant-vus with per-vu-iterations, or shared-iterations | |
| Smoke: 1 VU, 1 iteration | plain run with --vus 1 --iterations 1 |
Best-practice checklist (apply to every script)
export const optionswith realistic VUs/durations — no toy defaults.- Thresholds on every load test — at minimum
http_req_durationandhttp_req_failed(or protocol equivalent). Without them CI can't fail on regression. sleep()in VU-based tests; arrival-rate executors pace themselves, so skip it there.- Assert every response with
check()orexpect(); name every assertion — the name is what you grep at 3am. - No
let/varat top level (module scope is shared across VUs) — useconst. - No deprecated imports:
k6/websockets, notk6/ws. - Track SLO-relevant custom metrics (
Trendfor latency,Ratefor errors) plus ahandleSummaryfor p95/p99 + throughput. - Browser scripts:
expect()from k6-testing, wrap intry/finallywithpage.close(); gRPC:client.close()infinally; WebSocket:try/catcharoundJSON.parseof incoming frames.
Synthetic Monitoring specifics
Check-type ladder — stop at the simplest sufficient type:
- Protocol checks (HTTP/ping/DNS/TCP/gRPC) — single endpoint uptime, no script.
- MultiHTTP — HTTP sequence with
${variable}capture; caution: it does not auto-validate status codes, define assertions per request. - k6 scripted — real logic: signing, branching, generated data, WebSockets.
- k6 browser — only for JS-rendered journeys/forms/Core Web Vitals (billed at the expensive tier; 1GB memory per browser on public probes).
Failure semantics (this is what most scripts get wrong): SM runs with --throw and one VU/iteration. probe_success fails when the script throws or calls fail() — a bare failed check() only records metrics and does not fail the execution. Preferred assertion patterns:
SM constraints to respect: frequency 60–3600s for k6-class checks, timeout ≤ frequency, no open()/fs (bundle everything or import from https://jslib.k6.io/), frequency choice sets cost (probes × 43200 / frequency_minutes executions per month).
Deliverable
Present: the full script, the exact run command (k6 run --vus 10 --duration 30s script.js, or SM setup steps: UI → new check → type → paste script → pick 2-3 probes near users), and any best-practice issues you corrected. Never end with the script only in chat — if you can write files, save it as k6/scripts/<kebab-case-name>.js.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingpkg/skills/bundled/writing-k6-tests/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/consensys/ask-o11y-plugin/writing-k6-tests)