Api
Use for REST API contracts: endpoints, fields, evolution, status codes, errors, pagination, idempotency.From its SKILL.md
npx -y skills add kreek/consult --skill apiAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
7.1 KB, ~1.6k tokens by cl100k_base, as published. Nobody here has run it
API
Iron Law
DESIGN THE CONTRACT FIRST. EVOLVE WITHOUT BREAKING. PICK STATUS BY ORIGIN.
When to Use
- Adding, removing, renaming, or reviewing REST endpoints, fields, status codes, webhooks, auth, pagination, rate limits, or idempotency.
- Writing or changing OpenAPI, JSON Schema, public SDK boundaries, or integration contracts external callers depend on.
When NOT to Use
- Internal function signatures with no caller contract; use
domain-modelingorrefactoring. - Auth, secrets, or trust-boundary review beyond API shape; use
security. - Database schema design; use
database. - Non-REST API styles (gRPC, GraphQL, message queues): contract,
error, and evolution conventions differ; use
architecturefor style-of-API decisions and the relevant ecosystem's conventions for shape.
Core Ideas
- Contract first. Sketch OpenAPI or the repo's API contract source
before controller code; implement from the contract, not toward it.
Every response shape is explicit, including errors, empty states,
pagination, and auth failures. Durable API interfaces route through
contract-first; error shape is part of the contract. - Evolution: additive in place; breaking needs a path forward.
Optional fields, query params, headers, methods, and endpoints
evolve in place. Renames, removals, required additions, status-code
changes, and semantic changes need a successor contract or
deprecation path. Never break in place. See
references/api-evolution.md. - Versioning: one strategy per service. Pick URL path, media
type, header, or date and apply it consistently. Major bumps for
breaking changes only; compatible additions never re-version.
Retire versions with an overlap window; route deprecation
primitives through
release. Seereferences/api-evolution.md. - Errors: status by origin, shape by contract.
4xxfor consumer-request problems,5xxfor upstream or your-service problems; never mix origins in one response. Use the chosen data model's native error shape (JSON:APIerrors[], FHIROperationOutcome, or RFC 9457 Problem Details). These are structurally distinct conventions, not interchangeable. Never leak raw upstream or internal errors. Seereferences/rest-error-status-codes.md. - Default to JSON:API; switch only when the domain has its own
standard. JSON:API is the default for REST resource APIs (envelope
with
id/type/attributes/relationships, sparse fieldsets, includes, pagination conventions, error array). Switch to a domain-specific standard when one applies: FHIR for healthcare, HAL for hypermedia-centric APIs, JSON-LD when semantic-web interop matters. Document deviations from the chosen standard explicitly. Seereferences/data-models.md.
Workflow
- Identify the caller and the contract surface they bind to.
- Define the contract before implementation: path, method, request body, response bodies, status codes, auth, pagination, idempotency, and error shape.
- Route durable API interfaces through
contract-firstbefore controller, client, SDK, webhook, or integration work continues. - Apply the relevant reference only when the feature needs it:
api-evolution,rest-error-status-codes,idempotency,pagination,webhooks, ormiddleware-vs-handler. - Add outer-boundary contract or behavior tests. Update source-of-truth docs, not generated output by hand.
Verification
- Contract exists or is updated before implementation lands.
- Durable API interfaces have explicit user approval before implementation continues.
- Every endpoint documents request, auth, responses by status, and errors.
- Request, response, and error shapes follow the chosen data model consistently; status codes are selected by origin and do not leak internal or upstream details.
- Non-idempotent mutations define idempotency key scope, replay window, duplicate response, and conflict semantics, or are documented as unsafe to retry.
- Lists and streams have bounded pagination, stable ordering, and explicit invalid-token behavior; bad tokens do not silently restart, rewind, or skip position.
- Additive changes are optional and old callers still work; incompatible changes have a successor contract or deprecation path with overlap and migration guidance.
- Webhooks are signed, timestamped, replay-protected, and deduplicable.
- Middleware is limited to transport-wide request-pipeline concerns; endpoint-specific validation, ownership checks, privileged authorisation, and domain invariants stay at the route/domain boundary.
- Tests exercise the public boundary; unproven public contract claims are reported.
Tripwires
Use these when the shortcut thought appears:
- Treat field renames and removals as breaking unless a successor contract or deprecation path exists.
- Pick status by origin: consumer problems are
4xx; service/upstream problems are5xx. - Define response and error shape in the contract before returning handler internals.
- Define bounded pagination, stable ordering, and invalid-token behavior before the endpoint can grow.
- Define idempotency key scope, replay window, duplicate response, and conflict semantics before retrying mutations.
- Sign, timestamp, replay-protect, version, and deduplicate external webhooks.
- Keep route-specific validation, ownership, and domain rules in handler/domain code; use middleware for transport-wide concerns.
Handoffs
contract-first: durable API approval.proof: prove at the request → handler and handler → response handoffs; status codes, error envelopes, and pagination contracts are asserted at those seams.error-handling: internal failure mapping, remote-call timeouts, retries, budgets, and circuit breakers behind the API.security: authn/authz, input trust, SSRF, secrets, and data exposure.architecture: middleware placement and API style decisions.async-systems: SSE, subscriptions, event streams, async consumers, delivery.release: version bumps, changelog,Sunset, andDeprecationprimitives.documentation: API docs location; generated contract reference stays source of truth.
References
references/api-evolution.md: evolution rules and versioning strategies.references/rest-error-status-codes.md: status-by-origin decision tree.references/data-models.md: JSON:API as the REST default; FHIR, HAL, JSON-LD when the domain calls for them.references/idempotency.md: idempotency-key contract.references/pagination.md: cursor and bounded-pagination semantics.references/webhooks.md: signing, versioning, replay protection.references/middleware-vs-handler.md: request-pipeline placement.../security/references/web-app.md: CSRF middleware, security headers, and CORS.../security/references/api-and-auth.md: handler-level authorisation caveats for privileged endpoints.
What ships with it: 8 files
20.7 KB alongside SKILL.md
agents/
- openai.yaml188 B
references/
- api-evolution.md4.0 KB
- data-models.md4.9 KB
- idempotency.md2.0 KB
- middleware-vs-handler.md2.0 KB
- pagination.md2.2 KB
- rest-error-status-codes.md3.6 KB
- webhooks.md1.7 KB