Skill

api-design

API design patterns for REST/GraphQL framework design, versioning strategies, and RFC 9457 error handling. Use when designing API endpoints, choosing versioning schemes, implementing Problem Details errors, or building OpenAPI specifications.

From ork
Install
1
Run in your terminal
$
npx claudepluginhub yonatangross/orchestkit --plugin ork
Tool Access

This skill is limited to using the following tools:

ReadGlobGrepWebFetchWebSearch
Supporting Assets
View in Repository
assets/asyncapi-template.yaml
assets/openapi-template.yaml
checklists/api-design-checklist.md
checklists/error-handling-checklist.md
checklists/versioning-checklist.md
examples/fastapi-problem-details.md
examples/fastapi-versioning.md
examples/orchestkit-api-design.md
metadata.json
references/frontend-integration.md
references/graphql-api.md
references/grpc-api.md
references/payload-access-control.md
references/payload-collection-design.md
references/payload-vs-sanity.md
references/rest-api.md
references/rest-patterns.md
references/rfc9457-spec.md
references/telegram-bot-api.md
references/versioning-strategies.md
Skill Content

API Design

Comprehensive API design patterns covering REST/GraphQL framework design, versioning strategies, and RFC 9457 error handling. Each category has individual rule files in rules/ loaded on-demand.

Quick Reference

CategoryRulesImpactWhen to Use
API Framework3HIGHREST conventions, resource modeling, OpenAPI specifications
Versioning3HIGHURL path versioning, header versioning, deprecation/sunset policies
Error Handling4HIGHRFC 9457 Problem Details, agent-facing errors, validation errors, error type registries
GraphQL2HIGHStrawberry code-first, DataLoader, permissions, subscriptions
gRPC2HIGHProtobuf services, streaming, interceptors, retry
Streaming2HIGHSSE endpoints, WebSocket bidirectional, async generators

| Integrations | 2 | HIGH | Messaging platforms (WhatsApp, Telegram), Payload CMS patterns |

Total: 18 rules across 7 categories

API Framework

REST and GraphQL API design conventions for consistent, developer-friendly APIs.

RuleFileKey Pattern
REST Conventionsrules/framework-rest-conventions.mdPlural nouns, HTTP methods, status codes, pagination
Resource Modelingrules/framework-resource-modeling.mdHierarchical URLs, filtering, sorting, field selection
OpenAPIrules/framework-openapi.mdOpenAPI 3.1 specs, documentation, schema definitions

Versioning

Strategies for API evolution without breaking clients.

RuleFileKey Pattern
URL Pathrules/versioning-url-path.md/api/v1/ prefix routing, version-specific schemas
Headerrules/versioning-header.mdX-API-Version header, content negotiation
Deprecationrules/versioning-deprecation.mdSunset headers, lifecycle management, breaking change policy

Error Handling

RFC 9457 Problem Details for machine-readable, standardized error responses.

RuleFileKey Pattern
Problem Detailsrules/errors-problem-details.mdRFC 9457 schema, application/problem+json, exception classes
Agent-Facing Errorsrules/errors-agent-facing.mdAgent extensions: retryable, error_category, content negotiation, token efficiency
Validationrules/errors-validation.mdField-level errors, Pydantic integration, 422 responses
Error Catalogrules/errors-error-catalog.mdProblem type registry, error type URIs, client handling

GraphQL

Strawberry GraphQL code-first schema with type-safe resolvers and FastAPI integration.

RuleFileKey Pattern
Schema Designrules/graphql-strawberry.mdType-safe schema, DataLoader, union errors, Private fields
Patterns & Authrules/graphql-schema.mdPermission classes, FastAPI integration, subscriptions

gRPC

High-performance gRPC for internal microservice communication.

RuleFileKey Pattern
Service Definitionrules/grpc-service.mdProtobuf, async server, client timeout, code generation
Streaming & Interceptorsrules/grpc-streaming.mdServer/bidirectional streaming, auth, retry backoff

Streaming

Real-time data streaming with SSE, WebSockets, and proper cleanup.

RuleFileKey Pattern
SSErules/streaming-sse.mdSSE endpoints, LLM streaming, reconnection, keepalive
WebSocketrules/streaming-websocket.mdBidirectional, heartbeat, aclosing(), backpressure

Integrations

Messaging platform integrations and headless CMS patterns.

