Skip to main content
skill CX Codex

testing · grafana — Claude Code skill: monitoring and installation

Sets up uptime probes, k6 load tests, and frontend observability through Grafana Cloud. Use it before a release or when investigating failures.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add grafana/skills --skill testing -a claude-code
Open on GitHub

What testing does

The skill guides setup of Synthetic Monitoring for HTTP checks and network probes. It can create a check through the API, verify that it is enabled, inspect probe_success, and track TLS certificate expiry. Probes are available from 20+ locations.

For load testing, it uses Grafana Cloud k6. It starts with a local run of script.js, then launches the script in the cloud and evaluates http_req_duration thresholds. CI can use grafana/k6-action; exit code 99 means a threshold failed.

For React or Vue, the skill covers Faro Web SDK setup, custom events through pushEvent, and correlation between frontend errors and distributed traces. It requires a Grafana Cloud stack plus separate credentials for Synthetic Monitoring, k6, or Faro, so it is not a standalone test setup.

What it helps with

  • check website uptime from multiple probe locations
  • create an HTTP check and inspect probe_success
  • run script.js as a k6 Cloud load test
  • fail CI when a load threshold is breached
  • instrument a React or Vue app with Faro

Example prompts for the agent

  • Set up Synthetic Monitoring for an HTTP check of my API and verify probe_success.
  • Run script.js locally first, then prepare a Grafana Cloud k6 run.
  • Add Faro Web SDK to my React app and send a faro_smoketest event.

How to install testing

1Skills CLI (Vercel)

npx skills add grafana/skills --skill testing -a claude-code

2Manually: put the files in place

~/.claude/skills/testing/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/testing/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about testing

How do I install testing in Claude Code?

Run npx skills add grafana/skills --skill testing -a claude-code, then run npx skills add grafana/skills --skill testing -a claude-code again. The skill file is placed at ~/.claude/skills/testing/SKILL.md.

What does testing do?

The skill covers Synthetic Monitoring, Grafana Cloud k6 load testing, and Faro frontend observability. It helps configure uptime checks, load thresholds, frontend events, and error tracing.

What is required for Synthetic Monitoring, k6, and Faro?

You need a Grafana Cloud stack. Synthetic Monitoring needs an sm:write token; k6 needs a token and projectID; Faro needs a Faro app and write-token.

Source text

SKILL.md · Apache-2.0
---
name: testing
license: Apache-2.0
description: Probe, load-test, and instrument frontends from Grafana Cloud. Covers Synthetic Monitoring (HTTP / DNS / TCP / Ping / Traceroute / Multihttp / k6-browser scripted checks from 20+ global probes, alert on `probe_success` + TLS-cert expiry), Grafana Cloud k6 (distributed load tests across AWS load-zones, scenarios, `http_req_duration` thresholds, CI integration via `grafana/k6-action`), and Frontend Observability with Faro Web SDK (RUM, Core Web Vitals, custom events, `pushError`, distributed-trace correlation). Use when checking website / API uptime from multiple regions, gating a release on a load test, watching for TLS-cert renewal, instrumenting a React/Vue app, tracking Core Web Vitals, or correlating frontend errors to backend traces — even when the user says "is my login flow up?", "monitor my API", "ping our endpoint every minute", "release-gate load test", "browser performance monitoring", "session replay", or "RUM" without naming Synthetic Monitoring / k6 / Faro.
---

# Grafana Cloud Testing

> **Docs**: https://grafana.com/docs/grafana-cloud/testing/

Three pillars: external probing (Synthetic Monitoring), load testing (k6 Cloud), real-user monitoring (Faro).

## Prerequisites

- Grafana Cloud stack
- Synthetic Monitoring: SM access token (`sm:write`)
- k6 Cloud: a Grafana Cloud k6 token + projectID
- Faro: a Faro app + write-token from **Frontend Observability → Apps**

## Common Workflows

### 1. Create + verify a Synthetic HTTP check

```bash
# 1. Create the check (full payload in references/synthetic.md)
curl -X POST https://synthetic-monitoring-api.grafana.net/sm/checks \
  -H "Authorization: Bearer <sm-token>" -H "Content-Type: application/json" \
  -d '{"job":"website","target":"https://example.com","frequency":60000,"timeout":15000,
       "enabled":true,"probes":[1,5,10],
       "settings":{"http":{"method":"GET","validStatusCodes":[200]}}}'

# 2. List checks — confirm it exists and is enabled
curl -s https://synthetic-monitoring-api.grafana.net/sm/checks \
  -H "Authorization: Bearer <sm-token>" | jq '.[] | select(.job=="website")'

# 3. Verify probe_success arrived (wait ~60s for the first run)
#    In Grafana Explore on the synthetic metrics datasource:
#      probe_success{job="website"}
#    Expect 1 from each probe in `probes:[1,5,10]`.
#
# Rollback: DELETE /sm/checks/<id> or set `"enabled": false`.
```

See [`references/synthetic.md`](references/synthetic.md) for all check types, PromQL queries, and alert rules.

