AP

api-design-principles

Provides design principles for building intuitive REST and GraphQL APIs.

Install

mkdir -p .claude/skills/api-design-principles-repairyourtech && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/10739" && unzip -o skill.zip -d .claude/skills/api-design-principles-repairyourtech && rm skill.zip

Installs to .claude/skills/api-design-principles-repairyourtech

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.

Master REST and GraphQL API design principles to build intuitive, scalable, and maintainable APIs that delight developers. Use when designing new APIs, reviewing API specifications, or establishing API design standards.
219 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Design REST APIs
  • Design GraphQL APIs
  • Standardize status codes
  • Implement pagination

How it works

It provides a set of design principles and a checklist for creating consistent, scalable APIs.

Inputs & outputs

You give it
API requirements
You get back
API design specification

When to use api-design-principles

  • Designing a new API endpoint
  • Reviewing API documentation
  • Standardizing API responses

About this skill

API Design Principles

Design APIs that developers love to use — consistent, predictable, and well-documented.

When to Use

  • Designing new REST or GraphQL APIs
  • Reviewing API specs before implementation
  • Establishing API design standards for a team
  • Migrating between API paradigms

When NOT to Use

  • Framework-specific implementation details (use stack skills instead)
  • Infrastructure-only work without API contracts
  • Existing APIs that cannot be versioned

Core Rules

1. Resources Are Nouns, Methods Are Verbs

✅ GET    /api/users          → List users
✅ POST   /api/users          → Create user
✅ GET    /api/users/{id}     → Get user
✅ PATCH  /api/users/{id}     → Update user fields
✅ DELETE /api/users/{id}     → Delete user

❌ POST   /api/createUser
❌ GET    /api/getUserById
❌ POST   /api/deleteUser

2. HTTP Methods Have Meaning

MethodPurposeIdempotentSafeRequest Body
GETReadNo
POSTCreateYes
PUTReplaceYes
PATCHPartial updateYes
DELETERemoveNo

3. Status Codes Tell the Story

CodeWhenExample
200Success with bodyGET returns resource
201CreatedPOST creates new resource
204Success, no bodyDELETE succeeds
400Client sent bad dataMalformed JSON
401Not authenticatedMissing/invalid token
403Authenticated but not authorizedWrong role
404Resource doesn't existInvalid ID
409ConflictDuplicate email
422Valid JSON, invalid contentEmail format wrong
429Rate limitedToo many requests
500Server errorUnhandled exception

4. Error Responses Are Structured

{
  "error": "ValidationError",
  "code": "INVALID_EMAIL",
  "message": "Email address is not valid",
  "details": {
    "field": "email",
    "value": "not-an-email",
    "constraint": "Must be a valid email format"
  }
}

Rules:

  • Same envelope for every error
  • Machine-readable code for client logic
  • Human-readable message for display
  • details for field-level validation errors
  • NEVER include stack traces in production

5. Always Paginate Collections

GET /api/users?page=2&page_size=20

Response:
{
  "items": [...],
  "total": 243,
  "page": 2,
  "page_size": 20,
  "pages": 13
}

For GraphQL, use cursor-based pagination (Relay spec):

type UserConnection {
  edges: [UserEdge!]!
  pageInfo: PageInfo!
  totalCount: Int!
}

6. Version From Day One

StrategyURLHeaderQuery
Example/api/v1/usersAccept: application/vnd.api+json; version=1/api/users?version=1
ProsSimple, visibleClean URLsSimple to add
ConsURL pollutionHidden from browsersCaching complexity
Best forMost APIsInternal APIsQuick prototypes

7. Rate Limit Everything Public

Every public endpoint must return rate limit headers:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 42
X-RateLimit-Reset: 1625097600

API Design Checklist

Before implementing any endpoint:

  • Resource name is a plural noun
  • HTTP method matches the operation semantics
  • Request/response schemas are defined (contract-first)
  • Error responses use consistent envelope
  • Pagination is implemented for collection endpoints
  • Authentication and authorization rules are specified
  • Rate limiting is configured
  • API version is specified
  • Input validation rules are documented per field

Anti-Patterns

Don'tDo
Verbs in URLs (/getUser)Nouns + HTTP methods (GET /users)
200 for everythingCorrect status codes per operation
Generic errors ("Something went wrong")Structured errors with codes
Return all fields alwaysSupport field selection or use GraphQL
Nest resources >2 levels deep/users/{id}/orders max; flatten after that
Ignore backward compatibilityVersion APIs; deprecation headers before removal

Extended Reference

See resources/implementation-playbook.md for:

  • Full pagination implementation (FastAPI)
  • HATEOAS patterns
  • GraphQL schema design with Relay-style connections
  • DataLoader patterns for N+1 prevention
  • Complete code templates

When not to use it

  • Framework-specific implementation

Limitations

  • Not for existing APIs that cannot be versioned

How it compares

It focuses on API contract design rather than implementation details.

Compared to similar skills

api-design-principles side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
api-design-principles (this skill)03moNo flagsIntermediate
openapi-spec-generation222moNo flagsIntermediate
microsoft-code-reference75moReviewBeginner
openai-knowledge54moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

More by RepairYourTech

View all by RepairYourTech

You might also like

openapi-spec-generation

wshobson

Generate and maintain OpenAPI 3.1 specifications from code, design-first specs, and validation patterns. Use when creating API documentation, generating SDKs, or ensuring API contract compliance.

22122

microsoft-code-reference

github

Look up Microsoft API references, find working code samples, and verify SDK code is correct. Use when working with Azure SDKs, .NET libraries, or Microsoft APIs—to find the right method, check parameters, get working examples, or troubleshoot errors. Catches hallucinated methods, wrong signatures, and deprecated patterns by querying official docs.

747

openai-knowledge

openai

Use when working with the OpenAI API (Responses API) or OpenAI platform features (tools, streaming, Realtime API, auth, models, rate limits, MCP) and you need authoritative, up-to-date documentation (schemas, examples, limits, edge cases). Prefer the OpenAI Developer Documentation MCP server tools when available; otherwise guide the user to enable `openaiDeveloperDocs`.

539

agent-docs-api-openapi

ruvnet

Agent skill for docs-api-openapi - invoke with $agent-docs-api-openapi

432

openai-docs

openai

Use when the user asks how to build with OpenAI products or APIs and needs up-to-date official documentation with citations (for example: Codex, Responses API, Chat Completions, Apps SDK, Agents SDK, Realtime, model capabilities or limits); prioritize OpenAI docs MCP tools and restrict any fallback browsing to official OpenAI domains.

333

http-generate

spring-ai-alibaba

Generates HTTP request examples for Spring Boot Web interfaces according to task specification and saves them as .http files in module-generate.md directories

16

Search skills

Search the agent skills registry