本文へスキップ
Skillpedia
APIとサーバー(バックエンド)12k · #11437

microservices-architect

できること

分散システムを設計し、モノリスをマイクロサービスに分割するようエージェントを導きます。サービスベースのシステムを計画するアーキテクトやバックエンドのチーム向けです。

使う場面

  • ✓大きなアプリケーションを、どのようにサービスに分けるかを決めているとき。
  • ✓RESTとgRPCとイベントベースの通信のどれを選ぶか決める必要があるとき。
  • ✓タイムアウト、リトライ、サーキットブレーカーなどの回復性のパターンを計画したいとき。

スキルのリンク

https://github.com/Jeffallan/claude-skills/blob/main/skills/microservices-architect/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/Jeffallan/claude-skills/blob/main/skills/microservices-architect/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“注文のモノリスなシステムを、明確なサービスの境界を持つマイクロサービスに分けるのを手伝ってください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、ドメイン駆動設計を使って、境界付けられたコンテキストを見つけます。そのあと、同期と非同期の通信のどちらかを選びます。デプロイの手順の前に、データの所有権、回復性、トレーシングを計画します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

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.
    • Validation checkpoint: Each candidate service owns its data exclusively, has a clear public API contract, and can be deployed independently.
  2. Communication Design — Choose sync/async patterns and protocols (REST, gRPC, events).
    • Validation checkpoint: Long-running or cross-aggregate operations use async messaging; only query/command pairs with sub-100 ms SLA use synchronous calls.
  3. Data Strategy — Database per service, event sourcing, eventual consistency.
    • Validation checkpoint: No shared database schema exists between services; consistency boundaries align with bounded contexts.
  4. Resilience — Circuit breakers, retries, timeouts, bulkheads, fallbacks.
    • Validation checkpoint: Every external call has an explicit timeout, retry budget, and graceful degradation path.
  5. Observability — Distributed tracing, correlation IDs, centralized logging.
    • Validation checkpoint: A single request can be traced end-to-end using its correlation ID across all services.
  6. Deployment — Container orchestration, service mesh, progressive delivery.
    • 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

よくある質問

境界付けられたコンテキストとは何ですか?

独自のデータとロジックを持つ、業務上の明確な領域のことで、サービスの境界になります。

サーガのパターンやイベントソーシングにも対応していますか?

はい。サーガのパターン、イベントソーシング、CQRSを扱います。

障害はどう扱いますか?

外部の各呼び出しに対して、サーキットブレーカー、リトライ、タイムアウト、バルクヘッド、フォールバックを計画します。

詳細

作者による元の説明

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.

repo: Jeffallan/claude-skills

人気

GitHubのスター
12k
ランキング
#11437
ライセンス
MIT
更新日
2026/10/30

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル