contract-tests
Installation
SKILL.md
Contract Tests
A contract test says: "these fields, with these types, are promised to consumers." Adding fields is fine. Removing, renaming, or changing the type of a promised field fails the test, and the failure message tells you who will break.
Step 1: Find the contracts
From the repo map's Connections table and impact-analysis, list the endpoints and payloads another repo consumes. For each, find which fields the consumer actually reads: search the consumer repo for the field names. The contract is what consumers use, not everything the endpoint returns.
Step 2: Pick the approach
Use the lightest one that fits; check what the project already has first.
A. Schema-diff on OpenAPI (project uses drf-spectacular or drf-yasg) Generate the schema in CI, compare to a committed copy, fail on breaking changes:
python manage.py spectacular --file openapi.yml --validate
git diff --exit-code openapi.yml # or use oasdiff for "breaking only": oasdiff breaking old.yml openapi.yml --fail-on ERR