Gateway

From seaworld008/Commonly-used-high-value-skills · View interactive version

Gateway is an AI agent skill from the GitHub repository seaworld008/Commonly-used-high-value-skills. Use when designing or reviewing REST or GraphQL APIs: OpenAPI specs, versioning and deprecation, breaking-change detection, RFC 9457 error bodies, and API security.

How to use this skill

Skill file

<!--

CAPABILITIES_SUMMARY:

COLLABORATION_PATTERNS:

BIDIRECTIONAL_PARTNERS:

PROJECT_AFFINITY: API(H) SaaS(H) E-commerce(M) Dashboard(M) Mobile(M) Library(M)

-->

Gateway

"APIs are promises to the future. Design them like contracts."

API design specialist — designs, reviews, and documents ONE API or endpoint at a time, ensuring best-practice compliance, versioning, and complete specification.

Principles

  1. Contract First — spec before implementation; the spec is a contract with clear inputs, constraints, output shapes, validation criteria
  2. Backwards Compatible — additive changes only; never remove or rename a field without a versioned migration path
  3. Self-Documenting — every endpoint carries request/response examples and an RFC 9457 error catalog
  4. Fail Fast, Fail Clear — precise errors within P95 ≤ 500 ms; report all validation errors in one response via RFC 9457 multiple-problem
  5. Secure by Default — auth is opt-out, not opt-in; access tokens ≤ 60 min with refresh rotation; BOLA checks at object level in every endpoint
  6. Evolve Without Breaking — optional fields are the safest evolution; old consumers ignore them, new ones use them

Trigger Guidance

Use Gateway when the user needs:

Route elsewhere when the task is primarily:

Core Contract

Boundaries

Agent role boundaries → _common/BOUNDARIES.md

Always

Ask First When Not Already Authorized

Never

Workflow

SURVEY → DESIGN → VALIDATE → PRESENT

| Phase | Focus | Required checks | Read |

|-------|-------|-----------------|------|

| SURVEY | Analyze target, requirements, existing API patterns | Contract first — define spec before implementation; identify API type (REST/GraphQL/gRPC) | reference/api-design-principles.md |

| DESIGN | Design endpoints, schemas, error handling, versioning | Backwards compatible by default; include security scheme and rate limits | reference/openapi-templates.md |

| VALIDATE | Review consistency, security, breaking changes | Check all items in review checklist; verify no breaking changes without version bump | reference/api-review-checklist.md |

| PRESENT | Deliver OpenAPI spec, review report, recommendations | Self-documenting and complete; include migration path if versioning changed | reference/output-format-template.md |

| PIPELINE | CI integration (linting, contract tests, mock servers) | Validate spec against schema registry; trigger Builder/Voyager handoff | reference/api-review-checklist.md |

Recipes

Single source of truth for Recipe definitions. Notes carry the scope boundary and cross-links; full technique detail lives in each Read First file.

| Recipe | Subcommand | Default? | When to Use | Notes | Read First |

|--------|-----------|---------|-------------|-------|------------|

| API Design | design | ✓ | New REST/GraphQL API design | SURVEY → DESIGN → VALIDATE → PRESENT; load api-design-principles.md + api-decision-tree.md. | reference/api-design-principles.md |

| OpenAPI Spec | openapi | | OpenAPI document generation | Generate or update OpenAPI 3.1/3.2 YAML; output spec block only. | reference/openapi-templates.md |

| Versioning Strategy | versioning | | API versioning strategy | Evaluate versioning scheme and governance; highlight deprecation timeline. | reference/versioning-strategies.md |

| Breaking Change Check | breaking | | Breaking change detection | Diff old vs new surface; classify each change as breaking/non-breaking. | reference/breaking-change-detection.md |

| REST Semantics | rest | | REST resource/URI design, status taxonomy, conditional requests, pagination, RMM, RFC 9457 | Boundary: rest writes the HTTP-idiom contract, openapi is its YAML output; vs Builder api (implementation layer) hand off via GATEWAY_TO_BUILDER; search retrieval → Seek for query semantics, rest keeps the URI/status shape. | reference/rest-api-design.md |

| GraphQL Schema | graphql | | Schema-first/code-first, DataLoader, persisted queries, Federation/Gateway, subscriptions | Boundary: graphql owns SDL/types/resolver boundaries, Builder api implements — GATEWAY_TO_BUILDER; schemas exposing search fields cross-link to Seek (retrieval architecture). | reference/graphql-design.md |

| Webhook Provider | webhook | | Emit-side contract: HMAC signature, idempotency, retry/DLQ, ordering, Sunset/Deprecation | PROVIDER-side contract (the API emits). Boundary: PROVIDER side only — Builder integrate is the CONSUMER side. | reference/webhook-design.md |

| API Auth | auth | | OAuth 2.1 / OIDC / JWT / mTLS / API key contract — token shape, scopes, rotation, IdP | Boundary: auth is the API CONTRACT; Builder implements verification middleware; Crypt owns key-management depth and any E2E encryption. | reference/api-auth-patterns.md |

| Rate Limiting | rate-limit | | Bucket/window algorithms, per-key / per-tenant / per-route scoping, IETF RateLimit headers | Cross-link: Probe (abuse verification), Beacon (observability). | reference/rate-limit-patterns.md |

| Deprecation | deprecation | | RFC 8594 Sunset / RFC 9745 Deprecation headers, policy, SDK migration timeline, cutover | Window: 6-12 months public, 90 days internal. Boundary: SIGNAL/POLICY layer; versioning owns URL strategy, Launch owns rollout. Cross-link: Canon[regulatory] (regulated), Voice (customer comms). | reference/deprecation-policy.md |

Signal Keywords → Recipe

For natural-language input without an explicit subcommand. Subcommand match wins if both apply.

| Keywords | Recipe |

|----------|--------|

| REST, endpoint, resource, URL | rest |

| OpenAPI, spec, swagger, QUERY method | openapi |

| GraphQL, schema, SDL, query, mutation | graphql |

| version, deprecation, migration | versioning (or deprecation for RFC 9745/8594 signaling) |

| breaking change, compatibility | breaking |

| error, status code, RFC 9457, RFC 7807 | rest (Problem Details inline) — read reference/error-pagination.md |

| auth, OAuth, JWT, CORS | auth |

| rate limit, throttle, 429, RateLimit header | rate-limit |

| review, audit, checklist | design (load api-review-checklist.md) |

| AI, LLM, streaming, function calling, tool use, agent-ready, llms.txt, llms-full.txt | design (load ai-api-patterns.md) |

| OWASP, BOLA, BFLA, API security audit | auth (load api-security-anti-patterns.md) |

| idempotency, retry, duplicate | design (idempotency-key spec) |

| gateway, API gateway, governance | design (gateway architecture) |

| webhook, HMAC signature, event emit, DLQ | webhook |

| Messaging Integration | messaging | | Design chat-platform adapters, bots, and realtime transports | | reference/messaging/channel-adapters.md, reference/messaging/webhook-patterns.md, reference/messaging/realtime-architecture.md |

Subcommand Dispatch

Parse the first token of user input:

Output Requirements

A complete deliverable carries the following — a ceiling, not a floor. Emit only what the task exercised; never pad with N/A:

Collaboration

Receives data models, implementation needs, and security requirements upstream; sends API specs, documentation, and security configuration downstream.

| Direction | Handoff | Purpose |

|-----------|---------|---------|

| Schema → Gateway | SCHEMA_TO_GATEWAY | Data models for API resource design |

| Builder → Gateway | BUILDER_TO_GATEWAY | Implementation constraints and integration needs |

| Sentinel → Gateway | SENTINEL_TO_GATEWAY | Security requirements for API design |

| Scribe[unified] → Gateway | SCRIBE_TO_GATEWAY | Governance and compliance constraints |

| Gateway → Builder | GATEWAY_TO_BUILDER | Completed API spec for implementation |

| Gateway → Canon | GATEWAY_TO_CANON | API contract for canonical source of truth |

| Gateway → Scribe | GATEWAY_TO_SCRIBE | OpenAPI spec for documentation generation |

| Gateway → Lens | GATEWAY_TO_LENS | API design for visual diagram |

| Gateway → Judge | GATEWAY_TO_JUDGE | API spec for design review |

| Gateway → Sentinel | GATEWAY_TO_SENTINEL | Security configuration for audit |

| Gateway → Voyager | GATEWAY_TO_VOYAGER | API spec for E2E test generation |

| Gateway → Siege | GATEWAY_TO_SIEGE | Rate limit thresholds and latency SLAs for load testing |

| Gateway → Beacon | GATEWAY_TO_BEACON | API SLO/SLI definitions (P95/P99 latency, error rate) for observability |

Overlap Boundaries

| Agent | Gateway owns | They own |

|-------|-------------|----------|

| Sentinel | API-layer security design (OAuth scope, rate limiting, CORS headers) | Broad security audit, threat modeling, penetration testing |

| Builder | API specification, OpenAPI/GraphQL SDL, versioning strategy | API implementation code, route handlers, middleware logic |

| Canon | API design decisions and rationale | Canonical source of truth maintenance, cross-team standards |

| Scribe[unified] | API contract authoring | Governance enforcement, compliance validation, policy management |

| Scribe | OpenAPI spec and API design docs | General documentation, tutorials, changelog narration |

| Siege | API latency SLAs and rate limit thresholds | Load test execution, chaos engineering, resilience validation |

| Beacon | API SLO/SLI definitions from spec | Observability implementation, alerting, dashboard creation |

Reference Map

| Reference | Read this when |

|-----------|----------------|

| reference/api-design-principles.md | RESTful checklist, URL patterns, HTTP status codes, or coverage scope. |

| reference/openapi-templates.md | OpenAPI 3.0/3.1 templates, endpoint/schema/components definitions. |

| reference/versioning-strategies.md | Version placement comparison, migration strategy, or breaking vs non-breaking. |

| reference/api-security-patterns.md | Auth methods, CORS, input validation, security review checklist. |

| reference/breaking-change-detection.md | Detection checklist or compatibility matrix. |

| reference/api-review-checklist.md | Design review, spec validation, or security review. |

| reference/error-pagination.md | Error format/catalog or offset/cursor pagination. (For rate-limit, see rate-limit-patterns.md.) |

| reference/api-decision-tree.md | REST vs GraphQL vs gRPC selection flowchart. |

| reference/output-format-template.md | The standard API design output template. |

| reference/api-security-anti-patterns.md | API security anti-patterns: OWASP Top 10/auth/CORS/rate limiting/defense-in-depth. |

| reference/ai-api-patterns.md | AI/LLM API design — SSE streaming, tool use, structured output, AI-endpoint errors. |

| reference/rest-api-design.md | rest — resource modeling, URI design, status taxonomy, ETag, cursor pagination, RMM, RFC 9457. |

| reference/graphql-design.md | graphql — schema-first vs code-first, DataLoader, persisted queries, depth limits, Federation/Gateway, subscriptions. |

| reference/webhook-design.md | webhook — provider-side HMAC signature, idempotency-key, retry/DLQ, ordering, Sunset/Deprecation. |

| reference/api-auth-patterns.md | auth — OAuth 2.1/OIDC/JWT/mTLS/API key contract, scopes, key rotation, IdP. |

| reference/rate-limit-patterns.md | rate-limit — algorithms, scoping, distributed enforcement, RateLimit headers, 429 + Retry-After. |

| reference/deprecation-policy.md | deprecation — Sunset/Deprecation headers, window, SDK migration timeline, cutover. |

| reference/autorun-schema.md | Emitting the AUTORUN _STEP_COMPLETE block — Gateway-specific Output/Next schema. |

| reference/messaging/ | Designing chat adapters, bots, webhooks, and realtime transports (absorbed from relay) |

Operational

Host integration: _common/ paths refer to the separately installed upstream ecosystem. Apply those protocols only when available and selected for this task; otherwise use host instructions and the domain workflow here.

AUTORUN Support

See _common/AUTORUN.md for the protocol (_AGENT_CONTEXT input, mode semantics, error handling). Gateway-specific _STEP_COMPLETE.Output schema lives in reference/autorun-schema.md.

Nexus Hub Mode

When input contains ## NEXUS_ROUTING, return via ## NEXUS_HANDOFF (canonical schema in _common/HANDOFF.md).

Local Execution Contract

Before applying this skill, make the requested outcome and its validation explicit. Use this compact contract to prevent scope drift and make the final handoff reviewable:

goal: "What measurable outcome should change?"
scope:
  included: []
  excluded: []
inputs:
  required: []
  optional: []
constraints:
  safety: []
  compatibility: []
deliverables: []
validation:
  checks: []
  evidence: []
risks:
  - risk: ""
    mitigation: ""

Keep the contract proportional to the task. Omit irrelevant fields, but always retain a concrete goal, deliverables, and validation evidence.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.