API Scenario Automation

根据需求文档、测试用例、OpenAPI、Postman、Apipost、Swagger、Markdown 接口文档、后端文档或后端路由生成场景化接口自动化。适用于生成接口流程编排、scenarios.yaml/scenarios.json 场景文件、unittest/pytest 兼容的接口自动化测试,以及带数据依赖的端到端接口测试;不用于生成单元测试。

43 stars 4 forksProductivity & Notes

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add xiaoce-xiaoce/testing-skills-xiaoce --skill api-scenario-automation
Manual install
git clone --depth 1 https://github.com/xiaoce-xiaoce/testing-skills-xiaoce.git /tmp/testing-skills-xiaoce
mkdir -p ~/.claude/skills
cp -r /tmp/testing-skills-xiaoce/api-scenario-automation ~/.claude/skills/api-scenario-automation

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# 场景化接口自动化

使用本 skill 将接口资料和测试用例转换成场景化接口自动化。目标不是生成单接口冒烟用例,而是生成可执行的业务流程:包含请求顺序、变量提取、跨步骤数据依赖、业务断言和清晰的失败反馈。

## 工作流程

1. 收集源材料:
   - 接口资料:OpenAPI、Swagger、Postman 集合、Apipost 导出、Markdown 接口文档、后端路由文件。
   - 可选上游测试用例,例如 `test-case-xmind` 生成的 `cases.json`。
   - 环境信息:`base_url`、测试账号、鉴权方式、必要测试数据、数据清理要求。
2. 编写场景 DSL 前,阅读 `references/scenario_schema.md`。
3. 导出测试代码前,阅读 `references/pytest_export.md`。
4. 如果接口资料是 Markdown,可以先运行 `scripts/extract_api_inventory.py` 提取接口清单。
5. 生成 `scenarios.yaml`。除非用户明确要求其他格式,否则保持 JSON 兼容 YAML。
6. 运行 `scripts/validate_scenarios.py scenarios.yaml` 校验场景文件,并修复所有错误。
7. 运行 `scripts/export_pytest.py scenarios.yaml --output <项目目录>/api-automation` 导出接口自动化测试代码。
8. 如果目标应用可以在本地运行,执行生成的测试套件;如果无法运行,交付生成文件并说明未执行的原因。

## 场景设计规则

- 优先生成 3-8 条有价值的业务场景,而不是大量浅层接口检查。
- 使用 `extract` 和 `{{ variable }}` 模板串联步骤之间的数据。
- 同时断言传输结果和业务结果:
  - HTTP 状态码。
  - 响应字段。
  - 创建后的资源能被查询。
  - 数量、状态、归属关系或业务流转符合预期。
  - 禁止访问路径返回正确失败结果。
- 在有价值的地方加入反向场景:缺少必填字段、非法 ID、错误鉴权、过期状态、重复提交、可注入的服务错误。
- 保持测试确定性。避免真实支付、真实邮件、真实 AI 调用或不可逆的生产操作。
- 如果没有清理接口,生成唯一测试数据,并避免依赖持久化全局状态。

## 输出结构

默认输出目录:

```text
api-automation/
├── scenarios.yaml
├── tests/
│   └── test_api_scenarios.py
└── README.generated.md
```

`scenarios.yaml` 是接口自动化的源文件。生成的测试文件会内嵌场景定义,因此运行时不需要额外 YAML 解析依赖。导出的测试基于 `unittest`,也可以被 pytest 收集执行。

## 脚本

可在任意工作目录运行:
Read the full skill on GitHub

Details

Skill name
api-scenario-automation
Path
api-scenario-automation/SKILL.md
Repo updated
14 June 2026

FAQ

What does the API Scenario Automation skill do?

根据需求文档、测试用例、OpenAPI、Postman、Apipost、Swagger、Markdown 接口文档、后端文档或后端路由生成场景化接口自动化。适用于生成接口流程编排、scenarios.yaml/scenarios.json 场景文件、unittest/pytest 兼容的接口自动化测试,以及带数据依赖的端到端接口测试;不用于生成单元测试。

How do I install the API Scenario Automation skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add xiaoce-xiaoce/testing-skills-xiaoce --skill api-scenario-automation. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is API Scenario Automation popular?

It lives in xiaoce-xiaoce/testing-skills-xiaoce, which has 43 GitHub stars and 4 forks.

Related skills

Test Case Xmind

43

xiaoce-xiaoce/testing-skills-xiaoce

根据产品需求文档、前端技术文档、后端技术文档、交互稿、接口说明、截图和相关项目资料生成结构化软件测试用例;校验用例格式;按“用例标题/前置条件/步骤/预期结果”模板导出 .xmind 脑图文件。适用于生成 QA 测试用例、验收用例、功能用例、回归用例、边界用例,或根据一个或多个输入文档生成 XMind 测试用例脑图。

Testing & QA

UI Scenario Automation

43

xiaoce-xiaoce/testing-skills-xiaoce

根据需求文档、UI 文档、截图、前端文档、已有测试用例(如 cases.json)或可访问的本地页面生成并执行浏览器 UI 场景验证。适用于驱动 Codex 内置浏览器进行点击、输入、导航、检查页面状态、截图取证、验证用户流程、生成 UI 检查报告、创建 ui-scenarios.json;也可在用户明确要求时导出 Playwright 测试。

Frontend & Design

Attio Setup

79

LeadMagic/gtm-skills

Set up Attio for B2B SaaS GTM — programmable CRM, custom objects, workflow automation, enrichment integration, and real-time collaboration. Use when configuring Attio for sales, building a programmable CRM, or migrating from HubSpot/Salesforce. Triggers on: "Attio setup", "configure Attio", "Attio CRM", "Attio pipeline", or any Attio configuration request.

Productivity & NotesIn 1 list18

Possession

48

Summer907/possession-skill

角色扮演蒸馏器:从官方设定、语音台词、背景故事中蒸馏可扮演的游戏角色——AI夺舍角色灵魂,让TA在你面前活过来。支持profile、personality、interaction、memory、relations五维提取。

Productivity & Notes

Board Meeting Prep

79

LeadMagic/gtm-skills

Board meeting preparation for B2B SaaS founders. Use when preparing quarterly board meetings, building board decks, selecting metrics to present, crafting narrative, managing board relationships, or handling difficult board conversations (down rounds, missed targets, CEO transitions).

Productivity & NotesIn 1 list18

Superme

33

aloncarmel/supermeskill

Online supermarket automation. Login, search products, add to cart/wishlists, magicorder from past orders. Supports Shufersal, Keshet Teamim, Rami Levy, and Tiv Taam. Usage: /superme login <vendor>, /superme search <product>, /superme add <#>, /superme magicorder, /superme lists, /superme cart, /superme help

Productivity & Notes

Browse the most popular Claude skills, all productivity & notes skills, or write your own with the skills generator.