agentleFS
d4rkNinjad4rkNinja/arcforge/skills/api-contracts/SKILL.md

api-contracts

Skill16 starsChanged 3 months agoMITView on GitHub

Use when thinking through, reviewing, changing, or verifying APIs and client contracts: endpoint design, validation, errors, pagination, filtering, bulk behavior, versioning, serialization, webhooks, realtime channels, SDKs, or CLIs. For whole-system architecture use system-architecture-harness; for identity and permissions use auth-access; for event delivery use async-messaging; for compatibility rollout use migration-evolution.

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    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:

    Use this skill when thinking through, reviewing, changing, or verifying:

    line 28
  2. Distinctive:

    Treat every other owner paper or section as optional depth.

    line 85
  3. Distinctive:

    Never load every paper in this skill by default.

    line 87
  4. Distinctive:

    Use the domain workflow as shared gates, then branch by the selected mode:

    line 91
  5. Distinctive:

    Verify: run the relevant checks, report observed results, and label every unavailable or unrun check.

    line 96
  6. Distinctive:

    Before completion, re-scan the normative lists and stop if any rule lacks a decision, test, or documented exception.

    line 106
  7. Distinctive:

    If a companion is unavailable, complete only the safe local contract decision, name the missing depth, and recommend the exact technical ID …

    line 117
  8. Distinctive:

    Stop and revise when any of these appears:

    line 137

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “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

Think Through API & Client Contracts

Overview

Production guidance for API surfaces and their clients. Each reference paper captures the contract work that first drafts skip: request lifecycle and deadlines, validation edge cases, error taxonomies that do not leak internals, stable pagination under concurrent writes, deprecation windows, webhook signature verification, and realtime reconnection semantics.

Core principle: An API is a compatibility promise. Every endpoint, error, cursor, and webhook is a contract with real clients — including old clients you no longer control.

Domain Law

NO API OR CLIENT CONTRACT CHANGE WITHOUT:
1. the minimum required primary paper(s) for the surface selected from the context table;
2. the paper's pre-change questions
   answered, or each open point labeled as an assumption;
3. "Existing-codebase checks" run when changing an existing API;
4. every applicable MUST mapped to a decision, a test, or a documented
   exception — never silently downgraded.

When to Use

Use this skill when thinking through, reviewing, changing, or verifying:

  • REST, RPC, gRPC, or GraphQL endpoints and resource/command design;
  • request parsing, body limits, content-type handling, and input validation;
  • error architecture: codes, HTTP status mapping, public vs internal detail;
  • pagination (offset/cursor), filtering, sorting, and query complexity limits;
  • bulk and batch operations with partial-failure reporting;
  • API versioning, deprecation, sunset windows, and breaking-change detection;
  • data serialization choices and precision/compatibility pitfalls;
  • webhooks: registration, signing, timestamp/replay validation, retries, dead-lettering;
  • realtime communication: WebSockets/SSE, presence, reconnection, ordering;
  • SDK/client libraries and CLI-backend interactions;
  • security headers for browser-facing APIs.

When Not to Use

  • Whole-system architecture design: use system-architecture-harness.
  • Authentication, authorization, API keys: use auth-access.
  • Queue delivery semantics, events, outbox: use async-messaging.
  • Database schema evolution sequencing: use migration-evolution (070 overlaps at the contract level).
  • Rate limiting and quotas mechanics: use resilience-flow-control (038, 039).

Select the Operating Mode

ModeUse whenRequired result
ThinkThe safe decision is not settledrequirements, constraints, invariants, risks, alternatives, decision, and validation path
ReviewAn artifact, repository, diff, or operating state already existsevidence separated from assumptions, prioritized findings, and blockers
ChangeDecisions are approved and repository changes are requestedthe smallest safe change, compatibility notes, and verification still required
VerifyA claim needs prooftests or measurements run, observed evidence, and residual risks

If the user names a mode, use it. Otherwise infer the mode from intent and state the inference in one sentence. For a combined request, run Think → Review → Change → Verify and preserve the trace between phases. Think may stop with a decision; Review may stop with findings. Change must not claim completion before Verify. Verify must never turn a planned or unavailable check into evidence.

The first line of every response, including a findings-only response, must be exactly Skill and mode: Think Through API & Client Contracts (api-contracts) — <Think|Review|Change|Verify>. Use one concrete mode in place of the placeholder.

Required Context Loading

SituationPapers
Middleware, request context, deadlines, cancellation011 Request Lifecycle
Field/type/cross-field validation, malformed payloads012 Input Validation
Error taxonomy, status mapping, masking, correlation013 Error Architecture
Resource and command design, REST/RPC/GraphQL trade-offs014 API Design
Versioning strategies, deprecation, breaking changes015 API Versioning & Compatibility
Offset vs cursor pagination, stable ordering016 Pagination
Allowed filter fields, operator validation, complexity limits017 Filtering / Sorting / Query APIs
Webhook signing, retries, replay protection, versioning049 Webhooks
WebSockets/SSE, auth, reconnection, scaling050 Realtime Communication
Serialization formats and compatibility pitfalls116 Data Serialization
Browser security headers115 Web Security Headers
SDK design, retries, compatibility for library clients110 SDK / Client Design
CLI auth, pagination, error display for backend CLIs111 CLI Backend Interaction

