ai-api-test-skill

A skill that guides Claude Code and Codex through writing and fixing pytest API tests with a real-run verification loop.

  • 172 ★ on the repository
  • Last commit
  • MIT
Skill

Extended access

Why this level

  • Capture uses a mitmproxy proxy with a certificate that decrypts HTTPS on the machine.
  • The agent edits test files and runs `pytest` with real requests to the server.
All reasons and checks

buer2233/ai-api-test-skill

Install

In your terminal, with SkillFoxx CLI

npx skillfoxx add skills/ai-api-test-skill

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Extended accessThe tool runs code or makes network calls and only reads external data.

  • Capture uses a mitmproxy proxy with a certificate that decrypts HTTPS on the machine.
  • The agent edits test files and runs `pytest` with real requests to the server.

This is third-party code. Review the repository files before installing.

What it does

A skill for Python, pytest and requests projects. Before editing, the agent requires a filled template: the API method file and position, the test file and position, the case name. This bounds the area of change. The agent then picks a path: traffic capture through mitmproxy, an existing test as a pattern, a cURL command, a Java controller source or a pytest error. A SQLite index stores API URLs and methods so the agent finds the right function without a mass `grep`. The skill ends by running the target pytest and fixing real errors.

Who it is for. QA engineers on large projects without proper API documentation, where tests are plentiful and request chains are complex.

Good fit when

  • A test for a new endpoint must be added from real UI traffic.
  • A series of similar tests is multiplied from an existing sample with other parameters.
  • A failed `pytest` run is handed to the agent to fix and rerun.
  • You need to find quickly where a method for a given URL is already defined.

Not a fit when

  • The project uses another stack and no template for it is prepared.
  • You need UI tests rather than API tests.
  • Security policy forbids intercepting traffic through a proxy.

Example request

I want to add an automated test for a new API. Ask for the template data and build the test from captured traffic.

Limitations

The author targets Windows 10 and 11 and Python 3.8 or newer; capture launch scripts are `.bat` files. Traffic capture needs `mitmproxy` and its certificate installed, which exposes your HTTPS traffic to decryption on that machine. On first use you fill `config.json` with project paths and method and test directories. The README and docs are in Chinese with a short English version. Examples are built on the author's project and need adapting.

How to disable. Delete the skill folder from the project's `.claude/skills/`, stop capture with `capture/stop.bat` and remove the mitmproxy certificate from the system store.

FAQ

How do I check that the skill triggered?

Write "I want to add an automated API test". If the agent does not return a template with fields for the method file, the test file and the case name, the skill did not load.

Why is the up-front template needed?

It names the files and edit positions, so the agent does not rewrite other tests or duplicate methods that already exist.

How does the SQLite index work?

`python tools/scan_page_api.py --full` collects URLs and methods from the project, then `python tools/scan_page_api.py` extends the database. The agent looks up functions in it.

Which extra skills are recommended?

`/test-fixing` for repairing pytest and `/Debugging` for Python debugging. The `npx skills add` install commands are in the README.

Does the skill suit unittest or httpx?

Output defaults to the `pytest` style. The author suggests adapting `doc/coding_style_guide.md`, templates and gates for `unittest`, `httpx` or `aiohttp`.

Discussion

No questions or reviews yet.

Skills
Russian stack

A skill and tester agent for Claude Code that test the 1C interface through the 1c-testpilot MCP server with evidence

SkillExtended access22Repository stars

A CLI to evaluate and evolve agent skills: declarative YAML cases, runs across engines and structured reports

CLIExtended access1.4KRepository stars

Caliper runs agent tasks with and without your skill, then shows whether the skill helps and how many tokens it costs

CLIExtended access228Repository stars

Swift Testing Agent Skill

swift-testing-agent-skill

A Swift Testing skill from Antoine van der Lee: the new APIs, migration from XCTest, parameterized tests and flat tests. For Claude Code and other agents

SkillMinimal access479Repository stars

A skill helps an agent configure Dev Proxy to test API errors, rate limiting and delayed responses in an application.

SkillExtended access842Repository stars

