artillery
When the user wants to perform load testing or performance testing using Artillery with YAML-based scenario definitions. Also use when the user mentions "artillery," "YAML load test," "WebSocket testing," "Socket.io load test," "scenario-based load testing," or "artillery run." For JavaScript-based load testing, see k6.
What this skill does
# Artillery
## Overview
You are an expert in Artillery, the modern load testing toolkit. You help users define test scenarios in YAML, configure phases for ramping traffic, test HTTP APIs and WebSocket/Socket.io services, write custom JavaScript functions for complex flows, and generate HTML reports. You understand Artillery's plugin ecosystem and CI integration.
## Instructions
### Initial Assessment
Before creating a test scenario:
1. **Protocol** — HTTP, WebSocket, Socket.io, or gRPC?
2. **Flow** — Single endpoint or multi-step user journey?
3. **Load profile** — Constant rate, ramp-up, or phased?
4. **Success criteria** — Acceptable latency, error rate?
### Basic HTTP Load Test
```yaml
# load-test.yml — Artillery scenario testing an HTTP API.
# Ramps from 5 to 50 requests per second over 3 phases.
config:
target: "https://api.example.com"
phases:
- duration: 60
arrivalRate: 5
name: "Warm up"
- duration: 120
arrivalRate: 25
name: "Ramp up"
- duration: 60
arrivalRate: 50
name: "Peak load"
defaults:
headers:
Content-Type: "application/json"
scenarios:
- name: "Browse and purchase"
flow:
- get:
url: "/products"
capture:
- json: "$.products[0].id"
as: "productId"
- think: 2
- get:
url: "/products/{{ productId }}"
- think: 1
- post:
url: "/cart"
json:
productId: "{{ productId }}"
quantity: 1
```
### WebSocket Testing
```yaml
# websocket-test.yml — Artillery scenario testing a WebSocket server.
# Connects, sends messages, and validates responses.
config:
target: "wss://ws.example.com"
phases:
- duration: 60
arrivalRate: 10
engines:
ws: {}
scenarios:
- engine: "ws"
flow:
- send:
payload: '{"type": "subscribe", "channel": "updates"}'
- think: 1
- send:
payload: '{"type": "message", "text": "hello"}'
- think: 5
```
### Socket.io Testing
```yaml
# socketio-test.yml — Artillery scenario for Socket.io real-time apps.
# Simulates users joining rooms and exchanging messages.
config:
target: "http://localhost:3000"
phases:
- duration: 60
arrivalRate: 20
engines:
socketio:
transports: ["websocket"]
scenarios:
- engine: "socketio"
flow:
- emit:
channel: "join"
data:
room: "general"
username: "user_{{ $randomNumber(1, 1000) }}"
- think: 2
- emit:
channel: "message"
data:
text: "Hello from Artillery"
- think: 3
```
### Custom JavaScript Functions
```yaml
# custom-flow.yml — Artillery scenario with custom JS processing.
# Uses beforeRequest and afterResponse hooks for dynamic data.
config:
target: "https://api.example.com"
phases:
- duration: 120
arrivalRate: 10
processor: "./helpers.js"
scenarios:
- flow:
- function: "generateUser"
- post:
url: "/users"
json:
name: "{{ name }}"
email: "{{ email }}"
beforeRequest: "addAuthToken"
afterResponse: "logResponse"
```
```javascript
// helpers.js — Custom Artillery processor functions.
// Generates dynamic data and handles auth tokens.
module.exports = {
generateUser(context, events, done) {
context.vars.name = `user_${Date.now()}`;
context.vars.email = `user_${Date.now()}@test.com`;
return done();
},
addAuthToken(req, context, events, done) {
req.headers = req.headers || {};
req.headers['Authorization'] = `Bearer ${context.vars.token || 'test-token'}`;
return done();
},
logResponse(req, res, context, events, done) {
if (res.statusCode !== 200) {
console.log(`Error: ${res.statusCode} on ${req.url}`);
}
return done();
},
};
```
### Running Artillery
```bash
# run-artillery.sh — Common Artillery commands.
# Install, run tests, and generate reports.
# Install
npm install -g artillery
# Run a test
artillery run load-test.yml
# Generate HTML report
artillery run --output results.json load-test.yml
artillery report results.json --output report.html
# Quick test (no YAML needed)
artillery quick --count 100 --num 10 https://api.example.com/health
```
### CI Integration
```yaml
# .github/workflows/artillery.yml — Run Artillery in GitHub Actions.
# Posts HTML report as an artifact.
name: Load Test
on:
push:
branches: [main]
jobs:
artillery:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install -g artillery
- run: artillery run --output results.json tests/load-test.yml
- run: artillery report results.json --output report.html
- uses: actions/upload-artifact@v4
if: always()
with:
name: artillery-report
path: report.html
```
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.