QU

queue-patterns

Guides the implementation and management of message queue handlers and job enqueuing.

Install

mkdir -p .claude/skills/queue-patterns && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/15777" && unzip -o skill.zip -d .claude/skills/queue-patterns && rm skill.zip

Installs to .claude/skills/queue-patterns

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

How the @repo/queue package works in this repo. BullMQ queue + worker pattern. Use when: adding new job types, creating handlers, enqueuing jobs, or debugging queue issues.
172 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Define payload types for new job types
  • Add handler functions for specific job types
  • Enqueue jobs from any application
  • Enqueue jobs with a specified delay
  • Configure worker concurrency

How it works

The skill uses BullMQ with Redis to define job payload types, implement handlers, and enqueue jobs, ensuring strict typing and background processing.

Inputs & outputs

You give it
Job type definition, handler logic, and job payload
You get back
A new job type with a handler and enqueued jobs

When to use queue-patterns

  • Adding new job types
  • Implementing queue handlers
  • Debugging queue issues

About this skill

Queue Patterns — @repo/queue

Architecture

Any app (producer)                    apps/worker (consumer)
──────────────────                    ──────────────────────
QueueService.addJob() ──► Redis ──► WorkerService ──► handler function
  • QueueService — enqueues jobs (used in any app)
  • WorkerService — consumes jobs and runs handler functions (runs in apps/worker)
  • Both use BullMQ under the hood and share the same Redis server + queue name

Adding a new job type

Step 1 — Define the payload type

File: packages/queue/src/types.ts

export interface JobPayloadMap {
  "email.send": { to: string; subject: string; body: string }
  "bulk.email.send": { to: string; subject: string; body: string }[]
  // ↓ add new types here
  "your.job": { yourField: string }
}

Step 2 — Add a handler

File: apps/worker/src/handlers/index.ts

export const handlers: JobHandlerMap = {
  // ... existing handlers ...
  "your.job": async (payload, logger) => {
    // payload is strictly typed from JobPayloadMap
    logger.info(`Processing ${payload.yourField}`)
  }
}

TypeScript enforces that every key in JobPayloadMap has a matching handler.

Step 3 — Enqueue from any app

import { QueueService } from "@repo/queue"

const queue = new QueueService({ redis, logger })
await queue.addJob("your.job", { yourField: "value" })

// With delay:
await queue.addJob("your.job", { yourField: "value" }, { delay: 60_000 })

Key details

  • QueueService uses redis.client.duplicate() internally — the RedisClient namespace does NOT affect queue keys
  • BullMQ manages its own keys (e.g. bull:default:*) — separate from the caching namespace
  • The worker creates its own RedisClient because it's a separate process
  • Queue name is configurable via QUEUE_NAME env var (defaults to "default")
  • Worker concurrency is configurable via WORKER_CONCURRENCY env var

Worker env

REDIS_URL=redis://localhost:6379
QUEUE_NAME=default
WORKER_CONCURRENCY=3

Prerequisites

BullMQRedisTypeScript

Limitations

  • Requires a Redis server
  • Relies on BullMQ for queue management

How it compares

This skill provides a structured pattern for queue management with type enforcement and separate services for enqueuing and consuming jobs, unlike direct message queue interactions.

Compared to similar skills

queue-patterns side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
queue-patterns (this skill)06moNo flagsIntermediate
telegram-bot-builder1066moReviewIntermediate
workflow-orchestration-patterns102moNo flagsAdvanced
bullmq-specialist256moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

telegram-bot-builder

davila7

Expert in building Telegram bots that solve real problems - from simple automation to complex AI-powered bots. Covers bot architecture, the Telegram Bot API, user experience, monetization strategies, and scaling bots to thousands of users. Use when: telegram bot, bot api, telegram automation, chat bot telegram, tg bot.

106130

workflow-orchestration-patterns

wshobson

Design durable workflows with Temporal for distributed systems. Covers workflow vs activity separation, saga patterns, state management, and determinism constraints. Use when building long-running processes, distributed transactions, or microservice orchestration.

10117

bullmq-specialist

davila7

BullMQ expert for Redis-backed job queues, background processing, and reliable async execution in Node.js/TypeScript applications. Use when: bullmq, bull queue, redis queue, background job, job queue.

2595

workflow

vercel

Creates durable, resumable workflows using Vercel's Workflow DevKit. Use when building workflows that need to survive restarts, pause for external events, retry on failure, or coordinate multi-step operations over time. Triggers on mentions of "workflow", "durable functions", "resumable", "workflow devkit", or step-based orchestration.

431

trigger-dev

davila7

Trigger.dev expert for background jobs, AI workflows, and reliable async execution with excellent developer experience and TypeScript-first design. Use when: trigger.dev, trigger dev, background task, ai background job, long running task.

214

convex-cron-jobs

waynesutton

Scheduled function patterns for background tasks including interval scheduling, cron expressions, job monitoring, retry strategies, and best practices for long-running tasks

13

Search skills

Search the agent skills registry