ring:load-testing-with-k6
Load-testing with k6 for the LerianStudio/k6 Palantir platform: scaffolds product.yaml, smoke/load/stress/soak scenarios, a helper client, builds the webpack bundle, and verifies a local k6 run. Use when new API/gRPC endpoints or throughput-path changes need SLO validation under load, or a Palantir CI load gate is required. Skip when no network-facing endpoints are affected or changes are config-only or non-code.
What this skill does
# k6 Load Testing (Palantir Platform)
## When to use
- After integration testing passes
- Before production deploy of performance-sensitive changes
- New API endpoints or significant throughput-path changes
- Need to validate SLOs under load (latency, error rate, throughput)
- CI pipeline requires load test gate via Palantir
## Skip when
- Task is documentation-only, configuration-only, or non-code
- No HTTP/gRPC endpoints affected by the change
- Changes limited to static assets, configs, or non-runtime code
- Service has no network-facing interface
## Related
**Complementary:** ring:implementing-tasks, ring:reviewing-code
This skill generates k6 load tests following the Lerian k6 platform conventions.
Tests are structured for execution via Palantir (Self-Service Testing) and are
bundled by webpack into self-contained scripts deployed to EKS via k6-operator.
**Reference repository:** `LerianStudio/k6` — specifically `platform/` directory.
**Block conditions:**
- Test script missing `handleSummary` export = FAIL (Palantir can't collect results)
- `scenario.yaml` param names don't match `__ENV` vars in test.js = FAIL
- Test doesn't read VUS/DURATION from `__ENV` = FAIL
- No `checkResponse()` from shared utils = FAIL
- Missing `product.yaml` = FAIL
## Step 1: Validate Input
Required:
- `product` — product name in lowercase (e.g., `midaz`, `tracer`, `reporter`, `matcher`)
- `endpoints` — list of endpoints to test, each with method, path, and optional payload
- `base_port` — local dev port for the product (e.g., 3000 for midaz, 4020 for tracer)
Optional:
- `scenario_types` — which scenarios to generate (default: `[smoke, load, stress]`)
- `auth_type` — `bearer` (default, uses `shared/auth.js`) | `api-key` | `none`
- `api_key_header` — header name for API key auth (default: `X-API-Key`)
- `custom_thresholds` — override default thresholds
- `existing_product` — if true, extend existing product directory
## Step 2: Understand the Platform Structure
All test code lives under `platform/` in the `LerianStudio/k6` repo:
```
platform/
├── products/{product}/
│ ├── product.yaml # Product metadata (read by Palantir)
│ ├── helpers/
│ │ └── client.js # HTTP client for this product's API
│ └── scenarios/
│ └── {scenario}/
│ ├── scenario.yaml # Catalog metadata (read by Palantir)
│ └── test.js # k6 test script (webpack entry point)
├── shared/
│ ├── auth.js # getAuthHeaders(), authenticate()
│ ├── utils.js # checkResponse(), sleepWithJitter(), defaultHandleSummary()
│ └── palantir/ # SDK for complex scenarios (fixtures, runtime)
│ ├── index.js # scenario(), fixture(), createTestExports()
│ ├── runtime.js # Builds k6 exports from config
│ ├── scenario.js # Declarative scenario config builder
│ └── templates.js # Built-in test type templates (smoke/quick/full/breakpoint/soak)
├── dist/ # Webpack output (git-ignored)
├── build.js # Bundler entry point
├── webpack.config.js # Auto-discovers products/*/scenarios/*/test.js
├── config.yaml # Platform-level test catalog metadata
└── package.json
```
### Two Patterns for Writing Tests
**Pattern A: Simple client (recommended for most tests)**
Product `helpers/client.js` provides `get()`, `post()`, `patch()`, `del()` scoped to
the product's base URL. Scenarios import the client and `shared/utils.js` directly.
Used by: smoke, load, stress, soak scenarios for midaz, console, pix.
**Pattern B: Palantir SDK (for complex scenarios with fixtures)**
For scenarios that need declarative fixture setup (create rules, limits, etc.),
sanity checks, and built-in metric tracking, use the Palantir SDK:
```javascript
import { scenario, fixture, createTestExports } from '../../../../shared/palantir/index.js';
```
Used by: tracer scenarios (pass-through, denied-by-limit, denied-by-rule, complex-approval).
**Choose Pattern A** unless the product requires setup fixtures (rules, limits, etc.) that
must be created and activated before load can run.
## Step 3: Create Product Files
### 3a. product.yaml
Create `platform/products/{product}/product.yaml`:
```yaml
product: {product}
description: "{Product description} - performance tests"
base_url_env: {PRODUCT}_BASE_URL
defaults:
thresholds:
http_req_duration: ["p(95)<500", "p(99)<1000"]
http_req_failed: ["rate<0.01"]
env:
API_VERSION: "v1"
tags:
- {product}
- {relevant-tags}
```
### 3b. helpers/client.js
Create `platform/products/{product}/helpers/client.js`:
For **bearer auth** (most products):
```javascript
import http from 'k6/http';
import { getAuthHeaders } from '../../../shared/auth.js';
const BASE_URL = __ENV.{PRODUCT}_BASE_URL || __ENV.TARGET_URL || 'http://localhost:{base_port}';
const API_VERSION = __ENV.API_VERSION || 'v1';
export function apiUrl(path) {
return `${BASE_URL}/${API_VERSION}${path}`;
}
export function get(path, params = {}) {
const { headers: extraHeaders, ...restParams } = params;
return http.get(apiUrl(path), {
...restParams,
headers: { ...getAuthHeaders(), ...extraHeaders },
});
}
export function post(path, body, params = {}) {
const { headers: extraHeaders, ...restParams } = params;
return http.post(apiUrl(path), JSON.stringify(body), {
...restParams,
headers: { ...getAuthHeaders(), ...extraHeaders },
});
}
export function patch(path, body, params = {}) {
const { headers: extraHeaders, ...restParams } = params;
return http.patch(apiUrl(path), JSON.stringify(body), {
...restParams,
headers: { ...getAuthHeaders(), ...extraHeaders },
});
}
export function del(path, params = {}) {
const { headers: extraHeaders, ...restParams } = params;
return http.del(apiUrl(path), null, {
...restParams,
headers: { ...getAuthHeaders(), ...extraHeaders },
});
}
```
For **API key auth** (e.g., tracer):
```javascript
import http from 'k6/http';
const BASE_URL = __ENV.{PRODUCT}_BASE_URL || __ENV.TARGET_URL || 'http://localhost:{base_port}';
const API_VERSION = __ENV.API_VERSION || 'v1';
function getHeaders() {
const headers = { 'Content-Type': 'application/json' };
const apiKey = __ENV.{PRODUCT}_API_KEY;
if (apiKey) {
headers['{api_key_header}'] = apiKey;
}
return headers;
}
export function apiUrl(path) {
return `${BASE_URL}/${API_VERSION}${path}`;
}
// ... same get/post/patch/del pattern with getHeaders() ...
export function readiness() {
return http.get(`${BASE_URL}/health`, {
tags: { name: '{product}_readiness' },
});
}
```
**Key rules for the client:**
- `__ENV.TARGET_URL` is the primary URL injected by Palantir SST — always include as fallback
- Product-specific env var (`{PRODUCT}_BASE_URL`) allows override in multi-product environments
- Never hardcode auth credentials — read from `__ENV`
## Step 4: Create Scenario Files
### 4a. scenario.yaml (per scenario)
Create `platform/products/{product}/scenarios/{type}/scenario.yaml`:
```yaml
name: "{Scenario Display Name}"
description: "{What this scenario validates}"
type: {smoke|load|stress|soak|functional}
tags: [{type}, {relevant-tags}]
defaults:
vus: {default_vus}
duration: "{default_duration}"
parallelism: 1
params:
- name: VUS
label: "Virtual Users"
type: number
default: "{default_vus}"
description: "Number of concurrent virtual users"
- name: DURATION
label: "Test Duration"
type: string
default: "{default_duration}"
description: "How long the test runs (e.g. 1m, 5m, 30s)"
```
**Rules:**
- Every `params[].name` MUST match a `__ENV.XXX` variable read in test.js
- `type` must be one of: smoke, load, stress, soak, breakpoint, capacity, functional
- `defaults` define what Palantir pre-fills in the form
### Default values per scenario type
| Type | VUs | Duration | Thresholds |
|----Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.