background-jobs
Skill2 starsChanged 6 months agoMITView on GitHub
Use when work shouldn't run in the request path — offload emails, webhooks, exports, and scheduled tasks to a queue or job runner with retries, idempotency, and dead-letter handling instead of blocking the user.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- nahid-sparktales/agent-dispatchertheir own version, first seen Sep 21, 2026
- novatic-cu/nova-skillstheir own version, first seen Sep 20, 2026
- nimadorostkar/Claude-Skills-collectiontheir own version, first seen Jul 14, 2026
- YepAPI/skillstheir own version, first seen Apr 12, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- nahid-sparktales/agent-dispatcher★ 59same name
- nimadorostkar/Claude-Skills-collection★ 28same name
- YepAPI/skills★ 8same name
- novatic-cu/nova-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository14 other files it gives its agents.
- api-routes-and-validationSkill
- authenticationSkill
- authorization-rbacSkill
- data-access-layerSkill
- database-schemaSkill
- deployment-and-ciSkill
- environment-and-configSkill
- file-uploads-and-storageSkill
- multi-tenancySkill
- observability-and-errorsSkill
- payments-stripeSkill
- project-scaffoldingSkill
- subscription-billingSkill
- transactional-emailSkill
The file
Files
Background Jobs
Overview
Anything slow, flaky, or scheduled belongs off the request path: sending email, processing uploads, calling third-party APIs, nightly rollups. Use a job system — Inngest or Trigger.dev (serverless-friendly), or BullMQ + Redis (self-hosted) — that gives you retries, backoff, and observability. The request just enqueues and returns; the worker does the work with idempotency so retries are safe.
When to use
- A task takes more than ~1s or calls an external API that can fail.
- Scheduled/recurring work (digests, cleanup, syncing).
- Fan-out work (notify every member of an org).
The pattern (Inngest-style)
// src/server/jobs/send-invite.ts
import { inngest } from "@/server/jobs/client";
import { sendInvite } from "@/server/email/send";
export const sendInviteJob = inngest.createFunction(
{ id: "send-invite", retries: 4 }, // automatic backoff
{ event: "org/member.invited" },
async ({ event, step }) => {
await step.run("send-email", () =>
sendInvite(event.data.email, event.data.org, event.data.url),
);
},
);// in your action — return fast, do work later
await inngest.send({ name: "org/member.invited", data: { email, org, url } });Reliability rules
- Idempotent handlers. Key on a stable id so a retry doesn't double-send or double-charge.
- Retries with backoff, then a dead-letter path for poison jobs you can inspect and replay.
- Scope every job to its tenant — pass
orgIdin the payload and re-resolve, never assume. - Schedule with cron triggers for recurring work instead of a hand-rolled timer.
- Keep payloads small — pass ids, fetch fresh data in the worker (avoids stale/oversized events).
Pitfalls
await-ing slow work in the action — blocks the user and couples success to a third party being up.- Non-idempotent workers — retries duplicate emails/charges. Always key the side effect.
- Fire-and-forget with no retries — transient failures silently drop work; use a real queue.
- Putting secrets/large blobs in the event — reference them; fetch in the worker.
- No visibility — without job logs/metrics you can't tell a stuck queue from an empty one.
Hand-off
Durable async work with retries. transactional-email and file-uploads-and-storage run here; observability-and-errors watches failures and dead-letters.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

