/k6-load-testing:k6-test-maintenancefrom k6-load-testing
Maintain and improve existing k6 test scripts. Covers threshold tightening based on trend data, version migration between k6 releases, auto-fixing tests when the underlying service changes, refactoring for cleanliness, and auditing scripts against current best practices from docs. Use when the user asks to fix a failing k6 test, tighten thresholds, migrate a script to a new k6 version, refactor a test, update a script after a service change, or improve a script with best practices. Trigger on phrases like "fix my k6 test", "tighten my thresholds", "migrate to k6 v2", "update my test script", "refactor this k6 test", "my test is failing after a deploy", "apply best practices to my script", "modernize my k6 test", or "the service changed and my test broke". Also trigger when another skill (k6-trend-analysis or k6-cloud-investigate-test) hands off with a recommendation to edit a script. Maintains existing scripts; to author a new test use the k6 skill, or k6-browser-test for a browser test.
Trending skills
7-day visitors to each skill page
Ships in k6-load-testing. 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.
Maintain, fix, and improve existing k6 test scripts. Five maintenance tasks,
each with a step-by-step procedure in references/workflows.md:
Classify every proposed change by whether it alters the test's runtime behavior:
let → const,
remove unused imports, update comments, reformat. Apply directly.sleep(), endpoint URL updates, check rewrites, scenario changes, new
thresholds. Always present as a diff with rationale and require confirmation.The threshold for "behavioral" is deliberately low. If in doubt, treat it as behavioral and ask -- a trivial-looking threshold change can cascade to CI gates, SLO calculations, and alerting.
k6-manage -- fetch and edit GCk6-hosted scripts safely (§5: GET, backup,
edit, validate, PUT, verify by sha256). Read it before touching any
cloud-hosted script.gcx -- sole tool for Grafana Cloud API access.validate_script and get_documentation. Check
availability first; fall back to k6 x docs if absent.k6 x docs CLI -- documentation lookup when mcp-k6 isn't configured.k6 CLI -- local validation (k6 inspect, k6 run).Every workflow produces a modified script. Never present or PUT an unvalidated script -- run this loop, fixing and re-running until it passes:
k6 inspect <script> -- catches syntax errors, invalid
options, broken imports. Works on all types including browser tests (no
browser needed). If mcp-k6 is available, also run validate_script.k6 run --vus 1 --iterations 1 <script>.references/verification.md.application/octet-stream →
sha256-verify).options.thresholds or similar declarative fields that don't alter what the
k6 runtime executes; the bytes inside default function, imported modules,
and check predicates are byte-identical. Example: p(95)<500 → p(95)<420.default function,
imports, helper modules, request URLs, check predicates, or to
scenarios.*.vus/iterations/duration/executor (which alter load shape
and metric distributions). Example: changing a URL, adding a check, rewriting
auth, switching executors.When in doubt, treat as Class B.
| Class | Test duration | Verification |
|---|---|---|
| A | any | sha256 + k6 inspect + historical pass/fail prediction. No cloud run needed. |
| B | short (< 5 min) | sha256 + k6 inspect + full cloud run (k6-manage §11). |
| B | long (≥ 5 min) | sha256 + k6 inspect + local 1-iteration smoke + k6 cloud run of a local copy with --vus 1 --iterations 1. PUT to the saved test only after the cloud smoke passes. |
Verification depth depends on the change class, not the test's duration -- most
edits don't need a full run, and production tests may run for hours. Per-class
recipes (Class A prediction table, Class B short/long, edge cases like scenario
changes and loosening) are in
references/verification.md.
Before proposing any change that touches k6 APIs, imports, or patterns, confirm it against current docs and cite the source in your report -- this grounds recommendations in the real API, not stale model knowledge. Look up in order:
get_documentation("best_practices"),
get_documentation("javascript-api/k6-browser"), validate_script(...).k6 x docs CLI (always available):
k6 x docs using-k6 thresholds
k6 x docs javascript-api k6-http
k6 x docs search "websocket migration"
2-call strategy: try the direct path first; if it returns a topic list, pick
the subtopic and call again. Full parent paths required (using-k6 thresholds,
not thresholds). k6 x docs serves docs for the installed k6 version -- it
may lag the target version when migrating.https://grafana.com/docs/k6/latest/.A common browser-test bug: using check() from k6 with async predicates. The
built-in check() does not await Promises, so
check(page, { 'title': p => p.locator('h1').textContent() === 'Foo' }) silently
passes because the Promise object is truthy. Two valid fixes:
import { check } from 'https://jslib.k6.io/k6-utils/1.5.0/index.js' -- then
predicates can be async and await inside them works.const text = await page.locator('h1').textContent(); check(text, { ... }) --
keeps the standard sync check from k6.When you hit this during any workflow (migration, refactor, audit), flag it as a behavioral bug and propose one of these fixes.
k6-manage §5 (GET → backup → edit →
validate → PUT → verify sha256).Determine the source before starting: a GCk6 test URL or ID is cloud-hosted; a file path is local.
Authoring a new test, not maintaining one? This skill improves scripts that already exist. To write a new browser test from a plain-language user journey (selectors discovered by exploring the live site), use the k6-browser-test skill; for other new k6 scripts, use the k6 skill.
Full procedures are in references/workflows.md:
All five follow behavior-aware change control: auto-apply syntactic changes, present behavioral ones as diffs for confirmation.
| Issue | Detail |
|---|---|
| Cloud script format | GCk6 scripts can be single files or tar archives. Detect with file(1) before editing (see k6-manage §5). |
| Zero-observation thresholds | A threshold on a metric with no observations passes by default. When adding new thresholds, ensure the metric is actually emitted by the test. |
| abortOnFail cascades | If a threshold has abortOnFail: true, tightening it means runs abort earlier. Warn the user. |
| Browser script validation | Browser scripts can't be validated with k6 run --iterations 1 without a browser. Use k6 inspect for parse-only validation, or validate_script via mcp-k6. |
| k6 x docs version alignment | k6 x docs serves docs for the installed k6 version; when migrating to a newer version, local docs may not reflect the target API. Note this in migration lookups. |
| Script drift after edit | After pushing a cloud-hosted script, the next run uses the new version, but historical runs keep their bundled snapshot. To investigate a past failure, compare the run-bundled script (read-only), not the current one. |
references/workflows.md -- step-by-step procedures for the five maintenance tasksreferences/verification.md -- per-class post-edit verification recipesWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub fcakiroglu16/marketplace --plugin k6-load-testing3 skills in this plugin
/k6-browser-testGenerate a working k6 browser test (k6/browser) from a plain-language description of a user journey — no CSS selectors or technical detail needed. Explores the LIVE target site with a throwaway k6/browser session to discover real, verified selectors (getByRole/getByLabel/getByText, etc.), dismisses cookie/consent banners, then writes a functional or load test using expect() from k6-testing (Web-Vitals thresholds for load). Looks up k6/browser APIs via `k6 x docs`; validates with `k6 run`. Use when the user wants to write, author, or generate a k6 browser/UI or load test with a real browser, or says things like "write a browser test for…", "test this login/checkout/search flow with k6", "click through my site and verify…", or describes navigating a site in prose. For a full multi-test performance suite use k6-perf-test-website; for HTTP/protocol (non-browser) tests use the general k6 skills; for browser or scripted checks in Grafana Cloud Synthetic Monitoring, use synthetic-monitoring-checks./k6-perf-test-websiteUse when the user wants to performance-test, load-test, or stress-test a public website end-to-end with k6. Produces a hybrid (protocol + browser) test suite, SLO-backed thresholds, a load-generator monitor sidecar, and a Grafana-side investigation playbook for backends the user owns. Triggers on "perf test my site", "performance test my site", "load test this URL", "stress test my web app", "I want to load test [URL]", "set up k6 against my website", "write a k6 suite for [site]", "see if my site handles N concurrent users", or "how does my site perform under traffic". Use this skill whenever the user mentions k6, load testing, stress testing, performance testing, or wants to validate a website under traffic — even if they don't explicitly use the word "test" or ask for the specific outputs this skill produces. This skill is for a full multi-test suite across several workflows; for a single browser test — functional OR a browser load test measuring Web Vitals for one journey — use k6-browser-test.Other plugins' skills for the same job