← ClaudeAtlas

write-api-testlisted

Use when adding a Playwright test that exercises an HTTP endpoint directly with no browser — REST or GraphQL — including response-shape validation, error paths, and cleanup after writes. Reads conventions from .claude/test-profile.md and mirrors the existing request specs. Not for tests that drive a page.
AndreiBanu1/playwright-suite-skills · ★ 1 · Testing & QA · score 72
Install: claude install-skill AndreiBanu1/playwright-suite-skills
# Skill: write-api-test Add one request-level spec: no browser, no DOM, just a call and what came back. These tests are cheap and fast, which makes them the ones most often written carelessly. The two failure modes to avoid are asserting so little that the test cannot fail (`status < 500`, `toBeTruthy()`) and asserting so much that every unrelated field change turns it red. ## Preconditions 1. `.claude/test-profile.md` exists and lists a `request` group. If not, run **probe-conventions** first. 2. You know the endpoint, the method, and what the call is supposed to prove. If the ask is "add tests for the orders API", use **clarify-scope** — that is a backlog, not a test. ## Procedure ### 1. Read two existing request specs Record: the verbatim import line, how the call is made (a shared client, a domain-specific client, the raw request context), how credentials are obtained, how the response is unwrapped, and whether response shape is validated against a schema or asserted field by field. Copy all of it. ### 2. Route the call the way the repo routes calls If the profile names an endpoint-client layer, use it. If the endpoint has no client method yet, add one with **write-api-client** rather than reaching around the layer — one spec bypassing the client is how the layer stops being true. If the profile says `none`, calls go through whatever the request group already uses, and you leave the architecture alone. ### 3. Write the spec ``` <the profile's verbatim re