background-job-processing — Claude Code skill: task queues and workers
A skill for wiring up background job processing: task queues, workers, scheduling and retries. Useful when emails, reports or large exports should not block the request path.
npx skills add aj-geddes/useful-ai-prompts --skill background-job-processing -a claude-codeWhat background-job-processing does
The skill covers how to build background job processing: distributed task queues, worker pools, scheduling, error handling and monitoring. It ships a minimal Celery and Redis example plus a table of reference guides under references/ — Python with Celery and Redis, Node.js with Bull Queue, Ruby with Sidekiq, and separate guides on retries, error handling and observability.
There is a best-practices section too. Task timeouts, idempotent tasks, job priorities, exponential backoff and dead-letter queues for failed jobs are on the do list. The don't list warns against synchronous calls inside async tasks, unbounded retries and stuffing large objects into job data.
The quick-start example pulls the broker address from the REDIS_URL environment variable, so check that Redis is reachable and the variable is set before starting workers. Otherwise the app falls back to redis://localhost:6379/0 and fails on connect.
What it helps with
- move email sending out of the HTTP request
- add retries with exponential backoff
- split jobs into priority queues
- route failed jobs to a dead-letter queue
- watch queue depth and job failures
Example prompts for the agent
- Set up Celery with Redis for background email sending
- Add retries with exponential backoff and a dead-letter queue for failed jobs
- Put heavy exports on a separate queue with a task time limit
How to install background-job-processing
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill background-job-processing -a claude-code2Manually: put the files in place
~/.claude/skills/background-job-processing/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/background-job-processing/
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill background-job-processing -a codex2Manually: put the files in place
.agents/skills/background-job-processing/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill background-job-processing -a cursor2Manually: put the files in place
.cursor/skills/background-job-processing/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install aj-geddes/useful-ai-prompts background-job-processing2Manually: put the files in place
.github/skills/background-job-processing/SKILL.md1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill background-job-processing -a gemini-cli2Platform CLI
gemini skills install https://github.com/aj-geddes/useful-ai-prompts --path skills/background-job-processingManually: put the files in place
.devin/skills/background-job-processing/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill background-job-processing -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about background-job-processing
How do I install background-job-processing in Claude?
Run npx skills add aj-geddes/useful-ai-prompts --skill background-job-processing -a claude-code. The skill file then lives at ~/.claude/skills/background-job-processing/SKILL.md.
What does background-job-processing do?
It walks through building background job processing: queues, worker pools, scheduling, error handling and retries. A Celery and Redis example is included, along with reference guides for several stacks.
What do I need before using it?
The quick-start example reads the broker address from the REDIS_URL environment variable, so you need a reachable Redis instance and that variable set. The reference guides cover Celery, Bull Queue and Sidekiq.
Source text
SKILL.md · MIT
---
name: background-job-processing
description: >
Implement background job processing systems with task queues, workers,
scheduling, and retry mechanisms. Use when handling long-running tasks,
sending emails, generating reports, and processing large datasets
asynchronously.
---
# Background Job Processing
## Table of Contents
- [Overview](#overview)
- [When to Use](#when-to-use)
- [Quick Start](#quick-start)
- [Reference Guides](#reference-guides)
- [Best Practices](#best-practices)
## Overview
Build robust background job processing systems with distributed task queues, worker pools, job scheduling, error handling, retry policies, and monitoring for efficient asynchronous task execution.
## When to Use
- Handling long-running operations asynchronously
- Sending emails in background
- Generating reports or exports
- Processing large datasets
- Scheduling recurring tasks
- Distributing compute-intensive operations
## Quick Start
Minimal working example:
```python
# celery_app.py
from celery import Celery
from kombu import Exchange, Queue
import os
app = Celery('myapp')
# Configuration
app.conf.update(
broker_url=os.getenv('REDIS_URL', 'redis://localhost:6379/0'),
result_backend=os.getenv('REDIS_URL', 'redis://localhost:6379/0'),
task_serializer='json',
accept_content=['json'],
result_serializer='json',
timezone='UTC',
enable_utc=True,
task_track_started=True,
task_time_limit=30 * 60, # 30 minutes
task_soft_time_limit=25 * 60, # 25 minutes
broker_connection_retry_on_startup=True,
)
# Queue configuration
default_exchange = Exchange('tasks', type='direct')
app.conf.task_queues = (
// ... (see reference guides for full implementation)
```
## Reference Guides
Detailed implementations in the `references/` directory:
| Guide | Contents |
|---|---|
| [Python with Celery and Redis](references/python-with-celery-and-redis.md) | Python with Celery and Redis |
| [Node.js with Bull Queue](references/nodejs-with-bull-queue.md) | Node.js with Bull Queue |
| [Ruby with Sidekiq](references/ruby-with-sidekiq.md) | Ruby with Sidekiq |
| [Job Retry and Error Handling](references/job-retry-and-error-handling.md) | Job Retry and Error Handling |
| [Monitoring and Observability](references/monitoring-and-observability.md) | Monitoring and Observability |
## Best Practices
### ✅ DO
- Use task timeouts to prevent hanging jobs
- Implement retry logic with exponential backoff
- Make tasks idempotent
- Use job priorities for critical tasks
- Monitor queue depths and job failures
- Log job execution details
- Clean up completed jobs
- Set appropriate batch sizes for memory efficiency
- Use dead-letter queues for failed jobs
- Test jobs independently
### ❌ DON'T
- Use synchronous operations in async tasks
- Ignore job failures
- Make tasks dependent on external state
- Use unbounded retries
- Store large objects in job data
- Forget to handle timeouts
- Run jobs without monitoring
- Use blocking operations in queues
- Forget to track job progress
- Mix unrelated operations in one job
© aj-geddes · MIT · aj-geddes/useful-ai-prompts