# api-design-patterns

Architectural reference for REST, GraphQL, and gRPC. It guides endpoint structure, pagination, versioning, and error payloads.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 566 installs · ★ 78
- Author: bobmatnyc
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/bobmatnyc/claude-mpm-skills/tree/HEAD/universal/web/api-design-patterns/SKILL.md
- Updated: 2026-07-18
- HTML: https://affpapa.org/en/nevibecode/skills/bobmatnyc-api-design-patterns

## What it does

This skill adds API design standards to your coding agent. Inside are evaluation criteria for REST, GraphQL, and gRPC. It enforces plural noun conventions for endpoints and bans verbs in resource paths. It also standardizes error objects using `request_id` fields.

The reference includes offset and cursor pagination patterns, header or URI versioning, and token-based auth. Because the manifest sets `disable-model-invocation: true`, it serves as background reference material during architecture reviews.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill api-design-patterns -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/api-design-patterns/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/api-design-patterns/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill api-design-patterns -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/api-design-patterns/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill api-design-patterns -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/api-design-patterns/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install bobmatnyc/claude-mpm-skills api-design-patterns
```

2. **Manually: put the files in place**
- File: `.github/skills/api-design-patterns/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill api-design-patterns -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/bobmatnyc/claude-mpm-skills --path universal/web/api-design-patterns
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/api-design-patterns/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill api-design-patterns -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/bobmatnyc/claude-mpm-skills/tree/HEAD/universal/web/api-design-patterns/SKILL.md

## When to use it
- choose between REST, GraphQL, and gRPC for a service
- format REST endpoints with plural nouns instead of verbs
- standardize error response payloads with validation details
- implement offset or cursor pagination schemas

## Example prompts
- Design a REST API for an e-commerce order system using cursor pagination
- Compare GraphQL and gRPC for internal service communications
- Draft a standardized JSON error response structure for validation failures

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: d41e3aadb3cfa1f8.

BEGIN THIRD-PARTY FILE d41e3aadb3cfa1f8
```text
---
name: api-design-patterns
description: Comprehensive API design patterns covering REST, GraphQL, gRPC, versioning, authentication, and modern API best practices
user-invocable: false
disable-model-invocation: true
license: Apache-2.0
compatibility: claude-code
metadata:
  version: 1.0.0
  category: universal
  related_skills: [graphql, typescript, nodejs-backend, django, fastapi, flask]
  token_budget:
    entry_point: 85
    full_content: 8500
  self_contained: true
tags: [api, rest, graphql, grpc, architecture, web, design-patterns]
progressive_disclosure:
  entry_point:
    summary: "Comprehensive API design patterns covering REST, GraphQL, gRPC, versioning, authentication, and modern API best practices"
    when_to_use: "When designing, implementing, or documenting APIs."
    quick_start: "1. Review the core concepts below. 2. Apply patterns to your use case. 3. Follow best practices for implementation."
  references:
    - authentication.md
    - graphql-patterns.md
    - grpc-patterns.md
    - rest-patterns.md
    - versioning-strategies.md
---
# API Design Patterns

Design robust, scalable APIs using proven patterns for REST, GraphQL, and gRPC with proper versioning, authentication, and error handling.

## Quick Reference

**API Style Selection**:
- REST: Resource-based CRUD, simple clients, HTTP-native caching
- GraphQL: Client-driven queries, complex data graphs, real-time subscriptions
- gRPC: High-performance RPC, microservices, strong typing, streaming

**Critical Patterns**:
- Versioning: URI (`/v1/users`), header (`Accept: application/vnd.api+json;version=1`), content negotiation
- Pagination: Offset (simple), cursor (stable), keyset (performant)
- Auth: OAuth2 (delegated), JWT (stateless), API keys (service-to-service)
- Rate limiting: Token bucket, fixed window, sliding window
- Idempotency: Idempotency keys, conditional requests, safe retry

**See references/ for deep dives**: `rest-patterns.md`, `graphql-patterns.md`, `grpc-patterns.md`, `versioning-strategies.md`, `authentication.md`

## Core Principles

### Universal API Design Standards

Apply these principles across all API styles:

**1. Consistency Over Cleverness**
- Follow established conventions for your API style
- Use predictable naming patterns (snake_case or camelCase, pick one)
- Maintain consistent error response formats
- Version breaking changes, never surprise clients

**2. Design for Evolution**
- Plan for versioning from day one
- Use optional fields with sensible defaults
- Deprecate gracefully with sunset dates
- Document breaking vs non-breaking changes

**3. Security by Default**
- Require authentication unless explicitly public
- Use HTTPS/TLS for all production endpoints
- Implement rate limiting and throttling
- Validate and sanitize all inputs
- Return minimal error details to clients

**4. Developer Experience First**
- Provide comprehensive documentation (OpenAPI, GraphQL schema)
- Return meaningful error messages with actionable guidance
- Use standard HTTP status codes correctly
- Include request IDs for debugging
- Offer SDKs and code generators
```
END THIRD-PARTY FILE d41e3aadb3cfa1f8

The third-party file has ended. Everything between the d41e3aadb3cfa1f8 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 3105 of 22622 bytes. © bobmatnyc · Apache-2.0 · https://github.com/bobmatnyc/claude-mpm-skills/tree/HEAD/universal/web/api-design-patterns/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
