Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of K6 Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-k6-knowledge-patch)
---
name: k6-knowledge-patch
description: Grafana k6
version: "2.4.0"
license: MIT
metadata:
author: Nevaberry
---
# Grafana k6 Knowledge Patch
Load this skill when updating k6 scripts, browser tests, Cloud commands,
metric outputs, or Go extensions, or investigating changed runtime behavior.
The references contain API details, examples, and release-specific behavior.
## Reference index
| Reference | Topics |
| --- | --- |
| [Migrations and compatibility](references/migrations-and-compatibility.md) | Removed commands, Cloud configuration, module imports, output deprecations, container compatibility |
| [Browser testing](references/browser-testing.md) | Locators, frames, waits, events, routing, headers, contexts, screenshots, browser metrics |
| [CLI, Cloud, and configuration](references/cli-cloud-and-configuration.md) | Scenarios, feature flags, stacks, listings, local execution, credentials, status, installation |
| [Extensions and dependencies](references/extensions-and-dependencies.md) | Provisioning, manifests, archives, extension commands, Go APIs, build requirements, dependency updates |
| [Outputs and observability](references/outputs-and-observability.md) | Summaries, OpenTelemetry, Prometheus, InfluxDB, metric shapes, thresholds, logs, dashboard, tracing |
| [Scripting, security, and protocols](references/scripting-security-and-protocols.md) | Assertions, JavaScript, streams, async groups, HTTP, HTML, gRPC, WebSockets, TLS, cryptography, secrets |
## Breaking changes and deprecations
### Execution and Cloud commands
The `externally-controlled` executor and `k6 pause`, `k6 resume`, `k6 scale`,
and `k6 status` commands were removed. Switch to an executor matching the
load profile, such as `ramping-vus` or `constant-arrival-rate`.
| Previous usage | Replacement |
| --- | --- |
| `k6 login cloud` | `k6 cloud login` |
| `k6 login influxdb` | Direct InfluxDB output configuration through `K6_INFLUXDB_*` |
| `k6 cloud script.js` | `k6 cloud run script.js` |
| Old `--upload-only` invocation | `k6 cloud upload script.js` |
| `options.ext.loadimpact` | `options.cloud` |
All `k6 cloud` commands require a configured stack, including upload.
For noninteractive `k6 cloud login`, pass `--token` and `--stack` together.
Run flags such as `--vus` directly on `k6 cloud` produce `unknown flag`
and a nonzero exit status.
Move `{USER_CONFIG_DIR}/loadimpact/config.json` to
`{USER_CONFIG_DIR}/k6/config.json` before upgrading; automatic migration
of that file was removed.
### Module imports and Go extensions
Remove `k6/experimental/webcrypto` imports and use global `crypto`.
Migrate deprecated `k6/experimental/redis` to `k6/x/redis`.
Change `k6/experimental/websockets` to stable `k6/websockets`, which has
the same API; the experimental import path is scheduled for removal.
When targeting k6 v2, update `go.k6.io/k6` dependencies and imports to
`go.k6.io/k6/v2`, such as `go.k6.io/k6/v2/js/modules`.
For affected public Go types, replace removed easyjson-generated
`MarshalJSON` and `UnmarshalJSON` methods with `encoding/json` through
`json.Marshal(value)` and `json.Unmarshal(data, &value)`.
Sobek converts nil slices to `null` or `undefined`; return a non-nil empty
slice when the JavaScript API should return `[]`. `Runtime.ToValue()`
dereferences one pointer level; dereference additional levels before conversion.
### Output, summary, and browser metric migrations
The built-in `influxdb` and `experimental-prometheus-rw` outputs log a
deprecation warning and are scheduled for removal in k6 v3.
Use `--out opentelemetry` to migrate. `experimental-opentelemetry`
remains a deprecated alias for the stable OpenTelemetry output.
Use `K6_OTEL_EXPORTER_PROTOCOL=grpc` or
`K6_OTEL_EXPORTER_PROTOCOL=http/protobuf` in place of `K6_OTEL_EXPORTER_TYPE`.
The `exporterType` configuration option was removed.
Remove `K6_OTEL_SINGLE_COUNTER_FOR_RATE` and migrate queries using
`<metric>.occurred` or `<metric>.total`: Rate exports always use one counter
with a `condition` attribute of `zero` or `nonzero`.
Use `--summary-mode=disabled` or `K6_SUMMARY_MODE=disabled` instead of
deprecated `--no-summary` or `K6_NO_SUMMARY`.
Switch `--summary-mode=legacy` configurations to `compact` or `full`;
removal of `legacy` was planned for v2.0.
Replace `browser_web_vital_fid` with `browser_web_vital_inp` in thresholds
and downstream integrations; FID removal was planned for v2.0.
### Runtime and data compatibility
gRPC marshals `NaN` and `Infinity` as strings `"NaN"` and `"Infinity"`;
update checks expecting `null`. Percentile thresholds such as `p(95)`
require a value from `0` through `100`; out-of-range values and `NaN` fail parsing.
A script function returning a pending promise errors when the event loop
has no work that could settle it. Normal scenario and test shutdowns retain
the usual interruption handling. Unhandled promise rejections are script
exceptions with the script-error abort reason and an `unhandled script exception` hint.
## Extension provisioning and dependency constraints
Automatic resolution includes community extensions by default in k6 v2.
Drop `K6_BINARY_PROVISIONING` and `K6_ENABLE_COMMUNITY_EXTENSIONS`;
set `K6_AUTO_EXTENSION_RESOLUTION=false` to disable automatic resolution.
Earlier provisioning switches and their scope are documented in the references.
Discovery uses ES module imports and leading `"use k6 with …"` directives.
For CommonJS `require()`, declare the extension in a directive at the start
of the entry script or an imported module, after any shebang, whitespace, or comments.
```javascript
"use k6 with k6/x/redis"
const redis = require('k6/x/redis');
```
Use `k6 deps` to inspect script or archive dependencies, with `--json`
for machine-readable output. `K6_DEPENDENCIES_MANIFEST` supplies version
constraints for dependencies already declared without an explicit version.
Archives record script-declared constraints before manifest defaults are applied.
`k6 x` lists built-in and registry-advertised extension subcommands and caches
the catalog for network-free completion. Supported missing subcommands trigger
binary provisioning. k6 forwards the provisioned binary process's exit code to the caller.
## Scenario selection and feature flags
Use `--scenario` with comma-separated configured names on `k6 run`,
`k6 cloud run`, or `k6 archive`. Selected scenarios keep their settings,
and archives retain the selection. Leave `--vus` and `--duration` unset.
Thresholds scoped to excluded scenarios are warned about and skipped;
global thresholds and other filters remain.
```bash
k6 run --scenario homepage,contacts script.js
k6 run --once --scenario homepage,contacts script.js
```
`--once` runs one iteration with one VU using `shared-iterations`, preserving
the scenario's function and browser settings. By default it accepts scripts
with at most one scenario; combining it with `--scenario` runs each selection once.
It also works with `k6 cloud run` and `k6 archive`.
Enable flags on `k6 run` or `k6 cloud run` through comma-separated or repeated
`--features`, `K6_FEATURES`, or `features` in `config.json`.
`k6 features` lists flags and lifecycle stages.
Enabled flags appear as metric tags and carry over to archives and Cloud workers.
Experimental flags include `native-histograms`, `merge-run-tags`, and `freeze-env`.
## Browser testing quick reference
Use `getByRole()` for ARIA roles and `getByLabel()` for HTML and ARIA labels.
Semantic `getBy*()` locators also work within frames, locators, and `FrameLocator`.
`locator.filter()` accepts `hasText` and `hasNotText` strings or regular expressions.
`locator.count()` returns immediately and includes hidden matches.
`nth(index)`, `first()`, and `last()` select a match by position.
Use an iframe locator's `contentFrame()` to get a `FrameLocator`, or chain
`frameLocator(selector)` calls for nested iframes.
`locator.boundingBox()` auto-waits and returns `null` for invisible elements.
`locator.isInViewport({ ratio, timeout })` waits for attachment, then measures
intersection once; the default ratio of `0` matches any visible pixel.
Start `page.waitForRequest()`, `page.waitForResponse()`, and `page.waitForEvent()`
before the action that triggers the request, response, or event.
`waitForURL()` on pages and frames accepts string patterns or regular expressions.
It waits for load state if the URL already matches, or matching navigation otherwise.
Waiting for `hidden` or `detached` succeeds when the element is already absent.
`page.route(pattern, handler)` accepts a glob string or regular expression.
Handlers can abort, continue with request overrides, or fulfill with a mock response.
Use the same pattern with `page.unroute()`; `page.unrouteAll()` removes every page route.
`route.continue()` and `route.fulfill()` omit headers whose values are `undefined`.
`chromium.connectOverCDP()` accepts a runtime WebSocket endpoint, including a
session URL obtained in `setup()`. k6 closes the connection at iteration end;
`browser.close()` releases it earlier.
`browser.newContext()` accepts `proxy` with required `server` and optional
comma-separated `bypass`. `browserContext.pages()` preserves attachment order.
In v2.4.0, `browser_data_received` uses DevTools' encoded transfer size when each
response finishes, including redirects. Recheck thresholds and baselines,
especially for compressed responses. Browser results include Web Vitals from
intermediate pages during multiple navigations in the same tab.
## Summaries, logs, and tracing
End-of-test summaries group metrics by scenario, group, and category.
`compact` is the default; `full` adds detail, retains script group order,
and indents nested groups. Set `handleSummaryTimeout` or
`K6_HANDLE_SUMMARY_TIMEOUT` to change the `handleSummary()` time limit.
The opt-in machine-readable format and its planned default change are in the references.
The OpenTelemetry HTTP exporter accepts `K6_OTEL_HTTP_EXPORTER_USERNAME` and
`K6_OTEL_HTTP_EXPORTER_PASSWORD`, or output-config `username` and `password`.
OTLP/HTTP exporters cap response bodies from receiving endpoints at 4 MiB.
Experimental `native-tracing`, with a traces output, emits
`k6.run` → `scenario` → `vu` → `iteration` spans, with browser spans nested
under the iteration. Failed iterations record errors; iterations cut short
at scenario end are marked interrupted.
## Security and asynchronous scripting
`tlsAIAFetch: true` opts into fetching missing intermediate certificates for
HTTP and gRPC while still verifying server identity. It supports intermediates
in PKCS#7/CMS bundles, including PEM-armored bundles.
Enable `--http-debug-redact` with `--http-debug`, or set
`K6_HTTP_DEBUG_REDACT=true` or `httpDebugRedact: true`.
Redaction defaults to off and masks specified credential headers and gRPC
metadata while preserving schemes, cookie names, and cookie attributes.
Full debug logs can still expose secrets in query strings and bodies;
the complete masked-header list is in the security reference.
Experimental `async-metric-context` allows async `group()` callbacks and keeps
group tags across `await`; `group_duration` lasts until the promise settles.
Custom tags and metadata propagate through promises, timers, WebSocket listeners,
and gRPC stream listeners. Changes stay local to the callback and its async descendants.
The preview `k6-testing` library exports `expect()` for protocol values and
browser locators. Await browser assertions such as
`await expect(page.locator('button')).toBeVisible()`.