hatchet
FreeNo executable scriptsNot checkedOrchestrate background jobs and workflows with Hatchet — open-source distributed task queue with DAG workflows. Use when someone asks to "run background…
by TerminalSkills★ 221 GitHub starsAbout this skill
Hatchet
Overview
Hatchet is an open-source task queue and workflow engine on top of Postgres. You declare tasks (single functions) or workflows (DAGs of tasks), run workers that pick them up, and trigger runs from code, events, schedules or the dashboard. It gives per-task retries with backoff, timeouts, CEL-based concurrency control, rate limits and durable tasks. Typical uses: payment processing, data pipelines, AI agent orchestration, replacing BullMQ or Celery.
This skill uses the v1 SDK (@hatchet-dev/typescript-sdk 1.x, checked against 1.34.0 and engine v0.107). The old hatchet.workflow({ on: ... }).step(...) / ctx.stepOutput() API is the legacy v0 style; do not write new code with it.
Instructions
Setup
npm install @hatchet-dev/typescript-sdk # Python: pip install hatchet-sdk
# create the token in the dashboard (Settings > API Tokens), then:
export HATCHET_CLIENT_TOKEN="$(cat ~/.config/hatchet/worker-token)"
Hatchet Cloud or a self-hosted engine both issue that token. The CLI is available with brew install hatchet-dev/hatchet/hatchet --cask; hatchet profile add stores the token, hatchet worker dev runs a worker with hot reload, hatchet trigger simple fires a run of the quickstart workflow. For self-hosting follow docs.hatchet.run/self-hosting (Docker Compose runs the engine, dashboard on http://localhost:8080 and Postgres; the compose file's default login is for local use only, change it).
// src/hatchet-client.ts
import { HatchetClient } from '@hatchet-dev/typescript-sdk';
export const hatchet = HatchetClient.init(); // reads HATCHET_CLIENT_TOKEN
A single task
// src/tasks/send-invoice.ts
import { hatchet } from '../hatchet-client';
export const sendInvoice = hatchet.task({
name: 'send-invoice',
retries: 3,
backoff: { factor: 2, maxSeconds: 30 }, // waits 2s, 4s, 8s...
executionTimeout: '1m',
fn: async (input: { orderId: string; email: string }, ctx) => {
ctx.logger.info(`retry ${ctx.retryCount()} for ${input.orderId}`);
return { sent: true };
},
});
A DAG workflow
Parents are task objects, not strings, and a child reads parent output with await ctx.parentOutput(task).
// src/workflows/onboarding.ts
import { hatchet } from '../hatchet-client';
type OnboardingInput = { userId: string; email: string };
export const onboarding = hatchet.workflow<OnboardingInput>({
name: 'user-onboarding',
onEvents: ['user:created'], // event trigger
});
const welcome = onboarding.task({
name: 'send-welcome-email',
retries: 3,
executionTimeout: '30s',
fn: async (input) => ({ emailSent: true, to: input.email }),
});
const workspace = onboarding.task({
name: 'create-workspace',
parents: [welcome],
fn: async (input) => ({ workspaceId: `ws_${input.userId}` }),
});
onboarding.task({
name: 'send-guide',
parents: [welcome, workspace],
fn: async (input, ctx) => {
const ws = await ctx.parentOutput(workspace);
return { guideFor: ws.workspaceId };
},
});
Worker
// src/worker.ts
import { hatchet } from './hatchet-client';
import { onboarding } from './workflows/onboarding';
import { sendInvoice } from './tasks/send-invoice';
async function main() {
const worker = await hatchet.worker('billing-worker', {
workflows: [onboarding, sendInvoice],
slots: 50, // concurrent task runs this worker accepts
});
await worker.start();
}
main();
Trigger runs
import { onboarding } from './workflows/onboarding';
import { hatchet } from './hatchet-client';
// wait for the result
const result = await onboarding.run({ userId: 'u_8412', email: '[email protected]' });
// fire and forget, returns a run reference
await onboarding.runNoWait({ userId: 'u_8413', email: '[email protected]' });
// event trigger: every workflow with onEvents: ['user:created'] starts
await hatchet.events.push('user:created', { userId: 'u_8414', email: '[email protected]' });
Concurrency (CEL expression)
Limits are grouped by a CEL expression over the input. Strategies: GROUP_ROUND_ROBIN (queue and share fairly), CANCEL_IN_PROGRESS, CANCEL_NEWEST, CANCEL_QUEUED_EXCEPT_NEWEST, CANCEL_QUEUED_EXCEPT_OLDEST. An array lets you stack limits.
import { ConcurrencyLimitStrategy } from '@hatchet-dev/typescript-sdk';
export const apiSync = hatchet.workflow<{ provider: string; endpoint: string }>({
name: 'api-sync',
concurrency: {
expression: 'input.provider', // at most 5 runs per provider
maxRuns: 5,
limitStrategy: ConcurrencyLimitStrategy.GROUP_ROUND_ROBIN,
},
});
Cron
export const dailyReport = hatchet.workflow({
name: 'daily-report',
on: { cron: '0 9 * * *' }, // UTC; 5 or 6 fields (optional leading seconds)
});
Examples
Example 1: Order processing pipeline
User prompt: "Build a reliable order workflow in TypeScript: validate the cart, charge the card, the
Install hatchet in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the hatchet skill do?
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.
How do I install the hatchet skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the hatchet skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
by Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
by Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropic