jpskill.com
🛠️ 開発・MCP コミュニティ

temporal

マイクロサービス連携や長時間処理、障害に強い分散システム構築など、複雑な業務フローを確実に実行できるよう、信頼性の高い分散型ワークフローを構築・管理するSkill。

📜 元の英語説明(参考)

Build reliable distributed workflows with Temporal. Use when a user asks to orchestrate microservices, handle long-running workflows, implement saga patterns, build reliable background jobs, or create fault-tolerant distributed systems.

🇯🇵 日本人クリエイター向け解説

一言でいうと

マイクロサービス連携や長時間処理、障害に強い分散システム構築など、複雑な業務フローを確実に実行できるよう、信頼性の高い分散型ワークフローを構築・管理するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o temporal.zip https://jpskill.com/download/15465.zip && unzip -o temporal.zip && rm temporal.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15465.zip -OutFile "$d\temporal.zip"; Expand-Archive "$d\temporal.zip" -DestinationPath $d -Force; ri "$d\temporal.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して temporal.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → temporal フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Temporal

概要

Temporal は、信頼性の高い分散システムを構築するための永続的な実行プラットフォームです。ワークフローはクラッシュから回復し、リトライは自動的に行われ、長期実行プロセス(数日、数ヶ月)も問題なく動作します。Netflix、Snap、Stripe などでミッションクリティカルなワークフローに使用されています。

手順

ステップ 1: セットアップ

# Temporal サーバーをローカルで起動
brew install temporal
temporal server start-dev

# TypeScript プロジェクトを初期化
npx @temporalio/create@latest my-workflows --sample hello-world
cd my-workflows

ステップ 2: ワークフローの定義

// src/workflows.ts — 注文処理ワークフロー
import { proxyActivities, sleep } from '@temporalio/workflow'
import type * as activities from './activities'

const { processPayment, reserveInventory, sendConfirmation, shipOrder } = proxyActivities<typeof activities>({
  startToCloseTimeout: '30 seconds',
  retry: { maximumAttempts: 3 },
})

export async function orderWorkflow(orderId: string, items: Item[]): Promise<OrderResult> {
  // ステップ 1: 在庫を予約 (失敗時に自動的にリトライ)
  const reservation = await reserveInventory(orderId, items)

  // ステップ 2: 支払いを処理
  const payment = await processPayment(orderId, reservation.total)

  // ステップ 3: 倉庫からの確認を待機 (数時間かかる可能性あり)
  await sleep('2 hours')

  // ステップ 4: 発送と通知
  const tracking = await shipOrder(orderId)
  await sendConfirmation(orderId, tracking)

  return { orderId, tracking, total: reservation.total }
}
// サーバーがステップ 3 でクラッシュした場合、Temporal は停止した場所から正確に再開します。
// データ損失、重複支払い、孤立した注文は発生しません。

ステップ 3: アクティビティの定義

// src/activities.ts — ビジネスロジック (失敗とリトライが可能)
export async function processPayment(orderId: string, amount: number) {
  const result = await stripe.charges.create({
    amount: Math.round(amount * 100),
    currency: 'usd',
    metadata: { orderId },
  })
  return { chargeId: result.id, status: result.status }
}

export async function reserveInventory(orderId: string, items: Item[]) {
  // 在庫を確認し、予約を作成
  const total = items.reduce((sum, item) => sum + item.price * item.quantity, 0)
  return { reservationId: `res_${orderId}`, total }
}

export async function sendConfirmation(orderId: string, tracking: string) {
  await sendEmail({ to: orderEmail, subject: `Order ${orderId} shipped`, body: `Tracking: ${tracking}` })
}

ステップ 4: ワークフローの開始

// src/client.ts — API からワークフローを開始
import { Client } from '@temporalio/client'

const client = new Client()

// ワークフローを開始 (すぐに戻り、ワークフローはバックグラウンドで実行)
const handle = await client.workflow.start(orderWorkflow, {
  taskQueue: 'orders',
  workflowId: `order-${orderId}`,
  args: [orderId, items],
})

// ステータスを確認
const result = await handle.result()    // 完了を待機
const status = await handle.describe()  // 現在のステータス

ガイドライン

  • Temporal は、クラッシュやデプロイメントが発生した場合でも、ワークフローステップの正確に 1 回の実行を保証します。
  • 複数のサービスにまたがるもの、または数秒以上かかるものに使用してください。
  • アクティビティは、ワークフローから外部の世界とやり取りする唯一の方法です。
  • Temporal Cloud (ホスト型) は、開発用に無料で開始できます。セルフホストは Docker で無料です。
  • 単純な cron ジョブには Temporal を使用しないでください。複雑なステートフルワークフロー向けに設計されています。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Temporal

Overview

Temporal is a durable execution platform for building reliable distributed systems. Workflows survive crashes, retries are automatic, and long-running processes (days, months) just work. Used by Netflix, Snap, and Stripe for mission-critical workflows.

Instructions

Step 1: Setup

# Start Temporal server locally
brew install temporal
temporal server start-dev

# Initialize TypeScript project
npx @temporalio/create@latest my-workflows --sample hello-world
cd my-workflows

Step 2: Define Workflow

// src/workflows.ts — Order processing workflow
import { proxyActivities, sleep } from '@temporalio/workflow'
import type * as activities from './activities'

const { processPayment, reserveInventory, sendConfirmation, shipOrder } = proxyActivities<typeof activities>({
  startToCloseTimeout: '30 seconds',
  retry: { maximumAttempts: 3 },
})

export async function orderWorkflow(orderId: string, items: Item[]): Promise<OrderResult> {
  // Step 1: Reserve inventory (retries automatically on failure)
  const reservation = await reserveInventory(orderId, items)

  // Step 2: Process payment
  const payment = await processPayment(orderId, reservation.total)

  // Step 3: Wait for warehouse confirmation (could take hours)
  await sleep('2 hours')

  // Step 4: Ship and notify
  const tracking = await shipOrder(orderId)
  await sendConfirmation(orderId, tracking)

  return { orderId, tracking, total: reservation.total }
}
// If the server crashes at step 3, Temporal resumes from exactly where it stopped.
// No data loss, no duplicate payments, no orphaned orders.

Step 3: Define Activities

// src/activities.ts — Business logic (can fail and retry)
export async function processPayment(orderId: string, amount: number) {
  const result = await stripe.charges.create({
    amount: Math.round(amount * 100),
    currency: 'usd',
    metadata: { orderId },
  })
  return { chargeId: result.id, status: result.status }
}

export async function reserveInventory(orderId: string, items: Item[]) {
  // Check stock, create reservation
  const total = items.reduce((sum, item) => sum + item.price * item.quantity, 0)
  return { reservationId: `res_${orderId}`, total }
}

export async function sendConfirmation(orderId: string, tracking: string) {
  await sendEmail({ to: orderEmail, subject: `Order ${orderId} shipped`, body: `Tracking: ${tracking}` })
}

Step 4: Start Workflow

// src/client.ts — Start a workflow from your API
import { Client } from '@temporalio/client'

const client = new Client()

// Start workflow (returns immediately, workflow runs in background)
const handle = await client.workflow.start(orderWorkflow, {
  taskQueue: 'orders',
  workflowId: `order-${orderId}`,
  args: [orderId, items],
})

// Check status
const result = await handle.result()    // waits for completion
const status = await handle.describe()  // current status

Guidelines

  • Temporal guarantees exactly-once execution of workflow steps — even through crashes and deployments.
  • Use for anything that spans multiple services or takes more than a few seconds.
  • Activities are the only way to interact with the outside world from workflows.
  • Temporal Cloud (hosted) starts free for development. Self-hosted is free with Docker.
  • Don't use Temporal for simple cron jobs — it's designed for complex, stateful workflows.