background-jobs
Skill0 starsChanged 5 days agoMITView on GitHub
Background jobs for Node.js backends with BullMQ (and pointers to pg-boss/Graphile Worker) - what to move out of the request, queue and worker setup, retries with exponential backoff and UnrecoverableError, idempotency (deterministic jobId, provider idempotency keys, processed table, upserts), transactional outbox, dead-letter inspection and replay, rate limits and concurrency, job schedulers instead of setInterval/cron in web processes, graceful worker shutdown and Redis settings. Includes a checker for missing connections, Worker ioredis without maxRetriesPerRequest null, missing error/failed listeners, workers never closed, jobs without attempts/backoff/retention, whole request bodies in job data, missing jobIds and obsolete QueueScheduler/repeat usage, plus a jobs.ts template. Use when the user adds a queue, emails/webhooks/exports run in requests, jobs run twice or get lost, Redis memory grows, or asks about BullMQ, retries or idempotency.
10 other projects use a version of this.
Adopted by
Most recently taken up by
- AtulPurohit/Antigravity-Awesome-Skillstheir own version, first seen Nov 29, 2026
- hi-donwi/Donwi-Skillstheir own version, first seen Nov 22, 2026
- novatic-cu/nova-skills-coretheir own version, first seen Nov 22, 2026
- reddygopalkrishna/developer-agent-skillstheir own version, first seen Nov 8, 2026
- jars-demo/jars-skillstheir own version, first seen Oct 25, 2026
- nimadorostkar/Claude-Skills-collectiontheir own version, first seen Oct 13, 2026
Used with
Projects with it also use query-optimization, containerization and 8 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
ffsshhttiikkSkillquery-optimization
Database query optimization
Also in 4 projects that use this
mmondoraSkillcontainerization
Docker best practices for cloud-native applications. Multi-stage builds, distroless images, security scanning, non-root users, Cloud Run orchestration. Use when writing Dockerfiles, configuring container builds, or deploying to Cloud Run/GKE.
Also in 3 projects that use this
mmondoraSkillinfrastructure-as-code
Infrastructure as Code with Terraform and Pulumi. State management, modularity, drift detection, secrets handling. Use when provisioning cloud resources, writing Terraform/Pulumi modules, or managing infrastructure configuration.
Also in 4 projects that use this
wpankSkillcaching
Caching strategies, invalidation, eviction policies, HTTP caching, distributed caching, and anti-patterns. Use when designing cache layers, choosing eviction policies, debugging stale data, or optimizing read-heavy workloads.
Also in 4 projects that use this
harrissohail6Skillcaching-strategies
Caching patterns and strategies. Auto-activates when implementing caching, Redis, or performance optimization.
Also in 3 projects that use this
SkeneTechnologiesSkillproduct-analytics
When the user wants to set up product analytics -- including event taxonomy, tracking plans, funnel analysis, or tool selection (Mixpanel, Amplitude, PostHog). Also use when the user says "event tracking," "analytics setup," "tracking plan," "analytics implementation," or "user identification." For PLG metrics, see plg-metrics. For experimentation, see growth-experimentation.
Also in 4 projects that use this
Other versions10 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 10
- nahid-sparktales/agent-dispatcher★ 59same name
- nimadorostkar/Claude-Skills-collection★ 41same name
- reddygopalkrishna/developer-agent-skills★ 8same name
- YepAPI/skills★ 8same name
- AtulPurohit/Antigravity-Awesome-Skills★ 6same name
- novatic-cu/nova-skills★ 1same name
- novatic-cu/nova-skills-core★ 1same name
- hi-donwi/Donwi-Skills★ 0same name
- jars-demo/jars-skills★ 0same name
- MANVENDRA-github/agentry★ 0same 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 repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- api-performanceSkill
- env-configSkill
- error-handling-patternsSkill
- logging-and-tracingSkill
- node-deploySkill
- node-security-reviewSkill
- package-json-auditSkill
The file
Files
Background jobs
At-least-once delivery is the default, so jobs must be safe to run twice; they must not be lost between the database write and the enqueue; and deploys must not cut them off.
Paths below are relative to this skill's folder (in Claude Code: ${CLAUDE_SKILL_DIR}).
When to use
- "Move email / webhooks / PDF generation / exports to a queue"
- "Jobs run twice", "jobs get lost on deploy", "stalled jobs", "Redis memory keeps growing"
- Setting up BullMQ (Express, Fastify, NestJS
@nestjs/bullmq), retries, schedules - Reviewing queue/worker code before production
When not to use
- Event streaming at high volume (Kafka, NATS): different guarantees
- Simple fire-and-forget that may be lost (analytics pings): a plain async call is fine
- Error responses for HTTP requests:
error-handling-patterns - PM2/systemd/Docker setup for the worker process itself:
node-deploy
Workflow
- Decide what becomes a job (slow, flaky, CPU-heavy or must-retry work; see the
first section of references/patterns.md). The request keeps
validation and the defining write and returns
202with an id. - Check existing code (read-only).
Exit 1 = findings at or abovepython3 scripts/check_bullmq.py src python3 scripts/check_bullmq.py src --json --min-severity low--fail-on(defaultmedium). - Set up or fix the basics from assets/jobs.ts (show the diff first):
- explicit
connectionfromREDIS_URL; Workers use ioredis withmaxRetriesPerRequest: null defaultJobOptions:attempts, exponentialbackoff,removeOnComplete,removeOnFail- job data holds ids, not request bodies or files
worker.on('error'),worker.on('failed')with final-failure alerting- SIGTERM:
await worker.close()then queues and Redis
- explicit
- Make every processor idempotent. For each side effect decide: deterministic
jobId, provider idempotency key, processed-table check, or upsert. Write it down in the code next to the effect. - Enqueue reliably. For jobs that must not be lost (payments, fulfilment), use the transactional outbox from the patterns reference; for best-effort jobs, enqueue after commit.
- Schedules: replace
setInterval/node-cronin web processes andadd({ repeat })withupsertJobScheduler(idempotent across deploys and replicas). - Operations: Redis
maxmemory-policy noeviction, dashboards behind auth, alerts on failed count and queue depth, replay procedure for failed jobs. Run the checker again.
Output
Jobs review: api + worker (BullMQ 5.30) - 3 medium, 4 low
MED src/queue.ts:4 Worker ioredis without maxRetriesPerRequest: null
MED src/worker.ts:17 no worker.close() on SIGTERM -> active jobs stall on every deploy
MED src/worker.ts:17 no 'error' listener
LOW src/signup.ts:9 req.body stored in job data -> { userId } only
Idempotency: sendReceipt now keyed by jobId receipt-<orderId> + provider idempotency key
Outbox: orders + outbox row in one transaction; relay every 1s (diff below)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.

