trigger-dev
БесплатноБез исполняемых скриптовНе проверенTrigger.dev is an open-source background jobs platform for TypeScript: long-running tasks with no timeouts, automatic retries, cron schedules, durable waits…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Trigger.dev
Overview
Trigger.dev (SDK @trigger.dev/sdk 4.x, CLI trigger.dev) runs your TypeScript functions as durable background tasks on its own workers, so there is no request timeout. Tasks live in a trigger/ folder, are bundled and deployed with the CLI, and are started from your backend, from other tasks, or on a cron schedule. v3 is retired: Cloud no longer runs v3 deploys, and new code imports from @trigger.dev/sdk, not @trigger.dev/sdk/v3.
Instructions
Set up
npx trigger.dev@latest init # installs @trigger.dev/sdk, writes trigger.config.ts and an example task
npx trigger.dev@latest dev # local dev server that runs your tasks; shows a dashboard link per run
npx trigger.dev@latest deploy --env prod
trigger.config.ts holds the project ref and the task folders:
import { defineConfig } from "@trigger.dev/sdk";
export default defineConfig({
project: "proj_abcdefghijklmnop",
dirs: ["./trigger"],
runtime: "node-24",
retries: { enabledInDev: false, default: { maxAttempts: 3, factor: 2, minTimeoutInMs: 1000, maxTimeoutInMs: 10000, randomize: true } },
});
In CI, deploy authenticates with the TRIGGER_ACCESS_TOKEN environment variable. To trigger tasks from your backend, create a Trigger-only API key for the environment and set it as TRIGGER_SECRET_KEY.
Define a task
// trigger/process-order.ts
import { task, logger, retry, wait } from "@trigger.dev/sdk";
export const processOrder = task({
id: "process-order",
retry: { maxAttempts: 3, factor: 2, minTimeoutInMs: 1000, maxTimeoutInMs: 30000 },
run: async (payload: { orderId: string; total: number }) => {
logger.info("Charging order", { orderId: payload.orderId });
const charge = await retry.onThrow(
async () => {
const res = await fetch("https://api.payments.internal/charges", {
method: "POST",
headers: { "content-type": "application/json", authorization: `Bearer ${process.env.PAYMENTS_API_KEY}` },
body: JSON.stringify({ orderId: payload.orderId, amount: payload.total }),
});
if (!res.ok) throw new Error(`charge failed: ${res.status}`);
return (await res.json()) as { id: string };
},
{ maxAttempts: 3, randomize: true },
);
await wait.for({ minutes: 5 }); // durable: long waits are checkpointed and do not use compute
return { orderId: payload.orderId, chargeId: charge.id };
},
});
Use schemaTask (with a schema: such as a Zod object) when the payload must be validated before a run is created. Task ids must be unique.
Trigger tasks
From your backend, import the task type only, so task code is not bundled into your app:
import { tasks } from "@trigger.dev/sdk";
import type { processOrder } from "@/trigger/process-order";
const handle = await tasks.trigger<typeof processOrder>("process-order", { orderId: "ord_1042", total: 4900 });
await tasks.batchTrigger<typeof processOrder>("process-order", [
{ payload: { orderId: "ord_1043", total: 1500 } },
{ payload: { orderId: "ord_1044", total: 2200 } },
]);
Inside another task, call the task object directly: processOrder.trigger(payload, options) fires and forgets; processOrder.triggerAndWait(payload) returns a result object, so check result.ok and then read result.output; processOrder.batchTriggerAndWait([...]) runs many children. Do not wrap triggerAndWait calls in Promise.all; use batchTriggerAndWait or a loop.
Trigger options (third argument of tasks.trigger, second of task.trigger): delay: "1h" (also "88s", a Date or an ISO time), ttl, idempotencyKey, queue, concurrencyKey, maxAttempts, tags, metadata, priority, machine.
Scheduled tasks
tasks.schedule does not exist. Use schedules.task with a declarative cron; it syncs on dev and deploy:
import { logger, schedules } from "@trigger.dev/sdk";
export const dailyReport = schedules.task({
id: "daily-report",
cron: { pattern: "0 9 * * *", timezone: "America/New_York", environments: ["PRODUCTION"] },
run: async (payload) => {
logger.info("Report for", { at: payload.timestamp, tz: payload.timezone });
},
});
A plain string cron: "0 */2 * * *" is UTC. Per-user schedules are created at runtime with schedules.create({ task: dailyReport.id, cron: "0 9 * * *", timezone: "Europe/Berlin", externalId: userId, deduplicationKey: ${userId}-daily }). New schedules get a 60-minute spreading window by default (run starts at a stable offset after the cron time); set window: "0m" for the exact time (not honored on a free plan, where schedules run at most hourly with a 60-minute minimum window). For a one-off future run use delay, not a schedule.
Concurrency
Cap a task with concurrency: { total: 5 }, or share one limit across tasks:
import { concurrencyLimit, task } from "@trigger.dev/sdk";
export const llmLimit = concurrencyLimit({ name: "llm", total: 25
Установить trigger-dev в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл trigger-dev?
Trigger.dev is an open-source background jobs platform for TypeScript: long-running tasks with no timeouts, automatic retries, cron schedules, durable waits, queues and concurrency limits, deployed to Trigger.dev Cloud or self-hosted. Use when the user wants to run background jobs, scheduled tasks or cron in TypeScript, move work off a request handler, retry flaky API calls, wait for hours or days inside a job, or replace BullMQ and Redis.
Как установить скилл trigger-dev?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл trigger-dev запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic