Communitygithub.com

curiositech/windags-skills

使用 Kong、Nginx、Traefik 进行 API 网关和反向代理配置,涵盖路由、认证和认证中间件。激活关键词:API 网关、反向代理、Kong、Nginx、Traefik、负载均衡、入口、认证中间件。不适用于:限流算法(请使用 api-rate-limiting-throttling-expert)、服务网格(请使用 service-mesh-microservices-expert)。

windags-skills 是什么?

该技能旨在帮助开发者配置和优化 API 网关与反向代理,专注于路由、认证、限流和流量管理。它支持多种主流网关技术,包括 Kong、Nginx、Traefik、Envoy、AWS API Gateway 和 Azure Application Gateway。技能提供了清晰的决策树,用于选择认证策略(如 API 密钥、JWT、mTLS、OAuth2)和网关技术,以及上游路由策略(如动态发现、固定池、地理路由)。此外,它还详细列出了常见的故障模式(如超时、认证绕过、熔断器抖动、证书过期和资源耗尽)及其诊断和修复步骤。通过实际案例(如电商 API 网关设置和金丝雀部署回滚),展示了从问题检测到解决方案的完整工作流程,并提供了严格的质量检查清单和界限说明,确保正确使用。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/curiositech/windags-skills/tree/HEAD/skills/api-gateway-reverse-proxy-expert

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

API 网关与反向代理专家

配置和优化 API 网关与反向代理,用于路由、认证、限流和流量管理。

决策点

认证策略选择

流量模式与需求
├── 仅内部服务
│   └── API 密钥认证
│       ├── 低复杂度,快速验证
│       └── Kong: key-auth 插件, Traefik: forwardAuth
├── 面向客户的 API,有会话需求
│   └── JWT 认证
│       ├── 无状态,包含用户声明
│       └── Kong: jwt 插件, Nginx: lua-resty-jwt
├── 企业 B2B 集成
│   └── mTLS 认证
│       ├── 基于证书,最高安全性
│       └── Kong: mtls-auth, Nginx: ssl_verify_client
└── 第三方 SaaS 集成
    └── OAuth2 流程
        ├── 令牌交换,委托认证
        └── Kong: oauth2 插件, AWS API Gateway: 授权器

网关技术选择

需求 → 选择
├── 需要插件生态和图形界面
│   └── Kong Enterprise/OSS
├── 原生集成 Kubernetes,自动发现
│   └── Traefik v3 或 Ingress-NGINX
├── 最大性能,最少功能
│   └── Nginx 或 Envoy
└── 云托管,无服务器弹性扩缩
    └── AWS API Gateway 或 Azure Application Gateway

上游路由策略

服务架构 → 路由方法
├── 微服务,含服务发现
│   └── 动态上游目标
│       ├── Consul/Eureka 集成
│       └── 基于健康检查的负载均衡
├── 静态后端服务
│   └── 固定的上游池
│       ├── 轮询或最少连接
│       └── 加权路由用于金丝雀部署
└── 多区域部署
    └── 地理路由
        ├── 基于延迟或地理 IP
        └── 回退到辅助区域

故障模式

网关超时级联

症状: 负载下 API 响应缓慢(>10秒)
检测: 响应时间飙升,但上游服务报告正常延迟
根因: 网关超时大于上游超时,导致请求排队
修复: 设置网关读取超时 < 上游超时(网关:30秒,上游:25秒)

认证绕过

症状: 未经授权的请求到达后端服务
检测: 后端日志显示请求缺少预期的认证头
根因: 路由顺序允许宽松规则在认证规则之前匹配
修复: 将认证中间件移至全局级别,或确保特定路由在配置中优先

熔断器抖动

症状: 流量高峰期间间歇性出现 503 错误
检测: 熔断器快速打开/关闭(每分钟多次)
根因: 阈值过于敏感或健康检查配置错误
修复: 调整故障阈值(5次以上)和恢复时间(至少30秒)

SSL 证书过期

症状: HTTPS 握手失败,浏览器证书警告
检测: SSL 证书检查显示30天内到期
根因: 手动证书管理,没有自动续期
修复: 实施 cert-manager(K8s)或带有自动续期的 ACME 客户端

