All skills
asyrafhussin avatar

/api-design-patterns

@1de3a7a

RESTful API design, error handling, versioning, and best practices. Use when designing APIs, reviewing endpoints, implementing error responses, or setting up API structure. Triggers on "design API", "review API", "REST best practices", or "API patterns".

Use this Skill: https://skilld.dev/gh/asyrafhussin/agent-skills/api-design-patterns

This session only. Nothing lands on disk.

rulesver-url-path.md

≈513 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Version in URL Path

Impact: HIGH (Explicit version visibility prevents accidental breaking-change consumption)

URL path versioning is the most explicit and widely adopted approach to API versioning. The version is visible in every request, making it impossible to accidentally hit the wrong version. It works naturally with routing, caching, load balancing, and documentation tools.

Incorrect

# No version — all consumers share one contract
GET /api/users
// v1 response shape
{
  "id": 1,
  "name": "Jane Smith",
  "email": "jane@example.com"
}
// After a breaking change — same URL, different shape
{
  "id": 1,
  "full_name": "Jane Smith",
  "email_address": "jane@example.com",
  "name": null
}

Problems:

  • Breaking changes immediately affect all consumers with no migration path
  • No way to run old and new versions side-by-side during transition periods
  • Clients cannot pin to a known-good contract — any deploy can break them
  • Rollback requires reverting the entire API, not just routing rules

Correct

# Version 1 — original contract
GET /api/v1/users/1
{
  "id": 1,
  "name": "Jane Smith",
  "email": "jane@example.com"
}
# Version 2 — new contract, coexists with v1
GET /api/v2/users/1
{
  "id": 1,
  "full_name": "Jane Smith",
  "email_address": "jane@example.com",
  "profile": {
    "avatar_url": "https://cdn.example.com/avatars/1.jpg"
  }
}

Benefits:

  • Version is immediately visible in URLs, logs, and documentation
  • Old and new versions run simultaneously — consumers migrate at their own pace
  • Load balancers and API gateways can route versions to different backends
  • CDNs and proxies cache each version independently without conflict

Reference: Stripe API - Versioning

Source: SKILL.md on GitHub

1 alert16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    This skill is a comprehensive documentation library for RESTful API design patterns. It provides best practices for resource design, error handling, security, and documentation. The skill contains no executable code, malicious instructions, or hidden functionality, and its references are restricted to well-known technical documentation sources.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer6mo

    4/28 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 1de3a7a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Steadyupdated 7 months ago
metadata
{
  "author": "agent-skills",
  "version": "2.0.0"
}

README badge

README badge for asyrafhussin/agent-skills/api-design-patterns