Architecture Microservices Patternsのロゴ

Architecture Microservices Patterns

コミュニティ
j4flmao
architecture-microservices-patterns

Use this skill when the user says 'microservices patterns', 'split the monolith', 'saga', 'circuit breaker', 'service decomposition', 'database per service', 'API gateway', 'strangler fig', 'distributed monolith', 'service-to-service resilience'. Decides whether and how to decompose into services, then applies the core patterns: decomposition by capability, data ownership, sagas, resilience (timeouts, retries, circuit breakers, bulkheads), gateway/BFF, and migration via strangler fig. Do NOT use for: domain modeling inside a service (architecture/system-design/domain-driven-design), messaging infrastructure details (architecture/event-driven), or Kubernetes/service-mesh operations (devops skills).

概要

公開者j4flmao
リポジトリagent-skills
スキル名architecture-microservices-patterns
スター
41
フォーク
6
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    j4flmaoがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルArchitecture Microservices PatternsをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/j4flmao/agent-skills/tree/main/skills/architecture/system-design/microservices-patterns
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/j4flmao/agent-skills.git /tmp/agent-skills
mkdir -p .claude/skills
cp -r /tmp/agent-skills/skills/architecture/system-design/microservices-patterns .claude/skills/architecture-microservices-patterns
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでArchitecture Microservices Patternsを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にArchitecture Microservices Patternsを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Architecture Microservices Patternsは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Microservices Architecture Patterns

Purpose

Microservices buy independent deployment and scaling per business capability at the cost of distributed-systems complexity: partial failure, network latency, eventual consistency, and operational overhead. This skill covers when that trade is worth it and the patterns that keep a service landscape from becoming a distributed monolith.

Agent Protocol

Trigger

"microservices", "service decomposition", "monolith to microservices", "saga", "compensating transaction", "circuit breaker", "bulkhead", "API gateway", "database per service", "strangler fig".

Input Context

  • Team count and structure; deployment frequency pain.
  • Domain map / bounded contexts.
  • Current architecture and data model; cross-entity transactions.
  • SLOs and traffic patterns.

Output Artifact

Decomposition proposal, per-service data ownership, interaction style per flow, resilience policy table, migration plan.

Response Format

Decision: {modular monolith|microservices} because {reason}
Services: {name}: capability, owns {data}, team {x}
Flow {name}: {sync|async} via {REST|gRPC|events}; consistency {saga orchestration|choreography}
Resilience per call: timeout={ms} retries={n, backoff+jitter, idempotent?} breaker={threshold}
Migration: strangler step {n}: route {path} -> {service}

Completion Criteria

  • Services aligned to business capabilities/bounded contexts.
  • Each service owns its data; no shared tables.
  • Every remote call has timeout; retries only on idempotent operations.
  • Multi-service business transactions modeled as sagas with compensations.
  • Observability: tracing across services, per-service SLOs.

When (Not) to Use

SituationRecommendation
Small team, unclear domainModular monolith with enforced module boundaries
Many teams blocked by shared deploysExtract services along team/capability lines
One component with very different scaling/runtime needsExtract that component only
Desire for "modern architecture"Not a reason

Decomposition

  • By business capability / bounded context (Ordering, Payments, Shipping), not by technical layer or by table (entity services).
  • Services should be able to fulfill most requests with their own data; frequent synchronous chains (A → B → C → D) signal wrong boundaries.
  • Database per service: other services access data only via API or events; read models replicate what they need.

Communication

StyleUse forRisks
Sync REST/gRPCQueries, user-facing request/responseTemporal coupling, latency chains
Async eventsPropagating state changesEventual consistency
Async commands (queue)Work requests to one ownerNeed correlation and replies

Gateway/BFF: single entry point for clients handling routing, auth, rate limiting; a BFF per client type when needs diverge.

Sagas

A saga is a sequence of local transactions; on failure, previously completed steps are undone by compensating transactions.

VariantCoordinationProsCons
ChoreographyServices react to each other's eventsNo central componentFlow hard to see; cyclic dependencies
OrchestrationOrchestrator sends commands, tracks stateExplicit flow, easier monitoringOrchestrator is extra component
python
from __future__ import annotations

import logging
from dataclasses import dataclass
from typing import Callable

log = logging.getLogger("saga")


@dataclass(frozen=True)
class Step:
    name: str
    action: Callable[[dict], None]        # must be idempotent (keyed by saga_id)
    compensate: Callable[[dict], None]    # must be idempotent and retryable


class SagaFailed(RuntimeError):
    pass


