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

hatchet

Hatchetは、バックグラウンド処理や複雑なワークフローを効率的に実行するためのオープンソースツールで、処理の定義、再試行、並行制御、イベントトリガーなどを扱い、Celery/Bullの代替として活用できるDAGワークフローエンジンを構築するSkill。

📜 元の英語説明(参考)

Orchestrate background jobs and workflows with Hatchet — open-source distributed task queue with DAG workflows. Use when someone asks to "run background jobs", "Hatchet", "workflow orchestration", "distributed task queue", "durable execution", "replace Celery/Bull", or "DAG workflow engine". Covers workflow definition, step functions, retries, concurrency control, and event-driven triggers.

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

一言でいうと

Hatchetは、バックグラウンド処理や複雑なワークフローを効率的に実行するためのオープンソースツールで、処理の定義、再試行、並行制御、イベントトリガーなどを扱い、Celery/Bullの代替として活用できるDAGワークフローエンジンを構築するSkill。

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

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して hatchet.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → hatchet フォルダができる
  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 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Hatchet

概要

Hatchet は、オープンソースの分散タスクキューおよびワークフローエンジンです。ワークフローを DAG (有向非巡回グラフ) として定義し、自動リトライとタイムアウトでステップを実行し、並行性を制御し、イベントまたはスケジュールからワークフローをトリガーします。Temporal に似ていますがより軽量で、BullMQ に似ていますがワークフローオーケストレーション機能があります。信頼性を必要とするバックグラウンドジョブ (決済処理、データパイプライン、AI エージェントオーケストレーション) 向けに構築されています。

どのような時に使うか

  • 信頼性 (リトライ、タイムアウト、冪等性) が必要なバックグラウンドジョブ
  • 複数ステップのワークフロー (オンボーディング、注文処理、データパイプライン)
  • ファンアウト/ファンインパターン (アイテムを並行して処理し、結果を集計)
  • レート制限された API 呼び出し (ワークフローごとの並行性制御)
  • BullMQ/Celery をより構造化されたものに置き換える場合

手順

セットアップ

npm install @hatchet-dev/typescript-sdk

# Self-host
docker compose up -d  # From hatchet-dev/hatchet repo

ワークフローの定義

// workflows/onboarding.ts — 複数ステップのユーザーオンボーディング
import Hatchet from "@hatchet-dev/typescript-sdk";

const hatchet = Hatchet.init();

const onboardingWorkflow = hatchet.workflow({
  name: "user-onboarding",
  on: { event: "user:created" },
  timeout: "10m",
});

// Step 1: Send welcome email
onboardingWorkflow.step("send-welcome-email", async (ctx) => {
  const { userId, email } = ctx.input();
  await sendEmail(email, {
    subject: "Welcome!",
    template: "welcome",
  });
  return { emailSent: true };
}, { retries: 3, timeout: "30s" });

// Step 2: Set up default workspace (runs after step 1)
onboardingWorkflow.step("create-workspace", async (ctx) => {
  const { userId } = ctx.input();
  const workspace = await createWorkspace(userId, "My Workspace");
  return { workspaceId: workspace.id };
}, {
  parents: ["send-welcome-email"],
  retries: 2,
  timeout: "1m",
});

// Step 3: Generate sample data (runs after workspace created)
onboardingWorkflow.step("seed-data", async (ctx) => {
  const { workspaceId } = ctx.stepOutput("create-workspace");
  await seedSampleData(workspaceId);
  return { seeded: true };
}, {
  parents: ["create-workspace"],
  timeout: "2m",
});

// Step 4: Send getting-started guide (runs after email + workspace)
onboardingWorkflow.step("send-guide", async (ctx) => {
  const { email } = ctx.input();
  await sendEmail(email, {
    subject: "Getting Started Guide",
    template: "getting-started",
  });
}, {
  parents: ["send-welcome-email", "create-workspace"],
  retries: 3,
});

ワークフローのトリガー

// src/api/users.ts — アプリケーションからトリガー
import Hatchet from "@hatchet-dev/typescript-sdk";

const hatchet = Hatchet.init();

// Event-based trigger
await hatchet.event.push("user:created", {
  userId: "user_123",
  email: "kai@example.com",
  plan: "pro",
});

// Direct trigger
const run = await hatchet.workflow.run("user-onboarding", {
  userId: "user_123",
  email: "kai@example.com",
});

// Wait for result
const result = await run.result();
console.log(result); // { emailSent: true, workspaceId: "ws_xxx", seeded: true }

並行性制御

// workflows/api-sync.ts — レート制限された外部 API 呼び出し
const syncWorkflow = hatchet.workflow({
  name: "api-sync",
  concurrency: {
    maxRuns: 5,              // 最大 5 つの同時ワークフロー実行
    limitStrategy: "QUEUE",  // 超過分をキューに入れ、ドロップしない
  },
});

syncWorkflow.step("fetch-data", async (ctx) => {
  const { apiEndpoint } = ctx.input();
  const data = await fetch(apiEndpoint).then(r => r.json());
  return { records: data.length };
}, {
  retries: 3,
  backoff: { type: "exponential", base: 2 },
  timeout: "30s",
  concurrency: { key: "api-provider", maxRuns: 10 },  // キーごとの制限
});

スケジュールされたワークフロー

// workflows/daily-report.ts — Cron でトリガーされるワークフロー
const reportWorkflow = hatchet.workflow({
  name: "daily-report",
  on: { cron: "0 9 * * *" },  // 毎日午前 9 時
});

reportWorkflow.step("generate", async (ctx) => {
  const stats = await generateDailyStats();
  return stats;
});

reportWorkflow.step("send", async (ctx) => {
  const stats = ctx.stepOutput("generate");
  await sendSlackReport(stats);
}, { parents: ["generate"] });

例 1: 注文処理パイプライン

ユーザープロンプト: 「信頼性の高い注文処理ワークフローを構築してください — 検証、課金、フルフィルメント、通知。」

エージェントは、連続したステップ、支払いリトライロジック、および顧客 + 倉庫への並列通知を備えた Hatchet ワークフローを作成します。

例 2: AI エージェントオーケストレーション

ユーザープロンプト: 「AI パイプラインを実行します: データをスクレイピング → 処理 → レポートを生成 → メール送信。」

エージェントは、ファンアウトスクレイピング、集計ステップ、LLM 生成、およびリトライ付きのメール配信を備えた DAG ワークフローを作成します。

ガイドライン

  • ワークフローは DAGparents でステップの依存関係を定義します
  • リトライはステップごと — 各ステップは独自のリトライポリシーを持つことができます
  • タイムアウトはジョブのハングを防ぎます — 常にステップごとおよびワークフローごとのタイムアウトを設定します
  • 並行性制御 — 並列実行をグローバルまたはキーごとに制限します
  • デカップリングのためのイベント — 直接呼び出しではなく、イベントからワークフローをトリガーします
  • ctx.stepOutput() はステップ間でデータを渡します — 型付きのステップ結果
  • 冪等性 — 安全にリトライできるようにステップを設計します
  • 自己ホスト可能 — Postgres + Hatchet エンジン
  • 監視用のダッシュボード — 実行中のワークフロー、失敗したステップ、リトライ履歴を確認します
  • バックオフ戦略 — リトライには指数関数的、線形、または定数を使用します
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Hatchet

Overview

Hatchet is an open-source distributed task queue and workflow engine. Define workflows as DAGs (directed acyclic graphs), run steps with automatic retries and timeouts, control concurrency, and trigger workflows from events or schedules. Like Temporal but lighter, like BullMQ but with workflow orchestration. Built for background jobs that need reliability: payment processing, data pipelines, AI agent orchestration.

When to Use

  • Background jobs that need reliability (retries, timeouts, idempotency)
  • Multi-step workflows (onboarding, order processing, data pipelines)
  • Fan-out/fan-in patterns (process items in parallel, aggregate results)
  • Rate-limited API calls (concurrency control per workflow)
  • Replacing BullMQ/Celery with something more structured

Instructions

Setup

npm install @hatchet-dev/typescript-sdk

# Self-host
docker compose up -d  # From hatchet-dev/hatchet repo

Define a Workflow

// workflows/onboarding.ts — Multi-step user onboarding
import Hatchet from "@hatchet-dev/typescript-sdk";

const hatchet = Hatchet.init();

const onboardingWorkflow = hatchet.workflow({
  name: "user-onboarding",
  on: { event: "user:created" },
  timeout: "10m",
});

// Step 1: Send welcome email
onboardingWorkflow.step("send-welcome-email", async (ctx) => {
  const { userId, email } = ctx.input();
  await sendEmail(email, {
    subject: "Welcome!",
    template: "welcome",
  });
  return { emailSent: true };
}, { retries: 3, timeout: "30s" });

// Step 2: Set up default workspace (runs after step 1)
onboardingWorkflow.step("create-workspace", async (ctx) => {
  const { userId } = ctx.input();
  const workspace = await createWorkspace(userId, "My Workspace");
  return { workspaceId: workspace.id };
}, {
  parents: ["send-welcome-email"],
  retries: 2,
  timeout: "1m",
});

// Step 3: Generate sample data (runs after workspace created)
onboardingWorkflow.step("seed-data", async (ctx) => {
  const { workspaceId } = ctx.stepOutput("create-workspace");
  await seedSampleData(workspaceId);
  return { seeded: true };
}, {
  parents: ["create-workspace"],
  timeout: "2m",
});

// Step 4: Send getting-started guide (runs after email + workspace)
onboardingWorkflow.step("send-guide", async (ctx) => {
  const { email } = ctx.input();
  await sendEmail(email, {
    subject: "Getting Started Guide",
    template: "getting-started",
  });
}, {
  parents: ["send-welcome-email", "create-workspace"],
  retries: 3,
});

Trigger Workflows

// src/api/users.ts — Trigger from your application
import Hatchet from "@hatchet-dev/typescript-sdk";

const hatchet = Hatchet.init();

// Event-based trigger
await hatchet.event.push("user:created", {
  userId: "user_123",
  email: "kai@example.com",
  plan: "pro",
});

// Direct trigger
const run = await hatchet.workflow.run("user-onboarding", {
  userId: "user_123",
  email: "kai@example.com",
});

// Wait for result
const result = await run.result();
console.log(result); // { emailSent: true, workspaceId: "ws_xxx", seeded: true }

Concurrency Control

// workflows/api-sync.ts — Rate-limited external API calls
const syncWorkflow = hatchet.workflow({
  name: "api-sync",
  concurrency: {
    maxRuns: 5,              // Max 5 concurrent workflow runs
    limitStrategy: "QUEUE",  // Queue excess, don't drop
  },
});

syncWorkflow.step("fetch-data", async (ctx) => {
  const { apiEndpoint } = ctx.input();
  const data = await fetch(apiEndpoint).then(r => r.json());
  return { records: data.length };
}, {
  retries: 3,
  backoff: { type: "exponential", base: 2 },
  timeout: "30s",
  concurrency: { key: "api-provider", maxRuns: 10 },  // Per-key limit
});

Scheduled Workflows

// workflows/daily-report.ts — Cron-triggered workflow
const reportWorkflow = hatchet.workflow({
  name: "daily-report",
  on: { cron: "0 9 * * *" },  // 9 AM daily
});

reportWorkflow.step("generate", async (ctx) => {
  const stats = await generateDailyStats();
  return stats;
});

reportWorkflow.step("send", async (ctx) => {
  const stats = ctx.stepOutput("generate");
  await sendSlackReport(stats);
}, { parents: ["generate"] });

Examples

Example 1: Order processing pipeline

User prompt: "Build a reliable order processing workflow — validate, charge, fulfill, notify."

The agent will create a Hatchet workflow with sequential steps, payment retry logic, and parallel notification to customer + warehouse.

Example 2: AI agent orchestration

User prompt: "Run an AI pipeline: scrape data → process → generate report → email."

The agent will create a DAG workflow with fan-out scraping, aggregation step, LLM generation, and email delivery with retries.

Guidelines

  • Workflows are DAGs — define step dependencies with parents
  • Retries are per-step — each step can have its own retry policy
  • Timeouts prevent hung jobs — always set per-step and per-workflow timeouts
  • Concurrency control — limit parallel runs globally or per-key
  • Events for decoupling — trigger workflows from events, not direct calls
  • ctx.stepOutput() passes data between steps — typed step results
  • Idempotency — design steps to be safely retried
  • Self-hostable — Postgres + Hatchet engine
  • Dashboard for monitoring — see running workflows, failed steps, retry history
  • Backoff strategies — exponential, linear, or constant for retries