### 2. Run a k6 cloud load test

```bash
# 1. Authenticate once
k6 cloud login --token <grafana-cloud-k6-token>

# 2. Validate the script locally first (smoke run, no cloud cost)
k6 run --vus 1 --duration 30s script.js

# 3. Launch in cloud
k6 cloud script.js
# → URL of the run; thresholds (p95<500ms, error<1%) decide pass/fail.

# 4. Verify in CI — exit code 0 = thresholds passed, 99 = threshold failed.
echo $?
```

Full script + scenarios + CI YAML: [`references/k6-and-faro.md`](references/k6-and-faro.md).

### 3. Instrument a frontend with Faro

```bash
# 1. Install
npm install @grafana/faro-web-sdk @grafana/faro-web-tracing
```

```javascript
// 2. initializeFaro({ url, apiKey, app, instrumentations }) — see references/k6-and-faro.md
// 3. Push a test event so we have something to look for:
faro.api.pushEvent('faro_smoketest', { ts: Date.now().toString() });
```

```bash
# 4. Verify the collector accepted it (browser DevTools → Network)
#    POST to /collect should return 202. If 401 — apiKey mismatch.

# 5. Verify in Grafana
#    - Frontend Observability → your app → Sessions: should show your session
#    - Explore on Loki: `{kind="event"} |= "faro_smoketest"`
#    - For traces: filter by `service.name="my-frontend"` in Tempo
```

## Troubleshooting

- Synthetic check stuck at `probe_success=0` → check `probe_*_duration_seconds` for the failing stage; the probe-region label tells you which prober errored
- k6 cloud run "ABORTED_THRESHOLD" → a threshold tripped; inspect the run page to see which one
- Faro events not landing → check the browser network call to `/collect` returns 202; common cause is wrong `apiKey` or `url` (must match the FE Observability app)

## References

- For deep authoring of Synthetic Monitoring scripted (k6) and browser checks — execution model, assertions, secrets, API/Terraform payloads — see the [`synthetic-monitoring-checks`](../synthetic-monitoring-checks/SKILL.md) skill
- [`references/synthetic.md`](references/synthetic.md) — Synthetic Monitoring essentials: check types, key PromQL metrics, alert rules
- [`references/synthetic-monitoring.md`](references/synthetic-monitoring.md) — deep dive: full API for check CRUD, probe selection, scripted (k6) checks, multi-step browser checks
- [`references/k6-and-faro.md`](references/k6-and-faro.md) — k6 cloud script + Faro Web SDK init snippets for end-to-end testing
- [`references/k6-cloud.md`](references/k6-cloud.md) — deep dive: k6 cloud config (project + load zones + thresholds), CI integration, run analysis

## Resources

- [Synthetic Monitoring docs](https://grafana.com/docs/grafana-cloud/testing/synthetic-monitoring/)
- [Grafana Cloud k6 docs](https://grafana.com/docs/grafana-cloud/testing/k6/)
- [Faro / Frontend Observability docs](https://grafana.com/docs/grafana-cloud/monitor-applications/frontend-observability/)

© grafana · Apache-2.0 · grafana/skills

Similar skills

Everything for Testing and QA →

testing by other authors comes first.

testing tursodatabase Skill teaches you to write tests for SQL and Rust: choose between .sqltest, TCL and integration formats, run test suites with the right commands. CX Codex +1 1,300installs testing codewithmukesh A skill that lays out a testing strategy for .NET 10 apps: integration tests via WebApplicationFactory, real databases in Testcontainers, Verify snapshots. CX Codex +1 2,800installs testing rshankras A set of TDD workflows and test infrastructure for Apple platform apps. Useful when an agent writes the code and you want tests around it. CX Codex +1 468installs testing modelcontextprotocol The skill covers where tests live for each MCP server, which runner picks them up, and how to clear the per-file coverage gate. Useful when a test is skipped or passes against a stale build. CX Codex +1 ★ 91,547repo stars monitoring-observability ahmedasmar A skill for building monitoring and observability: metrics strategy, alerts, dashboards, SLOs and incident troubleshooting. CX Codex +1 493installs web-testing mrgoonie A web testing skill covering unit, integration, E2E, load, security, visual and accessibility checks. Useful when your test suite needs structure. CX Codex +1 442installs qa-dashboard kindlmann Builds test dashboards and reports with Allure, Grafana and ReportPortal. Useful when run results need to reach the team or leadership. CX Codex +1 1,100installs testing-mwaa-workflow aws Runs end-to-end execution tests for Amazon MWAA workflows and tracks them to completion. Useful for verifying Python DAGs and Serverless workflows safely. CX Codex +1 861installs performance-testing kindlmann Generates k6 load testing scripts and Lighthouse CI budgets, turning latency thresholds and Web Vitals into strict build gates in your pipeline. CX Codex +1 1,100installs stress-testing aj-geddes A skill for stress testing: push a system past normal capacity to find breaking points, check auto-scaling and recovery after overload. CX Codex +1 497installs

From the same set47

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor