接口manual
API Contract Until Match已精选
Loop until API responses match the OpenAPI or JSON Schema contract — catch drift between docs and implementation.
基本信息
分类
接口
目标
API implementation matches the published contract
最大迭代次数
10
检查命令
npm run test:contract
退出条件
contract test suite exits 0
支持的智能体
Cursor
启动提示词
Start the "API Contract Until Match" loop.
Goal: API implementation matches the published contract
Max iterations: 10
Between iterations run: npm run test:contract
Exit when: contract test suite exits 0
Step 1: Run contract tests. Fix each schema/response mismatch with minimal diffs, then re-run.
Self-pace this loop. After each iteration, run the check command, read the output, and only continue if the exit condition is not met. Stop when the exit condition passes or max iterations is reached. Give a short status update each pass.步骤
- 1
Run contract tests
Run contract tests against openapi.yaml or schema fixtures. List every mismatch with endpoint and field.
npm run test:contract - 2
Fix implementation or spec
Fix the smallest change: update handler types/validation or correct the spec if the code is canonical.
评论