RuleFileKey Pattern
Messaging Platformsrules/messaging-integrations.mdWhatsApp WAHA, Telegram Bot API, webhook security
Payload CMSrules/payload-cms.mdPayload 3.0 collections, access control, CMS selection

Quick Start Example

# REST endpoint with versioning and RFC 9457 errors
from fastapi import APIRouter, Depends, Request
from fastapi.responses import JSONResponse

router = APIRouter()

@router.get("/api/v1/users/{user_id}")
async def get_user(user_id: str, service: UserService = Depends()):
    user = await service.get_user(user_id)
    if not user:
        raise NotFoundProblem(
            resource="User",
            resource_id=user_id,
        )
    return UserResponseV1(id=user.id, name=user.full_name)

Key Decisions

DecisionRecommendation
Versioning strategyURL path (/api/v1/) for public APIs
Resource namingPlural nouns, kebab-case
PaginationCursor-based for large datasets
Error formatRFC 9457 Problem Details with application/problem+json
Error type URIYour API domain + /problems/ prefix
Support windowCurrent + 1 previous version
Deprecation notice3 months minimum before sunset
Sunset period6 months after deprecation
GraphQL schemaCode-first with Strawberry types
N+1 preventionDataLoader for all nested resolvers
GraphQL authPermission classes (context-based)
gRPC protoOne service per file, shared common.proto
gRPC streamingServer stream for lists, bidirectional for real-time
SSE keepaliveEvery 30 seconds
WebSocket heartbeatping-pong every 30 seconds
Async generator cleanupaclosing() for all external resources

Common Mistakes

  1. Verbs in URLs (POST /createUser instead of POST /users)
  2. Inconsistent error formats across endpoints
  3. Breaking contracts without version bump
  4. Plain text error responses instead of Problem Details
  5. Sunsetting versions without deprecation headers
  6. Exposing internal details (stack traces, DB errors) in errors
  7. Missing Content-Type: application/problem+json on error responses
  8. Supporting too many concurrent API versions (max 2-3)
  9. Caching without considering version isolation

Evaluations

See test-cases.json for 9 test cases across all categories.

Related Skills

  • fastapi-advanced - FastAPI-specific implementation patterns
  • rate-limiting - Advanced rate limiting implementations and algorithms
  • observability-monitoring - Version usage metrics and error tracking
  • input-validation - Validation patterns beyond API error handling
  • streaming-api-patterns - SSE and WebSocket patterns for real-time APIs

Capability Details

rest-design

Keywords: rest, restful, http, endpoint, route, path, resource, CRUD Solves:

  • How do I design RESTful APIs?
  • REST endpoint patterns and conventions
  • HTTP methods and status codes

graphql-design

Keywords: graphql, schema, query, mutation, connection, relay Solves:

  • How do I design GraphQL APIs?
  • Schema design best practices
  • Connection pattern for pagination

endpoint-design

Keywords: endpoint, route, path, resource, CRUD, openapi Solves:

  • How do I structure API endpoints?
  • What's the best URL pattern for this resource?
  • RESTful endpoint naming conventions

url-versioning

Keywords: url version, path version, /v1/, /v2/ Solves:

  • How to version REST APIs?
  • URL-based API versioning

header-versioning

Keywords: header version, X-API-Version, content negotiation Solves:

  • Clean URL versioning
  • Header-based API version

deprecation

Keywords: deprecation, sunset, version lifecycle, backward compatible Solves:

  • How to deprecate API versions?
  • Version sunset policy
  • Breaking vs non-breaking changes

problem-details

Keywords: problem details, RFC 9457, RFC 7807, structured error, application/problem+json Solves:

  • How to standardize API error responses?
  • What format for API errors?

agent-facing-errors

Keywords: agent error, AI agent, retryable, retry_after, error_category, content negotiation, accept header, token efficient, machine readable Solves:

  • How to design error responses for AI agent consumers?
  • How to reduce token cost of error responses?
  • How to enable deterministic agent error handling?
  • Content negotiation for agents vs browsers vs LLMs

validation-errors

Keywords: validation, field error, 422, unprocessable, pydantic Solves:

  • How to handle validation errors in APIs?
  • Field-level error responses

error-registry

Keywords: error registry, problem types, error catalog, error codes Solves:

  • How to document all API errors?
  • Error type management
Stats
Parent Repo Stars128
Parent Repo Forks14
Last CommitMar 15, 2026