audit-contracts
/octopus:audit-contracts scans a branch for drift between an API
and its frontend consumers before the change merges β finding the
mismatches that compile successfully but break at runtime.
What it solves
In monorepos with separate API and frontend stacks, contract drift is
the failure mode that TypeScript canβt catch: a renamed endpoint URL,
a removed DTO field, an enum value that no longer exists on the
backend. These usually surface in production or during manual QA,
long after the change was written. audit-contracts makes the
cross-stack comparison automatic on every diff.
How it works
The skill resolves which stacks are present (via .octopus.yml or
autodetection), extracts βintent tokensβ from the API diff β endpoint
paths, DTO/record names, enum names, auth annotations, param
signatures β and greps each frontend stack for matching usage.
Seven drift classes are checked:
- C1 endpoint-added β new endpoint with no frontend consumer
(
βΉ Info). - C2 endpoint-removed β frontend still calls a removed or renamed
URL (
π« Block). - C3 dto β DTO field added, removed, or renamed; frontend
interface not updated (
β Warn). - C4 enum β enum member set changed; frontend union or
as constmap out of sync (β Warn). - C5 status β response status code changed on an existing
endpoint; nearest frontend error handler flagged for review
(
βΉ Info). - C6 auth β authorization rule added, removed, or changed on an
endpoint; frontend login flow should be re-verified (
β Warn). - C7 params β path or query param added, removed, or renamed;
live call sites use the old signature (
β Warn).
Each finding carries a confidence label (high / medium / low)
and cites both the API file and the frontend file where the drift
was detected. Findings are guidance for the reviewer β not an
automated gate.
Usage & parameters
/octopus:audit-contracts [ref] [--base=main] [--stacks=<list>] [--only=<checks>] [--write-report]refβ branch, commit SHA, or PR ref to inspect. Default: current working-copy diff against--base.--base=<branch>β comparison base. Default:main.--stacks=<list>β comma-separated subset of stacks to compare (api,app,lp, or custom names from.octopus.yml). Default: all detected stacks.--only=<checks>β run only the listed drift checks. Valid values:endpoint-added,endpoint-removed,dto,enum,status,auth,params. Default: all seven.--write-reportβ write findings todocs/reviews/YYYY-MM-DD-contract-<slug>.mdin addition to displaying them inline. Default: display only.