def run_saga(saga_id: str, steps: list[Step], ctx: dict) -> None:
    done: list[Step] = []
    for step in steps:
        try:
            step.action({**ctx, "saga_id": saga_id})
            done.append(step)          # persist progress in production (durable saga log)
        except Exception as exc:
            log.error("saga=%s step=%s failed: %s; compensating %d steps",
                      saga_id, step.name, exc, len(done))
            for prev in reversed(done):
                prev.compensate({**ctx, "saga_id": saga_id})
            raise SagaFailed(f"saga {saga_id} failed at {step.name}") from exc

# run_saga("ord-981", [Step("reserve_stock", reserve, release),
#                      Step("charge_payment", charge, refund),
#                      Step("schedule_shipping", schedule, cancel_shipment)], {"order_id": "981"})

In production, persist saga state (or use a durable workflow engine such as Temporal) so a crash mid-saga resumes or compensates; design for semantic rollback (refund, release) because steps are visible to others before the saga ends. Put the step most likely to fail early and irreversible steps (send email, ship) last.

Resilience Patterns

PatternPurposeGuidance
TimeoutBound waitingEvery call; inner timeouts shorter than outer; propagate deadlines
RetrySurvive transient faults2-3 attempts, exponential backoff + full jitter, idempotent ops only, one layer only
Circuit breakerStop hammering a failing dependencyOpen on failure rate over a sliding window; half-open probes
BulkheadContain resource exhaustionSeparate pools/concurrency limits per dependency
FallbackDegrade gracefullyCached/default data, feature off
Rate limiting / load sheddingProtect capacityReject early with 429/503

Resilience4j (Spring Boot) example; Hystrix is in maintenance mode since 2018:

yaml
resilience4j:
  circuitbreaker:
    instances:
      payments:
        slidingWindowType: COUNT_BASED
        slidingWindowSize: 50
        minimumNumberOfCalls: 20
        failureRateThreshold: 50
        waitDurationInOpenState: 30s
        permittedNumberOfCallsInHalfOpenState: 5
  timelimiter:
    instances:
      payments:
        timeoutDuration: 2s
  retry:
    instances:
      payments:
        maxAttempts: 3
        waitDuration: 200ms
        enableExponentialBackoff: true
        exponentialBackoffMultiplier: 2
        enableRandomizedWait: true

Other stacks: Polly (.NET), gobreaker / failsafe-go (Go), opossum (Node.js), or mesh-level outlier detection and retries (Envoy/Istio). Avoid retrying in both the mesh and the application.

Migration: Strangler Fig

  1. Put a routing facade (gateway/proxy) in front of the monolith.
  2. Extract one capability; route its endpoints to the new service.
  3. Sync data during transition (CDC from the monolith DB or events), then cut ownership over.
  4. Delete the old code path; repeat. Never big-bang rewrite.

Anti-Patterns

Anti-patternSymptomFix
Distributed monolithLockstep deploys, shared DBData ownership, async integration, contract tests
Entity servicesCustomerService, AddressService chatty callsCapability-based boundaries
Synchronous chainsLatency and availability multiplyEvents, local read models
Retry stormsOutage amplificationRetry budgets, jitter, breakers
No tracingUndebuggable incidentsOpenTelemetry across services and queues
2PC across servicesBlocking, couplingSagas

Checklist

  • Decomposition justified by teams/capabilities.
  • Data ownership matrix; no shared schemas.
  • Per-dependency timeout/retry/breaker/bulkhead table.
  • Sagas with compensations, idempotent steps, durable state.
  • Outbox for events; idempotent consumers.
  • Gateway/BFF, service discovery, tracing, per-service SLOs.
  • Consumer-driven contract tests in CI.

References

  • Richardson, "Microservices Patterns" (2018) and microservices.io; Newman, "Building Microservices" 2nd ed. (2021).
  • Nygard, "Release It!" 2nd ed. — stability patterns; Garcia-Molina & Salem, "Sagas" (SIGMOD 1987).
  • Resilience4j documentation.

よくある質問

AIスキル「Architecture Microservices Patterns」では何ができますか?

Use this skill when the user says 'microservices patterns', 'split the monolith', 'saga', 'circuit breaker', 'service decomposition', 'database per service', 'API gateway', 'strangler fig', 'distributed monolith', 'service-to-service resilience'. Decides whether and how to decompose into services, then applies the core patterns: decomposition by capability, data ownership, sagas, resilience (timeouts, retries, circuit breakers, bulkheads), gateway/BFF, and migration via strangler fig. Do NOT use for: domain modeling inside a service (architecture/system-design/domain-driven-design), messagi...

TypingMindでArchitecture Microservices Patternsを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Architecture Microservices Patternsはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにArchitecture Microservices Patternsをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/j4flmao/agent-skills/tree/main/skills/architecture/system-design/microservices-patternsを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Architecture Microservices Patternsを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Architecture Microservices Patternsは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもArchitecture Microservices Patternsを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Architecture Microservices Patterns」は無料ですか?

はい。j4flmaoがGitHubでMITライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