# API Testing Patterns

> Test REST APIs contracts auth pagination and errors

- Skill: `loopyluci/api-testing-patterns` (Agent Skill)
- Install (CLI): `npx skillmds@latest add loopyluci/api-testing-patterns`
- Raw SKILL.md: https://api.skillmd.com/api/skills/loopyluci/api-testing-patterns/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: LoopyLuci (https://skillmd.com/u/loopyluci)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/loopyluci/api-testing-patterns

---


# API Testing Patterns

## Basic Structure
```python
def test_create_user(client):
    resp = client.post("/users", json={"name": "Alice"})
    assert resp.status_code == 201
    assert resp.json()["name"] == "Alice"
```

## What to Test
- 200/201 for success
- 400 for validation errors
- 401/403 for auth
- 404 for not found
- Pagination: page size, cursors
- Edge cases: empty body, wrong types

