Set up Artillery load testing for any project. Detects package manager and project type, creates a TypeScript test script (HTTP or Playwright browser), configures Artillery Cloud, and provides the run command. Use when the user wants to add load testing, performance testing, or browser-based load testing to their project.
93
88%
Does it follow best practices?
Impact
96%
1.84xAverage score across 6 eval scenarios
Risky
Do not use without reviewing
You are setting up Artillery (https://artillery.io), a load testing tool, for this project. Follow the steps below. Ask the user questions at each decision point marked with DECISION.
Examine the project to determine:
package-lock.json (npm), pnpm-lock.yaml (pnpm), yarn.lock (yarn), bun.lockb (bun). If none exist, this is a non-JS project — you will use npx.turbo.json, pnpm-workspace.yaml, lerna.json, or workspaces in package.json.playwright.config.ts, tests/, e2e/, or existing load test files.dev commands, API routes, or a deployed URL.DECISION — Ask these questions:
What do you want to test?
What is the target URL? (e.g. http://localhost:3000, https://staging.example.com). If you can infer it from the project config, suggest it.
Do you have an Artillery Cloud account? (free at https://app.artillery.io). If yes, ask for their API key (found in Settings > API Keys).
Based on detected package manager:
| Package manager | Command |
|---|---|
| npm | npm install -D artillery |
| pnpm | pnpm add -D artillery |
| yarn | yarn add -D artillery |
| bun | bun add -D artillery |
| non-JS project | No install. Use npx artillery@latest to run. |
If the user chose (B) Playwright, also install Playwright browsers (the Playwright engine is included in Artillery — no separate package needed):
npx playwright installCreate the test as a TypeScript file. Place it at a sensible location (e.g. load-tests/test.ts, tests/load/test.ts, or alongside existing test files). Use .ts extension always.
import type { Config, Scenario } from "artillery";
export const config: Config = {
target: "TARGET_URL",
phases: [
{
duration: 30, // seconds
arrivalRate: 1, // 1 new virtual users per second
name: "warm_up",
},
],
};
export const scenarios: Scenario[] = [
{
name: "SCENARIO_NAME",
engine: "http",
flow: [
{ get: { url: "/ENDPOINT" } },
],
},
];Adapt this template:
target to the user's URL/ENDPOINT with a real endpoint from the project (prefer GET, read-only)config.http.defaults.headers{ post: { url: "/path", json: { key: "value" } } }import type { Config, Scenario, PlaywrightTestFunction } from "artillery";
export const config: Config = {
target: "TARGET_URL",
phases: [
{
duration: 10,
arrivalCount: 2, // total 2 browser sessions over 10s (safe default)
name: "smoke",
},
],
engines: {
playwright: {},
},
};
export const testFunction: PlaywrightTestFunction = async (page, vuContext, events, test) => {
await test.step("Go to homepage", async () => {
await page.goto("TARGET_URL");
await page.waitForLoadState("networkidle");
});
await test.step("DESCRIBE_ACTION", async () => {
// Add user interaction here:
// await page.click('text=Sign In');
// await page.fill('#email', 'test@example.com');
// await page.waitForURL('**/dashboard');
});
};
export const scenarios: Scenario[] = [
{
name: "SCENARIO_NAME",
engine: "playwright",
testFunction: "testFunction",
},
];Adapt this template:
test.step() to label each logical action — these show up in Artillery CloudIf the user provided an API key, instruct them to set the environment variable:
export ARTILLERY_CLOUD_API_KEY=<their-key>Or they can pass it inline with the run command using --key.
Do NOT run the test. Output the command for the user to run themselves.
Basic run:
npx artillery run ./path/to/test.tsWith Artillery Cloud recording:
npx artillery run --record ./path/to/test.tsWith inline API key:
npx artillery run --record --key <API_KEY> ./path/to/test.tsTell the user:
--record is used, a link to Artillery Cloud dashboard will be printed.phases: [
{ duration: 30, arrivalRate: 5, name: "warm_up" },
{ duration: 60, arrivalRate: 5, rampTo: 50, name: "ramp_up" },
{ duration: 120, arrivalRate: 50, name: "sustained" },
]export const config: Config — target URL, phases, engine config, pluginsexport const scenarios: Scenario[] — array of test scenariosengine: "http", then flow is auto-typed — { get: { url } }, { post: { url, json } }, { put: ... }, { delete: ... }, { log: ... }, { think: ... }, { loop: [...] }engine: "playwright" and testFunction: "functionName", export the functionexport const fn: PlaywrightTestFunction = async (page, vuContext, events, test) => { ... } — all params auto-typedtest.step(name, fn) — labels steps for reportingimport type { Config, Scenario, PlaywrightTestFunction } from "artillery"78a9dbe
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.