AGENT SKILL

api-contracts

Keep workspace/CONTRACTS.md in sync with schemas and REST endpoints, including idempotency and financial invariants. Use when creating or changing any API or data model.

License 许可
MIT
最近更新
2026-10-20
Stars
★ 0
Forks
0

01 前言 Front Matter

name
api-contracts
license
MIT
description
Keep workspace/CONTRACTS.md in sync with schemas and REST endpoints, including idempotency and financial invariants. Use when creating or changing any API or data model.
compatibility
opencode

03 SKILL.md 正文

What I do

  • Define the exact contract format every backend/architect agent must maintain.

When to use me

Use when creating or altering a schema, table, endpoint, or response shape.

Rules

  1. Document immediately in workspace/CONTRACTS.md: route + method, request headers/body schema, response schemas per status code (200/201/400/404/500), validation rules. Every documented error status ships a test that triggers it.
  2. Money: integer minor units + ISO currency; amounts immutable once processing begins.
  3. Idempotency: Idempotency-Key on POST create/confirm paths; effectively-once webhook handling with (provider_id, provider_event_id) uniqueness.
  4. Tenancy: every query tenant-scoped; public IDs (UUIDv4) opaque and non-secret.
  5. Never invent: frontend and QA build strictly against documented contracts — no guessed paths or params.
  6. Collections: cursor pagination with capped limit ({ data, nextCursor }); filtering/sorting via explicit query params, documented per endpoint.
  7. Rate limits: document quotas and 429 + Retry-After behavior for public endpoints.

04 同仓库更多 Skills