api-contract-review
Compare frontend API usage with backend endpoint definitions to find contract mismatches. Use when Codex needs to debug or review frontend-backend API alignment for failing screens, rejected form subm
SKILL.mdskills/api-contract-review/SKILL.md
GitHubAPI Contract Review
Use this skill to verify whether frontend and backend agree on an API contract.
Core Rule
Compare actual frontend code against actual backend code. Do not assume either side is wrong until both sides have been inspected.
Workflow
- Identify the API flow:
- frontend screen/function, backend endpoint, user action, data sent, data expected, error behavior, actor/role
- Inspect frontend API usage:
- API client, fetch/Axios call, data-fetching hook, form handler, mobile service, types/interfaces, state updates, auth headers, error handling
- Inspect backend API definition:
- route, controller, service, schema/DTO, validation, auth middleware, authorization, database query, response formatter, tests, docs
- Compare method and path.
- Compare headers and authentication behavior.
- Compare path/query parameters.
- Compare request body or upload format.
- Compare authorization and ownership rules.
- Compare success response shape, field names, data types, nullability, pagination, dates, and enums.
- Compare error response shape and status code handling.
- Check shared contract sources if present:
- OpenAPI, generated clients, shared TypeScript types, Zod schemas, Postman collections, API markdown docs
- Produce a contract mismatch report with recommended changes and likely files affected.
Read references/contract-review-template.md for mismatch categories, checklist, and report format.
Behavior Rules
- Identify exact mismatches, not vague "API mismatch" statements.
- Recommend the smallest safe alignment change.
- Do not change both frontend and backend unnecessarily.
- Do not ignore auth, authorization, nullability, error response, or date/time differences.
- Do not expose secrets while reviewing headers or config.
- If no formal contract exists, recommend one for important APIs.
Output Contract
When using this skill, provide:
- API flow reviewed.
- Frontend expectation.
- Backend implementation.
- Contract match summary.
- Mismatches table with severity and recommended fix.
- Recommended frontend/backend/docs changes.
- Files likely affected.
- Testing checklist.
- Risks and follow-up.