api-gateway-patterns
API Gateway patterns for routing, authentication, rate limiting, and service composition in microservices architectures. Use when implementing API gateways, building BFF layers, or managing service-to-service communication at scale.
What this skill does
# API Gateway Patterns Expert guidance for implementing API gateways with routing, authentication, traffic management, and service composition patterns for microservices architectures at scale. ## When to Use This Skill - Implementing API gateway infrastructure for microservices - Designing Backend for Frontend (BFF) layers - Adding authentication and authorization at the gateway level - Implementing rate limiting, circuit breakers, and retry logic - Setting up service discovery and dynamic routing - Building API composition and aggregation layers - Managing cross-cutting concerns (logging, monitoring, CORS) - Evaluating gateway solutions (Kong, Nginx, Envoy, AWS API Gateway) ## Core Concepts ### Gateway Responsibilities **Routing**: Direct requests to appropriate backend services based on path, headers, or host **Security**: Centralized authentication, authorization, and API key validation **Traffic Management**: Rate limiting, circuit breakers, retry logic **Composition**: Aggregate multiple service calls into unified responses **Transformation**: Modify requests/responses for client optimization or legacy adaptation ### Architecture Patterns **Single Gateway**: One gateway for all clients (simple, potential bottleneck) **BFF Pattern**: Separate gateway per client type (mobile, web, admin) - optimized for each **GraphQL Gateway**: Schema stitching across services, client-driven data fetching **Service Mesh**: Distributed gateway pattern with sidecar proxies (Istio, Linkerd) ## Quick Reference | Task | Load reference | | --- | --- | | Routing strategies (path, header, host-based) | `skills/api-gateway-patterns/references/routing-patterns.md` | | Request/response transformation | `skills/api-gateway-patterns/references/transformation.md` | | API composition and aggregation | `skills/api-gateway-patterns/references/composition.md` | | Authentication & authorization (JWT, OAuth, RBAC) | `skills/api-gateway-patterns/references/authentication.md` | | Traffic management (rate limiting, circuit breakers) | `skills/api-gateway-patterns/references/traffic-management.md` | | Backend for Frontend (BFF) pattern | `skills/api-gateway-patterns/references/bff-pattern.md` | | Service discovery integration | `skills/api-gateway-patterns/references/service-discovery.md` | | Gateway implementations (Kong, Nginx, Envoy, AWS) | `skills/api-gateway-patterns/references/implementations.md` | ## Implementation Workflow ### Phase 1: Requirements Analysis 1. **Identify client types**: Mobile, web, admin, partners 2. **Map service landscape**: Catalog backend services and endpoints 3. **Define cross-cutting concerns**: Auth, logging, monitoring, CORS 4. **Determine composition needs**: Which endpoints require aggregation? 5. **Establish SLAs**: Latency, throughput, availability targets ### Phase 2: Gateway Design 1. **Choose architecture**: Single gateway vs BFF vs GraphQL 2. **Select implementation**: Kong, Nginx, Envoy, AWS API Gateway 3. **Design routing rules**: Path-based, header-based, host-based 4. **Plan authentication**: JWT, OAuth 2.0, API keys, or hybrid 5. **Define traffic policies**: Rate limits, circuit breakers, timeouts ### Phase 3: Implementation 1. **Set up infrastructure**: Deploy gateway instances, configure load balancer 2. **Implement routing**: Configure service discovery and route definitions 3. **Add authentication**: JWT validation, OAuth integration, API key management 4. **Apply traffic management**: Rate limiting, circuit breakers, retry logic 5. **Enable observability**: Distributed tracing, metrics, structured logging ### Phase 4: Testing & Optimization 1. **Load testing**: Verify performance under expected and peak load 2. **Failure injection**: Test circuit breakers and retry logic 3. **Security testing**: Verify auth flows, token validation, RBAC policies 4. **Latency optimization**: Cache strategies, connection pooling 5. **Monitor and tune**: Adjust timeouts, limits based on real traffic ## Best Practices 1. **Centralize Cross-Cutting Concerns**: Authentication, logging, monitoring at gateway 2. **Keep Gateway Lightweight**: Avoid complex business logic, delegate to services 3. **Implement Health Checks**: Monitor upstream service health, remove unhealthy instances 4. **Use Circuit Breakers**: Prevent cascading failures, fail fast 5. **Apply Rate Limiting**: Protect services from overload, implement tiered limits 6. **Enable Observability**: Distributed tracing, metrics, structured logging 7. **Version APIs**: Support multiple API versions, plan deprecation 8. **Secure Communication**: TLS everywhere, mutual TLS for service-to-service 9. **Cache Strategically**: Response caching, but invalidate properly 10. **Test Resilience**: Chaos engineering, failure injection, load testing ## Common Mistakes 1. **Business Logic in Gateway**: Keep gateway focused on routing/security, not business rules 2. **Chatty Composition**: Too many upstream calls (use BFF, GraphQL, or caching) 3. **Single Point of Failure**: Deploy redundantly, use load balancers 4. **No Timeout Configuration**: Always set connection/read timeouts to prevent hanging requests 5. **Ignoring Backpressure**: Implement queue limits, graceful degradation 6. **Over-Aggregation**: Don't make gateway do too much work (compute-heavy transformations) 7. **Inadequate Monitoring**: Must track latency, errors, throughput at gateway level 8. **No Rate Limiting**: Services will be overwhelmed eventually without protection 9. **Synchronous Everything**: Use async patterns for non-critical operations 10. **No Version Strategy**: Breaking changes break all clients simultaneously ## Resources - **Kong**: https://docs.konghq.com/gateway/latest/ - **Nginx**: https://nginx.org/en/docs/ - **Envoy**: https://www.envoyproxy.io/docs/envoy/latest/ - **AWS API Gateway**: https://docs.aws.amazon.com/apigateway/ - **Patterns**: "Microservices Patterns" by Chris Richardson - **Service Mesh**: https://istio.io/latest/docs/ - **Circuit Breakers**: Martin Fowler's CircuitBreaker pattern - **BFF Pattern**: Sam Newman's "Building Microservices"
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.