backend-api-contract
暂无简介
- License 许可
- MIT
- 最近更新
- 2026-11-06
- Stars
- ★ 8
- Forks
- 0
02 资源文件 1
- 参考文档evals.json676 B
03 SKILL.md 正文
backend-api-contract
The contract is the test; the implementation is green when a generated client can exercise every endpoint.
What you do
Produce a precise, implementable contract for one service or one resource boundary — nothing more. The spec names every route, request shape, response shape, error envelope, auth expectation, and the versioning/pagination rules. A backend engineer should be able to start coding from it without asking a follow-up.
- Use nouns in URLs; verbs are the HTTP method.
POST /orders, notPOST /createOrder. - Define the error envelope once (e.g.
{ error: { code, message, details } }) and reuse it. - State auth per endpoint (public / bearer / service-token) and the required scope/role.
- Pick a versioning strategy (URL
/v1/, headerAccept: application/vnd.x.v1+json, or GraphQL schema evolution) and apply it consistently. - Specify pagination shape (
cursor+limitpreferred for lists), sorting, and filtering grammar. - Call out idempotency: which endpoints are safe to retry and which need an
Idempotency-Key.
Output shape
Either an OpenAPI YAML fragment, a GraphQL SDL block, or a markdown spec with these sections:
- Scope — resource(s) in scope; explicitly what's out.
- Endpoints — method · path · summary · auth · request · response · errors.
- Schemas — typed models for every request/response body.
- Errors — error envelope + code table.
- Auth & versioning — how clients authenticate, how versions evolve.
- Pagination & idempotency rules.
Store at .guild/runs/<run-id>/api/<slug>.{yaml|md} if the run is tracked.
Anti-patterns
- Verbs in URLs (
/createOrder,/getUser) — use HTTP methods. - Missing error schema — errors are part of the contract, not an afterthought.
- Implicit auth — "obviously logged in" is not a spec.
- Breaking changes without versioning — renaming a field in v1 is a regression.
- Unbounded list endpoints — every list must cap
limitand require pagination past it. - String-typed everything — if a field is an enum, declare the enum.
Handoff
Return the spec path (or inline fragment) to the invoking backend specialist. If the contract implies DB work, the backend agent chains into backend-data-layer and backend-migration-writer; if it calls out to an external service, into backend-service-integration. This skill does not dispatch.
04 同仓库更多 Skills
technical-writer-user-manual
暂无简介
technical-writer-release-notes
暂无简介
technical-writer-api-docs
暂无简介
social-media-platform-post
暂无简介
social-media-engagement-templates
暂无简介
social-media-content-calendar
暂无简介