Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问clear审计通过

api-gateway-patternsAPI gateway 模式

Agent Skill

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

总安装

1,297

周安装

53

GitHub Stars

15

下载量

416
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:api-gateway-patterns(API gateway 模式)
来源仓库:https://github.com/nickcrew/claude-ctx-plugin
仓库路径:skills/api-gateway-patterns
安装命令:
npx skills add https://github.com/nickcrew/claude-ctx-plugin --skill api-gateway-patterns
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/nickcrew/claude-ctx-plugin --skill api-gateway-patterns

简介

API Gateway 模式工具提供微服务架构下的 API 网关设计指导。

  • 适合分布式系统和服务治理场景。api-gateway-patterns 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 包含路由、认证、限流和监控等网关功能设计。
  • 使用时需考虑性能开销和安全边界问题。
  • 建议根据实际流量模式调整配置参数。

SKILL.md

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

TaskLoad reference
Routing strategies (path, header, host-based)skills/api-gateway-patterns/references/routing-patterns.md
Request/response transformationskills/api-gateway-patterns/references/transformation.md
API composition and aggregationskills/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) patternskills/api-gateway-patterns/references/bff-pattern.md
Service discovery integrationskills/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

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

25.74%
按下载量换算107

Gemini CLI

23.57%
按下载量换算98

OpenCode

18.34%
按下载量换算76

Antigravity

11.67%
按下载量换算49

Codex

7.47%
按下载量换算31

windsurf

2.85%
按下载量换算12

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills