
api-testing
Skill that gives Claude Code expert guidance for testing REST and GraphQL APIs across TypeScript and Python.
- version
- 3.12.0
- GitHub stars
- 250
What it does
- Adds an
api-testingskill covering Supertest for TypeScript and httpx, pytest, and FastAPI TestClient for Python - Covers request methods, headers, query parameters, file uploads, and Bearer or cookie authentication flows
- Verifies 4xx and 5xx error handling along with request and response schema validation
- Activates on phrases like "API testing," "GraphQL testing," and "supertest" for projects that need HTTP-level tests
HTTP API testing for TypeScript (Supertest) and Python (httpx, pytest). Test REST APIs, GraphQL, request/response validation, authentication, and error handling.
Add marketplace
/plugin marketplace add secondsky/claude-skillsRun it inside Claude Code once, then install the plugin below.
Install
/plugin install api-testing@claude-skillsRun it inside Claude Code after adding the marketplace.
Files
Discovered from sourceAPI Testing
Expert knowledge for testing HTTP APIs with Supertest (TypeScript/JavaScript) and httpx/pytest (Python).
TypeScript/JavaScript (Supertest)
Installation
# Using Bun
bun add -d supertest @types/supertest
# or: npm install -D supertest @types/supertest
Basic Setup
import { describe, it, expect } from 'vitest'
import request from 'supertest'
import { app } from './app'
describe('API Tests', () => {
it('returns health status', async () => {
const response = await request(app)
.get('/api/health')
.expect(200)
expect(response.body).toEqual({ status: 'ok' })
})
it('creates a user', async () => {
const response = await request(app)
.post('/api/users')
.send({ name: 'John Doe', email: 'john@example.com' })
.expect(201)
expect(response.body).toMatchObject({
id: expect.any(Number),
name: 'John Doe',
})
})
it('validates required fields', async () => {
await request(app)
.post('/api/users')
.send({ name: 'John Doe' })
.expect(400)
})
})
Request Methods
// GET
await request(app).get('/api/users').expect(200)
// POST with body
await request(app)
.post('/api/users')
.send({ name: 'John' })
.expect(201)
// PUT
await request(app)
.put('/api/users/1')
.send({ name: 'Jane' })
.expect(200)
// DELETE
await request(app).delete('/api/users/1').expect(204)
Headers and Query Parameters
// Set headers
await request(app)
.get('/api/protected')
.set('Authorization', 'Bearer token123')
.expect(200)
// Query parameters
await request(app)
.get('/api/users')
.query({ page: 1, limit: 10 })
.expect(200)
Authentication Testing
describe('Authentication', () => {
let authToken: string
beforeAll(async () => {
const response = await request(app)
.post('/api/auth/login')
.send({ email: 'user@example.com', password: 'password123' })
.expect(200)
authToken = response.body.token
})
it('accesses protected endpoint', async () => {
await request(app)
.get('/api/protected')
.set('Authorization', `Bearer ${authToken}`)
.expect(200)
})
it('rejects without token', async () => {
await request(app).get('/api/protected').expect(401)
})
})
Error Handling
it('handles validation errors', async () => {
const response = await request(app)
.post('/api/users')
.send({ email: 'invalid-email' })
.expect(400)
expect(response.body).toMatchObject({
error: 'Validation failed',
details: expect.any(Array),
})
})
it('handles not found', async () => {
await request(app).get('/api/users/999999').expect(404)
})
Python (httpx + pytest)
Installation
uv add --dev httpx pytest-asyncio
Basic Setup
import pytest
from fastapi.testclient import TestClient
from main import app
client = TestClient(app)
def test_health_check():
response = client.get("/api/health")
assert response.status_code == 200
assert response.json() == {"status": "ok"}
def test_create_user():
response = client.post(
"/api/users",
json={"name": "John Doe", "email": "john@example.com"}
)
assert response.status_code == 201
data = response.json()
assert data["name"] == "John Doe"
assert "id" in data
def test_not_found():
response = client.get("/api/users/999")
assert response.status_code == 404
Fixtures
@pytest.fixture
def auth_token(client):
response = client.post(
"/api/auth/login",
json={"email": "user@example.com", "password": "password123"}
)
return response.json()["token"]
def test_protected_endpoint(client, auth_token):
response = client.get(
"/api/protected",
headers={"Authorization": f"Bearer {auth_token}"}
)
assert response.status_code == 200
File Upload
def test_file_upload(client, tmp_path):
test_file = tmp_path / "test.txt"
test_file.write_text("test content")
with open(test_file, "rb") as f:
response = client.post(
"/api/upload",
files={"file": ("test.txt", f, "text/plain")}
)
assert response.status_code == 200
GraphQL Testing
it('queries GraphQL endpoint', async () => {
const query = `
query GetUser($id: ID!) {
user(id: $id) { id name email }
}
`
const response = await request(app)
.post('/graphql')
.send({ query, variables: { id: '1' } })
.expect(200)
expect(response.body.data.user).toMatchObject({
id: '1',
name: expect.any(String),
})
})
Performance Testing
it('responds within acceptable time', async () => {
const start = Date.now()
await request(app).get('/api/users').expect(200)
const duration = Date.now() - start
expect(duration).toBeLessThan(100) // 100ms threshold
})
Best Practices
- Group related endpoints in
describeblocks - Reset database between tests
- Validate status codes first
- Check response structure
- Test error message format
- Mock external services
- Test both happy path and error cases
See Also
vitest-testing- Unit testing frameworkplaywright-testing- E2E API testingtest-quality-analysis- Test quality patterns
Readme
API Testing Skill
HTTP API testing for TypeScript (Supertest) and Python (httpx, pytest).
Overview
Expert knowledge for testing REST APIs and GraphQL endpoints including request/response validation, authentication, error handling, and schema validation.
Supported Tools
- Supertest (TypeScript/JavaScript + Express/Fastify)
- httpx (Python)
- pytest (Python fixtures)
- FastAPI TestClient (Python)
When to Use
- Testing REST API endpoints
- Testing GraphQL APIs
- Authentication flow testing
- Request/response validation
- Error handling verification
- Performance assertions
Key Patterns
- Request methods (GET, POST, PUT, DELETE)
- Headers and query parameters
- Authentication (Bearer tokens, cookies)
- File uploads
- Error handling (4xx/5xx)
- Schema validation
Quick Start
# TypeScript (Supertest)
bun add -d supertest @types/supertest
# Python (httpx)
uv add --dev httpx pytest-asyncio
Auto-Trigger Keywords
- API testing
- REST API tests
- GraphQL testing
- supertest
- httpx testing
- request validation
- response validation
Source
Adapted from laurigates/dotfiles
Details
- Marketplace
- secondsky/claude-skills
- Source
- plugins/api-testing
- Category
- Api
- Keywords
- api-testing, api, testing, rest, graphql, endpoints, http, authentication, validation
- Listed since
- Apr 7, 2026
More from secondsky/claude-skills
All 122- api-versioning-strategyv3.12.0
- app-store-deploymentv3.12.0
- architecture-patternsv3.12.0
- auto-animatev3.12.0
- base-ui-reactv3.12.0
- bunv3.12.0
- claude-code-bash-patternsv3.12.0
- claude-hook-writerv3.12.0
- clefcut-cloudflare-remotion-videov3.12.0
- clefcut-cloudflare-videov3.12.0
- code-reviewv3.12.0
- csrf-protectionv3.12.0
- cybersecurityv3.12.0
- defense-in-depth-validationv3.12.0
- delegate-my-workv3.12.0
- dependency-upgradev3.12.0
- design-reviewv3.12.0
- design-system-creationv3.12.0
- drizzle-orm-d1v3.12.0
- feature-devv3.12.0
- frontend-designv3.12.0
- gemini-cliv3.12.0
- github-project-automationv3.12.0
- graphql-implementationv3.12.0
Similar to api-testing
More Testing & QA
api-testingSkillsecondsky/claude-skills917 installsHTTP API testing guide for Supertest and httpx/pytest covering REST, GraphQL, auth, and error handling.
api-design-principlesPluginsecondsky/claude-skills250 starsMaster REST and GraphQL API design principles to build intuitive, scalable, and maintainable APIs that delight developers. Use when designing new APIs, reviewin
api-pluginPluginlaurigates/claude-plugins60 starsAPI integration and testing - REST endpoints, client generation
contract-testerPluginrohitg00/awesome-claude-code-toolkit2.8K starsAPI contract testing with Pact for microservice compatibility
api-scaffoldingPluginHermeticOrmus/LibreUIUX-Claude-Code126 starsREST and GraphQL API scaffolding, framework selection, backend architecture, and API generation
api-patternsSkillvudovn/ag-kit131 installsAPI design principles and decision-making covering REST, GraphQL, and tRPC selection, responses, and security.