api-testing

A set of practices and examples for testing backend web APIs. It uses pytest, a Python testing tool, with httpx or FastAPI TestClient to check endpoints, responses, authentication, errors, and external-service mocks.

In plain words
What is it for?
Use it to write unit and integration tests for REST APIs, verify response formats and status codes, test protected routes, and simulate outside services.
Why use it?
It helps catch broken endpoints and incorrect responses before they reach users. It also shows how to test a FastAPI app without running a separate server.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/omnigentx/jarvis/api-testing
Any agent
npx skills add omnigentx/jarvis --skill api-testing
Clone the repo
git clone --depth 1 https://github.com/omnigentx/jarvis

Made for: Claude Code, Codex.

Per session 51 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 907 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00051 $0.00907
Opus 5 $0.00026 $0.00453
Sonnet 5 $0.00010 $0.00181
Haiku 4.5 $0.00005 $0.00091

Measured 2d ago against content hash 61348eb880f5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

api-testing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

backend/.fast-agent/skills/api-testing/SKILL.md · 136 lines

How it starts

The opening of the file, as written. The whole thing — 136 lines — stays where its author put it; the contents beside it link to each section on GitHub.

API Testing

Test backend APIs using pytest + httpx (integration) or FastAPI TestClient (unit). Write tests to /tmp, execute via python.

Decision Tree

API to test → Is it a FastAPI app?
    ├─ Yes → Use TestClient (no server needed)
    │         from fastapi.testclient import TestClient
    │
    └─ No → Use httpx (server must be running)
             import httpx

FastAPI TestClient (Unit Tests)

# /tmp/test_api.py
import pytest
from fastapi.testclient import TestClient
from server import app  # Import your FastAPI app

client = TestClient(app)

def test_health():
    r = client.get("/health")
    assert r.status_code == 200

def test_create_item():
    r = client.post("/items", json={"name": "test", "price": 9.99})
    assert r.status_code == 201
    data = r.json()
    assert data["name"] == "test"
    assert "id" in data

def test_auth_required():
    r = client.get("/protected")
    assert r.status_code == 401

def test_with_auth():
    r = client.get("/protected", headers={"Authorization": "Bearer test-token"})
    assert r.status_code == 200

httpx (Integration Tests)

# /tmp/test_integration.py
import httpx
import pytest

BASE_URL = "http://localhost:8000"  # Adjust to target

def test_endpoint_responds():
    r = httpx.get(f"{BASE_URL}/health")
    assert r.status_code == 200

def test_crud_flow():
    # Create
    r = httpx.post(f"{BASE_URL}/items", json={"name": "test"})
    assert r.status_code == 201
    item_id = r.json()["id"]

    # Read
    r = httpx.get(f"{BASE_URL}/items/{item_id}")
    assert r.status_code == 200

    # Delete
    r = httpx.delete(f"{BASE_URL}/items/{item_id}")
    assert r.status_code == 204

Execution

# Run all tests
cd <project_dir> && python -m pytest /tmp/test_api.py -v

# Run with coverage
cd <project_dir> && python -m pytest /tmp/test_api.py --cov=. --cov-report=term

Testing Patterns

Pattern When Example
Happy path Always first POST /items → 201
Error scenarios Required Invalid input → 422, Not found → 404
Auth flows If protected No token → 401, Bad token → 403
Edge cases Important Empty body, large payload, special chars
Contract validation API changes Verify response schema matches spec

Read the full file on GitHub · 136 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 136 lines · 51 tokens per session scan A 61348eb880f5

Subscribe to this mod's changes

api-testing is a skill published in the GitHub repository omnigentx/jarvis (35 stars, last pushed 6d ago), licensed MIT. It adds 51 tokens to every session and 907 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

agent-host-e2e-tests

Use when writing, recording, updating, or troubleshooting the agent host end-to-end tests under src/vs/platform/agentHost/test/node/e2e (black-box tests that drive the whole agent host over the AHP protocol, using a CapiReplayProxy record/replay system for Claude/Copilot/Codex). Covers adding a cross-provider test…

microsoft/vscode · 104 tokens

use-agent-browser-for-airi

Test AIRI display-model imports with agent-browser across stage-tamagotchi Electron, stage-web, and stage-pocket mobile web layouts. Use when uploading and verifying contributor-supplied Live2D ZIP, VRM, or MMD ZIP/PMX/PMD files through AIRI's model selector, including onboarding bypass, format-specific import…

moeru-ai/airi · 87 tokens

test-conversion

Workflow for converting unit tests to browser tests for Project Bedrock. Invoke this when the user wants to remove complex Browser dependencies from tests.

chromium/chromium · 31 tokens

agui-dotnet-cross-language-tests

Author cross-language interop tests that verify the AG-UI .NET SDK is wire-compatible with the TypeScript SDK — a Vitest TS client driving a C# CrossLanguage.TestServer over HTTP, both directions, including protobuf byte-parity against @ag-ui/proto. USE FOR: adding or modifying cross-language interop coverage…

ag-ui-protocol/ag-ui · 146 tokens

cli-e2e-testcase-writer

Use when adding or updating Go CLI E2E coverage for one tests/clie2e/{domain} domain of the compiled lark-cli, especially when the work requires live --help or schema exploration, scenario-based clie2e.RunCmd workflows, and per-domain coverage.md maintenance.

larksuite/cli · 78 tokens

harness-test-writer

Add regression test cases to the Bifrost provider harness (the Postman collection run via make run-provider-harness-test) based on a merged PR or a GitHub issue. Fetches the PR/issue, traces the affected wire path in the codebase, checks existing harness coverage, designs cases following harness conventions, inserts…

maximhq/bifrost · 133 tokens