pytest-api

pytest-api is a skill for Claude Code from aks-builds/quality-skills. It costs 114 tokens per session (2,668 once invoked), scanned A, original, MIT.

A guide to testing Python web APIs with pytest and HTTP clients such as requests or httpx. An API is a program interface that lets software exchange requests and data.

In plain words
What is it for?
Use it to design, debug, or expand tests for REST and JSON-RPC APIs, including authentication, asynchronous endpoints, mocked responses, fixtures, and OpenAPI-based checks.
Why use it?
It helps you create tests that check API behavior reliably without making the test code difficult to maintain or accidentally depending on external services.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the quality-skills plugin — 57 skills shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/aks-builds/quality-skills/pytest-api
Any agent
npx skills add aks-builds/quality-skills --skill pytest-api
Clone the repo
git clone --depth 1 https://github.com/aks-builds/quality-skills

Made for: Claude Code.

Or install quality-skills, the plugin that ships this one along with the rest of its 57 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pytest-api

README.md
[![agentmods](https://agentmods.dev/badge/skills/aks-builds/quality-skills/pytest-api.svg)](https://agentmods.dev/skills/aks-builds/quality-skills/pytest-api)
Your own site
<a href="https://agentmods.dev/skills/aks-builds/quality-skills/pytest-api"><img src="https://agentmods.dev/badge/skills/aks-builds/quality-skills/pytest-api.svg" alt="Measured on agentmods" height="20"></a>
Per session 114 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,668 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00114 $0.02668
Opus 5 $0.00057 $0.01334
Sonnet 5 $0.00023 $0.00534
Haiku 4.5 $0.00011 $0.00267

Measured 5d ago against content hash 98a1eb228c23, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

pytest-api scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

resp = requests.post(
skills/pytest-api/SKILL.md · 304 lines

How it starts

The opening of the file, as written. The whole thing — 304 lines — stays where its author put it; the contents beside it link to each section on GitHub.

pytest API Testing

You are an expert in API testing with Python + pytest + requests / httpx. Your goal is to help engineers write maintainable, fast pytest suites for REST (and JSON-RPC, gRPC-over-REST gateways, etc.) — without fabricating fixture signatures, library APIs, or pytest plugin names. When uncertain, point the reader to docs.pytest.org, docs.python-requests.org, or python-httpx.org.

Initial Assessment

Check .agents/qa-context.md (fallback: .claude/qa-context.md) before answering. Pay attention to:

  • HTTP clientrequests (sync, by far the most common), httpx (sync + async), or the framework's test client (e.g., FastAPI's TestClient, Django's Client).
  • Sync vs async — if the system under test is async (FastAPI / Starlette / aiohttp), httpx.AsyncClient is the natural fit.
  • Pytest plugins in usepytest-xdist (parallel), pytest-asyncio (async), pytest-httpx / responses (mocking), pytest-vcr (cassettes), schemathesis (property-based / OpenAPI-driven).
  • Auth model — Bearer / Basic / OAuth / cookies / mTLS. Affects fixture design.
  • Target environment — local in-process (TestClient), local server (compose), or remote (staging URL).

If the file does not exist, ask: HTTP client choice, sync or async, in-process or against a server, target framework, and any pytest plugins already standardized.


Why pytest + requests/httpx

  • First-class fixtures — declarative, scoped, composable. Setup once, reuse everywhere.
  • Parametrization — boundary cases and data-driven tests are trivial (@pytest.mark.parametrize).
  • Parallel executionpytest-xdist for free CPU scaling.
  • Rich ecosystem — assertion plugins, reporters, OpenAPI integration, property-based testing via hypothesis/schemathesis.
  • Pythonic — refactors, types (with mypy), IDE support all work.

When not to use pytest:

  • Non-Python stack with no Python expertise → use the language-native option.
  • Pure Postman/QA-led workflows → postman-newman.

Read the full file on GitHub · 304 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 304 lines · 114 tokens per session scan A 98a1eb228c23

Subscribe to this mod's changes

pytest-api is a skill published in the GitHub repository aks-builds/quality-skills (2 stars, last pushed 2d ago), licensed MIT. It adds 114 tokens to every session and 2,668 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

defect-analyzer

Use when someone asks to analyze a defect report, analyze bug data, perform defect metrics analysis, review a defect log, or upload a defect file for quality insights.

ukkuru/testmetry-skills · 38 tokens

test-case-writer

Use when someone asks to generate test cases, write test cases from a user story, create test cases from a BRD, design test cases from a mockup or wireframe, or produce a test case table from requirements.

ukkuru/testmetry-skills · 50 tokens

automated-e2e-testing

将手动测试用例转为 Playwright E2E 测试并执行时使用;含写自动化前的业务熟悉踩点、Page Object/Helper 编写、执行中的 Bug 证据收集与报告条目记录。不用于:纯 API 接口测试(api-testing)、以理解系统为目的的独立探索会话(exploratory-testing)、已确认 Bug 的根因分析(bug-analysis)。.

fishzjp/qa-skills · 100 tokens

api-testing

接口级测试时使用——从 OpenAPI/Swagger 文档或用例 Schema 中可自动化的接口用例出发,覆盖参数、边界、鉴权、幂等、并发、错误响应与数据一致性,产出可执行的 API 测试脚本与运行结果;含接口压测承接(k6,类型矩阵轴 1 执行层)。不用于:Web UI 流程(automated-e2e-testing)、手动用例编写(test-case-writing)。.

fishzjp/qa-skills · 117 tokens

test-strategy

回答"这个功能应该怎么测"——把风险翻译成两域测试范围与深度。策略位于"需求 → 风险分析 → 策略 → 测试设计 → 用例"链路中,跳过策略直接写用例是本框架明确反对的。.

fishzjp/qa-skills · 103 tokens

regression-testing

代码变更(diff/Bug 修复/需求变更)后判断应回归哪些测试时使用——沿"改动文件 → 改动函数 → 受影响功能 → 受影响用例"分析链,基于用例 Schema 的追溯映射产出分级回归清单。不用于:用例文件本身的增量修改(test-case-writing)、长期回归策略(test-strategy)。.

fishzjp/qa-skills · 98 tokens