From msw-api
Use when the user provides Swagger, OpenAPI, or Postman docs to diff against frontend mocks/API/tests and produce msw-plan.md—with msw-plan.config.json or Vue/React projects
How this skill is triggered — by the user, by Claude, or both
Slash command
/msw-api:msw-find-diffThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
接受 **Swagger / OpenAPI / Postman**,结合前端项目中的 MSW、API 模块、request 封装与测试,找出接口与**字段差异**,输出 **`msw-plan.md`**。执行前读取项目约定,并按 **Vue / React 目录速查** 加速定位(见 [project-layouts.md](./project-layouts.md))。
接受 Swagger / OpenAPI / Postman,结合前端项目中的 MSW、API 模块、request 封装与测试,找出接口与字段差异,输出 msw-plan.md。执行前读取项目约定,并按 Vue / React 目录速查 加速定位(见 project-layouts.md)。
包入口:msw-api。改代码用 msw-update-code,验收用 msw-verify-plan。
msw-plan.mdWhen NOT to use:已有完整 msw-plan.md 且只需改代码 → msw-update-code
msw-plan.config.json(项目根,可选)若存在则 优先于 默认启发式;可复制 msw-plan.config.example.json 到业务仓库根目录。
| 字段 | 作用 |
|---|---|
framework | vue | react — 选用 project-layouts.md 对应表 |
projectRoot | monorepo 子包路径,如 apps/web |
handlersAggregate | 总文件:命中后只在此文件内查字段 |
globs | 按角色覆盖 mocks / api / request / unitTests / e2e |
searchOrder | 搜索顺序,默认:handlers → mocks → api → request → types → unitTests → e2e |
pathPrefix / baseURLFromEnv | 文档 path 与项目 URL 对齐 |
docAuthorityDefault | 默认权威:document(见下方) |
scope.includeDocPaths | 只对比部分 path(增量) |
verifyCommands | 供 msw-verify-plan 使用 |
在 plan「搜索记录」写:config: yes|no、framework、handlersAggregate。
| 值 | 含义 |
|---|---|
document | 以接口文档为准改 mock/类型(默认) |
project | 项目故意偏离文档,不建议自动改为文档值 |
user-confirmed | 用户确认以哪侧为准 |
表格增加列 权威。project 项勿让 msw-update-code 强改文档方向。
method + path + schema 字段handlersAggregate → 仅在该文件完成字段对比解析文档 → 映射到项目 → 对比字段 → 写入 msw-plan.md(格式见 msw-plan.template.md)。
用户确认 plan → msw-update-code → 可选 msw-verify-plan
| mistake | 修复 |
|---|---|
| 忽略 config / layouts | 先读 msw-plan.config.json |
| 只写「字段不对」 | 必须 从 / 变为 |
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub eminoda/msw-api --plugin msw-api