api-contract-testing

A way to test HTTP APIs, web services that receive requests and return responses, by checking their status codes, content, headers, timing, and response structure.

In plain words
What is it for?
It helps probe API routes with curl, send JSON requests, measure response time, validate success and error responses, and check conformance with OpenAPI or other expected schemas.
Why use it?
It catches endpoints that return the wrong result or do not follow their documented contract, meaning the agreed request and response format.

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/vladkesler/initrunner/api-contract-testing
Any agent
npx skills add vladkesler/initrunner --skill api-contract-testing
Clone the repo
git clone --depth 1 https://github.com/vladkesler/initrunner

Made for: Claude Code, Codex.

Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,023 The whole file, excluding the scripts and references it only reads on demand.
Security scan D 3 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.00030 $0.01023
Opus 5 $0.00015 $0.00511
Sonnet 5 $0.00006 $0.00205
Haiku 4.5 $0.00003 $0.00102

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

Security

Grade D, and why

api-contract-testing scanned grade D with 3 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.

Sends data to an external URLmediumData exfiltration

A POST to an outside endpoint may be telemetry or may be exfiltration; either way the mod talks to somewhere, and you should know where.

curl -s -X POST -H 'Content-Type: application/json' -d '{"key":"value"}' http://host:port/path

Downloads and executes remote codehighSupply chain

curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.

curl -s http://host:port/path | python -c "

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

bins: [curl]
examples/roles/integration-tester/skills/api-contract-testing/SKILL.md · 147 lines

How it starts

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

API contract testing skill using curl and inline validation scripts.

When to activate

Use this skill when the project has API endpoints: an OpenAPI/Swagger spec, a routes directory, an Express/FastAPI/Flask/Rails app entrypoint, or existing API test files. Also activate when integration tests reference HTTP endpoints or when a new endpoint has been added.

Probing commands

Status code extraction

curl -s -w '\n%{http_code}' http://host:port/path

The last line of output is the HTTP status code. Capture it separately from the response body.

Response body

curl -s http://host:port/path

Use -s (silent) to suppress progress bars.

Timing

curl -s -o /dev/null -w '%{time_total}' http://host:port/path

Record total request time for baseline comparison.

Sending payloads

curl -s -X POST -H 'Content-Type: application/json' -d '{"key":"value"}' http://host:port/path

Always set the Content-Type header explicitly when sending a body.

Status validation

  • 2xx -- expected for healthy endpoints and valid requests
  • 4xx -- expected for bad input, missing auth, or not-found resources; verify that the status matches the specific error condition (400 for malformed input, 401 for missing auth, 403 for forbidden, 404 for unknown resource, 422 for validation failure)
  • 5xx -- indicates a bug or unhandled exception in the service; always flag these as failures unless explicitly expected

Response body checks

Use inline scripts to validate JSON structure:

curl -s http://host:port/path | python -c "
import sys, json
data = json.load(sys.stdin)
assert 'id' in data, 'missing id field'
assert isinstance(data['id'], int), 'id must be integer'
"

Or with Node.js if Python is unavailable:

curl -s http://host:port/path | node -e "
const data = JSON.parse(require('fs').readFileSync(0,'utf8'));
if (!data.id) { console.error('missing id'); process.exit(1); }
"

Check:

  • Required fields exist and are non-null
  • Field types match expectations (string, integer, array, object)
  • Array responses have expected length or are non-empty
  • Nested objects have required sub-fields

Read the full file on GitHub · 147 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 · 147 lines · 30 tokens per session scan D 8c711070d8be

Subscribe to this mod's changes

api-contract-testing is a skill published in the GitHub repository vladkesler/initrunner (41 stars, last pushed 4d ago), licensed Apache-2.0. It adds 30 tokens to every session and 1,023 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it D with 3 findings (sends data to an external url, downloads and executes remote code, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.