Seven QA agents and ten skills for test automation: Playwright in TypeScript, Selenium in Java, API, accessibility and ISTQB.

PluginExtended access262Repository stars

README in short

The README covers skill features, environment setup, task forms for new and existing tests and a table of working modes. A detailed manual is in `detailedUserManual.md` and the process diagram in `flow_chart/flow.md`.

README badge

Original SKILL.md

---
name: api-test-E10
description: 当前 test-automation 项目内置的接口自动化编写 skill,物理位置 `.claude/skills/api-test-E10/`。用于在 `\test-automation\E10自动化\接口自动化测试` 中新增、维护、补齐、迁移接口测试方法与 pytest 用例。触发场景包括:新增接口方法、新增接口测试用例、参考 Java Controller 源码或 Jacoco 报告补齐未覆盖接口、维护已有接口方法与用例、补齐参数化、修复接口断言、按指定位置插入代码、按 URL 查重复实现、处理 UTF-8 中文编码、执行 pytest 并根据真实报错循环修复直到通过。运行时产物统一放在项目根 `api_test_dwp_temp/` 目录下。
---

# api-test-E10

随 `test-automation` 项目一起分发的接口自动化编写 skill,把已验证有效的编写习惯、问题处理方式和交付格式沉淀为稳定流程。当前 skill 把“新增”和“维护”拆成两条独立上下文路径,项目根直接由 skill 在 `<project>/.claude/skills/api-test-E10/` 的固定位置推导,运行时产物统一落在项目根的 `api_test_dwp_temp/` 目录下。

## 适用范围

当任务涉及在 `E10自动化/接口自动化测试/` 内**新增或维护**接口测试方法/pytest 用例时,优先使用本 skill。同样适用于按 URL 查重、处理中文编码/导入路径/登录态/返回结构差异、根据真实 pytest 报错循环修复等场景。

## 🚨 前置门禁(按新增 / 维护分流读取)

- AI 必须先识别任务类型:新增接口方法/用例读取 **@doc/preflight_gates_new.md**;维护已有接口方法/用例读取 **@doc/preflight_gates_maintenance.md**
- 若任务类型不明确,先询问“新增还是维护”;确认后再读取对应前置门禁文件并严格执行

## 任务类型分流

任何进入接口自动化编写/维护的任务,AI **必须先确认任务类型**,再进入方式选择:

| 任务类型 | 适用场景 | 读取顺序 |
|---|---|---|
| 新增 | 新接口、新用例、补齐新链路 | 先读 `doc/preflight_gates_new.md`;门禁通过并选定方式后,再读 `doc/coding_style_guide.md` + 对应 `doc/mode_*.md` |
| 维护 | 既有用例修复、接口方法调整、链路回溯、参数/断言更新 | 先读 `doc/preflight_gates_maintenance.md`;门禁通过并选定方式后,再读 `doc/coding_style_guide.md` + `doc/maintenance_prompt_context.md` + 对应 `doc/mode_maintenance_*.md` |

若任务类型未明确,先询问“新增还是维护”;若用户已明确表达“维护 / 修复 / 同步最新链路 / 回归更新”等信号,可直接推断为维护。

## 用例编写/维护方式的执行流程

### 第三方依赖 Skill

维护方式④(pytest 报错驱动)依赖两个外部 Skill:

| 依赖 Skill | 使用时机 |
|---|---|
| `/test-fixing` | 默认优先使用,用于根据 pytest 失败分组、定位根因、做最小补丁并循环验证 |
| `/Debugging` | 仅在 `/test-fixing` 无法解决、维护遇到困难,或前后接口信息/调用栈/返回层级不明确时兜底使用;通过断点、执行堆栈、局部变量、请求 payload、接口响应和方法返回值辅助定位 |

### 强制按需读取门禁

进入任一种方式后,AI **必须先 Read 对应的方案文件**,再继续编写接口方法或用例:

| 方式 | 新增任务 | 维护任务 |

Report a problem

Foxx AIai-api-test-skill
Foxx AI

I am Foxx AI and I have already vetted this tool. Ask about install, setup or anything else, and I will keep it simple.