agentsclimarketplace

Api design

Skill TrevorEdris/fellowship-of-the-workflows/skills/api-design

Design REST and GraphQL APIs. Covers endpoint naming, versioning, OpenAPI 3.1 specs, pagination, error handling, and auth patterns. Triggered by: design an API, REST endpoints, GraphQL schema, OpenAPI spec, API versioning, pagination strategy, error response format, create endpoints for, review API. Use even when the user just describes endpoints they need without explicitly asking for 'API design'.From its SKILL.md

Install
npx -y skills add TrevorEdris/fellowship-of-the-workflows --skill api-design

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 2 stars2 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

11.0 KB, as published. Nobody here has run it

API Design


Quick Start

Just describe your domain:

design an API for an e-commerce platform with products, orders, and customers

You'll get a complete endpoint design and OpenAPI snippet like:

paths:
  /v1/products:
    get:
      summary: List products
      parameters:
        - $ref: '#/components/parameters/PageLimit'
        - $ref: '#/components/parameters/PageCursor'
      responses:
        '200':
          description: Paginated product list
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductListResponse'
  /v1/products/{id}:
    get:
      summary: Get product by ID
      responses:
        '200':
          description: Product detail
        '404':
          $ref: '#/components/responses/NotFound'

What to include in your request:

  • Domain or system name (e-commerce, billing, identity)
  • Key resources (users, products, orders)
  • Relationships (orders belong to users, orders have line items)
  • Consumer context (mobile app, internal service, public API)
  • Existing constraints (auth system, versioning requirements)

Key Terms

TermDefinition
RESTRepresentational State Transfer — stateless, resource-oriented HTTP API style
GraphQLQuery language for APIs with a single endpoint and client-driven data fetching
OpenAPIStandard specification format for describing REST APIs (current version: 3.1)
EndpointA URL path + HTTP method combination that handles a specific operation
ResourceA noun representing an entity in your domain (user, order, product)
SchemaFormal definition of the shape and constraints of request/response data
IdempotencyAn operation that produces the same result no matter how many times it's called
HATEOASHypermedia As The Engine Of Application State — embedding navigable links in responses
PaginationStrategy for returning large datasets in chunks (offset-based or cursor-based)
Rate LimitingRestricting how often a client can call an endpoint within a time window

Quick Reference

TaskApproachKey Consideration
New APIStart with resource identificationModel the domain, not the UI
VersioningURL path /v1/ for simplicityCommit to support policy before launch
PaginationCursor-based for large/live dataOffset breaks on concurrent writes
AuthBearer token (JWT) as defaultScope to least privilege
Error handling{ error: { type, message, subcode } } envelopeMachine-readable codes, human-readable messages
GraphQL vs RESTREST for CRUD, GraphQL for flexible queriesConsider client diversity and caching needs

Process Overview

Your API Requirements
    |
    v
+-----------------------------------------------------+
| Phase 1: REQUIREMENTS                               |
| * Identify resources and relationships              |
| * Determine consumers (mobile, web, service-to-service) |
| * Define auth model and access control needs        |
| * Enumerate constraints (rate limits, SLAs, quotas) |
+-----------------------------------------------------+
    |
    v
+-----------------------------------------------------+
| Phase 2: DESIGN                                     |
| * Define URL structure and resource hierarchy       |
| * Map HTTP methods to CRUD operations               |
| * Design request/response schemas                   |
| * Choose auth mechanism and scoping                 |
+-----------------------------------------------------+
    |
    v
+-----------------------------------------------------+
| Phase 3: SPECIFY                                    |
| * Generate OpenAPI 3.1 spec (or GraphQL SDL)        |
| * Define error codes and Problem Details format     |
| * Document pagination strategy and parameters       |
| * Add examples for every endpoint                   |
+-----------------------------------------------------+
    |
    v
+-----------------------------------------------------+
| Phase 4: VALIDATE                                   |
| * Run verification checklist                        |
| * Assess breaking change risk                       |
| * Review auth coverage                              |
| * Confirm documentation completeness               |
+-----------------------------------------------------+
    |
    v
Production-Ready API Specification

Commands

CommandWhen to UseAction
design api for {domain}Starting freshFull endpoint design + OpenAPI spec
add endpoints for {resource}Extending existing APINew resource endpoints
openapi spec for {api}Formalizing existing designComplete OpenAPI 3.1 document
graphql schema for {domain}GraphQL APIType definitions + queries + mutations
review apiAuditing existing APIChecklist audit + recommendations

Workflow: Start with design api → formalize with openapi spec → extend with add endpoints → audit with review api


Core Principles

PrincipleWHYImplementation
Resource-oriented designResources are stable; operations on them are predictableNouns in URLs, verbs in HTTP methods
Consistent namingReduces cognitive load for consumersPlural nouns, kebab-case paths, camelCase fields
Explicit versioningAllows evolution without breaking clientsVersion in URL path or header, committed from day one
Defensive schemasFail fast on bad input; never trust caller dataRequired fields, format constraints, max lengths

Anti-Patterns

AvoidWhyInstead
Verbs in URLs (/getUser, /createOrder)Conflates HTTP method semanticsGET /users/{id}, POST /orders
Inconsistent pluralizationForces clients to memorize per-resource conventionsAlways plural: /users, /orders, /products
No versioning on day oneFirst breaking change forces emergency migrationAdd /v1/ from the start
Generic error responses ({"error": "failed"})Client can't distinguish or act on error{ error: { type, message, subcode } } with typed codes
Breaking changes without deprecationBreaks deployed clients silentlyAdditive changes only; Sunset header for removals
Nesting resources more than 2 levels deepURLs become unmaintainable and coupling increases/orders/{id}/items yes; /users/{id}/orders/{id}/items/{id} no
FLOAT for monetary values in responsesFloating-point rounding corrupts financial dataReturn money as integer cents or string decimal
Exposing internal IDs or database row numbersLeaks implementation, complicates migrationUse opaque IDs (UUIDs or slugs)

Verification Checklist

After designing an API:

  • All resource URLs use plural nouns
  • No verbs in URL paths
  • Nesting depth is 2 levels maximum
  • URL paths use kebab-case for multi-word segments
  • HTTP methods match semantics (GET=read, POST=create, PUT=replace, PATCH=partial, DELETE=remove)
  • PUT and DELETE are idempotent
  • Status codes are appropriate (201 for creation, 204 for no-content DELETE, 409 for conflict)
  • Version is in URL path or header, documented from day one
  • All endpoints with state mutation require auth
  • Error responses use { error: { type, message, subcode } } envelope
  • Validation errors include field-level detail
  • Pagination included for all collection endpoints
  • Pagination response includes meta.total, meta.cursor, or links.next
  • Money/currency fields use integer cents or string decimal (never float)
  • Dates use ISO 8601 in UTC (2025-10-31T14:30:00Z)
  • Content-Type is application/json on all JSON endpoints
  • Rate limiting headers documented (X-RateLimit-Limit, X-RateLimit-Remaining)
  • OpenAPI spec validates without errors
  • Every endpoint has at least one request/response example
  • Breaking changes assessed against existing consumers

See api-design-checklist.md for the full pre-launch review checklist. See openapi-templates.md for concrete OpenAPI 3.1 spec templates. See scalar-api-docs.md for interactive API documentation setup (Go, Python, TypeScript, Rust).


References

Consult these when you need detailed patterns for a specific aspect of API design:

ReferenceWhen to Read
rest-endpoint-design.mdURL structure, HTTP methods, status codes, sub-resource patterns
response-format.mdEnvelope structure, HATEOAS links, field naming, null/date/money handling
versioning-strategies.mdChoosing a versioning approach, lifecycle management, compatibility rules
pagination-patterns.mdOffset vs cursor pagination, response format, implementation patterns
error-handling.mdError envelope format, status code decision tree, RFC 9457, error code registry
auth-patterns.mdJWT, API keys, OAuth 2.0 flows, scoping, rate limiting headers
openapi-templates.mdCopy-paste OpenAPI 3.1 skeletons, reusable schema patterns, $ref strategy
graphql-patterns.mdType definitions, query/mutation patterns, Relay pagination, union error types
breaking-changes.mdBreaking vs non-breaking change matrix, deprecation process, migration guide template

Extension Points

  1. Framework-Specific Patterns: Express middleware, FastAPI dependency injection, Go net/http routing conventions
  2. API Gateway Integration: Kong, AWS API Gateway, Apigee — rate limiting, auth delegation, routing
  3. Contract Testing: Pact for consumer-driven contract tests; validate against OpenAPI spec with dredd
  4. SDK Generation: openapi-generator for client SDKs from OpenAPI spec; graphql-code-generator for TypeScript types
  5. Spec Validation Automation: spectral rulesets in CI, redocly lint for doc quality gates
  6. API Mocking: prism for mock servers from OpenAPI spec; enables parallel frontend/backend development
  7. Interactive Documentation: Scalar for modern, themeable API reference UI — see references/scalar-api-docs.md

Keep looking

Skills are one crate of 626,194. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.