TeoSlayer/pilot-skills / skills/pilot-api-gateway-manager-setup
pilot-api-gateway-manager-setup
VerifiedDeploy an API gateway management system with 4 agents. Use this skill when: 1. User wants to set up API gateway management with service discovery, routing, auth, and monitoring 2. User is configuring agents for API request routing, rate limiting, or backend health tracking 3. User asks about API gateway pipelines, service registries, or request authentication workflows Do NOT use this skill when: - User wants a single load balancer (use pilot-load-balancer instead) - User wants to verify a single token (use pilot-verify instead) - User only needs health checks (use pilot-health instead)
README.md
View on GitHub# API Gateway Manager
Deploy an API gateway management system with 4 agents that handle service discovery, request routing, authentication, and monitoring. A discovery agent registers backend microservices and tracks their health, a router distributes incoming requests based on path and load, an auth gateway validates credentials and enforces rate limits, and a monitor tracks latency and error rates while alerting on anomalies. The feedback loop from monitor to discovery enables automatic removal of unhealthy backends.
**Difficulty:** Intermediate | **Agents:** 4
## Roles
### discovery (Service Discovery)
Registers and discovers backend microservices, maintains a live service registry, and runs periodic health checks to detect failed or degraded backends.
**Skills:** pilot-discover, pilot-health, pilot-heartbeat-monitor
### router (Request Router)
Routes incoming API requests to appropriate backends based on path matching, header inspection, and current load distribution. Balances traffic across healthy instances.
**Skills:** pilot-load-balancer, pilot-task-router, pilot-metrics
### auth (Auth Gateway)
Validates API keys and JWT tokens, enforces per-client rate limits and quotas, and blocks known-bad actors. Logs all access decisions for audit compliance.
**Skills:** pilot-verify, pilot-audit-log, pilot-blocklist
### monitor (API Monitor)
Tracks request latency, error rates, and throughput across all backends. Generates dashboards and fires alerts when anomalies exceed configured thresholds.
**Skills:** pilot-metrics, pilot-alert, pilot-slack-bridge
## Data Flow
```
discovery --> router : Service registry updates with healthy backends (port 1002)
router --> auth : Auth requests for incoming API calls (port 1002)
auth --> monitor : Access logs with auth decisions and client metadata (port 1002)
monitor --> discovery: Health feedback to deregister failing backends (port 1002)
monitor --> external : API alerts to ops dashboards and Slack (port 443)
```
## Setup
Replace `<your-prefix>` with a unique name for your deployment (e.g. `acme`).
### 1. Install skills on each server
```bash
# On server 1 (service discovery)
clawhub install pilot-discover pilot-health pilot-heartbeat-monitor
pilotctl set-hostname <your-prefix>-discovery
# On server 2 (request router)
clawhub install pilot-load-balancer pilot-task-router pilot-metrics
pilotctl set-hostname <your-prefix>-router
# On server 3 (auth gateway)
clawhub install pilot-verify pilot-audit-log pilot-blocklist
pilotctl set-hostname <your-prefix>-auth
# On server 4 (API monitor)
clawhub install pilot-metrics pilot-alert pilot-slack-bridge
pilotctl set-hostname <your-prefix>-monitor
```
### 2. Establish trust
Agents are private by default. Each pair that communicates must exchange handshakes. When both sides send a handshake, trust is auto-approved -- no manual step needed.
```bash
# discovery <-> router
# On discovery:
pilotctl handshake <your-prefix>-router "setup: api-gateway-manager"
# On router:
pilotctl handshake <your-prefix>-discovery "setup: api-gateway-manager"
# router <-> auth
# On router:
pilotctl handshake <your-prefix>-auth "setup: api-gateway-manager"
# On auth:
pilotctl handshake <your-prefix>-router "setup: api-gateway-manager"
# auth <-> monitor
# On auth:
pilotctl handshake <your-prefix>-monitor "setup: api-gateway-manager"
# On monitor:
pilotctl handshake <your-prefix>-auth "setup: api-gateway-manager"
# monitor <-> discovery (feedback loop)
# On monitor:
pilotctl handshake <your-prefix>-discovery "setup: api-gateway-manager"
# On discovery:
pilotctl handshake <your-prefix>-monitor "setup: api-gateway-manager"
```
### 3. Verify
```bash
pilotctl trust
```
## Try It
After setup is complete, run these commands to see data flowing between your agents:
```bash
# On <your-prefix>-router -- subscribe to service registry updates:
pilotctl subscribe <your-prefix>-discovery service-registry
# On <your-prefix>-discovery -- publish a service registration:
pilotctl publish <your-prefix>-router service-registry '{"service":"user-api","version":"2.1.0","instances":[{"host":"10.0.1.5","port":8080,"health":"passing"},{"host":"10.0.1.6","port":8080,"health":"passing"}],"routes":["/api/v2/users/*"]}'
# On <your-prefix>-auth -- subscribe to auth requests from router:
pilotctl subscribe <your-prefix>-router auth-request
# On <your-prefix>-router -- publish an auth request:
pilotctl publish <your-prefix>-auth auth-request '{"request_id":"req-88210","path":"/api/v2/users/profile","method":"GET","api_key":"key_example_4eC39HqLyjWDarjtT1zdp7dc","client_ip":"203.0.113.42","headers":{"Authorization":"Bearer eyJhbGciOiJSUzI1NiJ9..."}}'
# On <your-prefix>-monitor -- subscribe to access logs from auth:
pilotctl subscribe <your-prefix>-auth access-log
# On <your-prefix>-auth -- publish an access log:
pilotctl publish <your-prefix>-monitor access-log '{"request_id":"req-88210","client":"acme-corp","decision":"allow","latency_ms":12,"rate_limit_remaining":847,"quota_used_pct":15.3}'
# On <your-prefix>-discovery -- subscribe to health feedback from monitor:
pilotctl subscribe <your-prefix>-monitor health-feedback
# On <your-prefix>-monitor -- publish health feedback:
pilotctl publish <your-prefix>-discovery health-feedback '{"service":"user-api","instance":"10.0.1.6:8080","status":"failing","error_rate":0.42,"p99_latency_ms":2800,"recommendation":"deregister"}'
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |