/caddis-extras:performance-testingfrom caddis-extras
Performance and load testing for APIs, databases and web apps: budgets, profiling, scalability, with Locust, k6 and pytest-benchmark.
Ships in caddis-extras. 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.
None: SKILL.md is the whole skill.
Measure before you optimise. This skill covers how to define performance budgets, write load tests, benchmark critical paths, and profile bottlenecks.
Trigger conditions:
Define budgets before testing. Every metric needs a target.
# Performance Budget: {Service/Feature}
## Response Time Targets
| Endpoint / Action | p50 | p95 | p99 | Max |
|-------------------|-----|-----|-----|-----|
| GET /api/items | <100ms | <250ms | <500ms | <1s |
| POST /api/orders | <200ms | <500ms | <1s | <2s |
| Dashboard page load | <1.5s | <3s | <5s | <8s |
## Throughput Targets
| Scenario | Target RPS | Concurrent Users |
|----------|-----------|-----------------|
| Normal load | 100 rps | 50 |
| Peak load | 500 rps | 200 |
| Stress test | 1000 rps | 500 |
## Resource Limits
| Resource | Threshold |
|----------|-----------|
| CPU | <70% at normal load |
| Memory | <80% at peak load |
| DB connections | <80% of pool size |
| Error rate | <0.1% at normal load |
from locust import HttpUser, task, between
class APIUser(HttpUser):
wait_time = between(1, 3)
@task(3)
def list_items(self):
self.client.get("/api/items", name="GET /api/items")
@task(1)
def create_item(self):
self.client.post(
"/api/items",
json={"name": "test", "value": 42},
name="POST /api/items",
)
def on_start(self):
"""Authenticate once per simulated user."""
resp = self.client.post("/api/auth/login", json={
"username": "loadtest",
"password": "test-password", # Use env var in real tests
})
self.client.headers["Authorization"] = f"Bearer {resp.json()['token']}"
Run: locust -f load_test.py --host=http://localhost:8000 --users=100 --spawn-rate=10
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
stages: [
{ duration: '1m', target: 50 }, // Ramp up
{ duration: '3m', target: 50 }, // Sustain
{ duration: '1m', target: 200 }, // Peak
{ duration: '2m', target: 200 }, // Sustain peak
{ duration: '1m', target: 0 }, // Ramp down
],
thresholds: {
http_req_duration: ['p(95)<500', 'p(99)<1000'],
http_req_failed: ['rate<0.01'],
},
};
export default function () {
const res = http.get('http://localhost:8000/api/items');
check(res, {
'status is 200': (r) => r.status === 200,
'response time < 500ms': (r) => r.timings.duration < 500,
});
sleep(1);
}
import pytest
def fibonacci(n: int) -> int:
if n <= 1:
return n
a, b = 0, 1
for _ in range(2, n + 1):
a, b = b, a + b
return b
def test_fibonacci_benchmark(benchmark):
result = benchmark(fibonacci, 100)
assert result == 354224848179261915075
Run: pytest --benchmark-only --benchmark-sort=mean
-- Enable actual execution plan + IO statistics
SET STATISTICS IO ON;
SET STATISTICS TIME ON;
-- Run the slow query
SELECT ...
-- Check for table scans, missing indexes
-- Key metrics: logical reads, CPU time, elapsed time
import cProfile
import pstats
def profile_function(func, *args):
"""Profile a function and print top 20 cumulative time entries."""
profiler = cProfile.Profile()
profiler.enable()
result = func(*args)
profiler.disable()
stats = pstats.Stats(profiler)
stats.sort_stats("cumulative")
stats.print_stats(20)
return result
| Metric | Good | Needs Improvement | Poor |
|---|---|---|---|
| LCP (Largest Contentful Paint) | ≤2.5s | ≤4.0s | >4.0s |
| INP (Interaction to Next Paint) | ≤200ms | ≤500ms | >500ms |
| CLS (Cumulative Layout Shift) | ≤0.1 | ≤0.25 | >0.25 |
npx @lhci/cli autorun --collect.url=http://localhost:3000 \
--assert.preset=lighthouse:recommended \
--assert.assertions.categories:performance=error:minScore:0.9
| Type | Purpose | Tool | When |
|---|---|---|---|
| Load test | Validate normal traffic capacity | Locust, k6 | Pre-launch, after scaling changes |
| Stress test | Find breaking point | k6 (ramping) | Capacity planning |
| Soak test | Detect memory leaks, connection exhaustion | Locust (long run) | Before major releases |
| Spike test | Validate autoscaling / recovery | k6 (sudden ramp) | Event-driven apps |
| Benchmark | Compare implementations | pytest-benchmark | During optimisation |
| Profile | Find hotspots | cProfile, py-spy | After identifying slow endpoint |
# Performance Test Report: {Date}
## Test Configuration
- Tool: {Locust/k6}
- Duration: {minutes}
- Peak users: {n}
- Environment: {staging/production-like}
## Results vs Budget
| Metric | Budget | Actual | Status |
|--------|--------|--------|--------|
| p95 response time | <500ms | {n}ms | ✅/❌ |
| Error rate | <0.1% | {n}% | ✅/❌ |
| Throughput | >100 rps | {n} rps | ✅/❌ |
## Bottlenecks Found
1. {description} — {root cause} — {recommendation}
## Recommendations
- {action items}
| Anti-Pattern | Problem | Fix |
|---|---|---|
| Testing against localhost only | Misses network latency, DNS, TLS | Test against staging environment |
| No warm-up phase | Cold caches skew results | Add 1-2 min ramp-up |
| Ignoring error rate | High throughput ≠ success | Always check error rate alongside latency |
| Single-metric focus | p50 looks fine but p99 is 10s | Report p50, p95, p99, and max |
| Testing with empty database | Production has millions of rows | Use production-sized test data |
| No baseline comparison | Can't tell if results are better/worse | Always compare against previous run |
What SKILL.md sets; muted values are Claude Code's defaults
81 skills in this plugin
/adopt-rbacPointer to the org's RBAC adoption skill. Use for "add RBAC to this app" or "adopt rbac-kit"./agent-md-refactorRefactor bloated agent instruction files (AGENTS.md, .cursorrules, .github/ files) into linked, progressively disclosed docs./agent-orchestrationBlueprint for orchestrating the agent pipeline from spec to planning, implementation, testing and debugging, plus when a second model is worth it, the intent→model map and cost guardrails./algorithmic-artGenerative and algorithmic art with p5.js: flow fields, particle systems, animations, WebGL, audio-reactive visuals; exports HTML, PNG, GIF, MP4, SVG. Use for creative coding or any p5.js visual./anchor-reviewSingle-model adversarial review technique — 3-lens analysis with confidence scoring and self-challenge/api-client-patternsTyped client-side API consumption: fetch wrappers, zod validation, auth injection, TanStack Query (useQuery, useMutation, optimistic updates), tRPC, OpenAPI codegen, pagination. Use when consuming REST or tRPC APIs.npx claudepluginhub saajunaid/caddis-plugin --plugin caddis-extras