Automated summary
This skill guides the authoring of k6 JavaScript scripts to run load, stress, spike, and soak tests against APIs and websites.
Strengths
- Explains the main test types (smoke, load, stress, spike, soak) and which to pick for a given goal
- Provides concrete threshold patterns that give tests explicit pass/fail criteria
- Demonstrates custom metrics (Trend, Counter, Rate) for tracking business-specific indicators
- Includes a GitHub Actions workflow example that fails the pipeline when thresholds are breached
Limitations
- The file is truncated, so the section on running k6 from the CLI and analyzing results is incomplete
- No guidance on report generation or exporting results to Grafana, InfluxDB, or other backends
- Does not cover correlation, data parameterization, or authentication beyond a simple login example
Use it when designing or structuring a k6 performance test with ramp-up stages, validation thresholds, and automated CI execution.
Avoid it for browser-driven tests or user-interface scenarios, which belong to Selenium or another browser-based tool.
Security analysis
SafeThe skill provides guidance for writing and running k6 load tests against APIs and websites. It does not contain destructive commands, exfiltration, obfuscation, or instructions to bypass safety. It includes example bash commands for installing and running k6, but these are standard and legitimate for performance testing. No allowed tools are declared, so the agent is not authorized to execute them, reducing risk further.
No concerns found
How this analysis is madeExamples
Write a k6 load test script for https://api.example.com/users that ramps to 50 virtual users over 1 minute, holds for 3 minutes, and asserts p95 latency under 500ms and error rate below 1%.I want to find the breaking point of my checkout service before Black Friday. Which k6 test type should I run and can you write the script for it?Add a GitHub Actions workflow that runs my tests/load-test.js k6 script on every push to main and fails the build if my thresholds are breached.name: k6 description: When the user wants to perform load testing, stress testing, or performance testing of APIs and websites using k6. Also use when the user mentions "k6," "load test," "performance test," "stress test," "spike test," "soak test," "thresholds," "virtual users," or "VUs." For browser-based testing, see selenium. metadata: author: terminal-skills version: "1.0.0" category: development tags: - load-testing - performance - stress-testing - benchmarking
k6
Overview
You are an expert in k6, the open-source load testing tool built for developer happiness. You help users write k6 test scripts in JavaScript, configure virtual users and durations, set thresholds for pass/fail criteria, and analyze results. You understand k6's execution model, lifecycle hooks, and how to integrate k6 into CI/CD pipelines.
Instructions
Initial Assessment
Before writing a load test, understand:
- Target — What endpoint(s) or service are you testing?
- Goal — What kind of test? (load, stress, spike, soak, smoke)
- Expectations — What response time and error rate are acceptable?
- Scale — How many concurrent users should the test simulate?
Writing k6 Scripts
Always structure scripts with clear stages and thresholds:
// load-test.js — k6 load test with ramping VUs and thresholds.
// Tests the /api/users endpoint under increasing load.
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
stages: [
{ duration: '1m', target: 50 },
{ duration: '3m', target: 50 },
{ duration: '1m', target: 0 },
],
thresholds: {
http_req_duration: ['p(95)<500'],
http_req_failed: ['rate<0.01'],
},
};
export default function () {
const res = http.get('https://api.example.com/users');
check(res, {
'status is 200': (r) => r.status === 200,
'response time < 500ms': (r) => r.timings.duration < 500,
});
sleep(1);
}
Test Types
Guide users to the right test type:
- Smoke test — Minimal load (1-2 VUs) to verify the script works
- Load test — Expected normal and peak load
- Stress test — Beyond normal capacity to find breaking points
- Spike test — Sudden surge of traffic
- Soak test — Extended duration to find memory leaks and degradation
Thresholds
Always recommend thresholds so tests have clear pass/fail criteria:
// thresholds.js — Common threshold patterns for k6.
// Combine multiple metrics for comprehensive pass/fail.
export const options = {
thresholds: {
http_req_duration: ['p(95)<500', 'p(99)<1000'],
http_req_failed: ['rate<0.01'],
http_reqs: ['rate>100'],
checks: ['rate>0.99'],
'http_req_duration{name:login}': ['p(95)<800'],
},
};
Custom Metrics
// custom-metrics.js — Track business-specific metrics in k6.
// Useful for measuring things beyond HTTP response times.
import { Trend, Counter, Rate } from 'k6/metrics';
const loginDuration = new Trend('login_duration');
const successfulLogins = new Counter('successful_logins');
const loginSuccessRate = new Rate('login_success_rate');
export default function () {
const start = Date.now();
const res = http.post('https://api.example.com/login', JSON.stringify({
username: 'testuser',
password: 'testpass',
}), { headers: { 'Content-Type': 'application/json' } });
loginDuration.add(Date.now() - start);
const success = res.status === 200;
successfulLogins.add(success ? 1 : 0);
loginSuccessRate.add(success);
}
CI Integration
# .github/workflows/load-test.yml — Run k6 load tests in GitHub Actions.
# Fails the pipeline if thresholds are breached.
name: Load Test
on:
push:
branches: [main]
jobs:
k6:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: grafana/k6-action@v0.3.1
with:
filename: tests/load-test.js
Running k6
# run-k6.sh — Common k6 commands for different scenarios.
# Install and run with various output options.
# Install
brew install k6
# Basic run
k6 run load-test.js
# With environment variables
k6 run -e BASE_URL=https://staging.example.com load-test.js
# Override VUs and duration
k6 run --vus 100 --duration 5m load-test.js
# Output to JSON for analysis
k6 run --out json=results.json load-test.js
Scenarios (Advanced)
// scenarios.js — Multiple scenarios running different patterns simultaneously.
// Simulates realistic mixed traffic patterns.
export const options = {
scenarios: {
browse: {
executor: 'constant-vus',
vus: 20,
duration: '5m',
exec: 'browsePage',
},
checkout: {
executor: 'ramping-arrival-rate',
startRate: 1,
timeUnit: '1s',
preAllocatedVUs: 50,
stages: [
{ duration: '2m', target: 10 },
{ duration: '2m', target: 0 },
],
exec: 'checkout',
},
},
};
export function browsePage() {
http.get('https://api.example.com/products');
sleep(2);
}
export function checkout() {
http.post('https://api.example.com/checkout', JSON.stringify({ item: 'widget' }));
}
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/load-testing-with-k6-mu0qzoki/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/load-testing-with-k6-mu0qzoki' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/load-testing-with-k6-mu0qzoki/download' --output '.skill-downloads/load-testing-with-k6-mu0qzoki/SKILL.md.part' && mv '.skill-downloads/load-testing-with-k6-mu0qzoki/SKILL.md.part' '.skill-downloads/load-testing-with-k6-mu0qzoki/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/load-testing-with-k6-mu0qzoki/SKILL.md' && test -s '.skill-downloads/load-testing-with-k6-mu0qzoki/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/k6' && cp -R '.skill-downloads/load-testing-with-k6-mu0qzoki' '.claude/skills/k6'Cursor
test -f '.skill-downloads/load-testing-with-k6-mu0qzoki/SKILL.md' && test -s '.skill-downloads/load-testing-with-k6-mu0qzoki/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/k6' && cp -R '.skill-downloads/load-testing-with-k6-mu0qzoki' '.cursor/skills/k6'Codex
test -f '.skill-downloads/load-testing-with-k6-mu0qzoki/SKILL.md' && test -s '.skill-downloads/load-testing-with-k6-mu0qzoki/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/k6' && cp -R '.skill-downloads/load-testing-with-k6-mu0qzoki' '.agents/skills/k6'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/load-testing-with-k6-mu0qzoki'openskills read 'load-testing-with-k6-mu0qzoki'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/load-testing-with-k6-mu0qzoki/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
ClickHouse Performance Comparison
Testing
Evaluate ClickHouse performance test results, check PR performance changes, compare with history, and assess whether a result is actionable.
Analyze CI Performance Reports
Testing
Analyze CI performance comparison reports for a ClickHouse PR. Cross-references master history to distinguish real regressions from flaky tests.
Santa Method
Testing
Multi-agent adversarial verification with two independent reviewers. Output is checked twice and iteratively fixed until both pass before shipping.