/realistic-load-test:realistic-load-testfrom realistic-load-test
Runs realistic k6 load tests with virtual users that mimic real browsing, profiling traffic, sizing load-generator VMs, and reporting max concurrent users.
Ships in realistic-load-test. 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; scripts run unread.
The goal is one number the user can trust: how many concurrently active real users their system serves while staying inside their criteria, plus what breaks first beyond that. "Real users" is the important part. A tool that hammers one URL as fast as it can measures something, but not that. Here one k6 virtual user (VU) is one person with the app open: they load a page, the page fires its API calls, they read for a few seconds, maybe click or write something, and so on. Because each VU sleeps between actions, N users produce roughly N × r requests per second, where r is the per-user rate measured in phase 1. That is a closed model, and it is what makes "2,500 users" mean 2,500 people.
The work has six phases. Each one produces a file in a loadtest/ folder in the user's project, so the work can resume across sessions and the user can review it:
| Phase | Output |
|---|---|
| 0. Scope and permission | loadtest/PLAN.md |
| 1. Profile a real user | loadtest/profile.json, loadtest/PROFILE.md |
| 2. Write the virtual user | loadtest/journey.js (+ lib.js, staircase.js, hold.js) |
| 3. Calibrate (low load) | the calibration table in PROFILE.md |
| 4. Load generators | loadtest/INFRA.md |
| 5. Run: staircase, then holds | loadtest/results/… |
| 6. Report | loadtest/REPORT.md |
Check whether loadtest/ already exists before starting, and pick up where it left off.
Tell the user at each phase boundary what you found and what comes next. Phases 0, 4 and 5 involve their money, their production system, and possibly other people's traffic, so get an explicit go-ahead before you create VMs or send real load.
Ask, in one message, for what you can't infer from the repo:
references/criteria.md covers how to pick them.references/platforms.md for the target's platform before going further, because some platforms block load-test traffic or charge per request.Write loadtest/PLAN.md: target, environment, ownership confirmation (as the user stated it), criteria, the question, the platform notes, and a rough cost estimate (VMs plus any per-request platform cost).
You need:
There are two sources. Use logs when they exist: they show what thousands of real users actually did. Use the browser when there are no logs, or the app is pre-launch, or to see the exact request sequence behind one action. Often you use both: logs for rates and mix, the browser for the request sequence and payloads.
Ask what they have: Vercel (vercel logs, log drains), Cloudflare, Nginx or Apache access logs, AWS ALB or CloudWatch, Datadog, Grafana Loki, PostHog, or a DB of request logs. If an MCP connector or CLI for it is available, offer to pull logs through it. Otherwise ask for an export. A busy representative window is best: a peak day, or at least a few hours including the daily peak.
Then run the analyzer:
python3 <skill>/scripts/analyze_logs.py access.log --out loadtest/profile.json --md loadtest/PROFILE.md
It reads combined/common log format, JSON lines (including Vercel's proxy.* fields), and CSV with a header. It drops static assets and bots, turns paths into route templates (/posts/123 → /posts/:id), splits traffic into sessions (user-id field if one exists, else IP + user agent, 30-minute idle gap), and reports r, the mix, the read/write split, think time between actions, requests per action, and peak concurrency. Run with --help for field overrides when a log format isn't detected. Read references/profiling.md for how to sanity-check the numbers, because log-derived profiles have known traps (NAT'd IPs merging users, health checks, cached responses that never reach the origin).
Use whatever browser automation is available (Playwright MCP, Claude in Chrome, or the Playwright CLI). Walk through each important journey the way a person would, and capture the network requests. Better still, ask the user to click through the app themselves for a few minutes while a HAR is recorded, because their pauses are real think times:
npx playwright open --save-har=loadtest/session.har https://their-site.example
python3 <skill>/scripts/har_to_profile.py loadtest/session.har --out loadtest/browser-profile.json --md loadtest/BROWSER.md
The HAR summary lists every same-site request in order, grouped into user actions, with methods, route templates, status codes, request bodies for writes, which auth mechanism is used (cookie or bearer, values redacted), and the third-party hosts the page calls (which the journey must leave out). If you browse with an MCP tool instead, collect the same information from its network request list.
A browser walkthrough gives you the request sequence but not real usage frequencies. When there are no logs, ask the user for the rough proportions ("of 100 visitors, how many sign in? how many post?"). If they don't know, use cautious assumptions and write them down as assumptions in PROFILE.md.
Whatever the source, PROFILE.md ends with a short, plain summary the user confirms before you write any k6 code, for example:
One active user makes about 0.12 req/s (one action every ~15 s, ~1.8 API requests per action). 91 % reads / 9 % writes. Journeys: browse (70 %), read + like (25 %), post (5 %). Peak observed: ~340 concurrent users at 18:00 UTC, so testing to 5× peak = 1,700 users covers a launch spike.
Copy templates/lib.js, templates/staircase.js and templates/hold.js into loadtest/ unchanged, and write loadtest/journey.js starting from templates/journey.example.js. Read references/k6-journey.md before writing it. The essentials:
sleep() think times drawn from the profile's distribution (uniform ranges around the observed quartiles are fine). Pick a journey per iteration by weight. Add a random 0–5 s sleep on the first iteration so VUs don't move in lockstep.GET /api/product/:id and GET /api/reviews?product=:id together, the action issues both (use http.batch for requests the browser sends in parallel).SharedArray. Hitting the same ID every time measures a cache.setup() / on the VU's first iteration if login is part of real behaviour. Read references/k6-journey.md for the options.loadtest- prefix or a flag) so it can be cleaned up, and stub or skip anything that triggers a third-party call that costs money or reaches real people (payments, emails, SMS, LLM calls). Write the decision into PROFILE.md.tags: {name: 'GET /posts/:id'} and export the list of names as ENDPOINTS. lib.js uses it for per-endpoint stats. Don't leave raw URLs as metric tags: one series per URL eats k6's memory.responseType: 'none' for requests whose body you don't read, and check() the status on every request.Smoke-test locally first: mkdir -p results && k6 run -e BASE_URL=… -e VUS=2 -e DURATION=30s -e RAMP_UP=5s hold.js (k6 doesn't create results/ itself). Every check should pass, and every endpoint in ENDPOINTS should appear in the summary.
Before scaling up, prove that the virtual user matches the real one. Run 20–50 VUs for 3–5 minutes (low enough that the system is relaxed, high enough for stable numbers), from a laptop or one small VM:
k6 run -e BASE_URL=… -e VUS=30 -e DURATION=4m -e LABEL=calibrate -e RESULTS_DIR=results hold.js
python3 <skill>/scripts/compare_profile.py loadtest/profile.json loadtest/results/calibrate-*.json
compare_profile.py compares the measured per-VU request rate and endpoint shares with the profile. Aim for r within ±15 % and each major endpoint's share within a few percentage points. If they're off, adjust think times or journey weights and run it again. Add the final table to PROFILE.md. This step is what makes the final user count believable, so don't skip it.
Read references/load-generators.md. In short:
k6 cloud run), and the reference explains the trade-offs.scripts/setup-loadgen.sh (installs k6, raises file and port limits) and scripts/loadgen-monitor.sh (records the generator's own CPU and memory, as evidence that the client wasn't the limit).references/platforms.md has the specifics.Record the VMs, IPs, sizes, regions, costs, and the teardown command in loadtest/INFRA.md.
Get an explicit "go" first, and tell the user what is about to happen (target, peak users, duration, expected peak RPS).
staircase.js adds users in steps and judges each step against the criteria using only the requests from that step. It aborts at the first failing step. Choose START at roughly 20 % of the expected max and STEP at about 10 %. Steps should last ≥ 40 s and contain at least a few thousand requests each, or p99 is noise. Pass the criteria as env vars (P95_MS, P99_MS, MAX_ERROR_RATE).hold.js: 60 s ramp, 5 min hold, 30 s ramp-down) at the staircase estimate, then one step above and one below. Run each level 3 times with a 60 s cooldown and use the median. scripts/run-holds.sh 1500 2000 2500 does exactly that on one generator. The answer is the highest level whose median passes.references/load-generators.md shows how).Stop immediately if errors spike at levels far below the expected capacity (that usually means a firewall, a rate limiter, or broken auth rather than capacity), or if the user asks you to.
If the question is "can it handle N users", skip the staircase: run holds at N and at 1.5 × N.
Write loadtest/REPORT.md using references/report-template.md. Lead with the answer ("3,500 concurrent users pass p95 < 500 ms / p99 < 1 s / errors < 1 %; at 4,000 the p99 climbs to 1.4 s"), then the user profile it rests on, the per-level table (users, RPS, p50, p95, p99, error %, generator CPU, pass/fail), the per-endpoint latency at the highest passing level, what broke first and the evidence for it, caveats (staging vs production differences, warm caches, data size, what wasn't tested), and a conversion to business terms: concurrent users ≈ sessions per hour × average session minutes ÷ 60, so 3,500 concurrent at 6-minute sessions ≈ 35,000 sessions per hour.
Finish by reminding the user to delete the load generators (give the exact command from INFRA.md), remove any firewall allow-list rules, and clean up test data.
references/criteria.md (opens in a new tab)references/k6-journey.md (opens in a new tab)references/load-generators.md (opens in a new tab)references/platforms.md (opens in a new tab)references/profiling.md (opens in a new tab)references/report-template.md (opens in a new tab)scripts/analyze_logs.py (opens in a new tab)scripts/compare_profile.py (opens in a new tab)scripts/har_to_profile.py (opens in a new tab)scripts/loadgen-monitor.sh (opens in a new tab)scripts/run-holds.sh (opens in a new tab)scripts/setup-loadgen.sh (opens in a new tab)templates/hold.js (opens in a new tab)templates/journey.example.js (opens in a new tab)templates/lib.js (opens in a new tab)templates/staircase.js (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub arjaythedev/realistic-load-test --plugin realistic-load-testOther plugins' skills for the same job