.cursor/skills/qa-k6-writer/SKILL.md
Generate k6 performance tests in JavaScript for load, stress, soak, and spike testing with thresholds, scenarios, checks, and CI-friendly output.
npx skillsauth add AZANIR/qa-skills qa-k6-writerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Write k6 performance tests from test case specifications and performance plans. Transform structured performance requirements (from qa-nfr-analyst, qa-plan-creator performance plans) into executable k6 scripts with scenarios, thresholds, checks, and CI-friendly output.
| Type | Purpose | Key Characteristics | |------|---------|---------------------| | Load testing | Validate behavior under expected load | Steady VUs, target throughput | | Stress testing | Find breaking point | Ramp up until failure | | Soak testing | Detect memory leaks, degradation | Sustained load over hours | | Spike testing | Sudden traffic surge | Sharp ramp up/down | | Smoke testing | Quick sanity check | 1–5 VUs, minimal duration | | Breakpoint testing | Find capacity limit | Incremental load until threshold fails |
| Feature | Description |
|---------|-------------|
| JavaScript ES6 | Standard JS syntax; no transpilation required |
| Scenarios | Multiple executors: shared-iterations, per-vu-iterations, constant-arrival-rate, ramping-arrival-rate, externally-controlled |
| Thresholds | Pass/fail criteria: http_req_duration, http_req_failed, custom metrics |
| Checks | Assertions: check(res, { 'status is 200': (r) => r.status === 200 }) |
| Stages | Ramp-up, steady, ramp-down for realistic load profiles |
| Custom metrics | Trend, Rate, Counter, Gauge for business metrics |
| Protocols | HTTP, WebSocket, gRPC |
.js file with export default function, HTTP calls, checks, groupsUse Context7 MCP for k6 documentation when:
| Pattern | Usage |
|---------|-------|
| export default function(options) | Main entry; receives options (env, etc.) |
| http.get(url) / http.post(url, body) | HTTP requests; returns response |
| check(res, assertions) | Assertions; returns boolean; does not fail test |
| sleep(duration) | Think time between actions |
| group(name, fn) | Logical grouping; metrics tagged by group |
| Trend, Rate, Counter, Gauge | Custom metrics |
| scenarios in options | Define executor-based scenarios |
thresholds: {
'http_req_duration': ['p(95)<200', 'p(99)<500'],
'http_req_failed': ['rate<0.01'],
'http_reqs': ['count>1000'],
}
| Executor | Use Case |
|----------|----------|
| shared-iterations | Fixed total iterations across all VUs |
| per-vu-iterations | Each VU runs N iterations |
| constant-arrival-rate | Fixed request rate (RPS) |
| ramping-arrival-rate | Ramping RPS (stress/spike) |
| externally-controlled | Control VUs from external source |
See references/patterns.md for load profiles, scenario executors, thresholds, custom metrics, groups.
.js files in tests/ or performance/ per project conventionk6 run, threshold pass/failCan do (autonomous):
Cannot do (requires confirmation):
Will not do (out of scope):
k6 run script.js)references/patterns.md — Load profiles, scenario executors, thresholds, custom metrics, groupsreferences/config.md — options, scenarios, stages, thresholds, output formatsreferences/best-practices.md — Realistic load, correlation, parameterization, CI integrationthreshold for pass/fail__ENV or options| Symptom | Likely Cause | Fix |
|---------|--------------|-----|
| Thresholds fail in CI | Different baseline or env | Align thresholds with target env; use env-specific config |
| High http_req_failed | Timeouts, 5xx, or wrong assertions | Increase timeout; fix check logic; verify endpoint |
| VUs not ramping as expected | Wrong executor or stage config | Use ramping-vus or ramping-arrival-rate for stress |
| Metrics not tagged | Missing groups | Wrap logic in group('name', () => { ... }) |
| Script fails to run | ES module or import error | Use export default; ensure k6-compatible imports |
| WebSocket/gRPC errors | Protocol-specific setup | Use k6/experimental/grpc or k6/ws; check Context7 docs |
| CI exit code 0 despite failures | Thresholds not enforced | Ensure --threshold or options.thresholds set; k6 exits non-zero on threshold fail |
tools
Analyze OpenAPI/Swagger spec (JSON or YAML) against existing test files and generate an HTML coverage report with QA automation tasks. Use when user provides an OpenAPI spec file and wants to know test coverage status.
testing
Universal QA plan generator supporting 10 plan types including test plans, sprint plans, regression plans, release plans, UAT plans, performance plans, migration plans, onboarding plans, and custom plans.
development
Generate consumer-driven contract tests using Pact for JavaScript and Python to verify microservice API compatibility between consumer and provider.
development
Master skill coordinating all QA skills through pipeline modes (full-cycle, docs-only, testcases-only, write-tests, report), formalized handoff chains, scheduler rules, and framework/language selection based on project context.