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

workflow-orchestration-patterns

できること

このツールは、長時間かかる場合や複数のシステムが関わる場合でも、段階的に進める必要がある複雑な処理を整理するためのものです。問題が起きても、すべてが正しく動作するようにします。

使う場面

  • ✓在庫、支払い、配送が関わる顧客の注文処理を整理するとき。
  • ✓承認に数日かかることもある長い文書の承認処理を管理するとき。
  • ✓複数のシステムの各部分を調整し、取引が必ず完了するか、完全に失敗するようにするとき。

スキルのリンク

https://github.com/wshobson/agents/blob/main/plugins/backend-development/skills/workflow-orchestration-patterns/SKILL.md

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

使い方

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

貼り付け用メッセージ

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

AIへの頼み方の例

“空室の確認、部屋の確定、支払い処理を含むホテル予約の流れを、どのように整理すればよいですか?”

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

仕組み

メインの「ワークフロー」を定義し、より小さな「アクティビティ」の呼び出しを調整する仕組みで動作します。アクティビティが失敗した場合、ワークフローは再試行するか、復旧手順に従います。進捗は自動的に保存されます。

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

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

Workflow Orchestration Patterns

Master workflow orchestration architecture with Temporal, covering fundamental design decisions, resilience patterns, and best practices for building reliable distributed systems.

When to Use Workflow Orchestration

Ideal Use Cases (Source: docs.temporal.io)

  • Multi-step processes spanning machines/services/databases
  • Distributed transactions requiring all-or-nothing semantics
  • Long-running workflows (hours to years) with automatic state persistence
  • Failure recovery that must resume from last successful step
  • Business processes: bookings, orders, campaigns, approvals
  • Entity lifecycle management: inventory tracking, account management, cart workflows
  • Infrastructure automation: CI/CD pipelines, provisioning, deployments
  • Human-in-the-loop systems requiring timeouts and escalations

When NOT to Use

  • Simple CRUD operations (use direct API calls)
  • Pure data processing pipelines (use Airflow, batch processing)
  • Stateless request/response (use standard APIs)
  • Real-time streaming (use Kafka, event processors)

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

Best Practices

Workflow Design

  1. Keep workflows focused - Single responsibility per workflow
  2. Small workflows - Use child workflows for scalability
  3. Clear boundaries - Workflow orchestrates, activities execute
  4. Test locally - Use time-skipping test environment

Activity Design

  1. Idempotent operations - Safe to retry
  2. Short-lived - Seconds to minutes, not hours
  3. Timeout configuration - Always set timeouts
  4. Heartbeat for long tasks - Report progress
  5. Error handling - Distinguish retryable vs non-retryable

Common Pitfalls

Workflow Violations:

  • Using datetime.now() instead of workflow.now()
  • Threading or async operations in workflow code
  • Calling external APIs directly from workflow
  • Non-deterministic logic in workflows

Activity Mistakes:

  • Non-idempotent operations (can't handle retries)
  • Missing timeouts (activities run forever)
  • No error classification (retry validation errors)
  • Ignoring payload limits (2MB per argument)

Operational Considerations

Monitoring:

  • Workflow execution duration
  • Activity failure rates
  • Retry attempts and backoff
  • Pending workflow counts

Scalability:

  • Horizontal scaling with workers
  • Task queue partitioning
  • Child workflow decomposition
  • Activity batching when appropriate

Additional Resources

Official Documentation:

  • Temporal Core Concepts: docs.temporal.io/workflows
  • Workflow Patterns: docs.temporal.io/evaluate/use-cases-design-patterns
  • Best Practices: docs.temporal.io/develop/best-practices
  • Saga Pattern: temporal.io/blog/saga-pattern-made-easy

Key Principles:

  1. Workflows = orchestration, Activities = external calls
  2. Determinism is non-negotiable for workflows
  3. Idempotency is critical for activities
  4. State preservation is automatic
  5. Design for failure and recovery
よくある質問

「ワークフロー」と「アクティビティ」とは何ですか?

「ワークフロー」は、何をどの順番で行うかを定めるメインのレシピです。「アクティビティ」は、ワークフローが実行を指示する個別のタスクで、「在庫を確認する」「支払いを処理する」などが例です。

ワークフローのコードが「決定的」であることがなぜ重要なのですか?

「決定的」とは、何回実行しても、ワークフローが常にまったく同じ処理を同じ順番で行うことを意味します。これは、失敗から復旧し、エラーなく中断した場所から再開するために非常に重要です。

どのような場合にこれを使うべきではありませんか?

データの保存(CRUD)のような単純な処理や、簡単なデータ処理には使わないでください。障害からの復旧が必要な長時間の処理や、複数のステップとシステムが関わる処理に最適です。

詳細

作者による元の説明

Design durable workflows with Temporal for distributed systems. Covers workflow vs activity separation, saga patterns, state management, and determinism constraints. Use when building long-running processes, distributed transactions, or microservice orchestration.

repo: wshobson/agents

人気

GitHubのスター
41k
ランキング
#6643
ライセンス
MIT
更新日
2026/10/15

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

0

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

コメント

  • …

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

似ているスキル