/quality-skills:k6from quality-skills
Designs, implements, debugs, and operates k6 load tests. Covers scenario executors, thresholds, CI integration, and common anti-patterns.
Ships in quality-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
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.
Check .agents/qa-context.md (fallback: .claude/qa-context.md) before answering. Pay attention to:
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.
When not to use k6:
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
scenarios: {
smoke: {
executor: 'constant-vus',
vus: 5,
duration: '30s',
},
},
thresholds: {
http_req_failed: ['rate<0.01'], // <1% errors
http_req_duration: ['p(95)<300', 'p(99)<800'],
},
};
export default function () {
const res = http.get('https://staging.example.com/api/products', {
tags: { name: 'GET /api/products' },
headers: { Accept: 'application/json' },
});
check(res, {
'status 200': r => r.status === 200,
'has products': r => Array.isArray(r.json('products')),
});
sleep(1);
}
options declares scenarios and thresholds.check records pass/fail without failing the test.thresholds are the pass/fail gates of the run.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 make the test pass/fail. Common patterns:
thresholds: {
// Global
http_req_duration: ['p(95)<300'],
http_req_failed: ['rate<0.005'],
// Per-endpoint (using tag)
'http_req_duration{name:GET /api/products}': ['p(95)<200'],
// Per-scenario
'http_req_duration{scenario:checkout}': ['p(99)<1000'],
// Custom metric
'order_value_total': ['count>1000'],
}
Set thresholds matching your SLOs. A test without thresholds just produces numbers — pass/fail is what makes it a real CI gate.
check(res, ...) records a passing/failing boolean per call, but does not fail the test.threshold is the pass/fail gate.Common mistake: writing many check()s and assuming a failed check fails the run. It doesn't (by default). Either:
'checks{check:status 200}': ['rate>0.99'], orfail() to abort, or--summary-mode full / --out experimental-prometheus-rw and let downstream dashboards alert.import { SharedArray } from 'k6/data';
const users = new SharedArray('users', () => JSON.parse(open('./users.json')));
export default function () {
const u = users[Math.floor(Math.random() * users.length)];
// ... use u.email
}
SharedArray loads test data once, shared across VUs.
For per-VU initialization (token, account setup), use the setup() function:
export function setup() {
const token = http.post('https://staging.example.com/auth/login', {
email: '[email protected]', password: 'Pa$$w0rd-fake',
}).json('token');
return { token };
}
export default function (data) {
http.get('https://staging.example.com/me', {
headers: { Authorization: `Bearer ${data.token}` },
});
}
k6 run script.js # local
k6 run --vus 50 --duration 1m script.js # override options
k6 run --out json=results.json script.js # JSON output
k6 run --out experimental-prometheus-rw script.js # Prometheus remote write
k6 cloud script.js # run in k6 Cloud
Verify flag names with k6 run --help against your installed version.
- run: |
curl https://github.com/grafana/k6/releases/download/<version>/k6-<version>-linux-amd64.tar.gz | tar xz
./k6 run --out junit=k6-junit.xml tests/load/checkout.js
- if: always()
uses: actions/upload-artifact@v4
with:
name: k6-results
path: k6-junit.xml
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.
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).http_req_failed.http.get('https://staging.example.com/users/abc') and .../users/xyz show up as different aggregations. Either use URL templates or explicit tags.name.default instead of init — wastes memory per VU. Use init context (top-level) or SharedArray.When helping with k6, ask:
setup()?karate-gatling reuses Karate features for load (Gatling-based).ghz is the gRPC-native equivalent; k6 has a gRPC module.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub aks-builds/quality-skills --plugin quality-skills56 skills in this plugin
/accessibility-testingWhen the user wants to design, implement, or operate accessibility (a11y) testing — automated scans, manual audits, screen-reader testing, WCAG conformance, Section 508 / EAA compliance. Use when the user mentions "accessibility," "a11y," "WCAG," "Section 508," "EAA," "ADA compliance," "axe," "axe-core," "pa11y," "Lighthouse," "aXe DevTools," "screen reader," "NVDA," "JAWS," "VoiceOver," "TalkBack," "WAVE," or "AT testing." For visual diff see visual-regression. For overall test strategy see test-strategy./ai-augmented-testingWhen the user wants to evaluate, adopt, or operate AI-augmented testing tools and approaches — autonomous test generation, self-healing locators, AI-assisted authoring, vision-based testing, agentic test runners. Use when the user mentions "AI testing," "AI-augmented testing," "Testim," "Mabl," "Functionize," "Reflect," "TestRigor," "Tricentis Copilot," "Cypress AI," "Playwright codegen with AI," "AI test generation," "self-healing tests," or "vision-based test automation." For LLM-product evals see llm-eval-testing. For overall strategy see test-strategy./appiumWhen the user wants to design, implement, debug, or scale Appium tests for iOS and Android mobile automation. Use when the user mentions "Appium," "Appium 2," "UiAutomator2," "XCUITest driver," "appium:capabilities," "AppiumServer," "accessibility id," "TouchAction," "W3C Actions," "Appium inspector," "real device cloud," or "App Center / BrowserStack / Sauce mobile." For Android-native frameworks see espresso. For iOS-native see xcuitest. For React Native specifically see detox. For YAML-driven mobile flows see maestro. For desktop web automation see selenium / playwright / webdriverio.