api-contract-change
Use when changing an API request or response shape, validation, error code, pagination, route, or other /api/v1 semantics.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 4
- Forks
- 2
01 前言 Front Matter
- name
- api-contract-change
- license
- MIT
- description
- Use when changing an API request or response shape, validation, error code, pagination, route, or other /api/v1 semantics.
02 资源文件 1
- 参考文档references/route-change-checklist.md2.6 KB
03 SKILL.md 正文
API contract change
Outcome: the server, backend/openapi.yaml, the generated fixtures/types, the
baseline, and both clients agree. Read docs/breaking-change-policy.md and
docs/adrs/0008-conditional-write-enforcement.md before editing.
Steps
- Change the handler/model and the spec together. The spec example is the source for contract fixtures; a hand-edited response shape is a failure.
- Open route-change-checklist and update every matrix the route belongs to: authorization, ownership, idempotency, conditional writes, pagination and error shape.
- Regenerate the artifact chain in order:
gencontract, thengentsapi, thengenapibaseline. Commit the diffs; the baseline diff is the review. - Make the consumers compile:
npx tsc --noEmitfor web and the Android contract-fixture test for the shared JSON. - A removed or narrowed field is a breaking change under MAINT-02: add the deprecation window and migration path, not just the baseline diff.
- Every new route or access path needs an ownership regression test scoped by
user_id(orContact.VCardUIDfor graph entities).
DoD
cd backend && go run ./cmd/gencontract
cd backend && go run ./cmd/gentsapi
cd backend && go run ./cmd/genapibaseline
cd backend && go test ./internal/apibaseline/... ./internal/contractfixtures/... ./internal/tsapi/...
cd frontend && npx tsc --noEmit
cd android && ./gradlew :core:network:testDebugUnitTest --tests '*ContractFixtureTest*'
Report any check you could not run; never imply it passed.
Stop and ask
- The change removes or narrows a field, status code or route without a deprecation window.
- The spec and the implementation disagree and you are tempted to hand-edit a generated fixture or baseline.
- A new route has no ownership regression test.
- A client would need a coordinated release before the server changes.
Canonical detail: docs/breaking-change-policy.md, docs/deprecation-policy.md,
backend/AGENTS.md (generated artifacts).
04 同仓库更多 Skills
valid
Use when exercising a well-formed skill fixture in the agent-context tests.
unregistered-dod
Use when a fixture must carry a DoD command no Suite registers.
orphan-reference
Use when a fixture must exercise an unlinked reference file.
missing-reference
Use when a fixture must link to a reference file that does not exist.
missing-description
暂无简介
long-reference
Use when a fixture must exceed the reference line maximum.