API Development & Design — Quick Reference
This skill provides execution-ready patterns for designing, implementing, and documenting production-grade APIs. Claude should apply these patterns when users need REST API design, GraphQL schemas, OpenAPI specifications, API versioning, authentication flows, or API documentation.
Modern Best Practices (Dec 2025): HTTP semantics and cacheability (RFC 9110), Problem Details error model (RFC 9457), OpenAPI 3.1, API-first + contract testing, strong AuthN/Z boundaries, explicit versioning/deprecation, and operable-by-default APIs (rate limits, idempotency, observability).
When to Use This Skill
Claude should invoke this skill when a user requests:
- REST API design and endpoint structure
- GraphQL schema design and resolver patterns
- gRPC service definitions and protocol buffers
- OpenAPI/Swagger specification creation
- API versioning strategies (URL, header, content negotiation)
- Authentication and authorization flows (JWT, OAuth2, API keys)
- Rate limiting, throttling, and quota management
- API pagination, filtering, and sorting patterns
- Error response standardization
- API documentation and developer portals
- API security best practices (OWASP API Security Top 10)
- API testing strategies (contract testing, mock servers)
- API gateway configuration and management
Quick Reference
| Task |
Pattern/Tool |
Key Elements |
When to Use |
| Design REST API |
RESTful Design |
Nouns (not verbs), HTTP methods, proper status codes |
Resource-based APIs, CRUD operations |
| Version API |
URL Versioning |
/api/v1/resource, /api/v2/resource |
Breaking changes, client migration |
| Paginate results |
Cursor-Based |
cursor=eyJpZCI6MTIzfQ&limit=20 |
Real-time data, large collections |
| Handle errors |
RFC 9457 Problem Details |
type, title, status, detail, errors[] |
Consistent error responses |
| Authenticate |
JWT Bearer |
Authorization: Bearer <token> |
Stateless auth, microservices |
| Rate limit |
Token Bucket |
X-RateLimit-* headers, 429 responses |
Prevent abuse, fair usage |
| Document API |
OpenAPI 3.1 |
Swagger UI, Redoc, code samples |
Interactive docs, client SDKs |
| Flexible queries |
GraphQL |
Schema-first, resolvers, DataLoader |
Client-driven data fetching |
| High-performance |
gRPC + Protobuf |
Binary protocol, streaming |
Internal microservices |
Decision Tree: Choosing API Style
User needs: [API Type]
├─ Public API for third parties?
│ └─ REST with OpenAPI docs (broad compatibility)
│
├─ Internal microservices?
│ ├─ High throughput required? → **gRPC** (binary, fast)
│ └─ Simple CRUD? → **REST** (easy to debug)
│
├─ Client needs flexible queries?
│ ├─ Real-time updates? → **GraphQL Subscriptions** or **WebSockets**
│ └─ Complex data fetching? → **GraphQL** (avoid over-fetching)
│
├─ Mobile/web clients?
│ ├─ Many entity types? → **GraphQL** (single endpoint)
│ └─ Simple resources? → **REST** (cacheable)
│
└─ Streaming or bidirectional?
└─ **gRPC** (HTTP/2 streaming) or **WebSockets**
Navigation: Core API Patterns
RESTful API Design
Resource: resources/restful-design-patterns.md
- Resource-based URLs with proper HTTP methods (GET, POST, PUT, PATCH, DELETE)
- HTTP status code semantics (200, 201, 404, 422, 500)
- Idempotency guarantees (GET, PUT, DELETE)
- Stateless design principles
- URL structure best practices (collection vs resource endpoints)
- Nested resources and action endpoints
Pagination, Filtering & Sorting
Resource: resources/pagination-filtering.md
- Offset-based pagination (simple, static datasets)
- Cursor-based pagination (real-time feeds, recommended)
- Page-based pagination (UI with page numbers)
- Query parameter filtering with operators (
_gt, _contains, _in)
- Multi-field sorting with direction (
-created_at)
- Performance optimization with indexes
Error Handling
Resource: resources/error-handling-patterns.md
- RFC 9457 Problem Details standard
- HTTP status code reference (4xx client errors, 5xx server errors)
- Field-level validation errors
- Trace IDs for debugging
- Consistent error format across endpoints
- Security-safe error messages (no stack traces in production)
Authentication & Authorization
Resource: resources/authentication-patterns.md
- JWT (JSON Web Tokens) with refresh token rotation
- OAuth2 Authorization Code Flow for third-party auth
- API Key authentication for server-to-server
- RBAC (Role-Based Access Control)
- ABAC (Attribute-Based Access Control)
- Resource-based authorization (user-owned resources)
Rate Limiting & Throttling
Resource: resources/rate-limiting-patterns.md
- Token Bucket algorithm (recommended, allows bursts)
- Fixed Window vs Sliding Window
- Rate limit headers (
X-RateLimit-*)
- Tiered rate limits (free, paid, enterprise)
- Redis-based distributed rate limiting
- Per-user, per-endpoint, and per-API-key strategies
Navigation: Extended Resources
API Design & Best Practices
- api-design-best-practices.md - Comprehensive API design principles
- versioning-strategies.md - URL, header, and query parameter versioning
- api-security-checklist.md - OWASP API Security Top 10
GraphQL & gRPC
- graphql-patterns.md - Schema design, resolvers, N+1 queries, DataLoader
- gRPC patterns - See software-backend for Protocol Buffers and service definitions
OpenAPI & Documentation
- openapi-guide.md - OpenAPI 3.1 specifications, Swagger UI, Redoc
- Templates: templates/openapi-template.yaml - Complete OpenAPI spec example
Optional: AI/Automation (LLM/Agent APIs)
- llm-agent-api-contracts.md - Streaming, long-running jobs, safety guardrails, observability
Navigation: Templates
Production-ready, copy-paste API implementations with authentication, database, validation, and docs.
Framework-Specific Templates
FastAPI (Python): templates/fastapi/fastapi-complete-api.md
- Async/await, Pydantic v2, JWT auth, SQLAlchemy 2.0, pagination, OpenAPI docs
Express.js (Node/TypeScript): templates/express-nodejs/express-complete-api.md
- TypeScript, Zod validation, Prisma ORM, JWT refresh tokens, rate limiting
Django REST Framework: templates/django-rest/django-rest-complete-api.md
- ViewSets, serializers, Simple JWT, permissions, DRF filtering/pagination
Spring Boot (Java): templates/spring-boot/spring-boot-complete-api.md
- Spring Security JWT, Spring Data JPA, Bean Validation, Springdoc OpenAPI
Cross-Platform Patterns
- api-patterns-universal.md - Universal patterns for all frameworks
- Authentication strategies, pagination, caching, versioning, validation
- template-api-governance.md - NEW API governance, deprecation, multi-tenancy
- Deprecation policy (90-day timeline), backward compatibility rules, error model templates
- template-api-design-review-checklist.md - Production API review checklist (security, reliability, operability)
- template-api-error-model.md - RFC 9457 Problem Details + stable error code registry
Do / Avoid
GOOD: Do
- Version APIs from day one
- Document deprecation policy before first deprecation
- Use semantic versioning for API versions
- Include trace IDs in all error responses
- Return appropriate HTTP status codes
- Implement rate limiting with clear headers
- Use RFC 9457 Problem Details for errors
BAD: Avoid
- Removing fields without deprecation period
- Changing field types in existing versions
- Using verbs in resource names (nouns only)
- Returning 500 for client errors
- Breaking changes without major version bump
- Mixing tenant data without explicit isolation
- Action endpoints everywhere (/doSomething)
Anti-Patterns
| Anti-Pattern |
Problem |
Fix |
| Instant deprecation |
Breaks clients |
90-day minimum sunset period |
| Action endpoints |
Inconsistent API |
Use resources + HTTP verbs |
| Version in body |
Hard to route, debug |
Version in URL or header |
| Generic errors |
Poor DX |
Specific error codes + messages |
| No rate limit headers |
Clients can't back off |
Include X-RateLimit-* |
| Tenant ID in URL only |
Forgery risk |
Validate against auth token |
| Leaky abstractions |
Tight coupling |
Design stable contracts |
Optional: AI/Automation
Note: AI tools assist but contracts need human review.
- OpenAPI linting — Spectral, Redocly in CI/CD
- Breaking change detection — oasdiff automated checks
- SDK generation — From OpenAPI spec on changes
- Contract testing — Pact, Dredd automation
Bounded Claims
- AI-generated OpenAPI specs require human review
- Automated deprecation detection needs manual confirmation
- SDK generation requires type verification
External Resources
See data/sources.json for:
- Official REST, GraphQL, gRPC documentation
- OpenAPI/Swagger tools and validators
- API design style guides (Google, Microsoft, Stripe)
- Security standards (OWASP API Security Top 10)
- Testing tools (Postman, Insomnia, Paw)
Quick Decision Matrix
| Scenario |
Recommendation |
| Public API for third parties |
REST with OpenAPI docs |
| Internal microservices |
gRPC for performance, REST for simplicity |
| Client needs flexible queries |
GraphQL |
| Real-time updates |
GraphQL Subscriptions or WebSockets |
| Simple CRUD operations |
REST |
| Complex data fetching |
GraphQL |
| High throughput required |
gRPC |
| Mobile/web clients |
REST or GraphQL |
Anti-Patterns to Avoid
- Verbs in URLs:
/getUserById → /users/:id
- Ignoring HTTP methods: Using GET for mutations
- No versioning: Breaking changes without version bump
- Inconsistent error format: Different error structures per endpoint
- Missing pagination: Returning unbounded lists
- No rate limiting: Allowing unlimited requests
- Poor documentation: Missing examples, outdated specs
- Security by obscurity: Not using HTTPS, weak auth
Related Skills
This skill works best when combined with other specialized skills:
Backend Development
- software-backend - Production backend patterns (Node.js, Python, Java frameworks)
- Use when implementing API server infrastructure
- Covers database integration, middleware, error handling
Security & Authentication
- software-security-appsec - Application security patterns
- Critical for securing API endpoints
- Covers OWASP vulnerabilities, authentication flows, input validation
Database & Data Layer
- data-sql-optimization - SQL optimization and database patterns
- Essential for API performance (query optimization, indexing)
- Use when APIs interact with relational databases
Testing & Quality
- qa-testing-strategy - Test strategy and automation
- Contract testing for API specifications
- Integration testing for API endpoints
DevOps & Deployment
- ops-devops-platform - Platform engineering and deployment
- API gateway configuration
- CI/CD pipelines for API deployments
Documentation
- docs-codebase - Technical documentation standards
- API reference documentation structure
- Complements OpenAPI auto-generated docs
Architecture
Performance & Observability
- qa-observability - Performance optimization and monitoring
- API latency monitoring, distributed tracing
- Performance budgets for API endpoints
Usage Notes
For Claude:
- Apply RESTful principles by default unless user requests GraphQL/gRPC
- Always include pagination for list endpoints
- Use RFC 9457 format for error responses
- Include authentication in all templates (JWT or API keys)
- Reference framework-specific templates for complete implementations
- Link to relevant resources for deep-dive guidance
Success Criteria: APIs are discoverable, consistent, well-documented, secure, and follow HTTP/GraphQL semantics correctly.
1---2name: dev-api-design3description: Production-grade API design patterns for REST, GraphQL, and gRPC. Covers API architecture, OpenAPI/Swagger specs, versioning strategies, authentication flows, rate limiting, pagination, error handling, and documentation best practices for modern API development.4---56# API Development & Design — Quick Reference78This skill provides execution-ready patterns for designing, implementing, and documenting production-grade APIs. Claude should apply these patterns when users need REST API design, GraphQL schemas, OpenAPI specifications, API versioning, authentication flows, or API documentation.910**Modern Best Practices (Dec 2025)**: HTTP semantics and cacheability (RFC 9110), Problem Details error model (RFC 9457), OpenAPI 3.1, API-first + contract testing, strong AuthN/Z boundaries, explicit versioning/deprecation, and operable-by-default APIs (rate limits, idempotency, observability).1112---1314## When to Use This Skill1516Claude should invoke this skill when a user requests:1718- REST API design and endpoint structure19- GraphQL schema design and resolver patterns20- gRPC service definitions and protocol buffers21- OpenAPI/Swagger specification creation22- API versioning strategies (URL, header, content negotiation)23- Authentication and authorization flows (JWT, OAuth2, API keys)24- Rate limiting, throttling, and quota management25- API pagination, filtering, and sorting patterns26- Error response standardization27- API documentation and developer portals28- API security best practices (OWASP API Security Top 10)29- API testing strategies (contract testing, mock servers)30- API gateway configuration and management3132---3334## Quick Reference3536| Task | Pattern/Tool | Key Elements | When to Use |37|------|--------------|--------------|-------------|38| **Design REST API** | RESTful Design | Nouns (not verbs), HTTP methods, proper status codes | Resource-based APIs, CRUD operations |39| **Version API** | URL Versioning | `/api/v1/resource`, `/api/v2/resource` | Breaking changes, client migration |40| **Paginate results** | Cursor-Based | `cursor=eyJpZCI6MTIzfQ&limit=20` | Real-time data, large collections |41| **Handle errors** | RFC 9457 Problem Details | `type`, `title`, `status`, `detail`, `errors[]` | Consistent error responses |42| **Authenticate** | JWT Bearer | `Authorization: Bearer <token>` | Stateless auth, microservices |43| **Rate limit** | Token Bucket | `X-RateLimit-*` headers, 429 responses | Prevent abuse, fair usage |44| **Document API** | OpenAPI 3.1 | Swagger UI, Redoc, code samples | Interactive docs, client SDKs |45| **Flexible queries** | GraphQL | Schema-first, resolvers, DataLoader | Client-driven data fetching |46| **High-performance** | gRPC + Protobuf | Binary protocol, streaming | Internal microservices |4748---4950## Decision Tree: Choosing API Style5152```text53User needs: [API Type]54 ├─ Public API for third parties?55 │ └─ REST with OpenAPI docs (broad compatibility)56 │57 ├─ Internal microservices?58 │ ├─ High throughput required? → **gRPC** (binary, fast)59 │ └─ Simple CRUD? → **REST** (easy to debug)60 │61 ├─ Client needs flexible queries?62 │ ├─ Real-time updates? → **GraphQL Subscriptions** or **WebSockets**63 │ └─ Complex data fetching? → **GraphQL** (avoid over-fetching)64 │65 ├─ Mobile/web clients?66 │ ├─ Many entity types? → **GraphQL** (single endpoint)67 │ └─ Simple resources? → **REST** (cacheable)68 │69 └─ Streaming or bidirectional?70 └─ **gRPC** (HTTP/2 streaming) or **WebSockets**71```7273---7475## Navigation: Core API Patterns7677### RESTful API Design7879**Resource:** [resources/restful-design-patterns.md](resources/restful-design-patterns.md)8081- Resource-based URLs with proper HTTP methods (GET, POST, PUT, PATCH, DELETE)82- HTTP status code semantics (200, 201, 404, 422, 500)83- Idempotency guarantees (GET, PUT, DELETE)84- Stateless design principles85- URL structure best practices (collection vs resource endpoints)86- Nested resources and action endpoints8788---8990### Pagination, Filtering & Sorting9192**Resource:** [resources/pagination-filtering.md](resources/pagination-filtering.md)9394- Offset-based pagination (simple, static datasets)95- Cursor-based pagination (real-time feeds, recommended)96- Page-based pagination (UI with page numbers)97- Query parameter filtering with operators (`_gt`, `_contains`, `_in`)98- Multi-field sorting with direction (`-created_at`)99- Performance optimization with indexes100101---102103### Error Handling104105**Resource:** [resources/error-handling-patterns.md](resources/error-handling-patterns.md)106107- RFC 9457 Problem Details standard108- HTTP status code reference (4xx client errors, 5xx server errors)109- Field-level validation errors110- Trace IDs for debugging111- Consistent error format across endpoints112- Security-safe error messages (no stack traces in production)113114---115116### Authentication & Authorization117118**Resource:** [resources/authentication-patterns.md](resources/authentication-patterns.md)119120- JWT (JSON Web Tokens) with refresh token rotation121- OAuth2 Authorization Code Flow for third-party auth122- API Key authentication for server-to-server123- RBAC (Role-Based Access Control)124- ABAC (Attribute-Based Access Control)125- Resource-based authorization (user-owned resources)126127---128129### Rate Limiting & Throttling130131**Resource:** [resources/rate-limiting-patterns.md](resources/rate-limiting-patterns.md)132133- Token Bucket algorithm (recommended, allows bursts)134- Fixed Window vs Sliding Window135- Rate limit headers (`X-RateLimit-*`)136- Tiered rate limits (free, paid, enterprise)137- Redis-based distributed rate limiting138- Per-user, per-endpoint, and per-API-key strategies139140---141142## Navigation: Extended Resources143144### API Design & Best Practices145146- **[api-design-best-practices.md](resources/api-design-best-practices.md)** - Comprehensive API design principles147- **[versioning-strategies.md](resources/versioning-strategies.md)** - URL, header, and query parameter versioning148- **[api-security-checklist.md](resources/api-security-checklist.md)** - OWASP API Security Top 10149150### GraphQL & gRPC151152- **[graphql-patterns.md](resources/graphql-patterns.md)** - Schema design, resolvers, N+1 queries, DataLoader153- **gRPC patterns** - See [software-backend](../software-backend/SKILL.md) for Protocol Buffers and service definitions154155### OpenAPI & Documentation156157- **[openapi-guide.md](resources/openapi-guide.md)** - OpenAPI 3.1 specifications, Swagger UI, Redoc158- **Templates:** [templates/openapi-template.yaml](templates/openapi-template.yaml) - Complete OpenAPI spec example159160### Optional: AI/Automation (LLM/Agent APIs)161162- **[llm-agent-api-contracts.md](resources/llm-agent-api-contracts.md)** - Streaming, long-running jobs, safety guardrails, observability163164---165166## Navigation: Templates167168Production-ready, copy-paste API implementations with authentication, database, validation, and docs.169170### Framework-Specific Templates171172- **FastAPI (Python)**: [templates/fastapi/fastapi-complete-api.md](templates/fastapi/fastapi-complete-api.md)173 - Async/await, Pydantic v2, JWT auth, SQLAlchemy 2.0, pagination, OpenAPI docs174175- **Express.js (Node/TypeScript)**: [templates/express-nodejs/express-complete-api.md](templates/express-nodejs/express-complete-api.md)176 - TypeScript, Zod validation, Prisma ORM, JWT refresh tokens, rate limiting177178- **Django REST Framework**: [templates/django-rest/django-rest-complete-api.md](templates/django-rest/django-rest-complete-api.md)179 - ViewSets, serializers, Simple JWT, permissions, DRF filtering/pagination180181- **Spring Boot (Java)**: [templates/spring-boot/spring-boot-complete-api.md](templates/spring-boot/spring-boot-complete-api.md)182 - Spring Security JWT, Spring Data JPA, Bean Validation, Springdoc OpenAPI183184### Cross-Platform Patterns185186- **[api-patterns-universal.md](templates/cross-platform/api-patterns-universal.md)** - Universal patterns for all frameworks187 - Authentication strategies, pagination, caching, versioning, validation188- **[template-api-governance.md](templates/cross-platform/template-api-governance.md)** - **NEW** API governance, deprecation, multi-tenancy189 - Deprecation policy (90-day timeline), backward compatibility rules, error model templates190- **[template-api-design-review-checklist.md](templates/cross-platform/template-api-design-review-checklist.md)** - Production API review checklist (security, reliability, operability)191- **[template-api-error-model.md](templates/cross-platform/template-api-error-model.md)** - RFC 9457 Problem Details + stable error code registry192193---194195## Do / Avoid196197### GOOD: Do198199- Version APIs from day one200- Document deprecation policy before first deprecation201- Use semantic versioning for API versions202- Include trace IDs in all error responses203- Return appropriate HTTP status codes204- Implement rate limiting with clear headers205- Use RFC 9457 Problem Details for errors206207### BAD: Avoid208209- Removing fields without deprecation period210- Changing field types in existing versions211- Using verbs in resource names (nouns only)212- Returning 500 for client errors213- Breaking changes without major version bump214- Mixing tenant data without explicit isolation215- Action endpoints everywhere (/doSomething)216217---218219## Anti-Patterns220221| Anti-Pattern | Problem | Fix |222|--------------|---------|-----|223| **Instant deprecation** | Breaks clients | 90-day minimum sunset period |224| **Action endpoints** | Inconsistent API | Use resources + HTTP verbs |225| **Version in body** | Hard to route, debug | Version in URL or header |226| **Generic errors** | Poor DX | Specific error codes + messages |227| **No rate limit headers** | Clients can't back off | Include X-RateLimit-* |228| **Tenant ID in URL only** | Forgery risk | Validate against auth token |229| **Leaky abstractions** | Tight coupling | Design stable contracts |230231---232233## Optional: AI/Automation234235> **Note**: AI tools assist but contracts need human review.236237- **OpenAPI linting** — Spectral, Redocly in CI/CD238- **Breaking change detection** — oasdiff automated checks239- **SDK generation** — From OpenAPI spec on changes240- **Contract testing** — Pact, Dredd automation241242### Bounded Claims243244- AI-generated OpenAPI specs require human review245- Automated deprecation detection needs manual confirmation246- SDK generation requires type verification247248---249250## External Resources251252See [data/sources.json](data/sources.json) for:253254- Official REST, GraphQL, gRPC documentation255- OpenAPI/Swagger tools and validators256- API design style guides (Google, Microsoft, Stripe)257- Security standards (OWASP API Security Top 10)258- Testing tools (Postman, Insomnia, Paw)259260---261262## Quick Decision Matrix263264| Scenario | Recommendation |265|----------|----------------|266| Public API for third parties | REST with OpenAPI docs |267| Internal microservices | gRPC for performance, REST for simplicity |268| Client needs flexible queries | GraphQL |269| Real-time updates | GraphQL Subscriptions or WebSockets |270| Simple CRUD operations | REST |271| Complex data fetching | GraphQL |272| High throughput required | gRPC |273| Mobile/web clients | REST or GraphQL |274275---276277## Anti-Patterns to Avoid278279- **Verbs in URLs**: `/getUserById` → `/users/:id`280- **Ignoring HTTP methods**: Using GET for mutations281- **No versioning**: Breaking changes without version bump282- **Inconsistent error format**: Different error structures per endpoint283- **Missing pagination**: Returning unbounded lists284- **No rate limiting**: Allowing unlimited requests285- **Poor documentation**: Missing examples, outdated specs286- **Security by obscurity**: Not using HTTPS, weak auth287288---289290## Related Skills291292This skill works best when combined with other specialized skills:293294### Backend Development295296- **[software-backend](../software-backend/SKILL.md)** - Production backend patterns (Node.js, Python, Java frameworks)297 - Use when implementing API server infrastructure298 - Covers database integration, middleware, error handling299300### Security & Authentication301302- **[software-security-appsec](../software-security-appsec/SKILL.md)** - Application security patterns303 - Critical for securing API endpoints304 - Covers OWASP vulnerabilities, authentication flows, input validation305306### Database & Data Layer307308- **[data-sql-optimization](../data-sql-optimization/SKILL.md)** - SQL optimization and database patterns309 - Essential for API performance (query optimization, indexing)310 - Use when APIs interact with relational databases311312### Testing & Quality313314- **[qa-testing-strategy](../qa-testing-strategy/SKILL.md)** - Test strategy and automation315 - Contract testing for API specifications316 - Integration testing for API endpoints317318### DevOps & Deployment319320- **[ops-devops-platform](../ops-devops-platform/SKILL.md)** - Platform engineering and deployment321 - API gateway configuration322 - CI/CD pipelines for API deployments323324### Documentation325326- **[docs-codebase](../docs-codebase/SKILL.md)** - Technical documentation standards327 - API reference documentation structure328 - Complements OpenAPI auto-generated docs329330### Architecture331332- **[software-architecture-design](../software-architecture-design/SKILL.md)** - System design patterns333 - Microservices architecture with APIs334 - API gateway patterns, service mesh integration335336### Performance & Observability337338- **[qa-observability](../qa-observability/SKILL.md)** - Performance optimization and monitoring339 - API latency monitoring, distributed tracing340 - Performance budgets for API endpoints341342---343344## Usage Notes345346**For Claude:**347348- Apply RESTful principles by default unless user requests GraphQL/gRPC349- Always include pagination for list endpoints350- Use RFC 9457 format for error responses351- Include authentication in all templates (JWT or API keys)352- Reference framework-specific templates for complete implementations353- Link to relevant resources for deep-dive guidance354355**Success Criteria:** APIs are discoverable, consistent, well-documented, secure, and follow HTTP/GraphQL semantics correctly.