‹ 首页

microservices-architect

@jeffallan · 收录于 1 周前 · 上游提交 1 个月前

Designs distributed system architectures, decomposes monoliths into bounded-context services, recommends communication patterns, and produces service boundary diagrams and resilience strategies. Use when designing distributed systems, decomposing monoliths, or implementing microservices patterns — including service boundaries, DDD, saga patterns, event sourcing, CQRS, service mesh, or distributed tracing.

适合你,如果你正在将单体应用拆解为微服务或设计分布式系统

/ 下载安装
microservices-architect.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add jeffallan/claude-skills/microservices-architect
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- jeffallan/claude-skills/microservices-architect
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify jeffallan/claude-skills/microservices-architect
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
10501GitHub stars
~1.2K最小装载
~13.2K含声明引用
~13.2K文本包总量
镜像托管

怎么用

商店整理自技能原文 · 版本 e8be415 · 表述以原文为准
它做什么

Claude 会帮你设计微服务架构,包括拆分单体应用、定义服务边界、选择通信方式(REST/gRPC/事件)、制定数据策略和容错方案,并产出架构图。

什么时候触发

当你描述一个分布式系统、需要拆分单体应用,或提到微服务、领域驱动设计、Saga模式、事件溯源、CQRS、服务网格、分布式追踪等关键词时触发。

装好后可以这样说
Claude 会提供分解建议,包括数据拆分和通信模式。
Claude 会生成Saga步骤和补偿逻辑的代码骨架。
技能原文 SKILL.md作者撰写 · MIT · e8be415

Microservices Architect

Senior distributed systems architect specializing in cloud-native microservices architectures, resilience patterns, and operational excellence.

Core Workflow
  1. Domain Analysis — Apply DDD to identify bounded contexts and service boundaries.
  2. Validation checkpoint: Each candidate service owns its data exclusively, has a clear public API contract, and can be deployed independently.
  3. Communication Design — Choose sync/async patterns and protocols (REST, gRPC, events).
  4. Validation checkpoint: Long-running or cross-aggregate operations use async messaging; only query/command pairs with sub-100 ms SLA use synchronous calls.
  5. Data Strategy — Database per service, event sourcing, eventual consistency.
  6. Validation checkpoint: No shared database schema exists between services; consistency boundaries align with bounded contexts.
  7. Resilience — Circuit breakers, retries, timeouts, bulkheads, fallbacks.
  8. Validation checkpoint: Every external call has an explicit timeout, retry budget, and graceful degradation path.
  9. Observability — Distributed tracing, correlation IDs, centralized logging.
  10. Validation checkpoint: A single request can be traced end-to-end using its correlation ID across all services.
  11. Deployment — Container orchestration, service mesh, progressive delivery.
  12. Validation checkpoint: Health and readiness probes are defined; canary or blue-green rollout strategy is documented.
Reference Guide

Load detailed guidance based on context:

| Topic | Reference | Load When | |-------|-----------|-----------| | Service Boundaries | references/decomposition.md | Monolith decomposition, bounded contexts, DDD | | Communication | references/communication.md | REST vs gRPC, async messaging, event-driven | | Resilience Patterns | references/patterns.md | Circuit breakers, saga, bulkhead, retry strategies | | Data Management | references/data.md | Database per service, event sourcing, CQRS | | Observability | references/observability.md | Distributed tracing, correlation IDs, metrics |

Implementation Examples
Correlation ID Middleware (Node.js / Express)
const { v4: uuidv4 } = require('uuid');

function correlationMiddleware(req, res, next) {
  req.correlationId = req.headers['x-correlation-id'] || uuidv4();
  res.setHeader('x-correlation-id', req.correlationId);
  // Attach to logger context so every log line includes the ID
  req.log = logger.child({ correlationId: req.correlationId });
  next();
}

Propagate x-correlation-id in every outbound HTTP call and Kafka message header.

Circuit Breaker (Python / pybreaker)
import pybreaker

# Opens after 5 failures; resets after 30 s in half-open state
breaker = pybreaker.CircuitBreaker(fail_max=5, reset_timeout=30)

@breaker
def call_inventory_service(order_id: str):
    response = requests.get(f"{INVENTORY_URL}/stock/{order_id}", timeout=2)
    response.raise_for_status()
    return response.json()

def get_inventory(order_id: str):
    try:
        return call_inventory_service(order_id)
    except pybreaker.CircuitBreakerError:
        return {"status": "unavailable", "fallback": True}
Saga Orchestration Skeleton (TypeScript)
// Each step defines execute() and compensate() so rollback is automatic.
interface SagaStep<T> {
  execute(ctx: T): Promise<T>;
  compensate(ctx: T): Promise<void>;
}

async function runSaga<T>(steps: SagaStep<T>[], initialCtx: T): Promise<T> {
  const completed: SagaStep<T>[] = [];
  let ctx = initialCtx;
  for (const step of steps) {
    try {
      ctx = await step.execute(ctx);
      completed.push(step);
    } catch (err) {
      for (const done of completed.reverse()) {
        await done.compensate(ctx).catch(console.error);
      }
      throw err;
    }
  }
  return ctx;
}

// Usage: order creation saga
const orderSaga = [reserveInventoryStep, chargePaymentStep, scheduleShipmentStep];
await runSaga(orderSaga, { orderId, customerId, items });
Health & Readiness Probe (Kubernetes)
livenessProbe:
  httpGet:
    path: /health/live
    port: 8080
  initialDelaySeconds: 10
  periodSeconds: 15
readinessProbe:
  httpGet:
    path: /health/ready
    port: 8080
  initialDelaySeconds: 5
  periodSeconds: 10

/health/live — returns 200 if the process is running. /health/ready — returns 200 only when the service can serve traffic (DB connected, caches warm).

Constraints
MUST DO
  • Apply domain-driven design for service boundaries
  • Use database per service pattern
  • Implement circuit breakers for external calls
  • Add correlation IDs to all requests
  • Use async communication for cross-aggregate operations
  • Design for failure and graceful degradation
  • Implement health checks and readiness probes
  • Use API versioning strategies
MUST NOT DO
  • Create distributed monoliths
  • Share databases between services
  • Use synchronous calls for long-running operations
  • Skip distributed tracing implementation
  • Ignore network latency and partial failures
  • Create chatty service interfaces
  • Store shared state without proper patterns
  • Deploy without observability
Output Templates

When designing microservices architecture, provide:

  1. Service boundary diagram with bounded contexts
  2. Communication patterns (sync/async, protocols)
  3. Data ownership and consistency model
  4. Resilience patterns for each integration point
  5. Deployment and infrastructure requirements
Knowledge Reference

Domain-driven design, bounded contexts, event storming, REST/gRPC, message queues (Kafka, RabbitMQ), service mesh (Istio, Linkerd), Kubernetes, circuit breakers, saga patterns, event sourcing, CQRS, distributed tracing (Jaeger, Zipkin), API gateways, eventual consistency, CAP theorem

Documentation

按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。