资源耗尽

症状: 网关停止接受连接,内存/CPU 达到 100%
检测: 连接被拒绝错误,网关健康检查失败
根因: 未设置连接限制或插件内存泄漏
修复: 设置 worker_connections(Nginx)或连接池限制(Kong),重启网关

实际案例

场景:电商 API 网关设置

背景: 为处理订单、库存和支付的微服务部署 Kong,并使用 JWT 认证

第1步:路由定义

# 首先标识服务端点
services:
  - orders: /api/v1/orders/* → http://orders:8080
  - inventory: /api/v1/inventory/* → http://inventory:8080  
  - payments: /api/v1/payments/* → http://payments:8080

第2步:应用决策树

  • 流量模式:面向客户的 API → JWT 认证
  • 架构:微服务 → 动态上游目标
  • 需求:需要插件生态 → 选择 Kong

第3步:插件排序

# 按正确顺序应用插件
plugins:
  1. cors(认证前)
  2. jwt(认证)
  3. rate-limiting(认证后)
  4. request-transformer(最后)

专家 vs 新手:

  • 新手错误: 在认证前应用限流(匿名用户消耗配额)
  • 专家做法: 先认证,然后对每个已认证用户进行限流
  • 新手错误: 使用全局 CORS 策略
  • 专家做法: 每条路由使用不同的 CORS(orders 允许管理员源,payments 限制为前端)

故障场景:金丝雀部署出错

情况: 将 20% 的流量部署到新的订单服务版本,看到 500 错误

检测过程:

  1. 检查网关指标:500 错误率与部署时间同步飙升
  2. 上游健康检查:新版本健康检查失败
  3. 网关日志:上游连接超时

回滚步骤:

# 第1步:立即切换流量
kong:
  routes:
    - service: orders-v1
      weight: 100  # 之前为 80
    - service: orders-v2  
      weight: 0    # 之前为 20

# 第2步:验证回滚
curl -H "Authorization: Bearer $JWT" \
  https://api.company.com/orders/health

# 第3步:移除失败的上游
kubectl scale deployment orders-v2 --replicas=0

根因分析: 新版本数据库连接池配置错误,导致负载下超时

质量检查

  • 所有路由都有显式路径匹配(没有捕获所有 /* 路由)
  • 认证中间件配置在业务逻辑插件之前
  • 健康检查在5秒内对健康上游返回 2xx
  • 熔断器阈值已设置:60秒窗口内5次故障,30秒恢复
  • TLS 证书在到期前30多天自动续期
  • 限流按已认证用户应用,而非全局
  • CORS 策略将源限制为仅必要的域名
  • 网关超时(30秒)< 上游超时(25秒)以防止级联
  • 访问日志包含关联 ID,用于请求追踪
  • 网关部署最少2个副本以实现高可用

不适用边界

此技能处理: 网关配置、路由规则、认证中间件、反向代理设置

不适用于:

  • 限流算法设计 → 请使用 api-rate-limiting-throttling-expert
  • 服务网格数据平面配置 → 请使用 service-mesh-microservices-expert
  • API 规范和设计 → 请使用 api-architect
  • 数据库连接池 → 请使用 database-performance-expert
  • 容器编排 → 请使用 kubernetes-expert 或 docker-expert
  • SSL 证书生成 → 请使用 security-infrastructure-expert

委托规则:

  • 对于自定义限流算法:"我将配置限流插件,但有关自定义算法,请使用 api-rate-limiting-throttling-expert"
  • 对于服务发现设置:"我将配置上游目标,但有关服务网格设置,请使用 service-mesh-microservices-expert"

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

curiositech/windags-skills

Expert in 2000s-era music visualization (Milkdrop, AVS, Geiss) and modern WebGL implementations. Specializes in Butterchurn integration, Web Audio API AnalyserNode FFT data, GLSL shaders for audio-reactive visuals, and psychedelic generative art. Activate on "Milkdrop", "music visualization", "WebGL visualizer", "Butterchurn", "audio reactive", "FFT visualization", "spectrum analyzer". NOT for simple bar charts/waveforms (use basic canvas), video editing, or non-audio visuals.

curiositech/windags-skills

Expert legal research agent for finding and scraping expungement data state by state. Knows authoritative sources, URL patterns, Firecrawl configuration, and 2026 legal landscape.

curiositech/windags-skills

Expert in 3D computer vision labeling tools, workflows, and AI-assisted annotation for LiDAR, point clouds, and sensor fusion. Covers SAM4D/Point-SAM, human-in-the-loop architectures, and vertical-specific training strategies. Activate on '3D labeling', 'point cloud annotation', 'LiDAR labeling', 'SAM 3D', 'SAM4D', 'sensor fusion annotation', '3D bounding box', 'semantic segmentation point cloud'. NOT for 2D image labeling (use clip-aware-embeddings), general ML training (use ml-engineer), video annotation without 3D (use computer-vision-pipeline), or VLM prompt engineering (use prompt-engineer).

curiositech/windags-skills

Implement WCAG 2.2 AA/AAA compliance with automated testing, keyboard navigation, screen reader support, and focus management. Activate on: accessibility audit, WCAG compliance, keyboard navigation, screen reader, aria attributes, axe-core, focus trap. NOT for: design-level accessibility review (use design-accessibility-auditor), color contrast only (use css-in-js-architect).

curiositech/windags-skills

Time-blind friendly planning, executive function support, and daily structure for ADHD brains. Specializes in realistic time estimation, dopamine-aware task design, and building systems that actually work for neurodivergent minds.

curiositech/windags-skills

Designs digital experiences for ADHD brains using neuroscience research and UX principles. Expert in reducing cognitive load, time blindness solutions, dopamine-driven engagement, and compassionate design patterns. Activate on 'ADHD design', 'cognitive load', 'accessibility', 'neurodivergent UX', 'time blindness', 'dopamine-driven', 'executive function'. NOT for general accessibility (WCAG only), neurotypical UX design, or simple UI styling without ADHD context.

curiositech/windags-skills

>- Apply crisis decision-making research to agent routing, uncertainty triage, and coordination failure analysis in time-pressured systems. Use when diagnosing handoff failures, analytical paralysis, or expert judgment under incomplete information. NOT for routine coding, simple CRUD design, or static single-agent tasks with complete information.

curiositech/windags-skills

Extend and modify the admin dashboard, developer portal, and operations console. Use when adding new admin tabs, metrics, monitoring features, or internal tools. Activates for dashboard development, analytics, user management, and internal tooling.

curiositech/windags-skills

Conversation patterns and interaction protocols for multi-agent systems. Covers request/response, pub/sub, blackboard, delegation chains, debate, critique, consensus, fan-out/fan-in, supervisor-worker, and peer negotiation. Deep analysis of AutoGen conversation patterns, CrewAI delegation, LangGraph state passing, and FIPA-ACL performatives. Teaches how to design what agents say to each other and in what order. Activate on: "agent conversation", "agent protocol", "multi-agent debate", "agent delegation", "supervisor worker pattern", "agent voting", "consensus protocol", "fan-out fan-in", "agent negotiation", "blackboard pattern", "agent dialogue", "conversation topology", "agent handoff". NOT for: wire format or serialization (use agent-interchange-formats), orchestration infrastructure (use agentic-infrastructure-2026), single agent behavior (use agentic-patterns).

curiositech/windags-skills

Meta-agent for creating new custom agents, skills, and MCP integrations. Expert in agent design, MCP development, skill architecture, and rapid prototyping. Activate on 'create agent', 'new skill', 'MCP server', 'custom tool', 'agent design'. NOT for using existing agents (invoke them directly), general coding (use language-specific skills), or infrastructure setup (use deployment-engineer).

curiositech/windags-skills

AI-powered calendar management and agent-based scheduling coordination. Covers calendar APIs (Google Calendar, CalDAV/iCal), AI scheduling assistants (Reclaim, Clockwise, Motion, Cal.com), building custom calendar agents with MCP, multi-calendar merging, timezone management, focus block protection, meeting fatigue detection, and agent-to-agent meeting negotiation protocols. Activate on: "calendar agent", "AI scheduling", "calendar coordination", "meeting scheduling", "calendar API", "focus time protection", "calendar optimization", "Google Calendar MCP", "Reclaim", "Clockwise", "Motion", "Cal.com", "smart scheduling", "calendar-aware agent", "timezone scheduling", "agent negotiation meetings". NOT for: manual calendar UI component design (use form-validation-architect), project management scheduling or Gantt charts (use project-management-guru-adhd), general time-tracking or pomodoro apps (use adhd-daily-planner for time-awareness), building the agent itself from scratch (use agent-creator).

curiositech/windags-skills

Build and adopt production AI agent infrastructure in 2026. Covers framework selection (LangGraph, CrewAI, AutoGen, MCP), orchestration patterns, evaluation, observability, memory systems, and tool use. Also covers the SOCIAL dimension: how to sell agent infrastructure internally, change management, measuring ROI, building trust in autonomous systems, and scaling adoption across teams. Activate on: "agent infrastructure", "agent framework comparison", "which agent framework", "sell AI tools internally", "agent adoption", "agent observability", "agent evaluation", "MCP architecture", "agentic mesh", "enterprise AI agents", "AI change management", "agent ROI". NOT for: building specific agents (use ai-engineer), designing agent behavior patterns (use agentic-patterns), prompt tuning (use prompt-engineer).

curiositech/windags-skills

Fundamental patterns for effective agentic behavior. Teaches decomposition, tool orchestration, error recovery, context management, quality self-assessment, and knowing when to stop. Model-agnostic principles that make any agent more effective regardless of domain. Activate on: "how should I structure this agent", "agentic workflow", "agent patterns", "multi-step task", "tool orchestration", "/agentic-patterns", "decompose this", "agent best practices", "chain of actions", "when should the agent stop", "agent loop design". NOT for: creating agent infrastructure (use agent-creator), building DAGs (use windags-architect), specific tool implementation.

curiositech/windags-skills

Automated discovery and matching of agent skills for dynamic task routing and capability assessment

curiositech/windags-skills

Cryptographic security for agentic systems — zero-trust agent networking, signed message envelopes (JWS/JWE), capability-based security (ocaps), Merkle tree audit trails, WASM sandboxing, and formal verification. Covers CLI dev tool security, mTLS between agents, permission boundaries (least privilege for AI agents), and supply chain security for skills/plugins. Activate on: "agent security", "zero trust agents", "secure agent communication", "capability-based security", "ocap", "signed messages between agents", "agent audit trail", "sandbox agent execution", "agent permissions", "mTLS agents", "cryptographic verification", "agent supply chain", "OWASP agentic", "prove agent did X", "tamper-proof agent logs". NOT for: application-level SAST scanning (use security-auditor), network firewall rules (use infrastructure), SOC2/HIPAA compliance (organizational), or prompt injection defense (use prompt-engineer).

curiositech/windags-skills

Data structures and serialization formats for agent-to-agent communication. Covers message envelopes, structured output schemas, capability declarations, task handoff payloads, error/retry signaling, and context windows as data structures. Deep comparison of A2A protocol, MCP, OpenAI function calling, and LangChain message types. Teaches when to use rigid schemas vs free-form with validation, typed vs untyped, streaming vs batch. Activate on: "agent message format", "agent communication schema", "agent-to-agent protocol", "A2A protocol", "MCP message format", "structured output for agents", "agent interop", "interchange format", "agent serialization", "task handoff format", "capability declaration". NOT for: what agents say to each other (use agent-conversation-protocols), orchestration topology (use multi-agent-coordination), building agent infrastructure (use agentic-infrastructure-2026).

curiositech/windags-skills

Logic-based agent programming language implementing BDI architecture for practical autonomous agent development

curiositech/windags-skills

>- Design AgentSpeak(L)-style BDI agents with context-guarded plans, selection functions, and intention stacks. Use for interruptible autonomy, agent policy, and multi-agent orchestration in dynamic environments. NOT for simple rule engines, static planners, or centralized workflows.

curiositech/windags-skills

Foundational concurrent computation model where actors communicate exclusively through asynchronous message passing

curiositech/windags-skills

license: Apache-2.0 NOT for unrelated tasks outside this domain.

相关技能