Skip to content
Back to skills

Background Jobs

ASecurity

Write reliable background jobs and queue consumers: idempotency, retries, timeouts, dead letters and observability

  • 7 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 30, 2026
ai-agentsdatabasebackend

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add ansh44233/forge --skill background-jobs --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Background Jobs?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Background Jobs
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ansh44233-background-jobs/badge)](https://www.skillsdirectory.com/skills/ansh44233-background-jobs)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
description: Write reliable background jobs and queue consumers: idempotency, retries, timeouts, dead letters and observability
profile: standard
tags: backend, queues, reliability
---

# Background jobs

Use when adding or changing jobs, workers, cron tasks or queue consumers (Sidekiq, Celery, BullMQ, SQS, Kafka, Cloud Tasks).

## Make every job safe to run twice
Queues deliver at least once. Use an idempotency key, upserts, "already processed" markers, or conditional updates so a retry or duplicate does no harm. External side effects (emails, charges) need their own idempotency keys.

## Payloads
Pass ids and small values, not whole objects; load fresh data inside the job. Version the payload format if producers and consumers deploy separately.

## Enqueue after commit
Enqueue after the database transaction commits, or use an outbox table. Otherwise the job can run before the data exists, or run for data that was rolled back.

## Retries and failures
- Retry transient errors with exponential backoff and jitter; do not retry validation errors.
- Cap attempts and send exhausted jobs to a dead-letter queue that someone monitors.
- Set a timeout per job shorter than the queue's visibility timeout, so a slow job is not picked up twice.

## Scheduling and scale
- Cron jobs: guard against overlapping runs (locks) and make missed runs safe to catch up.
- Process large sets in batches with checkpoints so a failure resumes instead of restarting.

## Observe
Log job id, attempt and duration; track queue depth, age of the oldest message, failure rate and DLQ size.

## Verify
Tests that run the job twice (same result), a failing dependency (retries then DLQ), and enqueue-after-commit behaviour.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.