DE

designing-apis

Conventions for designing and reviewing consistent RESTful API endpoints.

Install

mkdir -p .claude/skills/designing-apis-pengfeng && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/13934" && unzip -o skill.zip -d .claude/skills/designing-apis-pengfeng && rm skill.zip

Installs to .claude/skills/designing-apis-pengfeng

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

REST API design patterns — endpoints, routes, routers, resources, HTTP methods, status codes, pagination, error responses, versioning. Use when designing, reviewing, or refactoring API endpoints.
195 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Design resource URLs with plural nouns and hyphens
  • Apply appropriate HTTP methods for API actions
  • Return correct HTTP status codes
  • Implement consistent error response formats
  • Support pagination for collection endpoints

How it works

The skill applies conventions for designing or reviewing REST API endpoints, covering URL structure, HTTP methods, status codes, error formats, and pagination.

Inputs & outputs

You give it
API endpoint design requirements
You get back
REST API endpoints adhering to conventions

When to use designing-apis

  • Designing api endpoints
  • Refactoring api routes
  • Reviewing status code responses
  • Implementing pagination

About this skill

API Design Conventions

Apply these conventions when designing or reviewing REST API endpoints.

Resource URLs

  • Plural nouns: /users, /products, /order-items
  • Lowercase with hyphens: /user-profiles not /userProfiles
  • Nest for ownership, max 2 levels: /users/{id}/orders
  • For deeper resources, promote to top-level: /order-items/{id} not /users/{id}/orders/{id}/items/{id}
  • Never use verbs: GET /users/{id} not GET /getUser/{id}

HTTP Methods

MethodPurposeIdempotentResponse
GETRetrieveYes200 with body
POSTCreateNo201 with created resource
PUTFull replaceYes200 with updated resource
PATCHPartial updateNo200 with updated resource
DELETERemoveYes204 no body

Status Codes

Use the correct code — never return 200 with an error in the body.

  • 2xx: 200 OK, 201 Created, 204 No Content
  • 4xx: 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 409 Conflict, 422 Validation Error, 429 Rate Limited
  • 5xx: 500 Internal Server Error, 503 Service Unavailable

Error Response Format

Always return a consistent error structure:

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

Pagination

All collection endpoints must support pagination. Prefer cursor-based for large/real-time datasets, offset-based for simpler cases.

{
  "data": [...],
  "pagination": {
    "total": 1000,
    "limit": 50,
    "offset": 100,
    "has_more": true
  }
}

Support filtering and sorting via query params:

  • Filter: ?status=active&role=admin
  • Sort: ?sort=-created_at (prefix - for descending)
  • Field selection: ?fields=id,name,email

Versioning

Use URL path versioning (/api/v1/...) only when introducing breaking changes. Do not version preemptively.

Checklist

When designing or reviewing an API, verify:

  • Resources are plural nouns, no verbs in URLs
  • Correct HTTP methods and status codes
  • Collections are paginated
  • Error responses use consistent format
  • Filtering/sorting supported where needed
  • No nesting deeper than 2 levels

See references.md for external guides and specs.

Limitations

  • Nesting of resources is limited to a maximum of 2 levels.

How it compares

This skill provides specific conventions for REST API design, unlike general software development practices.

Compared to similar skills

designing-apis side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
designing-apis (this skill)03moNo flagsIntermediate
api-design-principles722moNo flagsIntermediate
nodejs-backend-patterns122moNo flagsIntermediate
designing-apis16moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry