From api-first
Use when setting up API tests for a service, adding test coverage for a new endpoint, or diagnosing failures in spec conformance or backward compatibility tests
How this skill is triggered — by the user, by Claude, or both
Slash command
/api-first:api-testingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Four layers (Layer 4 is conditional on the framework) plus a custom agent-friendliness suite. **All applicable layers must pass before merging** — no exceptions for "just this once".
Four layers (Layer 4 is conditional on the framework) plus a custom agent-friendliness suite. All applicable layers must pass before merging — no exceptions for "just this once".
Validates the running application matches the OpenAPI spec: paths, operationIds, response schemas, x-agent-* extensions on every POST, format: date-time on timestamp fields. Catches drift between spec and code without needing a running server.
Run: pytest tests/test_openapi.py -v
Generates valid (and edge-case) requests from the spec and validates responses conform to the spec. Finds edge cases hand-written tests miss. Catches empty-state envelope bugs, missing Retry-After on 429, 409 without conflicting_id.
Run: pytest tests/test_schemathesis.py -v
Requires: running server at http://localhost:8000.
oasdiff comparing the spec on the PR branch against the spec on main. Fails the PR on any breaking change in a stable (v1+) API.
Run in CI:
oasdiff breaking \
<(git show origin/main:api/myservice/v1.yaml) \
api/myservice/v1.yaml
For frameworks that auto-generate an OpenAPI spec at runtime (FastAPI, Flask-RESTX, Django REST Framework, etc.): run oasdiff comparing the runtime-generated spec against the canonical api/{service}/v1.yaml. Catches divergence introduced by code changes that update the generated spec without updating the canonical file.
Run: pytest tests/test_generated_spec.py -v
Skip Layer 4 only if the framework does not generate a spec at runtime. Do not skip it because "FastAPI generates the spec from the code anyway" — the canonical file is still the source of truth.
tests/test_agent_friendliness.py — not covered by schemathesis. Cover behaviours that require stateful or authenticated interaction:
Idempotency-Key twice; expect identical response, not a duplicate resourcecode: TOKEN_EXPIRED. Send a malformed token; expect code: TOKEN_INVALID.items lengths; assert equals total from first responseRetry-After header present with integer value| Bug category | Layer 1 | Layer 2 | Layer 3 | Layer 4 | Custom |
|---|---|---|---|---|---|
| Endpoint missing from code | ✓ | ||||
| Missing operationId | ✓ | ||||
Missing x-agent-* extensions on POST | ✓ | ||||
Timestamp fields missing format: date-time | ✓ | ||||
| Optional response fields absent (null/absent convention) | ✓ | ||||
| Response doesn't match schema | ✓ | ✓ | |||
Empty list returns null or bare array | ✓ | ✓ | |||
| Edge case input handling | ✓ | ||||
| Undocumented error responses | ✓ | ||||
Retry-After header absent on 429 | ✓ | ||||
409 missing conflicting_id | ✓ | ||||
| Breaking spec change vs main | ✓ | ||||
| Code change breaks generated spec vs canonical | ✓ | ||||
| Framework annotation drift | ✓ | ||||
| Idempotency deduplication actually works | ✓ | ||||
TOKEN_EXPIRED vs TOKEN_INVALID distinction | ✓ | ||||
Pagination total matches actual page sum | ✓ |
Not auto-testable — requires human review:
x-agent-retryable annotation matches actual endpoint behaviour (you can test behaviour; you cannot prove the annotation describes it correctly)docs/agent-integration.md intent table is complete and accurate/health from not_a_server_error — correctly returns 503 when dependencies are downmissing_required_headerpositive_data_acceptanceAny other exclusion must have a docstring explaining why. No bare @pytest.mark.skip. No # noqa without a reason.
When writing a new test file:
# noqa or @pytest.mark.skip without a docstringreferences/python-testing.md — full example test files (test_openapi.py, test_schemathesis.py, test_generated_spec.py, test_agent_friendliness.py), pyproject.toml schemathesis config, GitHub Actions CI for all layersapi-first:api-reviewing — testing coverage checklist that reviewers use to verify all layers are presentSearches MemPalace before answering questions about past work, people, projects, or prior decisions. Returns verbatim stored content instead of guessing from model memory.
Guides Payload CMS config (payload.config.ts), collections, fields, hooks, access control, APIs. Debugs validation errors, security, relationships, queries, transactions, hook behavior.
Implements vector databases with Pinecone, Weaviate, Qdrant, Milvus, pgvector for semantic search, RAG, recommendations, and similarity systems. Optimizes embeddings, indexing, and hybrid search.
npx claudepluginhub u-abramchuk/skills --plugin api-first