Agent skill · Backend & API

api-tester

依据真实 OpenAPI、路由实现和现有测试生成并验证 API 测试。用于用户要求测试接口、补集成测试、验证 API 契约、生成回归用例或排查接口兼容性时;区分“生成测试”和“执行请求”的授权,不猜测状态码、响应结构或 SLA,不在未确认环境中发送写请求。

laolaoshirengithub.com/laolaoshirenGitHub ↗
claude-codeMIT
Install
npx skills add laolaoshiren/claude-code-skills-zh --skill api-tester --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 2 KB
Bundled scripts: none
Path: skills/api-tester/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 725
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# API 测试助手 ## 核心原则 - 只把可核验的 OpenAPI、代码、类型、调用方或现有测试当作契约证据。 - 生成测试不等于执行测试;读取接口定义不等于可以访问真实服务。 - 保护现有数据、凭据和用户修改,优先使用隔离且可清理的测试环境。 ## 工作流程 ### 1. 读取项目与接口证据 先读取适用的仓库规则、测试说明、Git 状态和项目脚本,再按实际存在情况检查: - OpenAPI / Swagger 文件及其引用的 Schema。 - 路由、controller、handler、DTO、验证器和错误处理中间件。 - 客户端类型、调用方、公开文档和现有 API 测试。 - 测试配置、fixture、认证方式、环境变量模板和数据清理机制。 记录规范、实现与现有测试之间的不一致。无法确定哪个行为才是期望契约时,列出证据并请求确认,不用新测试固化猜测。 ### 2. 建立契约矩阵 为目标 endpoint 记录: | 项目 | 证据 | |------|------| | method 与 path | OpenAPI 或路由位置 | | 认证与权限 | security scheme、中间件或调用方 | | 请求参数与约束 | Schema、DTO 或验证器 | | 已声明响应 | 状态码、响应结构与 header | | 副作用与幂等性 | 实现、文档或调用链 | | 测试环境与清理 | fixture、事务或 teardown | 不要默认每个接口都应返回 `400`、`401`、`403`、`404`、`422` 或 `500`。只有契约已声明或代码路径真实可达时才生成对应断言。 ### 3. 明确环境与授权 在执行任何请求前确认: - Base URL、环境归属以及是否为 local、test、staging 或 production。 - 测试账号、权限范围和凭据来源。 - 是否允许执行 POST、PUT、PATCH、DELETE、上传、支付、通知等有副作用操作。 - 测试数据隔离、唯一标识、清理或事务回滚方案。 用户只要求“生成测试”时只产出代码。生产环境、共享 staging、第三方服务及任何可能改变真实数据的执行都必须获得明确授权。GET 也不能仅凭 method 判定无副作用。 ### 4. 选择项目锁定的工具 - 优先运行仓库已有的 test、OpenAPI lint 或 contract test script。 - 读取 package manager、lockfile 和已安装版本后再选择命令。 - 不用裸 `npx`、全局工具或临时下载的最新版解析规范。 - 缺少依赖时先报告;安装工具、更新 lockfile 或修改测试配置需要单独授权。 - 使用真正的 YAML / JSON / OpenAPI 解析器,不用 `gre

What's inside
Steps it walks through
  1. 核心原则
  2. 工作流程
  3. 1. 读取项目与接口证据
  4. 2. 建立契约矩阵
  5. 3. 明确环境与授权
  6. 4. 选择项目锁定的工具
  7. 5. 设计有依据的用例
  8. 6. 实现最小测试
  9. 7. 执行与复验
  10. 安全边界
  11. 输出
More from claude-code-skills-zh
All skills →
About this skill
What does the api-tester skill do?

依据真实 OpenAPI、路由实现和现有测试生成并验证 API 测试。用于用户要求测试接口、补集成测试、验证 API 契约、生成回归用例或排查接口兼容性时;区分“生成测试”和“执行请求”的授权,不猜测状态码、响应结构或 SLA,不在未确认环境中发送写请求。

How do I install it?

Run `npx skills add laolaoshiren/claude-code-skills-zh --skill api-tester --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From laolaoshiren/claude-code-skills-zh, a repository with 725 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going