k6-load-testing

Creates and runs Grafana k6 scripts for load, stress, spike, and soak testing of APIs.

1|Updated Apr 1, 2026
One-click install
npx skills add https://github.com/AlahmadiQ8/sre-agent-demo --skill k6-load-testing-alahmadiq8
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: k6-load-testing
Source: https://github.com/AlahmadiQ8/sre-agent-demo/tree/main/.claude/skills/k6-load-testing
Command: npx skills add https://github.com/AlahmadiQ8/sre-agent-demo --skill k6-load-testing-alahmadiq8

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing correct load tests requires knowing k6's executors, lifecycle hooks, thresholds, and metrics. This Skill generates ready-to-run k6 JavaScript scripts matched to your testing goal, so you can validate API performance under realistic traffic without learning the entire k6 API surface first. ## Core Features & Use Cases - Test Type Templates: Generates smoke, average-load, stress, spike, soak, and breakpoint test scripts with appropriate VU counts, durations, and thresholds. - Executor Selection: Chooses between VU-based executors (constant-vus, ramping-vus) and arrival-rate executors based on whether you model concurrent users or requests per second. - Multi-Protocol Support: Covers HTTP, WebSockets, and gRPC with authentication patterns, checks, thresholds, custom metrics, and scenario-based multi-workload tests. - Use Case: You want to know if your API survives a product launch. Ask for a spike test against your endpoint and get a script that ramps to thousands of VUs with pass/fail thresholds, runnable via k6 run script.js. ## Quick Start Ask the assistant to write a k6 smoke test script that hits your API endpoint with 3 virtual users for one minute and fails if p95 latency exceeds 500ms.

Frequently Asked Questions about k6-load-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a k6 load test script for my API?▼

Import http from k6/http, define options with VUs and duration or stages, then make requests in the default function. Add check() calls for response validation and thresholds in options for pass/fail criteria, then run with k6 run script.js.

What is the difference between ramping-vus and ramping-arrival-rate in k6?▼

Ramping-vus controls concurrent virtual users through stages, modeling user count. Ramping-arrival-rate controls iterations per second regardless of response time, modeling throughput. Use arrival-rate for breakpoint tests and requests-per-second targets.

Does k6 support WebSocket and gRPC load testing?▼

Yes. k6 includes k6/websockets for standard WebSocket connections and k6/net/grpc for gRPC services including streaming. Other protocols like Kafka, SQL, and Redis are available through xk6 extensions.

How do I set pass/fail thresholds in a k6 test?▼

Define thresholds in the options object using metric expressions like http_req_failed: ['rate<0.01'] or http_req_duration: ['p(95)<500']. k6 exits with a non-zero code when thresholds fail, which works directly in CI pipelines.

Why does my k6 test show fragmented metrics for dynamic URLs?▼

Requests with dynamic path segments like user IDs create separate metric series per URL. Group them using http.url tagged templates or a name tag so all variants aggregate under one metric.

When should I not use sleep() in k6 scripts?▼

Avoid sleep() with arrival-rate executors because the executor already paces iterations to hit the target rate. Use sleep() only in VU-based executors to simulate realistic user think time between requests.