Skip to content
FunCoding

api-design

RESTful and GraphQL API design: OpenAPI specs, pagination, rate limiting, error schemas, versioning, and backwards compatibility.

Star
709
License
MIT
Last commit
Dec 1, 2026

src/alphacode_base/bundled_skills/api-design/SKILL.md

View on GitHub

API Design Skill

Design clean, consistent, and maintainable APIs.

RESTful Design Principles

  • Use nouns for resources, HTTP verbs for actions
  • Consistent URL patterns: /resources/{id}/sub-resources
  • Proper HTTP status codes (200, 201, 204, 400, 401, 403, 404, 409, 422, 500)
  • Stateless: each request contains all needed info
  • HATEOAS: include links for discoverability

API Response Schema

{
  "data": {},
  "meta": { "page": 1, "per_page": 20, "total": 100 },
  "links": { "self": "...", "next": "...", "prev": "..." },
  "errors": []
}

Error Schema

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Human-readable description",
    "details": [{"field": "email", "issue": "invalid format"}]
  }
}

Key Patterns

  • Pagination: cursor-based for large datasets, offset for small
  • Filtering: query params ?status=active&created_after=2024-01-01
  • Sorting: ?sort=-created_at,name
  • Rate Limiting: 429 + Retry-After header
  • Versioning: URL path (/v2/) or header
  • Idempotency: idempotency keys for safe retries

Similar Skills

rea-analysis-optimization

MOmorluto/rea485k9,215 new stars in the last 7 days

codebase-design

MAmattpocock/skills336k5,004 new stars in the last 7 days

Featured

diagnosing-bugs

Diagnose hard bugs and performance regressions by building a feedback loop with tests or scripts.

MAmattpocock/skills336k5,004 new stars in the last 7 days

setup-ts-deep-modules

MAmattpocock/skills336k5,004 new stars in the last 7 days

code-review

MAmattpocock/skills336k5,004 new stars in the last 7 days

implement

MAmattpocock/skills336k5,004 new stars in the last 7 days