Load context in stages:

  1. For the minimum required primary paper(s), read the executive engineering summary, pre-implementation questions, and the applicable normative requirements, failure modes, and verification checks needed to establish the obligations.
  2. Then read only the named request-specific sections needed to decide or verify this surface; record those section names in the output.
  3. Treat every other owner paper or section as optional depth. Load it only when the request, a newly discovered dependency, risk, or unresolved evidence gap requires it; promote that depth to required when it becomes necessary.

Never load every paper in this skill by default.

Workflow

Use the domain workflow as shared gates, then branch by the selected mode:

  • Think: answer the questions and stop with a reasoned decision and validation path; do not edit by default.
  • Review: inspect the available artifact or repository and stop with evidence-backed findings; do not claim changes.
  • Change: apply only approved decisions, then continue to Verify before claiming completion.
  • Verify: run the relevant checks, report observed results, and label every unavailable or unrun check.

In every mode, label a material issue Observed defect only when current artifact, repository, test, or runtime evidence demonstrates it. Label unsupported but relevant concerns Assumption / unverified risk with the evidence needed to resolve them. Findings-only output follows the same distinction; do not present a prompt premise or missing evidence as an observed implementation defect.

  1. Identify the surface being built or changed and select the primary paper; load neighbors for every contract edge you touch (a new list endpoint usually needs 014 + 016 + 017 + 012 + 013).
  2. Apply the staged loading contract above; do not turn a touched boundary into a full read of every owner paper.
  3. Answer the paper's pre-implementation questions; label autonomous assumptions and their impact.
  4. For existing APIs, run the existing-codebase checks: inventory real clients, current schemas, and usage before renaming fields, tightening validation, or changing defaults.
  5. Convert each MUST/SHOULD/AVOID/NEVER into contract decisions: schemas, status codes, limits, versioning policy, and error model — each with a test.
  6. Apply the active mode: stop at a decision in Think; stop at findings in Review; make the smallest approved safe change in Change; run the paper's malformed-input, cursor-stability, and old-client checks in Verify.
  7. Before completion, re-scan the normative lists and stop if any rule lacks a decision, test, or documented exception.

Companion Skills and Standalone Safety

TypeWhenCompanionMissing companion behavior
RequiredAuthentication or object, field, action, or tenant authorization is in scopeauth-accessPreserve authorization requirements and identify missing access-policy depth.
RecommendedFilters, sorting, pagination, or serialization affect queries or precisiondata-storageKeep fields allowlisted and responses bounded; label storage depth missing.
HandoffEvent delivery or webhook worker internals are in scopeasync-messagingDefine the surface contract and identify delivery internals as incomplete.
HandoffOld clients or consumers must coexist with a contract changemigration-evolutionDo not prescribe a breaking one-step rollout.

If a companion is unavailable, complete only the safe local contract decision, name the missing depth, and recommend the exact technical ID or relevant installation group. Never claim unavailable material was read or weaken a compatibility, authorization, or boundedness requirement.

Output Contract

The selected mode is authoritative. Include only applicable fields below, but never omit the mandatory identity or Review envelope; a planned check is a validation path, not verification evidence.

Scale the output to the active mode: Think returns contract decisions; Review returns evidence-backed findings; Change returns the repository-aware change plus pending proof; Verify returns observed compatibility and failure evidence with unrun checks labeled. A combined flow preserves all four phases.

For Review, including a request for “findings only,” the output order is mandatory: first the exact skill-and-mode line; then a separate Assumptions / unverified risks section that states the evidence boundary or None; then severity-prioritized findings whose demonstrated issues are labeled Observed defect. The identity and assumptions section is part of the findings-only review envelope, not optional introductory prose.

  1. Skill and mode — the mandatory exact first line defined above.
  2. Papers consulted — numbers and the sections relied on.
  3. Assumptions and unanswered questions — labeled, with their design impact.
  4. Rule-to-decision map — each applicable MUST/SHOULD → contract decision, enforcement point, and test.
  5. Failure modes addressed — malformed input, cursor instability, breaking changes, webhook replay, realtime message loss.
  6. Verification evidence — tests mapped to the paper's verification checklist.
  7. Compatibility and migration notes — old clients, deprecation windows, versioning policy.

Stop Conditions

Stop and revise when any of these appears:

  • code is written before the primary paper's pre-implementation questions are answered or labeled;
  • the response does not begin with the exact skill-and-mode line, or a claimed defect is not labeled separately from assumptions and unverified risks;
  • endpoints without validation, size limits, and a defined error contract;
  • error responses that leak stack traces, SQL, internal codes, or sensitive data;
  • pagination without stable ordering, maximum page size, or duplicate/miss handling under writes;
  • user-controlled filter/sort fields without an allowlist and complexity limits;
  • a breaking change with no versioning, deprecation window, or client inventory;
  • webhooks without signature verification, timestamp validation, and bounded retries;
  • realtime channels without authentication, reconnection, heartbeat, and ordering policy;
  • serialization that silently loses precision, timezone, or unknown-field fidelity;
  • bulk APIs without per-item error reporting and partial-failure semantics;
  • any API MUST downgraded to a TODO without a documented exception.

References

Thirteen production papers under references/papers/: 011 Request Lifecycle, 012 Input Validation, 013 Error Architecture, 014 API Design, 015 API Versioning & Compatibility, 016 Pagination, 017 Filtering / Sorting / Query APIs, 049 Webhooks, 050 Realtime Communication, 110 SDK / Client Design, 111 CLI Backend Interaction, 115 Web Security Headers, 116 Data Serialization. Cross-domain pointers inside the papers name the sibling skill to activate.

Worked example: a bounded, cursor-paginated list endpoint.

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.