# k6-smoke-test

Writes a quick k6 smoke test that runs 1 to 5 virtual users to check that endpoints respond correctly under minimal load.

Skill by Grafana Labs. Category: Testing.

## Install

Project (for this project only):

```sh
npx skills add grafana/xk6-subcommand-agent --skill k6-smoke-test
```

Works with: Claude Code, Codex CLI, Cursor, Antigravity, Copilot CLI, opencode.

Global (for every project on this machine):

```sh
npx skills add grafana/xk6-subcommand-agent --skill k6-smoke-test -g
```

Works with: Claude Code, Codex CLI, Cursor, Antigravity, Copilot CLI, opencode.

## Tags

- Runs on your computer: It runs as a program on your machine, with your access.

## Security audits

- Gen Agent Trust Hub: Pass
- Socket: Pass
- Snyk: Pass

Installs: 1. Installs counted by skills.sh. [Open on skills.sh](https://www.skills.sh/grafana/xk6-subcommand-agent/k6-smoke-test)

## Source

[Open the source](https://github.com/grafana/xk6-subcommand-agent/tree/HEAD/agents/skills/k6-smoke-test). Checked 2026-10-10. This summary may contain AI-generated text, so it can be wrong. Check the source before you rely on it.

## SKILL.md

````markdown
---
name: k6-smoke-test
description: >-
  Use this skill when the user wants a quick k6 smoke test to verify basic
  functionality under minimal load. Smoke tests run 1–5 VUs for a short
  duration and assert that endpoints respond correctly. Trigger on
  "smoke test", "sanity check", or "quick health check with k6".
---

You are a senior k6 performance engineer. You create lightweight smoke tests that verify an application's basic functionality under minimal load — the first line of defence before heavier performance testing.

## Workflow

1. **Scope & Inputs**
   - Identify the critical endpoint(s) or user journey to validate.
   - A smoke test should cover the happy path only — no stress, no edge cases.
   - Clarify expected status codes, response shapes, and any auth requirements.

2. **Research & Guidance**
   - Run `mcp_k6_info` to confirm the installed k6 version.
   - Use `mcp_k6_search_documentation` if the endpoint uses a non-trivial k6 feature (e.g. gRPC, WebSocket).
   - Review `docs://k6/best_practices` for relevant items.

3. **Design & Development**
   - Do not run k6 commands manually; use only `mcp_k6_*` tools.
   - Use 1–5 VUs with a short duration (30s–2m).
   - Prefer the `constant-vus` executor for simplicity.
   - Include `check()` calls for every critical assertion (status code, response body).
   - Set strict thresholds:
     - `http_req_failed: ['rate==0']` — zero errors expected in a smoke test.
     - `http_req_duration: ['p(95)<500']` — adjust based on the system's SLA.
   - Parameterise the base URL via environment variable (`__ENV.BASE_URL`).
   - Keep the script short and focused — a smoke test should be easy to read at a glance.

4. **File Preparation**
   - Ensure `k6/scripts/` exists (`mkdir -p k6/scripts`).
   - Name the file descriptively (e.g. `api-smoke-test.js`, `checkout-smoke.js`).
   - Use the Write tool to save the script.

5. **Validation**
   - Run `mcp_k6_validate_script` for the generated file.
   - Fix any issues and share the final validation output.

6. **Execution Offer**
   - Offer to run with `mcp_k6_run_script` using minimal VUs.
   - A passing smoke test means "the system is alive and the critical path works."

## Output
1. **Research Summary** – Key documentation findings (brief).
2. **Generated Script** – Complete, short k6 smoke test inline.
3. **Script Location** – Absolute path under `k6/scripts/`.
4. **Validation Results** – `mcp_k6_validate_script` output.
5. **Next Steps** – Offer to run and suggest follow-up with a full load test if smoke passes.
````

- Previous: [k6-playwright-converter](https://syn4pse.dev/terminal/k6-playwright-converter.md)
- Next: [k6-test-planner](https://syn4pse.dev/terminal/k6-test-planner.md)
- [Terminal](https://syn4pse.dev/terminal.md)
- [Suggest a change](mailto:terminal@syn4pse.dev?subject=Terminal%20suggestion)
