Runs k6 load tests against APIs: virtual users, stages, thresholds, checks, and CI-friendly summary exports for throughput and latency assertions.
Agentic Workflow: Read -> Reason -> Act (api-perf-k6-load)
You are Api Perf K6 Load (backend) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — backend context for api-perf-k6-load
- Domain: Runs k6 load tests against APIs: virtual users, stages, thresholds, checks, and CI-friendly summary exports for throughput and latency assertions.
- k6-load-testing: Execute scripted load tests with thresholds —
k6 run script.js
- thresholds-checks: Define pass/fail gates on latency and error rate —
k6 run --threshold 'http_req_duration:p(95)<300' script.js
- Check
knowledge and prerequisites: node.js, python, redis, k6
2. Reason — think for api-perf-k6-load
- For
k6-load-testing: Execute scripted load tests with thresholds — decide which checks to run
- For
thresholds-checks: Define pass/fail gates on latency and error rate — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with api-perf-k6-load tools
- Tools:
Glob, Grep, Read, K6 (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
api-perf-k6-load:ca5de6b7
API Perf v2 - k6 Load Testing
Load testing with k6.
What This Skill Does
- Simulates realistic user load with virtual users
- Ramps traffic in stages to find saturation
- Fails CI when thresholds are breached
When to Use
- Before releases to catch regressions
- Capacity planning for expected traffic
- Comparing architecture options (caching, scaling)
Real Commands
k6 run --vus 50 --duration 60s script.js
k6 run --stage '2s:10,30s:100,10s:0' ramping.js
k6 run --summary-export=summary.json script.js
Script Example
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
thresholds: { http_req_failed: ['rate<0.01'], http_req_duration: ['p(95)<300'] }
};
export default function () {
const res = http.get('https://api.example.com/v1/items');
check(res, { 'status 200': (r) => r.status === 200 });
sleep(1);
}
Testing
- Run a soak variant (30m at moderate load) for leaks
- Add scenarios to mix read and write traffic
- Use k6 inspect to validate options before full runs
Best Practices
- Randomize test data to avoid cache skewing results
- Set thresholds on percentiles, not averages
- Store summary.json outputs for regression charts
Capabilities
k6-load-testing
Execute scripted load tests with thresholds
Parameters:
vus (integer): Number of virtual users
duration (string): Test duration e.g. 60s, 10m
stages (string): Ramp stages as comma-separated time:target pairs
Commands:
k6 run script.js
k6 run --vus 50 --duration 60s script.js
k6 run --stage '2s:10,30s:100,10s:0' ramping.js
k6 run --summary-export=summary.json script.js
k6 inspect script.js
Examples:
- k6 run --vus 50 --duration 60s runs a steady 50-user load
- --stage ramps users up and down over time
- --summary-export writes JSON for CI comparison
thresholds-checks
Define pass/fail gates on latency and error rate
Commands:
k6 run --threshold 'http_req_duration:p(95)<300' script.js
k6 run --threshold 'http_req_failed:rate<0.01' script.js
k6 run --quiet script.js
Examples:
References
1---2name: "api-perf-k6-load"3description: "Runs k6 load tests against APIs: virtual users, stages, thresholds, checks, and CI-friendly summary exports for throughput and latency assertions. Use when working with k6 load testing, thresholds checks or when the user mentions k6 load testing, thresholds checks."4license: "MIT"5compatibility: "Requires node.js, python, redis, k6, new-relic."6metadata:7 source: https://skillmd.com/skills/opknock/api-perf-k6-load8 author: Kdesk9 version: 2.0.010 category: backend11allowed-tools: "Glob Grep Read Bash(k6:*)"12---1314Runs k6 load tests against APIs: virtual users, stages, thresholds, checks, and CI-friendly summary exports for throughput and latency assertions.1516## Agentic Workflow: Read -> Reason -> Act (api-perf-k6-load)1718You are **Api Perf K6 Load** (backend) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — backend context for `api-perf-k6-load`21- Domain: Runs k6 load tests against APIs: virtual users, stages, thresholds, checks, and CI-friendly summary exports for throughput and latency assertions.22- **k6-load-testing**: Execute scripted load tests with thresholds — `k6 run script.js`23- **thresholds-checks**: Define pass/fail gates on latency and error rate — `k6 run --threshold 'http_req_duration:p(95)<300' script.js`24- Check `knowledge` and `prerequisites: node.js, python, redis, k6`2526### 2. Reason — think for `api-perf-k6-load`27- For `k6-load-testing`: Execute scripted load tests with thresholds — decide which checks to run28- For `thresholds-checks`: Define pass/fail gates on latency and error rate — decide which checks to run29- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3031### 3. Act — execute with `api-perf-k6-load` tools32- Tools: `Glob`, `Grep`, `Read`, `K6` (see frontmatter `tools`/`allowed-tools`)33- Use `safe_path` for any write; record evidence (paths, checksums)34- Fingerprint: `api-perf-k6-load:ca5de6b7`3536# API Perf v2 - k6 Load Testing3738Load testing with k6.3940## What This Skill Does41- Simulates realistic user load with virtual users42- Ramps traffic in stages to find saturation43- Fails CI when thresholds are breached4445## When to Use46- Before releases to catch regressions47- Capacity planning for expected traffic48- Comparing architecture options (caching, scaling)4950## Real Commands5152```bash53k6 run --vus 50 --duration 60s script.js54k6 run --stage '2s:10,30s:100,10s:0' ramping.js55k6 run --summary-export=summary.json script.js56```5758## Script Example5960```js61import http from 'k6/http';62import { check, sleep } from 'k6';63export const options = {64 thresholds: { http_req_failed: ['rate<0.01'], http_req_duration: ['p(95)<300'] }65};66export default function () {67 const res = http.get('https://api.example.com/v1/items');68 check(res, { 'status 200': (r) => r.status === 200 });69 sleep(1);70}71```7273## Testing74- Run a soak variant (30m at moderate load) for leaks75- Add scenarios to mix read and write traffic76- Use k6 inspect to validate options before full runs7778## Best Practices79- Randomize test data to avoid cache skewing results80- Set thresholds on percentiles, not averages81- Store summary.json outputs for regression charts8283## Capabilities8485### k6-load-testing86Execute scripted load tests with thresholds8788**Parameters:**89- `vus` (integer): Number of virtual users90- `duration` (string): Test duration e.g. 60s, 10m91- `stages` (string): Ramp stages as comma-separated time:target pairs9293**Commands:**94- `k6 run script.js`95- `k6 run --vus 50 --duration 60s script.js`96- `k6 run --stage '2s:10,30s:100,10s:0' ramping.js`97- `k6 run --summary-export=summary.json script.js`98- `k6 inspect script.js`99100**Examples:**101- k6 run --vus 50 --duration 60s runs a steady 50-user load102- --stage ramps users up and down over time103- --summary-export writes JSON for CI comparison104105### thresholds-checks106Define pass/fail gates on latency and error rate107108**Commands:**109- `k6 run --threshold 'http_req_duration:p(95)<300' script.js`110- `k6 run --threshold 'http_req_failed:rate<0.01' script.js`111- `k6 run --quiet script.js`112113**Examples:**114- -cli --help115- -api --help116117## References118- [k6 Docs - Running Tests](https://grafana.com/docs/k6/latest/get-started/running-k6/)119- [k6 Thresholds](https://grafana.com/docs/k6/latest/using-k6/thresholds/)