← All skills
Api Gateway Engineer
Use when designing or implementing an API gateway — routing, rate limiting, authentication proxying, or traffic transformation between clients and backend services.
About this skill
Use when designing or implementing an API gateway — routing, rate limiting, authentication proxying, or traffic transformation between clients and backend services.
SKILL.md
api-gateway-engineer.SKILL.mdPlace it in your Syntic skills folder. For Syntic Code, install in your local skills directory, review the contents and run it in a controlled environment first.
--- name: Api Gateway Engineer description: Use when designing or implementing an API gateway — routing, rate limiting, authentication proxying, or traffic transformation between clients and backend services. category: Engineering version: 1.0.0 tools: [] --- # API Gateway Engineer Design and implement gateway layers that protect, route, and transform traffic between clients and backend services, handling millions of requests with sub-millisecond overhead. ## Gateway Architecture Design 1. Map all upstream services, their health check endpoints, and expected traffic patterns. 2. Define routing rules based on path prefix, host header, HTTP method, and custom header matching. 3. Design the middleware pipeline order: TLS termination → rate limiting → authentication → authorization → request transformation → routing → response transformation → logging. 4. Choose the gateway technology by requirement: Kong for its plugin ecosystem, Envoy for service mesh integration, Nginx for raw throughput, or a custom Node.js/Go gateway for maximum flexibility. 5. Treat configuration as code — store gateway routes and policies in version-controlled YAML or JSON. ## Rate Limiting Strategies - Use token bucket for bursty traffic and sliding window for smooth rate enforcement. - Apply limits at multiple granularities: per-IP, per-API-key, per-user, per-endpoint, and globally. - Use Redis or an in-memory store for distributed rate limit counters, synchronized across gateway instances. - Return `429 Too Many Requests` with a `Retry-After` header indicating when the client can retry. - Implement graduated rate limiting: warn at 80% of quota via response headers, throttle at 100%. - Include `X-RateLimit-Limit`, `X-RateLimit-Remaining`, and `X-RateLimit-Reset` headers on every response. ## Authentication and Authorization - Terminate authentication at the gateway; forward authenticated identity to upstream services via trusted headers. - Support multiple mechanisms: JWT validation, API key lookup, OAuth 2.0 token introspection, mTLS client certificates. - Cache JWT validation results with a TTL shorter than the token expiry; invalidate on key rotation. - Apply RBAC or ABAC policies at the gateway for coarse-grained authorization; leave fine-grained checks to services. - Use a dedicated auth service for token issuance — the gateway only validates and forwards claims. ## Request Routing and Load Balancing - Use weighted routing for canary deployments: send 1%, 5%, 25%, 50%, 100% of traffic to new versions. - Use consistent hashing for session-sticky routing when upstream services hold local state. - Configure circuit breakers per upstream: open after 5 consecutive failures, half-open after 30 seconds, close after 3 successes. - Set per-route timeouts: 30s max for API endpoints, 300s for file uploads, 5s for health checks. - Retry with exponential backoff and jitter, only on 502, 503, 504, and connection errors. ## Request and Response Transformation - Strip internal headers before forwarding upstream; add tracing headers (`X-Request-ID`, `traceparent`). - Transform request bodies for API versioning — accept v2 format from clients, convert to v1 for legacy backends. - Aggregate responses from multiple upstream services into one client response for BFF patterns. - Compress responses with gzip or brotli at the gateway level; set `Vary: Accept-Encoding`. ## Observability and Monitoring - Log every request: method, path, status code, latency, upstream service, client IP, and request ID. - Emit metrics for request rate, error rate, latency percentiles (P50, P95, P99), and active connections per upstream. - Trace requests end-to-end with OpenTelemetry, propagating trace context through the gateway to upstream services. - Alert on error rate spikes, latency degradation, and upstream health check failures. ## Before Completing a Task - Load test the configuration with realistic traffic patterns using k6 or wrk. - Verify rate limiting by sending requests above the configured threshold. - Test authentication with valid, expired, malformed, and missing tokens. - Confirm circuit breaker activation by simulating upstream failures.
Install
Syntic App
- 1Create a dedicated folder for this skill in your local skills library.
- 2Place SKILL.md into that folder.
- 3Restart Syntic and invoke this skill on matching tasks.
Syntic Code (CLI)
- 1Save SKILL.md in your local Syntic Code skills directory.
- 2Keep related files in the same skill folder.
- 3Run in a safe environment and validate outputs.