← ClaudeAtlas

api-contract-synclisted

Keeps the frontend's view of the backend API true — locates the contract, regenerates the typed client, reports drift. Run it before touching an endpoint, when a request fails on shape, or when the backend moved ahead. Answers what an endpoint actually returns.
AlpayC/claude-skill-set · ★ 0 · API & Backend · score 60
Install: claude install-skill AlpayC/claude-skill-set
# API contract sync An unknown API shape is the single most common reason a frontend run stalls and asks a human. The contract is knowable — it lives in the backend repo. This skill fetches it, types it, and names what changed. ## 1 — Locate the contract `docs/agent/repo-map.md` → **Seams** records where it is. When that is blank, find it in this order and write the answer back into the map: - **Served spec** — the running backend exposes `/swagger/v1/swagger.json`, `/v3/api-docs`, `/openapi.json`, or a GraphQL introspection endpoint. Most authoritative: it is what is actually deployed. - **Committed spec** — an `openapi.yaml` / `schema.graphql` in the backend repo. Authoritative for what is merged, which may be ahead of or behind what runs. - **Generated from code** — controllers with attributes/decorators and a generation step. Run the generation step rather than reading the controllers by hand. - **Nothing formal** — the contract lives in the controller signatures. Read them and write down what you found in `docs/agent/api-contract.md`, marked as *derived, not authoritative*. Record which source you used and its commit or timestamp. Drift analysis is meaningless without knowing which two things were compared. ## 2 — Regenerate Use the repo's existing generator if there is one — a build target, a script in `package.json`, an `orval` / `openapi-typescript` / `graphql-codegen` config. Run it. Types that a generator owns are never hand-edited: the next regeneration sile