Api gateway
A comprehensive skill catalog for AI agents
npx -y skills add G1Joshi/Agent-Skills --skill api-gatewayAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 10 stars10 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
API Gateway pattern for routing. Use for microservices entry.
SKILL.md
2.1 KB, as published. Nobody here has run it
API Gateway
An API Gateway sits between clients (Mobile, Web) and services. It acts as a reverse proxy, accepting all API calls, aggregating the various services required to fulfill them, and returning the appropriate result.
When to Use
- Microservices: Essential to hide the complexity of backend services (Service Discovery).
- Cross-Cutting Concerns: Centralizing Authentication, SSL Termination, Rate Limiting, and Logging.
- Protocol Translation: Converting HTTP (Client) to gRPC (Internal).
Core Functionality
Routing
GET /users -> User Service
GET /orders -> Order Service
Aggregation (BFF - Backend for Frontend)
Combining results. One request to Gateway -> Calls User Service + Order Service -> Returns combined JSON.
Offloading
- Auth: Validating JWT tokens at the edge.
- Cache: Serving static or cached responses.
Common Patterns
Backend for Frontend (BFF)
Creating specific gateways for different clients (e.g., one for Mobile with small payloads, one for Web with rich payloads).
Best Practices
Do:
- Use mature tools: Kong, Traefik, AWS API Gateway, Nginx.
- Implement Rate Limiting to prevent DoS.
- Use Correlation IDs for tracing requests across services.
Don't:
- Don't put business logic in the Gateway (It's not a service).
- Don't let it become a Single Point of Failure (High Availability is key).
Troubleshooting
| Error | Cause | Solution |
|---|---|---|
502 Bad Gateway | Upstream service down or unreachable. | Check internal service health and firewall rules. |
504 Gateway Timeout | Upstream taking too long. | Optimize service or increase timeout (carefully). |