api-tester
RESTやGraphQLのAPIエンドポイントを、ヘッダー、ボディ、認証情報などを設定してGET、POSTなどでテストし、レスポンスを検証してAPIの動作確認やデバッグ、契約検証などを行うSkill。
📜 元の英語説明(参考)
Test REST and GraphQL API endpoints with structured assertions and reporting. Use when a user asks to test an API, hit an endpoint, check if an API works, validate a response, debug an API call, test authentication flows, or verify API contracts. Supports GET, POST, PUT, PATCH, DELETE with headers, body, auth, and response validation.
🇯🇵 日本人クリエイター向け解説
RESTやGraphQLのAPIエンドポイントを、ヘッダー、ボディ、認証情報などを設定してGET、POSTなどでテストし、レスポンスを検証してAPIの動作確認やデバッグ、契約検証などを行うSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o api-tester.zip https://jpskill.com/download/14636.zip && unzip -o api-tester.zip && rm api-tester.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/14636.zip -OutFile "$d\api-tester.zip"; Expand-Archive "$d\api-tester.zip" -DestinationPath $d -Force; ri "$d\api-tester.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
api-tester.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
api-testerフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
API Tester
概要
HTTPリクエストを送信し、レスポンスを検証し、結果を報告することで、APIエンドポイントをテストします。認証、カスタムヘッダー、リクエストボディ、およびステータスコード、ヘッダー、レスポンスペイロードに対する構造化されたアサーションを使用して、RESTおよびGraphQL APIをサポートします。
手順
ユーザーからAPIエンドポイントのテストまたはデバッグを依頼された場合は、次の手順に従ってください。
ステップ 1: エンドポイントの詳細を収集する
ユーザーまたはコードベースから以下を特定します。
- URL: 完全なエンドポイントURL
- Method: GET、POST、PUT、PATCH、DELETE
- Headers: Content-Type、Authorization、カスタムヘッダー
- Body: JSONペイロード、フォームデータ、またはクエリパラメータ
- Auth: Bearer token、API key、ベーシック認証
- Expected response: ステータスコード、レスポンスの形状、特定の値
ステップ 2: リクエストを送信する
curl を使用する (クイックテストに推奨):
# GET request
curl -s -w "\nHTTP Status: %{http_code}\nTime: %{time_total}s\n" \
-H "Authorization: Bearer $TOKEN" \
"https://api.example.com/users?page=1"
# POST request with JSON
curl -s -w "\nHTTP Status: %{http_code}\nTime: %{time_total}s\n" \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{"name": "Jane", "email": "jane@example.com"}' \
"https://api.example.com/users"
Python を使用する (複雑なフローの場合):
import requests
import json
import time
def test_endpoint(method, url, headers=None, body=None, expected_status=200):
start = time.time()
response = requests.request(method, url, headers=headers, json=body, timeout=30)
elapsed = time.time() - start
result = {
"status": response.status_code,
"time_ms": round(elapsed * 1000),
"headers": dict(response.headers),
"body": response.json() if response.headers.get("content-type", "").startswith("application/json") else response.text,
}
passed = response.status_code == expected_status
print(f"{'PASS' if passed else 'FAIL'} | {method} {url} | {response.status_code} | {result['time_ms']}ms")
return result, passed
ステップ 3: レスポンスを検証する
次の順序で確認します。
- Status code が期待値と一致する (200, 201, 204, 400, 401, 404 など)
- Response time が許容範囲内である (2 秒を超える場合はフラグを立てる)
- Content-Type ヘッダーが期待される形式と一致する
- Response body の構造が期待されるスキーマと一致する
- Specific values がアサーションと一致する
def validate_response(result, assertions):
failures = []
body = result["body"]
for field, expected in assertions.items():
actual = body
for key in field.split("."):
if isinstance(actual, dict):
actual = actual.get(key)
elif isinstance(actual, list) and key.isdigit():
actual = actual[int(key)]
else:
actual = None
break
if actual != expected:
failures.append(f" {field}: expected {expected!r}, got {actual!r}")
return failures
ステップ 4: 結果を報告する
明確なテストレポートとしてフォーマットします。
API Test Results
================
Endpoint: POST /api/users
Status: 201 Created (expected 201) -- PASS
Time: 142ms
Body: Valid JSON, 3 fields
Assertions:
[PASS] body.id is present
[PASS] body.name == "Jane"
[PASS] body.email == "jane@example.com"
[FAIL] body.role expected "admin", got "user"
Result: 3/4 assertions passed
例
例 1: CRUD フローをテストする
ユーザーリクエスト: "users API をテストしてください -- 作成、読み取り、更新、削除"
出力:
API Test Suite: Users CRUD
==========================
1. POST /api/users
Status: 201 Created -- PASS
Time: 156ms
Body: {"id": 42, "name": "Test User", "email": "test@example.com"}
2. GET /api/users/42
Status: 200 OK -- PASS
Time: 38ms
Body: {"id": 42, "name": "Test User", "email": "test@example.com"}
3. PUT /api/users/42
Status: 200 OK -- PASS
Time: 89ms
Body: {"id": 42, "name": "Updated Name", "email": "test@example.com"}
4. DELETE /api/users/42
Status: 204 No Content -- PASS
Time: 45ms
5. GET /api/users/42 (verify deletion)
Status: 404 Not Found -- PASS
Time: 22ms
Result: 5/5 PASSED
例 2: 失敗するリクエストをデバッグする
ユーザーリクエスト: "POST /api/orders で 401 が返ってきます。原因を調べていただけますか?"
出力:
Debugging POST /api/orders
===========================
Test 1: No auth header
Status: 401 -- Missing Authorization header (expected)
Test 2: With Bearer token
Status: 401 -- Response: {"error": "Token expired"}
Note: Token exp claim is 2024-01-15T00:00:00Z (expired)
Test 3: With refreshed token
Status: 201 Created -- PASS
Root cause: Your Bearer token has expired.
Fix: Refresh the token using POST /api/auth/refresh
ガイドライン
- ユーザーが明示的に確認しない限り、本番環境のAPIにリクエストを送信しないでください。最初に確認してください。
- 出力では、機密性の高い値(トークン、パスワード、APIキー)をマスクします。最後の4文字のみを表示します。
- 依存するリクエストのシーケンス(作成してから読み取る)の場合、最初のリクエストからのレスポンスを使用して2番目のリクエストを構築します。
- レポートにはレスポンス時間を含めます。2秒を超えるレスポンスには遅いというフラグを立てます。
- 認証フローをテストするときは、正常なパスと一般的な失敗モード(期限切れのトークン、間違った資格情報、不足している権限)の両方をテストします。
- GraphQL の場合、JSONボディにクエリを含めて POST を使用し、
dataフィールドをerrorsとは別に検証します。 - エンドポイントがページネーションを返す場合は、最初のページをテストし、合計数を記述します。
- 応答のないエンドポイントでハングアップしないように、常にタイムアウト(30秒)を設定してください。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
API Tester
Overview
Test API endpoints by sending HTTP requests, validating responses, and reporting results. Supports REST and GraphQL APIs with authentication, custom headers, request bodies, and structured assertions on status codes, headers, and response payloads.
Instructions
When a user asks you to test or debug an API endpoint, follow these steps:
Step 1: Gather endpoint details
Determine from the user or codebase:
- URL: The full endpoint URL
- Method: GET, POST, PUT, PATCH, DELETE
- Headers: Content-Type, Authorization, custom headers
- Body: JSON payload, form data, or query parameters
- Auth: Bearer token, API key, basic auth
- Expected response: Status code, response shape, specific values
Step 2: Send the request
Using curl (preferred for quick tests):
# GET request
curl -s -w "\nHTTP Status: %{http_code}\nTime: %{time_total}s\n" \
-H "Authorization: Bearer $TOKEN" \
"https://api.example.com/users?page=1"
# POST request with JSON
curl -s -w "\nHTTP Status: %{http_code}\nTime: %{time_total}s\n" \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{"name": "Jane", "email": "jane@example.com"}' \
"https://api.example.com/users"
Using Python (for complex flows):
import requests
import json
import time
def test_endpoint(method, url, headers=None, body=None, expected_status=200):
start = time.time()
response = requests.request(method, url, headers=headers, json=body, timeout=30)
elapsed = time.time() - start
result = {
"status": response.status_code,
"time_ms": round(elapsed * 1000),
"headers": dict(response.headers),
"body": response.json() if response.headers.get("content-type", "").startswith("application/json") else response.text,
}
passed = response.status_code == expected_status
print(f"{'PASS' if passed else 'FAIL'} | {method} {url} | {response.status_code} | {result['time_ms']}ms")
return result, passed
Step 3: Validate the response
Check these in order:
- Status code matches expected (200, 201, 204, 400, 401, 404, etc.)
- Response time is acceptable (flag if > 2 seconds)
- Content-Type header matches expected format
- Response body structure matches expected schema
- Specific values match assertions
def validate_response(result, assertions):
failures = []
body = result["body"]
for field, expected in assertions.items():
actual = body
for key in field.split("."):
if isinstance(actual, dict):
actual = actual.get(key)
elif isinstance(actual, list) and key.isdigit():
actual = actual[int(key)]
else:
actual = None
break
if actual != expected:
failures.append(f" {field}: expected {expected!r}, got {actual!r}")
return failures
Step 4: Report results
Format as a clear test report:
API Test Results
================
Endpoint: POST /api/users
Status: 201 Created (expected 201) -- PASS
Time: 142ms
Body: Valid JSON, 3 fields
Assertions:
[PASS] body.id is present
[PASS] body.name == "Jane"
[PASS] body.email == "jane@example.com"
[FAIL] body.role expected "admin", got "user"
Result: 3/4 assertions passed
Examples
Example 1: Test a CRUD flow
User request: "Test the users API -- create, read, update, delete"
Output:
API Test Suite: Users CRUD
==========================
1. POST /api/users
Status: 201 Created -- PASS
Time: 156ms
Body: {"id": 42, "name": "Test User", "email": "test@example.com"}
2. GET /api/users/42
Status: 200 OK -- PASS
Time: 38ms
Body: {"id": 42, "name": "Test User", "email": "test@example.com"}
3. PUT /api/users/42
Status: 200 OK -- PASS
Time: 89ms
Body: {"id": 42, "name": "Updated Name", "email": "test@example.com"}
4. DELETE /api/users/42
Status: 204 No Content -- PASS
Time: 45ms
5. GET /api/users/42 (verify deletion)
Status: 404 Not Found -- PASS
Time: 22ms
Result: 5/5 PASSED
Example 2: Debug a failing request
User request: "I'm getting a 401 on POST /api/orders, can you figure out why?"
Output:
Debugging POST /api/orders
===========================
Test 1: No auth header
Status: 401 -- Missing Authorization header (expected)
Test 2: With Bearer token
Status: 401 -- Response: {"error": "Token expired"}
Note: Token exp claim is 2024-01-15T00:00:00Z (expired)
Test 3: With refreshed token
Status: 201 Created -- PASS
Root cause: Your Bearer token has expired.
Fix: Refresh the token using POST /api/auth/refresh
Guidelines
- Never send requests to production APIs unless the user explicitly confirms. Ask first.
- Mask sensitive values (tokens, passwords, API keys) in output. Show only the last 4 characters.
- For sequences of dependent requests (create then read), use the response from the first request to build the second.
- Include response time in reports. Flag responses over 2 seconds as slow.
- When testing auth flows, test both the happy path and common failure modes (expired token, wrong credentials, missing permissions).
- For GraphQL, use POST with the query in the JSON body and validate the
datafield separately fromerrors. - If an endpoint returns pagination, test the first page and mention the total count.
- Always set a timeout (30 seconds) to avoid hanging on unresponsive endpoints.