void-background-job-pattern

Implement background jobs with queues, cron routes, idempotency, retries, and dead-letter handling.

Updated May 29, 2026
One-click install
npx skills add https://github.com/voidcorp-core/void-harness --skill void-background-job-pattern-voidcorp-core
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: void-background-job-pattern
Source: https://github.com/voidcorp-core/void-harness/tree/main/packages/cli/core-assets/packs/pack-server/skills/void-background-job-pattern
Command: npx skills add https://github.com/voidcorp-core/void-harness --skill void-background-job-pattern-voidcorp-core

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Work that is too slow for an HTTP request, scheduled, or needs retries often gets hacked into request handlers, causing timeouts, lost work, and silent failures. This Skill provides a decision framework and implementation patterns for running async work outside the request lifecycle safely. ## Core Features & Use Cases - Job type selection: Classifies work as event-driven, scheduled, or one-shot based on the trigger, mapping each to tools like Inngest, Trigger.dev, Cloudflare Queues, or Vercel Cron. - Five-layer job structure: Enforces input validation with Zod, idempotency, trace context, service-layer business logic, and retry classification in every job. - Failure handling: Covers retryable vs non-retryable error classification, dead-letter queues, cron concurrency locks, and cron secret authentication. - Use Case: After a user signs up, emit a user.signed_up event from a Server Action and let an Inngest function send the welcome email with automatic retries, instead of blocking the signup response on SMTP. ## Quick Start Ask the agent to move the slow email-sending work out of your signup handler into a background job with retries and idempotency.

Frequently Asked Questions about void-background-job-pattern

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

FAQPage Schema
How do I run background jobs in a Next.js app?

Use a managed queue like Inngest, Trigger.dev, or Cloudflare Queues for event-driven work, and route handlers plus Vercel Cron for scheduled work. Emit an event from a Server Action and let the queue handle retries and execution outside the request lifecycle.

Inngest vs Trigger.dev vs Cloudflare Queues for background jobs?

All three handle event-driven jobs with native retries and dead-letter queues. Inngest offers step.run checkpoints and event-ID dedupe, Trigger.dev has similar task primitives, and Cloudflare Queues fits Workers-based stacks. Pick based on your platform, not the work itself.

When should I not use a background job?

Avoid background jobs when the user is actively waiting for the result, when work completes in under 100ms, when it needs per-request context like cookies, or for one-off scripts. Inline execution or a runbook is cheaper and simpler in those cases.

How do I make a queue job idempotent?

Inngest and Trigger.dev dedupe on the event ID automatically. Otherwise use an inbox table with INSERT ON CONFLICT DO NOTHING keyed on the event ID, or design the service operation to be safely re-runnable, such as UPDATE WHERE status equals pending.

Why does my Vercel Cron job run multiple times or fail silently?

Cron routes need a concurrency lock, such as Redis SETNX or a Postgres advisory lock, to prevent overlapping runs. They also need the CRON_SECRET authorization check and explicit error reporting to Sentry, since a silent 500 means failures go unnoticed.