trigger-basic

Create and manage deterministic Trigger.dev tasks in TypeScript backends.

1.8k|375|Updated Jan 15, 2025
One-click install
npx skills add https://github.com/trycompai/comp --skill trigger-basic
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: trigger-basic
Source: https://github.com/trycompai/comp/tree/main/.agents/skills/trigger-basic
Command: npx skills add https://github.com/trycompai/comp --skill trigger-basic

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Efficiently create, orchestrate, and manage deterministic Trigger.dev tasks in TypeScript backends using the v4 SDK, reducing boilerplate and increasing reliability.

Core Features & Use Cases

  • Basic Task: Define a Task with id, retry policy, and a run function to execute business logic.
  • Schema Task: Validate and type-check payloads with a schema before running.
  • Scheduled Task: Schedule recurring jobs and observe payload data like timestamp and next runs.
  • Triggering Tasks: Trigger tasks from backend code, handle results, and coordinate batch operations.
  • Waits: Introduce precise delays and waits for external signals or timeouts.
  • Key Points: Distinguish between result and output, enforce type safety, and follow best practices for v4.

Quick Start

Write a simple task using the v4 SDK and wire it into your Node backend to start processing events.

Frequently Asked Questions about trigger-basic

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create Trigger.dev tasks in TypeScript with proper error handling?

To create Trigger.dev tasks in TypeScript, use the v4 SDK to define a task with an id, retry policy, and a run function. This structure handles business logic execution and manages errors automatically through configured retries.

How does a schema task validate payloads in Trigger.dev v4?

A schema task in Trigger.dev v4 validates and type-checks incoming payloads against a defined schema before executing the run function. This enforces type safety and prevents invalid data from entering your business logic.

Can I schedule recurring background jobs with Trigger.dev in a Node backend?

Yes, you can schedule recurring background jobs in Trigger.dev. Scheduled tasks execute recurring jobs and provide payload data such as the current timestamp and the next scheduled run times for observation.

Do I need the Trigger.dev v4 SDK to manage deterministic background tasks in TypeScript?

Yes, the Trigger.dev v4 SDK is required. You need a Node.js or TypeScript project setup with task imports and run handlers to orchestrate and manage deterministic background tasks effectively.

What is the difference between result and output in Trigger.dev task runs?

In Trigger.dev v4, distinguishing between result and output is a key best practice. The result represents the return value of the run function, while output encompasses broader task execution logs and data.

How do I introduce delays or wait for external signals in Trigger.dev tasks?

Trigger.dev v4 provides wait functions to introduce precise delays, wait for external signals, or handle timeouts within your tasks. This allows you to pause execution until specific conditions or timeframes are met.