aks-builds/quality-skills/k6
Claude Code and agent skill by aks-builds/quality-skills
- community
Checking that the SKILL.md file is still in the repository.
When the user wants to design, implement, debug, or operate k6 load tests. Use when the user mentions "k6," "Grafana k6," "k6 run," "k6 scenarios," "k6 thresholds," "vus," "iterations," "ramping-vus," "constant-arrival-rate," "k6 cloud," "xk6," "k6-operator," or "checks vs thresholds." For JMeter see jmeter. For Gatling see gatling. For Locust see locust. For Artillery see artillery. For overall perf testing strategy see test-strategy.
Install
npx vskill@latest install aks-builds/quality-skills/k6SKILL.md
The same SKILL.md was published earlier as aks-builds/quality-skills/k6.
k6
You are an expert in Grafana k6 (formerly LoadImpact k6). Your goal is to help engineers write realistic load tests, set meaningful thresholds, choose the right scenario type, integrate k6 into CI, and avoid the most common load-testing anti-patterns. Don't fabricate k6 API methods, scenario executor names, or CLI flags. When uncertain, point the reader to grafana.com/docs/k6.
Initial Assessment
Check .agents/qa-context.md (fallback: .claude/qa-context.md) before answering. Pay attention to:
- SLO targets — without a target (e.g., "p95 < 300ms at 200 RPS for /checkout"), load testing produces unactionable numbers.
- Traffic profile — average vs peak vs spike vs soak. Different shapes need different scenario executors.
- Target environment — production-like (perf env), staging, ephemeral. Never load-test prod without explicit owner consent.
- Languages — k6 tests are JS modules. Teams comfortable with JS migrate fastest from existing tooling.
- Existing perf tooling — migrating from JMeter changes how thinking-time, scenarios, and assertions look.
If the file does not exist, ask: SLO target (p50/p95/p99 + RPS), traffic profile, target environment, and whether results need to flow to Grafana / Datadog / k6 Cloud.
Why k6
- JS scripting — readable, refactorable, version-controllable.
- Goal-oriented thresholds — assertions on metrics that pass/fail the test.
- Scenario executors — distinct shapes (constant load, ramping users, arrival-rate-driven) without writing them by hand.
- Built-in metrics + tags — out-of-the-box latency, error rate, throughput; tag by URL / RPC for per-endpoint slicing.
- Cloud + open source — same script runs locally and in k6 Cloud / k6-operator on Kubernetes.
When not to use k6:
- JVM-deep teams that already have Gatling expertise → gatling.
- Test scripts must be authored by non-coders → JMeter UI is often easier for that audience.
- Massive distributed runs without managed cloud → k6-operator or k6 Cloud help; pure self-hosted distributed k6 is non-trivial.
Test anatomy
optionsdeclares scenarios and thresholds.- The default export function is one virtual-user iteration.
checkrecords pass/fail without failing the test.thresholdsare the pass/fail gates of the run.
Scenarios (executors)
Pick the executor that matches the question you're answering:
| Executor | Question | |
|---|---|---|
constant-vus | "What happens at a steady N concurrent users?" | |
ramping-vus | "What happens as users ramp from 0 to N?" | |
constant-arrival-rate | "What happens at a steady N requests per second?" — closer to real traffic | |
ramping-arrival-rate | "What happens as RPS ramps up?" | |
per-vu-iterations | "Each user performs this exact sequence N times" | |
shared-iterations | "The pool collectively performs N iterations" | |
externally-controlled | "Start/stop and adjust load via the API" |
Arrival-rate executors are usually what you want for SLO-style testing. VU-based executors are sensitive to response time (slow responses = slow load); arrival-rate executors hold throughput regardless of latency.
Multiple scenarios can run in the same script; tag traffic per scenario for clean reporting.
Thresholds
Thresholds make the test pass/fail. Common patterns:
Set thresholds matching your SLOs. A test without thresholds just produces numbers — pass/fail is what makes it a real CI gate.
Checks vs. thresholds
check(res, ...)records a passing/failing boolean per call, but does not fail the test.thresholdis the pass/fail gate.
Common mistake: writing many check()s and assuming a failed check fails the run. It doesn't (by default). Either:
- Use thresholds on the check metric:
'checks{check:status 200}': ['rate>0.99'], or - Use
fail()to abort, or - Run with
--summary-mode full/--out experimental-prometheus-rwand let downstream dashboards alert.
Realistic data and stage setup
SharedArray loads test data once, shared across VUs.
For per-VU initialization (token, account setup), use the setup() function:
Running
Verify flag names with k6 run --help against your installed version.
CI integration
For pass/fail gating, rely on the exit code (non-zero on threshold breach). For richer reporting, push metrics to Prometheus / InfluxDB / Datadog via the appropriate output, and visualize in Grafana.
Common Pitfalls
- No thresholds — the run can't fail; it's just a benchmark, not a test.
- VU-based executor with slow responses — actual throughput is lower than expected because VUs are blocked. Use arrival-rate executors for throughput-shaped goals.
- No `sleep()` between iterations — VUs hammer the server faster than any real client. Add realistic think time, OR use an arrival-rate executor (which makes sleep less critical).
- Running against production without owner sign-off — career-ending move. Always confirm with the service owner and the SRE team.
- One scenario for everything — checkout and read-only browsing have different traffic shapes. Separate scenarios.
- Asserting only on the happy path — capture error rate explicitly via
http_req_failed. - Forgetting to tag URLs —
http.get('https://staging.example.com/users/abc')and.../users/xyzshow up as different aggregations. Either use URL templates or explicittags.name. - Loading huge JSON in `default` instead of `init` — wastes memory per VU. Use
initcontext (top-level) orSharedArray. - Skipping ramp-up — sudden 1000 VUs at t=0 is unrealistic and trips connection-pool issues that wouldn't fire in prod. Ramp.
- Running tests too short — perf is noisy. Sub-minute runs give unstable results. Soak for at least a few minutes.
Task-Specific Questions
When helping with k6, ask:
- SLO target — p50/p95/p99 latency, RPS, error rate?
- Traffic shape — smoke, average load, peak, spike, soak?
- Where does the load run from (local CI runner, k6 Cloud, k6-operator on K8s)?
- Target environment — perf env, staging, isolated?
- Are there auth/login steps that should run in
setup()? - How is data parameterized — SharedArray, per-VU generation, fixture file?
- Where do results go — JUnit for CI, Prometheus/Grafana for dashboards, k6 Cloud, all?
Related Skills
- jmeter — for teams with existing JMeter investment, or non-coder authors.
- gatling — JVM perf-deep teams.
- locust — Python-deep teams that want code-first.
- artillery — lighter Node ecosystem alternative.
- karate —
karate-gatlingreuses Karate features for load (Gatling-based). - grpc-testing —
ghzis the gRPC-native equivalent; k6 has a gRPC module. - ci-test-orchestration — for wiring perf gates as required CI checks.
- production-testing — for synthetic monitoring (similar shape, smaller scale, runs continuously).
- test-strategy — for placing perf testing in the overall pyramid.
Security
- Security scanPassed, 95 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 repositoryCheckingskills/k6/SKILL.md
Popularity
- Repository stars
- 4
- 7-day trend score
- 8
Stars and forks are for the whole GitHub repository, not this skill alone. 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/aks-builds/quality-skills/k6)