API Test Plan Skill
APIs fail in specific, testable ways: wrong status codes, schema drift, missing auth checks, sloppy validation,
unhelpful errors. This skill plans the tests that catch them — per endpoint, across the response codes and the
error paths, with contract checks so the API keeps its promises to clients. It tests the whole behaviour, not
just the happy 200.
Working from a brief
Given an endpoint or an API description, produce the test plan anyway — infer the likely parameters,
responses, auth model, and error cases, labelling assumptions. Always include auth, validation, and negative
cases. Never hand back a question instead of a plan.
Required Inputs
Ask for these only if they aren't already provided (else infer and label):
- The API — REST/GraphQL, the endpoints/operations, and what they do.
- Contract — request/response schemas, parameters, status codes (or an OpenAPI/spec if available).
- Auth & rules — the auth model (token/scopes/roles), rate limits, and validation rules.
- Dependencies & data — downstream services, and the data/state needed to test.
Output Format
API Test Plan: [API / endpoint]
Per endpoint, a set of cases grouped by type:
| ID |
Endpoint |
Case |
Type |
Request |
Expected status |
Expected body / assertion |
| API-01 |
POST /orders |
valid create |
Functional |
valid payload |
201 |
body matches schema, id returned |
| API-02 |
POST /orders |
missing field |
Validation |
partial payload |
400 |
error names the field |
| API-03 |
POST /orders |
no token |
Auth |
valid payload, no auth |
401 |
not created |
| API-04 |
POST /orders |
wrong role |
Authz |
valid payload, wrong scope |
403 |
not created |
| API-05 |
GET /orders/{id} |
not found |
Negative |
unknown id |
404 |
error body |
Cover deliberately: happy path (correct status + schema), validation (missing/invalid/extra fields, types, boundaries), auth/authz (no token, expired, wrong scope/role), negative (not found, conflict, bad method), idempotency/concurrency where relevant, and errors (correct codes + helpful, consistent error bodies).
Contract checks — responses conform to the schema; required fields, types, and status codes match the spec; backward compatibility for existing clients.
Non-functional notes — rate limiting, pagination, large payloads, latency expectations, and security basics (no sensitive data leakage, proper status for unauthorised).
Setup — test data, environment, and any mocks/stubs for dependencies.
Quality Checks
Anti-Patterns
Based On
API testing practice — contract/schema validation, status-code correctness, auth/authz coverage, and negative/boundary testing beyond the happy path.
1---2name: api-test-plan3description: Plan tests for an API endpoint or service — functional, negative, and contract. Use when asked to test an API, write API test cases, plan REST/GraphQL endpoint testing, or validate an API contract. Produces an API test plan — per-endpoint cases (status codes, schema, auth, validation, errors), boundary/negative cases, contract checks, and non-functional notes — so the API is verified beyond the happy 200.4---5
6# API Test Plan Skill
7
8APIs fail in specific, testable ways: wrong status codes, schema drift, missing auth checks, sloppy validation,
9unhelpful errors. This skill plans the tests that catch them — per endpoint, across the response codes and the
10error paths, with contract checks so the API keeps its promises to clients. It tests the whole behaviour, not
11just the happy `200`.
12
13## Working from a brief
14
15Given an endpoint or an API description, **produce the test plan anyway** — infer the likely parameters,
16responses, auth model, and error cases, labelling assumptions. Always include auth, validation, and negative
17cases. Never hand back a question instead of a plan.
18
19## Required Inputs
20
21Ask for these only if they aren't already provided (else infer and label):
22
23- **The API** — REST/GraphQL, the endpoints/operations, and what they do.
24- **Contract** — request/response schemas, parameters, status codes (or an OpenAPI/spec if available).
25- **Auth & rules** — the auth model (token/scopes/roles), rate limits, and validation rules.
26- **Dependencies & data** — downstream services, and the data/state needed to test.
27
28## Output Format
29
30### API Test Plan: [API / endpoint]
31
32**Per endpoint**, a set of cases grouped by type:
33
34| ID | Endpoint | Case | Type | Request | Expected status | Expected body / assertion |
35|---|---|---|---|---|---|---|
36| API-01 | POST /orders | valid create | Functional | valid payload | 201 | body matches schema, id returned |
37| API-02 | POST /orders | missing field | Validation | partial payload | 400 | error names the field |
38| API-03 | POST /orders | no token | Auth | valid payload, no auth | 401 | not created |
39| API-04 | POST /orders | wrong role | Authz | valid payload, wrong scope | 403 | not created |
40| API-05 | GET /orders/{id} | not found | Negative | unknown id | 404 | error body |
41
42Cover deliberately: **happy path** (correct status + schema), **validation** (missing/invalid/extra fields, types, boundaries), **auth/authz** (no token, expired, wrong scope/role), **negative** (not found, conflict, bad method), **idempotency/concurrency** where relevant, and **errors** (correct codes + helpful, consistent error bodies).
43
44**Contract checks** — responses conform to the schema; required fields, types, and status codes match the spec; backward compatibility for existing clients.
45
46**Non-functional notes** — rate limiting, pagination, large payloads, latency expectations, and security basics (no sensitive data leakage, proper status for unauthorised).
47
48**Setup** — test data, environment, and any mocks/stubs for dependencies.
49
50## Quality Checks
51
52- [ ] Each endpoint is tested beyond 200 — error codes (4xx/5xx) and their bodies are asserted
53- [ ] Auth and authorization cases are included (no token, expired, wrong scope/role)
54- [ ] Validation/boundary/negative cases cover missing, invalid, and extra inputs
55- [ ] Responses are checked against the schema/contract, incl. backward compatibility
56- [ ] Status codes match the spec and are used correctly (e.g. 401 vs. 403, 400 vs. 422)
57- [ ] Non-functional aspects (rate limits, pagination, data leakage) are noted
58
59## Anti-Patterns
60
61- [ ] Do not test only the happy 200 — most API bugs are in validation, auth, and error paths
62- [ ] Do not ignore the response schema — a 200 with the wrong body still breaks clients
63- [ ] Do not skip authz (role/scope) testing — "logged in" isn't "allowed"
64- [ ] Do not assert only status codes — check the body/contract too
65- [ ] Do not overlook error-body quality and correct status semantics (401 vs 403, 400 vs 404)
66
67## Based On
68
69API testing practice — contract/schema validation, status-code correctness, auth/authz coverage, and negative/boundary testing beyond the happy path.