Agent skill

API Testing

by petrkindlmann in petrkindlmann/qa-skills

Test REST and GraphQL APIs with Playwright APIRequestContext, Supertest, or standalone HTTP clients.

MITAuto-check passedTesting & QA

Install API Testing

skills CLI
$ npx skills add petrkindlmann/qa-skills --skill api-testing -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install petrkindlmann/qa-skills api-testing --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/petrkindlmann/qa-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/api-testing .claude/skills/api-testing && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
api-testing
GitHub stars
163
Token cost
~2.7k tokens
SKILL.md length
1,263 words
Files
4 (incl. references)
Skills in repo
45
Repo updated
First seen
Licence
MIT

At a glance

Test REST and GraphQL APIs with Playwright APIRequestContext, Supertest, or standalone HTTP clients.

  • Works in 7 steps: Hardcoded auth tokens → Testing against production → Not validating error responses → …
  • Schema validation
  • SKILL.md covers Discovery Questions, Core Principles, Exploratory vs Automated:… and Playwright API Testing, plus 7 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

API Testing is an agent skill from petrkindlmann/qa-skills. Test REST and GraphQL APIs with Playwright APIRequestContext, Supertest, or standalone HTTP clients. Covers schema validation with Zod 4/AJV, auth flow testing, CRUD lifecycle tests, error and header validation, pagination, and performance assertions. Use when: "API test," "endpoint test," "REST test," "GraphQL test," "schema validation," "Postman replacement." Not for: consumer-driven contract verification (Pact, broker) — use contract-testing; browser UI flows — use playwright-automation. Related…

Its SKILL.md is about 2.7k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/playwright-setup.md`, `references/schema-validation.md` and `references/test-patterns.md`).

It sits in Testing & QA, covering API testing, Forms and validation and GraphQL. It works with Playwright, GraphQL, Zod and Postman. The repository describes itself as: 50 QA and test-automation skills for Claude Code, Codex, Cursor, and any Agent Skills Standard runtime. The licence is MIT.

When your agent uses it

  • Schema validation
  • Postman replacement. Not for: consumer-driven contract verification (Pact
  • Broker) — use contract-testing
  • Browser UI flows — use playwright-automation

Example prompts

  • “API test,”
  • “endpoint test,”
  • “REST test,”
  • “/api-testing”

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. Hardcoded auth tokens
  2. Testing against production
  3. Not validating error responses
  4. Asserting headers only conditionally
  5. No cleanup after test data creation
  6. Treating API tests as unit tests
  7. Ignoring idempotency

What it can do on your machine

Read from SKILL.md and the folder at commit b3bb61b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

API Testing loads about 2.7k tokens when it runs, and up to ~7k if it reads all its reference files. Until then it costs about 150 tokens; SKILL.md has 1,263 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~150
When it runs · the whole SKILL.md, loaded when a task matches
~2.7k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from petrkindlmann/qa-skills at commit b3bb61b, republished under its MIT licence (© petrkindlmann). 1,263 words, ~2,696 tokens.

Download SKILL.mdSave it as .claude/skills/api-testing/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
api-testing
description
Test REST and GraphQL APIs with Playwright APIRequestContext, Supertest, or standalone HTTP clients. Covers schema validation with Zod 4/AJV, auth flow testing, CRUD lifecycle tests, error and header validation, pagination, and performance assertions. Use when: "API test," "endpoint test," "REST test," "GraphQL test," "schema validation," "Postman replacement." Not for: consumer-driven contract verification (Pact, broker) — use contract-testing; browser UI flows — use playwright-automation. Related: contract-testing, test-data-management, ci-cd-integration, playwright-automation.
license
MIT
metadata.author
kindlmann
metadata.version
2.0
metadata.category
automation
<objective>
A response that adds a nullable field or quietly drops one slips past `toHaveProperty` spot-checks and silently breaks the frontend in production. Schema-as-contract tests catch that drift in CI, not prod. This skill produces REST and GraphQL API tests that assert response shape, status codes, headers, auth boundaries, and timing — against a real test environment, not a mocked stand-in.
</objective>

Discovery Questions

Check .agents/qa-project-context.md first — if it exists, use it and skip anything already answered there. Then:

  1. REST, GraphQL, or both? REST-only suites use standard HTTP assertions. GraphQL needs query/mutation builders and benefits from an introspection-diff snapshot.
  2. Auth mechanism? JWT, API key, OAuth 2.0, or session cookies — each needs a different fixture strategy.
  3. OpenAPI/Swagger spec available? If yes, auto-generate Zod schemas as contracts (orval, openapi-zod-client) and consider spec-driven fuzzing with Schemathesis.

Core Principles

  1. Test contracts, not implementations. Assert on response shape, status codes, and headers — not on internal logic or database state.
  2. Schema validation catches drift before it breaks consumers. A failing schema test means you caught a breaking change before your frontend did.
  3. Auth flows are tests too — don't just hardcode tokens. Test login, refresh, expiration, and permission boundaries.
  4. Response time is a testable assertion. Performance regressions caught in CI are cheaper than production incidents.

Exploratory vs Automated: Tooling

API exploration (debugging, manual probing, OpenAPI playground) and automated API testing are different jobs. Use the right tool for each:

ToolBest forWhy
Bruno (v3.4+)File-based collections, git-reviewable workflows, FOSS Postman replacementFilesystem-first, no cloud sync required; gRPC + OAuth + GraphQL query builder
Hurl (8.x)Plain-text HTTP testing, CI smoke checksOne file = many requests + assertions; runs anywhere curl runs; certificate + JSONPath (RFC 9535) queries
HoppscotchWeb-based Postman-style explorationOpen source, runs in browser, good for quick checks
Playwright APIRequestContextAutomated tests in your test runnerThis skill's focus — covered below
Supertest (Node) / httpx (Python)In-process API tests against your own appFastest feedback when you control both sides

Skip Postman/Insomnia for new projects unless your team already has investment there — file-based tools (Bruno, Hurl) are easier to review in PRs and survive when collections drift.

Playwright API Testing

APIRequestContext supports standalone API tests without launching a browser and shares cookie/storage state with browser contexts. Use it for:

  • Standalone API tests — request.get/post/... with status, header, and body assertions.
  • Combined browser + API tests — seed data via API, assert it appears in the UI, then clean up via API.
  • Authenticated fixtures — log in once in a fixture, hand a pre-authenticated APIRequestContext to tests, and dispose it on teardown. Never hardcode tokens.

See references/playwright-setup.md for the playwright.config.ts, standalone tests, combined browser+API test, and the authenticated API fixture.


Schema Validation

Validate response shape against a schema rather than spot-checking individual fields with toHaveProperty. Two common approaches:

  • Zod 4 — define a schema, safeParse the response, and assert result.success. Log result.error.issues on failure for a precise diff. Use the Zod 4 native string formats: z.email(), z.uuid(), z.iso.datetime() — the chained z.string().email() forms are deprecated and slated for removal.
  • AJV with JSON Schema — when you already have JSON Schema (e.g. from an OpenAPI spec), compile and validate with ajv + ajv-formats.

Schema-as-contract: have both the API and the tests import the same schema file. If the response shape changes, consumer tests fail immediately. With an OpenAPI spec, auto-generate the schema (orval or openapi-zod-client). For spec-first teams, add Schemathesis as a CI job to fuzz the live API against the spec and catch undocumented shapes and edge-case 500s.

See references/schema-validation.md for the Zod 4, AJV, schema-as-contract, and Schemathesis implementations.


Test Patterns

Cover each endpoint with a happy-path test plus at least one error-path test. The common patterns:

  • CRUD lifecycle — a describe.serial block that creates, reads, updates, deletes, then verifies the 404. Carries the resource id across steps.
  • Auth flows — login success, invalid credentials (401), expired token (401), token refresh, and permission boundary (403). Treat auth as its own describe block.
  • Error responses — 400 (malformed body), 422 (validation with field details), 429 (rate limit + retry-after). Don't ship happy-path-only suites.
  • Response headers — assert content-type, cache-control, and rate-limit headers directly (not behind a conditional that may never fire). See the pattern below.
  • Pagination — first-page metadata, out-of-bounds empty page, and rejection of invalid page size.
  • File upload/download — multipart upload and content-disposition header verification.
  • GraphQL — a small gql helper, then query / mutation / invalid-query (errors array) cases, plus an introspection-diff snapshot to catch silently-removed fields.
  • Webhooks — spin up a throwaway HTTP server, register a webhook, trigger the event, and assert delivery.

See references/test-patterns.md for the full runnable implementations of every pattern above plus performance assertions.

Show full SKILL.md (506 more words)Show less
Response Headers

Headers carry the contract: cache directives, rate-limit info, content type, CORS policy. Assert them with response.headers() and index by lowercase name; don't gate the assertion behind an if (rateLimited) that may not fire.

typescript
test('GET /api/users sets expected response headers', async ({ request }) => {
  const response = await request.get('/api/users');
  const headers = response.headers();

  expect(headers).toBeDefined();
  expect(headers['content-type']).toContain('application/json');
  expect(headers['cache-control']).toBeDefined();   // "no-store" | "max-age=60" | ...
});

For the rate-limit and retry-after variants, see references/test-patterns.md (Response Header Validation).


Performance Assertions

Response time and payload size are testable assertions — assert that a hot endpoint responds within a budget (e.g. 500ms), that payloads stay under a size ceiling, and that the API survives a burst of concurrent requests without 5xx. See references/test-patterns.md (Performance Assertions section) for the code.


Anti-Patterns

1. Hardcoded auth tokens

Tokens expire, rotate, and differ across environments. Use a login fixture that acquires tokens dynamically.

2. Testing against production

API tests create, modify, and delete data. Run against a dedicated test environment or local instance.

3. Not validating error responses

Happy-path-only suites miss the most common production issues. Test 400, 401, 403, 404, and 500 responses for every endpoint.

4. Asserting headers only conditionally

Headers carry cache directives, rate limit info, content type, and CORS policy. Assert them directly on every relevant response — a check buried inside if (rateLimited) may never run and proves nothing.

5. No cleanup after test data creation

Tests that create resources without deleting them pollute the database. Use afterEach/afterAll hooks or fixture teardown.

6. Treating API tests as unit tests

Don't mock the database — API tests verify the contract from the consumer's perspective. Mock only genuine third parties you don't own (payment gateways, external SaaS).

7. Ignoring idempotency

PUT and DELETE should be idempotent. Test that calling them twice produces the same result.


Done When

  • Every target endpoint has at least a happy-path test and at least one error-path test (4xx or 5xx response validated).
  • Auth flow tested as its own describe block: successful login, invalid credentials, expired token, and permission boundary (403).
  • Schema validation assertions on response shape using Zod 4 or AJV — not just toHaveProperty spot-checks.
  • Header assertions exist for at least content-type and any cache/rate-limit headers the API sets, asserted unconditionally.
  • Contract tests in place for any endpoint consumed by a different team or service (shared schema file; for consumer-driven verification use contract-testing).
  • Genuine third-party calls (payment gateways, external SaaS) are mocked or virtualized; the API and its database run for real.
  • CI job for the suite exits 0 (green) against the test environment.

Reference Files (in references/)

  • playwright-setup.md — playwright.config.ts, standalone API tests, combined browser+API tests, and the authenticated APIRequestContext fixture.
  • schema-validation.md — Zod 4 and AJV/JSON-Schema response validation, the schema-as-contract pattern, and Schemathesis spec-driven fuzzing.
  • test-patterns.md — Runnable CRUD lifecycle, auth flows, error responses, response headers, pagination, file upload/download, GraphQL (+ introspection diff), webhook, and performance tests.
  • contract-testing — Consumer-driven contract verification with Pact/broker; go there when a separate team consumes your API and you need guaranteed compatibility, not just a shared schema.
  • playwright-automation — Browser-based E2E testing, Page Object Model, and combined browser + API patterns.
  • ci-cd-integration — Running API test suites in CI pipelines, parallelization, and environment management.
  • test-strategy — Deciding what to test at the API layer vs. unit vs. E2E.

© petrkindlmann, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in skills/api-testing of petrkindlmann/qa-skills.

  • SKILL.md
  • references/playwright-setup.md
  • references/schema-validation.md
  • references/test-patterns.md

Open the folder on GitHubat commit b3bb61b

Compare with similar skills

API Testing next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

API Testing compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
API Testing this skillpetrkindlmann/qa-skills163—~2.7kAutomated safety check: PassMIT
API Testingfugazi/test-automation-skills-agents247—~1.5kAutomated safety check: PassMIT
Type Safetyidavidov13/agentic-playwright223—~3.5kAutomated safety check: PassMIT
API Testingcosmicstack-labs/mercury-agent-skills476—~449Automated safety check: PassMIT
Playwright E2E Testingfugazi/test-automation-skills-agents247—~3.2kAutomated safety check: PassMIT
API Testingidavidov13/agentic-playwright223—~5.7kAutomated safety check: PassMIT

Similar skills

  • API Testing

    fugazi/test-automation-skills-agents

    Test REST and GraphQL endpoint contracts using Playwright request fixture (TypeScript) or REST Assured (Java).

    247 GitHub stars~1.5k tokensUpdated 4 days ago
    Testing & QAAuto-check passed
  • Type Safety

    idavidov13/agentic-playwright

    TypeScript type safety conventions for the Playwright scaffold — the "no any" rule, Zod 4 schema patterns (z.strictObject, top-level validators like z.uuid / z.email / z.url / z.int / z.enum)…

    223 GitHub stars~3.5k tokensUpdated 6 days ago
    Testing & QAAuto-check passed
  • API Testing

    cosmicstack-labs/mercury-agent-skills

    REST and GraphQL testing, Postman/Insomnia patterns, contract testing, schema validation, and monitoring

    476 GitHub stars~449 tokensUpdated 1 mo ago
    Testing & QAAuto-check passed
  • Playwright E2E Testing

    fugazi/test-automation-skills-agents

    Author and maintain versioned Playwright (@playwright/test) TypeScript UI specs for browser user flows.

    247 GitHub stars~3.2k tokensUpdated 4 days ago
    Testing & QAAuto-check passed
  • API Testing

    idavidov13/agentic-playwright

    API testing patterns for Playwright -- apiRequest fixture usage, Zod response schema creation and validation, test.step wrapping for multi-call tests, per-field negative/validation testing, path…

    223 GitHub stars~5.7k tokensUpdated 6 days ago
    Testing & QAAuto-check passed
  • Common Tasks

    idavidov13/agentic-playwright

    Copy-paste AI prompt templates for common Playwright scaffold development tasks — adding page objects, functional/E2E/API tests, Zod schemas, factories, fixtures, and components.

    223 GitHub stars~2.5k tokensUpdated 6 days ago
    Testing & QAAuto-check passed

More from petrkindlmann/qa-skills

All 45 skills in this repo
  • Accessibility Testing

    petrkindlmann/qa-skills

    Test for WCAG 2.2 AA compliance with axe-core + Playwright, keyboard navigation audits, screen reader testing, ARIA pattern validation, and legal compliance mapping (ADA, EAA, Section 508).

    163 GitHub stars~4.5k tokensUpdated 3 mo ago
    Auto-check passed
  • Agentic Browser Testing

    petrkindlmann/qa-skills

    Goal-driven E2E testing where a browser agent (Playwright MCP / computer-use) reads a natural-language goal and explores the app via the accessibility tree to assert outcomes — no pre-written script.

    163 GitHub stars~4.5k tokensUpdated 3 mo ago
    Auto-check passed
  • AI Test Generation

    petrkindlmann/qa-skills

    Use AI to write NEW test code from specs, PRDs, user stories, code diffs, bug reports, or OpenAPI specs.

    163 GitHub stars~4.8k tokensUpdated 3 mo ago
    Auto-check passed
  • CI CD Integration

    petrkindlmann/qa-skills

    Design CI/CD pipelines that run test suites. An agent skill from petrkindlmann/qa-skills.

    163 GitHub stars~4.8k tokensUpdated 3 mo ago
    Auto-check passed
  • Compliance Testing

    petrkindlmann/qa-skills

    Test for regulatory compliance: GDPR/CMP consent verification, Google Consent Mode v2, Global Privacy Control (GPC), CCPA/US state opt-out, EU AI Act Article 50 transparency, Better Ads Standards…

    163 GitHub stars~4.6k tokensUpdated 3 mo ago
    Auto-check passed
  • Contract Testing

    petrkindlmann/qa-skills

    Implement consumer-driven contract testing with Pact-JS (v16).

    163 GitHub stars~4.1k tokensUpdated 3 mo ago
    Auto-check passed

Questions about API Testing

What does API Testing do?

Test REST and GraphQL APIs with Playwright APIRequestContext, Supertest, or standalone HTTP clients. API Testing is an agent skill from petrkindlmann/qa-skills. Test REST and GraphQL APIs with Playwright APIRequestContext, Supertest, or standalone HTTP clients.

When should I use API Testing?

API Testing fits situations like: schema validation; postman replacement. Not for: consumer-driven contract verification (Pact; broker) — use contract-testing; browser UI flows — use playwright-automation.

How do I install API Testing in Claude Code?

Run `npx skills add petrkindlmann/qa-skills --skill api-testing -a claude-code`. Or copy the skill folder (skills/api-testing in petrkindlmann/qa-skills) into .claude/skills/api-testing in your project. Claude Code loads it when a task matches its description.

How do I install API Testing in Codex?

Run `npx skills add petrkindlmann/qa-skills --skill api-testing -a codex`. Or copy the skill folder (skills/api-testing in petrkindlmann/qa-skills) into .agents/skills/api-testing in your project. Codex loads it when a task matches its description.

Can I use API Testing in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add petrkindlmann/qa-skills --skill api-testing -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/api-testing, .gemini/skills/api-testing, .github/skills/api-testing and .opencode/skills/api-testing in your project.

What does API Testing need to run?

SKILL.md names no scripts, command-line tools or credentials: API Testing is instructions for the agent only.

Does API Testing access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is API Testing safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does API Testing use?

API Testing is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does API Testing use?

About 2.7k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 4.3k tokens, read only when the agent opens those files.

What are the alternatives to API Testing?

Skills that share tags, products or a category with API Testing: API Testing (fugazi/test-automation-skills-agents, 247 stars), Type Safety (idavidov13/agentic-playwright, 223 stars), API Testing (cosmicstack-labs/mercury-agent-skills, 476 stars) and Playwright E2E Testing (fugazi/test-automation-skills-agents, 247 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains API Testing?

petrkindlmann (a GitHub user) maintains it in petrkindlmann/qa-skills, which has 163 GitHub stars. The repository holds 45 skills in this directory. The repository was last updated on June 10, 2026.

Source: petrkindlmann/qa-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.