agentleFS
AmirAzyAmirAzy/HoNspot/skills/api-contract/SKILL.md

api-contract

Skill2 starsChanged 8 days agoMITView on GitHub

Design, change or consume an HTTP API without breaking the clients you cannot see. Use when adding endpoints, changing a response shape, introducing versioning, pagination, idempotency or error codes, when a mobile client will lag behind the server, or when a "small" response change has to stay compatible with old builds.

20 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use design-system, release-notes and 4 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • AnthropicSkill

    design-system

    Audit, document, or extend your design system. Use when checking for naming inconsistencies or hardcoded values across components, writing documentation for a component's variants, states, and accessibility notes, or designing a new pattern that fits the existing system.

    Also in 4 projects that use this

  • Microsoft AzureSkill

    release-notes

    Author and update release notes for Azure App Configuration libraries and providers. USE FOR: write release notes, add release note entry, update release notes, draft release notes, new version release notes, format release notes. DO NOT USE FOR: generating changelogs from git history, writing internal engineering notes.

    Also in 4 projects that use this

  • OpenAISkill

    systematic-debugging

    Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes

    Also in 3 projects that use this

  • CloudflareSkill

    security-audit

    Security guidance and vulnerability review for codebases, APIs, services, CLI tools, libraries, and daemons. Use for security questions, focused reviews, vulnerability research, security audits, or pen tests. Run the complete workflow only for explicit codebase audit or pen-test requests, full/comprehensive/end-to-end reviews, or requested report artifacts.

    Also in 3 projects that use this

  • GoogleSkill

    code-review

    Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.

    Also in 5 projects that use this

  • MicrosoftSkill

    release

    Use ONLY when the user explicitly asks to cut/publish a Huabu desktop release or tag a version. Performs an outward action — bumps the version in apps/desktop/package.json, commits + annotated-tags vX.Y.Z, and pushes the branch + tag. That tag push auto-builds the macOS/Windows installers and publishes a GitHub Release. Provides `status`, `bump`, `tag-push`, and a one-command `run` (bump → tag-push).

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 14 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every field you remove is a client you break at a moment you do not control.

    line 9

“Common” is measured: kept by at least 6 in 10 of the 14 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

HTTP API contracts

Every field you remove is a client you break at a moment you do not control. An API contract is an agreement with software you cannot upgrade — old mobile builds, partner integrations, a script someone wrote in 2021 — and it deserves the same care as a database schema you can no longer migrate.

When to use

  • Adding or changing any endpoint a client consumes.
  • Adding versioning, deprecation, pagination, filtering, idempotency or rate limits.
  • A mobile app ships in weeks but the server deploys in minutes — the version skew is the design constraint.
  • Someone proposes renaming a field, changing a status code, or "just returning an array instead".

Ground rules

  1. Additive changes are safe; everything else is a breaking change. New optional field, new endpoint, new enum value for a client that tolerates unknowns: safe. Rename, removal, type change, tighter validation, new required field, changed default, changed status code: breaking.
  2. The client you must not break is the one you cannot update. Assume at least one client is six months old.
  3. Errors are part of the contract. A stable machine-readable code plus a human message, the same shape on every endpoint, and a status code that matches the category.
  4. Money, time and identifiers have rules. Minor units for money, RFC 3339 UTC for time, opaque string ids (never expose autoincrement).
  5. Every write that can be retried needs an idempotency key — retries happen inside load balancers, SDKs and mobile networks whether you planned for them or not.
  6. The document and the server must agree. An OpenAPI file that is hand-maintained and stale is worse than none; generate it or test it.

Procedure

  1. Write the contract before the code: method, path, request, response, errors, and what the other side does next. If you cannot describe the client's behaviour after the call, the design is incomplete.
  2. Classify the change against the breaking list in rule 1, and say which bucket it is in, in the pull request.
  3. Shape the response for growth: an object at the top level (never a bare array), a stable envelope for lists (items, plus pagination fields), and every new field optional in the schema until all known clients ignore its absence safely.
  4. Design errors once. One envelope: error.code (stable, machine-readable), error.message (human), error.details (structured, optional), plus a request id the support person can quote.
  5. Make writes safe to repeat: Idempotency-Key on creation and payment paths, stored with the response, replayed on repeat, and rejected if the payload differs under the same key.
  6. Paginate from the first version, with a cursor rather than an offset if the data changes underneath. Decide the page-size cap and enforce it.
  7. Version only when you must, in the path (/v2) or via a header — but choose one and never both. Prefer evolution (additive) over versions, and when you deprecate: announce, keep both running, return the sunset in headers, and set a date.
  8. Prove it: contract tests for the response shape, a test that old fixtures still parse, and a check that the published schema is generated from the code.

Anti-patterns

Tempting moveWhy it is wrong
Returning a bare arrayNo room to add pagination or metadata without a breaking change
200 OK with { "success": false }The status code stops meaning anything; every client grows a special case
Exposing database ids and column namesCouples your storage to the public contract forever
Silent default changesA new default is a breaking change wearing a disguise
"We will version it later"Later is after the first partner integrates
Deprecating without observationYou have no evidence anyone stopped using the old path, so you keep it forever

Definition of done

  • The change is classified breaking or additive, in writing.
  • Response shape can grow: object at the top level, list envelope with pagination.
  • Errors use the shared envelope with a stable code; status codes match categories.
  • Retryable writes have idempotency keys, with a test for the duplicate case.
  • Time, money and identifiers follow the stated formats.
  • The schema is generated or tested against the implementation; old fixtures still parse.
  • If deprecating: sunset header, announcement, date, and a way to observe remaining usage.

Report format

Change:     <method path> — <what is different>
Class:      additive | breaking (and why)
Client impact: <what an old build does after this ships>
Errors:     <codes added or changed>
Pagination: <shape, cap, cursor vs offset>
Idempotency: <key header, storage, replay behaviour>
Verified:   <contract test, old-fixture test, generated schema>
Deprecation: <none, or sunset date + how usage is measured>

The checklist that turns this into a review of an existing API, and the exact rules for compatibility, are in references/contract-checklist.md.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.