依据真实 OpenAPI、路由实现和现有测试生成并验证 API 测试。用于用户要求测试接口、补集成测试、验证 API 契约、生成回归用例或排查接口兼容性时;区分“生成测试”和“执行请求”的授权,不猜测状态码、响应结构或 SLA,不在未确认环境中发送写请求。
npx skills add https://github.com/laolaoshiren/claude-code-skills-zh --skill api-tester
先读取适用的仓库规则、测试说明、Git 状态和项目脚本,再按实际存在情况检查:
记录规范、实现与现有测试之间的不一致。无法确定哪个行为才是期望契约时,列出证据并请求确认,不用新测试固化猜测。
为目标 endpoint 记录:
| 项目 | 证据 |
|------|------|
| method 与 path | OpenAPI 或路由位置 |
| 认证与权限 | security scheme、中间件或调用方 |
| 请求参数与约束 | Schema、DTO 或验证器 |
| 已声明响应 | 状态码、响应结构与 header |
| 副作用与幂等性 | 实现、文档或调用链 |
| 测试环境与清理 | fixture、事务或 teardown |
不要默认每个接口都应返回 400、401、403、404、422 或 500。只有契约已声明或代码路径真实可达时才生成对应断言。
在执行任何请求前确认:
用户只要求“生成测试”时只产出代码。生产环境、共享 staging、第三方服务及任何可能改变真实数据的执行都必须获得明确授权。GET 也不能仅凭 method 判定无副作用。
npx、全局工具或临时下载的最新版解析规范。grep 推断嵌套 Schema。按目标契约选择必要场景:
断言外部可观察行为,避免绑定内部函数调用。随机数据应固定 seed,并避免真实个人信息、客户数据和生产标识。
没有实际运行时,只能说明“已生成、未验证”。没有明确 SLA 和受控测量条件时,不添加固定耗时断言或声称性能达标。
## API 测试结果
- 目标接口与契约证据:
- 环境与授权范围:
- 新增或修改文件:
## 用例
| 场景 | 契约依据 | 是否执行 | 结果 |
|------|----------|----------|------|
## 验证
- 实际命令与退出状态:
- 数据清理:
- 基线已有失败:
- 未确认契约与限制:
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Comprehensive GitHub release orchestration with AI swarm coordination for automated versioning, testing, deployment, and rollback management
Migrate test files from `as` type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace `as` in tests, or needs partial test data.
Modern JavaScript/TypeScript development with Bun runtime. Covers package management, bundling, testing, and migration from Node.js. Use when working with Bun, optimizing JS/TS development speed, or migrating from Node.js to Bun.
You are a dependency management expert specializing in safe, incremental upgrades of project dependencies. Plan and execute dependency updates with minimal risk, proper testing, and clear migration pa
Master systematic debugging techniques, profiling tools, and root cause analysis to efficiently track down bugs across any codebase or technology stack. Use when investigating bugs, performance issues, or unexpected behavior.
Opinionated backend development standards for Node.js + Express + TypeScript microservices. Covers layered architecture, BaseController pattern, dependency injection, Prisma repositories, Zod validation, unifiedConfig, Sentry error tracking, async safety, and testing discipline.
Best practices for writing JavaScript/TypeScript tests using Jest, including mocking strategies, test structure, and common patterns.
Take laolaoshiren/api-tester from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.