Hypermedia
// Prompt: "Add HATEOAS links:// - Resource navigation// - Available actions// - Related resources// - Pagination links"
Master API development with Cursor IDE and Claude Code. These patterns cover REST, GraphQL, gRPC, API design principles, versioning strategies, security, documentation, and testing approaches optimized for AI-assisted development.
claude "Create OpenAPI 3.0 specification for e-commerce API"
# API design prompt:"Design REST resources for blog platform:- Hierarchical resources (/blogs/{id}/posts/{id}/comments)- Resource relationships- Consistent naming conventions- Action endpoints for non-CRUD- Bulk operations- Async operations with status endpoints"
Hypermedia
// Prompt: "Add HATEOAS links:// - Resource navigation// - Available actions// - Related resources// - Pagination links"
Content Negotiation
# Prompt: "Implement content negotiation:# - Multiple response formats# - Language selection# - Version negotiation# - Compression support"
# GraphQL schema prompt:"Design GraphQL schema for social network:- User types with relationships- Query complexity limiting- Dataloader for N+1 prevention- Subscription for real-time updates- Custom scalars- Federation support"
// Resolver optimization prompt:"Optimize GraphQL resolvers with:- Batch loading- Caching strategies- Query depth limiting- Field-level permissions- Error handling"
// Mutation patterns:"Implement mutations with:- Input validation- Optimistic updates- Error types- Side effects handling- Event emission"
// gRPC service prompt:"Create gRPC service for payment processing:- Protocol buffer definitions- Service methods (unary, streaming)- Error handling with status codes- Interceptors for auth/logging- Health checking- Load balancing support"
// Versioning implementation prompt:"Implement API versioning with:- URL versioning (/v1/, /v2/)- Header versioning- Content negotiation- Sunset headers- Migration guides- Backward compatibility"
Version Management
AI can help with:
// OAuth implementation prompt:"Implement OAuth 2.0 with:- Authorization code flow- Refresh token rotation- PKCE for public clients- Scope management- Token introspection- Revocation endpoints"
// JWT implementation:"Set up JWT auth with:- Token generation- Claims validation- Refresh strategy- Blacklisting- Key rotation"
// API key system:"Create API key management:- Key generation- Rate limiting per key- Scope restrictions- Usage analytics- Key rotation"
// Rate limiting prompt:"Implement rate limiting with:- Token bucket algorithm- Sliding window counters- Distributed rate limiting- User-based limits- Endpoint-specific limits- Graceful degradation"
# Documentation prompt:"Generate OpenAPI documentation with:- Complete schema definitions- Request/response examples- Authentication details- Error responses- Webhook specifications- Testing endpoints"
Interactive Docs
// Prompt: "Create Swagger UI with:// - Try-it-out functionality// - Code generation// - Multiple languages// - Environment switching"
SDK Generation
// Prompt: "Generate client SDKs:// - TypeScript/JavaScript// - Python// - Go// - Java// With proper error handling"
// Error handling prompt:"Design error response format:{ 'error': { 'code': 'RESOURCE_NOT_FOUND', 'message': 'User not found', 'details': {...}, 'timestamp': '2024-01-01T00:00:00Z', 'traceId': 'abc123' }}
Include:- Standard error codes- Localized messages- Debug information- Recovery suggestions"
# Offset pagination:"Implement offset pagination:- Page and limit parameters- Total count in response- Link headers- Max limit enforcement"
# Cursor pagination:"Implement cursor pagination:- Opaque cursor tokens- Stable sorting- Efficient queries- Bidirectional navigation"
// Webhook system prompt:"Create webhook system with:- Event registration- Payload signing- Retry logic- Dead letter queue- Event filtering- Delivery tracking"
// API testing prompt:"Create API test suite with:- Contract testing- Integration tests- Load testing- Security testing- Mock services- Test data management"
Test Automation
AI can generate:
# Caching implementation:"Implement HTTP caching with:- ETag generation- Cache-Control headers- Conditional requests- CDN integration- Cache invalidation- Vary headers"
// Monitoring prompt:"Set up API monitoring with:- Request/response logging- Performance metrics- Error tracking- Usage analytics- SLA monitoring- Alerting rules"
# API gateway prompt:"Configure API gateway for:- Request routing- Authentication- Rate limiting- Request/response transformation- Circuit breaking- Service discovery"
// Structure prompts like:"Design [REST/GraphQL/gRPC] API for [domain] with:- Use cases: [list specific operations]- Performance requirements: [SLA]- Security needs: [auth method]- Integration points: [external services]- Include examples and edge cases"
Design Review
AI can review for:
Code Generation
AI can generate:
// Event-driven API:"Implement event-driven API with:- Server-sent events- WebSocket support- Event sourcing- CQRS pattern- Event replay- Schema registry"
// API composition pattern:"Create API composition layer:- Backend for frontend (BFF)- Service aggregation- Response transformation- Fallback strategies- Cache coordination"