jpskill.com
🛠️ 開発・MCP コミュニティ

api-load-tester

APIの負荷テストを、k6、wrk、autocannonなどのツールを使って自動で実行し、OpenAPI仕様などから現実的なテストシナリオを作成、APIの性能限界やボトルネックを効率的に見つけ出すSkill。

📜 元の英語説明(参考)

Generates and executes load test scripts for APIs using k6, wrk, or autocannon. Creates realistic test scenarios from OpenAPI specs, route files, or endpoint descriptions. Use when someone needs to load test, stress test, benchmark, or find the breaking point of their API. Trigger words: load test, stress test, benchmark, RPS, concurrent users, breaking point, performance test, k6, wrk.

🇯🇵 日本人クリエイター向け解説

一言でいうと

APIの負荷テストを、k6、wrk、autocannonなどのツールを使って自動で実行し、OpenAPI仕様などから現実的なテストシナリオを作成、APIの性能限界やボトルネックを効率的に見つけ出すSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o api-load-tester.zip https://jpskill.com/download/14635.zip && unzip -o api-load-tester.zip && rm api-load-tester.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/14635.zip -OutFile "$d\api-load-tester.zip"; Expand-Archive "$d\api-load-tester.zip" -DestinationPath $d -Force; ri "$d\api-load-tester.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して api-load-tester.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → api-load-tester フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

API Load Tester

概要

このスキルは、API定義から現実的なロードテストスクリプトを生成し、適切なランプアップパターン、認証フロー、およびアサーションを用いて実行します。そして、各トラフィックレベルでの限界点、ボトルネック、およびレイテンシのパーセンタイルを特定する明確なレポートを作成します。

手順

ステップ 1: ツールの選択とAPI情報の収集

複雑なシナリオ(複数ステップのフロー、閾値、カスタムメトリクス)には k6 を推奨します。迅速な単一エンドポイントのベンチマークには wrk を使用します。Node.js しか利用できない場合は autocannon を使用します。

以下の情報源からエンドポイント情報を収集します。

  • OpenAPI/Swagger spec ファイル
  • ルート定義 (Express, FastAPI など)
  • ユーザーが記述したエンドポイント

ステップ 2: 現実的なペイロードの生成

コードベース(TypeScript のインターフェース、Python の dataclass、Go の struct)からリクエスト/レスポンスの型を読み取り、以下の要素を含むペイロードを生成します。

  • 現実的なフィールド値 ("test123" や "foo" ではない)
  • 適切なデータ分布 (多様な製品 ID、現実的な数量)
  • エッジケースの混入 (長い文字列、特殊文字を約5%の割合で)

ステップ 3: テストシナリオの設計

目的に合ったシナリオを作成します。

ランプアップテスト (限界点の発見):

stages: [
  { duration: '2m', target: 50 },    // ウォームアップ
  { duration: '5m', target: 200 },   // ランプ
  { duration: '3m', target: 500 },   // プッシュ
  { duration: '2m', target: 500 },   // 維持
  { duration: '2m', target: 0 },     // クールダウン
]

ソークテスト (メモリリーク、接続枯渇の発見):

stages: [
  { duration: '5m', target: 100 },   // ランプ
  { duration: '60m', target: 100 },  // 維持
  { duration: '5m', target: 0 },     // クールダウン
]

スパイクテスト (突然のトラフィックバースト):

stages: [
  { duration: '2m', target: 50 },    // 通常
  { duration: '30s', target: 500 },  // スパイク
  { duration: '5m', target: 500 },   // スパイク維持
  { duration: '30s', target: 50 },   // 減少
]

ステップ 4: 適切なアサーションの追加

常に閾値を追加します。

thresholds: {
  http_req_duration: ['p(95)<800', 'p(99)<2000'],
  http_req_failed: ['rate<0.05'],
  // 必要に応じてエンドポイントごとにカスタム
}

ステップ 5: 実行とレポート

テストを実行し、出力を解析して、以下の情報を示す構造化されたレポートを作成します。

  • ステージごとのレイテンシのパーセンタイル (p50, p95, p99)
  • ステージごとのエラー率
  • 達成された1秒あたりのリクエスト数
  • 限界点 (閾値が最初に違反された場所)
  • エラーパターンに基づいたボトルネックの仮説

例 1: 迅速なエンドポイントベンチマーク

ユーザープロンプト:

100の同時接続を処理する /api/search エンドポイントをベンチマークしてください

エージェントの出力:

# k6 を使用した迅速なベンチマーク
k6 run --vus 100 --duration 60s - <<'EOF'
import http from 'k6/http';
import { check } from 'k6';

export default function () {
  const res = http.get('https://api.example.com/api/search?q=laptop&page=1');
  check(res, { 'status 200': (r) => r.status === 200 });
}
EOF
結果 — /api/search @ 100 VUs for 60s
  リクエスト数:    8,423 total (140.4 RPS)
  レイテンシ:     p50=89ms  p95=340ms  p99=890ms
  エラー数:      12 (0.14%)
  データ量:        24.3 MB received

判定: エンドポイントは 100 VUs で 140 RPS を処理します。p99 が 1s に近づいていることから、
持続的な高負荷のためにはデータベースクエリの最適化が必要です。

例 2: 複数ステップのフロー

ユーザープロンプト:

サインアップ → ログイン → プロジェクト作成フローのロードテストを作成してください

エージェントは以下の要素を含む k6 スクリプトを生成します:

  • ステップ 1: ランダム化されたメール/名前で POST /api/auth/signup
  • ステップ 2: JWT を取得するために POST /api/auth/login
  • ステップ 3: 認証ヘッダーと現実的なプロジェクトデータで POST /api/projects
  • 各ステップのレイテンシを個別に追跡するカスタムメトリクス
  • 実際のユーザーの行動をシミュレートするためにステップ間にスリープを挿入

ガイドライン

  • 明示的な確認なしに本番環境でロードテストを実行しないでください — 常にターゲット環境を明確にしてください
  • 低い負荷から開始し、徐々にランプアップしてください — 突然のジャンプは正確な限界点を特定することを困難にします
  • 現実的なシンク時間 — 実際のユーザーをシミュレートするために、リクエスト間に sleep(1-3) を追加します。これがない場合、ユーザーの同時実行性ではなく、スループットをテストすることになります
  • 認証は重要です — 多くのボトルネックは、実際の認証フロー (トークン検証、セッションルックアップ) でのみ現れます
  • 接続の再利用に注意してください — k6 はデフォルトで接続を再利用しますが、これはブラウザでは現実的ですが、サーバーレス/モバイルクライアントではそうではありません
  • レート制限の認識 — API にレート制限がある場合は、レポートにそれを記載してください。それはパフォーマンスのボトルネックではなく、意図的なものです
  • インフラストラクチャのコンテキストを報告してください — 常にサーバーのスペック、ポッド数、およびデータベースのサイズを結果とともに記載してください
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

API Load Tester

Overview

This skill generates realistic load test scripts from API definitions and executes them with proper ramp-up patterns, authentication flows, and assertions. It produces clear reports identifying breaking points, bottlenecks, and latency percentiles at each traffic level.

Instructions

Step 1: Choose Tool and Gather API Info

Prefer k6 for complex scenarios (multi-step flows, thresholds, custom metrics). Use wrk for quick single-endpoint benchmarks. Use autocannon if only Node.js is available.

Gather endpoint information from:

  • OpenAPI/Swagger spec files
  • Route definitions (Express, FastAPI, etc.)
  • User-described endpoints

Step 2: Generate Realistic Payloads

Read request/response types from the codebase (TypeScript interfaces, Python dataclasses, Go structs) and generate payloads with:

  • Realistic field values (not "test123" or "foo")
  • Proper data distributions (varied product IDs, realistic quantities)
  • Edge cases mixed in (long strings, special characters at ~5% rate)

Step 3: Design Test Scenarios

Create scenarios appropriate for the goal:

Ramp-up test (finding breaking point):

stages: [
  { duration: '2m', target: 50 },    // warm-up
  { duration: '5m', target: 200 },   // ramp
  { duration: '3m', target: 500 },   // push
  { duration: '2m', target: 500 },   // sustain
  { duration: '2m', target: 0 },     // cool-down
]

Soak test (finding memory leaks, connection exhaustion):

stages: [
  { duration: '5m', target: 100 },   // ramp
  { duration: '60m', target: 100 },  // sustain
  { duration: '5m', target: 0 },     // cool-down
]

Spike test (sudden traffic burst):

stages: [
  { duration: '2m', target: 50 },    // normal
  { duration: '30s', target: 500 },  // spike
  { duration: '5m', target: 500 },   // sustain spike
  { duration: '30s', target: 50 },   // drop back
]

Step 4: Include Proper Assertions

Always add thresholds:

thresholds: {
  http_req_duration: ['p(95)<800', 'p(99)<2000'],
  http_req_failed: ['rate<0.05'],
  // Custom per-endpoint if needed
}

Step 5: Execute and Report

Run the test and parse output into a structured report showing:

  • Latency percentiles (p50, p95, p99) per stage
  • Error rate per stage
  • Requests per second achieved
  • Breaking point (where thresholds first violated)
  • Bottleneck hypothesis based on error patterns

Examples

Example 1: Quick Endpoint Benchmark

User prompt:

Benchmark our /api/search endpoint handling 100 concurrent connections

Agent output:

# Quick benchmark with k6
k6 run --vus 100 --duration 60s - <<'EOF'
import http from 'k6/http';
import { check } from 'k6';

export default function () {
  const res = http.get('https://api.example.com/api/search?q=laptop&page=1');
  check(res, { 'status 200': (r) => r.status === 200 });
}
EOF
Results — /api/search @ 100 VUs for 60s
  Requests:    8,423 total (140.4 RPS)
  Latency:     p50=89ms  p95=340ms  p99=890ms
  Errors:      12 (0.14%)
  Data:        24.3 MB received

Verdict: Endpoint handles 140 RPS at 100 VUs. p99 approaching 1s suggests
database query optimization needed for sustained higher load.

Example 2: Multi-Step Flow

User prompt:

Create a load test for our signup → login → create-project flow

Agent generates a k6 script with:

  • Step 1: POST /api/auth/signup with randomized email/name
  • Step 2: POST /api/auth/login to get JWT
  • Step 3: POST /api/projects with auth header and realistic project data
  • Custom metrics tracking each step's latency separately
  • Sleep between steps to simulate real user behavior

Guidelines

  • Never load test production without explicit confirmation — always clarify the target environment
  • Start low, ramp gradually — sudden jumps make it hard to identify the exact breaking point
  • Realistic think time — add sleep(1-3) between requests to simulate real users; without it, you're testing throughput, not user concurrency
  • Authentication matters — many bottlenecks only appear with real auth flows (token validation, session lookups)
  • Watch for connection reuse — k6 reuses connections by default, which is realistic for browsers but not for serverless/mobile clients
  • Rate limit awareness — if the API has rate limiting, note it in the report; it's not a performance bottleneck, it's intentional
  • Report infrastructure context — always note the server specs, pod count, and database size alongside results