[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-0cec4b91-f402-4c71-8c04-5b46daf94bbe":3,"$fo2YwvVfZjM32ScnCjfk2wzHhICj_0n5mIPcPNMtDhSw":42},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":33},"0cec4b91-f402-4c71-8c04-5b46daf94bbe","bullmq-specialist","BullMQ Redis支持的作业队列、后台处理专家","cat_coding_backend","mod_coding","sickn33,coding","---\nname: bullmq-specialist\ndescription: BullMQ expert for Redis-backed job queues, background processing,\n  and reliable async execution in Node.js\u002FTypeScript applications.\nrisk: none\nsource: vibeship-spawner-skills (Apache 2.0)\ndate_added: 2026-02-27\n---\n\n# BullMQ Specialist\n\nBullMQ expert for Redis-backed job queues, background processing, and\nreliable async execution in Node.js\u002FTypeScript applications.\n\n## Principles\n\n- Jobs are fire-and-forget from the producer side - let the queue handle delivery\n- Always set explicit job options - defaults rarely match your use case\n- Idempotency is your responsibility - jobs may run more than once\n- Backoff strategies prevent thundering herds - exponential beats linear\n- Dead letter queues are not optional - failed jobs need a home\n- Concurrency limits protect downstream services - start conservative\n- Job data should be small - pass IDs, not payloads\n- Graceful shutdown prevents orphaned jobs - handle SIGTERM properly\n\n## Capabilities\n\n- bullmq-queues\n- job-scheduling\n- delayed-jobs\n- repeatable-jobs\n- job-priorities\n- rate-limiting-jobs\n- job-events\n- worker-patterns\n- flow-producers\n- job-dependencies\n\n## Scope\n\n- redis-infrastructure -> redis-specialist\n- serverless-queues -> upstash-qstash\n- workflow-orchestration -> temporal-craftsman\n- event-sourcing -> event-architect\n- email-delivery -> email-systems\n\n## Tooling\n\n### Core\n\n- bullmq\n- ioredis\n\n### Hosting\n\n- upstash\n- redis-cloud\n- elasticache\n- railway\n\n### Monitoring\n\n- bull-board\n- arena\n- bullmq-pro\n\n### Patterns\n\n- delayed-jobs\n- repeatable-jobs\n- job-flows\n- rate-limiting\n- sandboxed-processors\n\n## Patterns\n\n### Basic Queue Setup\n\nProduction-ready BullMQ queue with proper configuration\n\n**When to use**: Starting any new queue implementation\n\nimport { Queue, Worker, QueueEvents } from 'bullmq';\nimport IORedis from 'ioredis';\n\n\u002F\u002F Shared connection for all queues\nconst connection = new IORedis(process.env.REDIS_URL, {\n  maxRetriesPerRequest: null,  \u002F\u002F Required for BullMQ\n  enableReadyCheck: false,\n});\n\n\u002F\u002F Create queue with sensible defaults\nconst emailQueue = new Queue('emails', {\n  connection,\n  defaultJobOptions: {\n    attempts: 3,\n    backoff: {\n      type: 'exponential',\n      delay: 1000,\n    },\n    removeOnComplete: { count: 1000 },\n    removeOnFail: { count: 5000 },\n  },\n});\n\n\u002F\u002F Worker with concurrency limit\nconst worker = new Worker('emails', async (job) => {\n  await sendEmail(job.data);\n}, {\n  connection,\n  concurrency: 5,\n  limiter: {\n    max: 100,\n    duration: 60000,  \u002F\u002F 100 jobs per minute\n  },\n});\n\n\u002F\u002F Handle events\nworker.on('failed', (job, err) => {\n  console.error(`Job ${job?.id} failed:`, err);\n});\n\n### Delayed and Scheduled Jobs\n\nJobs that run at specific times or after delays\n\n**When to use**: Scheduling future tasks, reminders, or timed actions\n\n\u002F\u002F Delayed job - runs once after delay\nawait queue.add('reminder', { userId: 123 }, {\n  delay: 24 * 60 * 60 * 1000,  \u002F\u002F 24 hours\n});\n\n\u002F\u002F Repeatable job - runs on schedule\nawait queue.add('daily-digest', { type: 'summary' }, {\n  repeat: {\n    pattern: '0 9 * * *',  \u002F\u002F Every day at 9am\n    tz: 'America\u002FNew_York',\n  },\n});\n\n\u002F\u002F Remove repeatable job\nawait queue.removeRepeatable('daily-digest', {\n  pattern: '0 9 * * *',\n  tz: 'America\u002FNew_York',\n});\n\n### Job Flows and Dependencies\n\nComplex multi-step job processing with parent-child relationships\n\n**When to use**: Jobs depend on other jobs completing first\n\nimport { FlowProducer } from 'bullmq';\n\nconst flowProducer = new FlowProducer({ connection });\n\n\u002F\u002F Parent waits for all children to complete\nawait flowProducer.add({\n  name: 'process-order',\n  queueName: 'orders',\n  data: { orderId: 123 },\n  children: [\n    {\n      name: 'validate-inventory',\n      queueName: 'inventory',\n      data: { orderId: 123 },\n    },\n    {\n      name: 'charge-payment',\n      queueName: 'payments',\n      data: { orderId: 123 },\n    },\n    {\n      name: 'notify-warehouse',\n      queueName: 'notifications',\n      data: { orderId: 123 },\n    },\n  ],\n});\n\n### Graceful Shutdown\n\nProperly close workers without losing jobs\n\n**When to use**: Deploying or restarting workers\n\nconst shutdown = async () => {\n  console.log('Shutting down gracefully...');\n\n  \u002F\u002F Stop accepting new jobs\n  await worker.pause();\n\n  \u002F\u002F Wait for current jobs to finish (with timeout)\n  await worker.close();\n\n  \u002F\u002F Close queue connection\n  await queue.close();\n\n  process.exit(0);\n};\n\nprocess.on('SIGTERM', shutdown);\nprocess.on('SIGINT', shutdown);\n\n### Bull Board Dashboard\n\nVisual monitoring for BullMQ queues\n\n**When to use**: Need visibility into queue status and job states\n\nimport { createBullBoard } from '@bull-board\u002Fapi';\nimport { BullMQAdapter } from '@bull-board\u002Fapi\u002FbullMQAdapter';\nimport { ExpressAdapter } from '@bull-board\u002Fexpress';\n\nconst serverAdapter = new ExpressAdapter();\nserverAdapter.setBasePath('\u002Fadmin\u002Fqueues');\n\ncreateBullBoard({\n  queues: [\n    new BullMQAdapter(emailQueue),\n    new BullMQAdapter(orderQueue),\n  ],\n  serverAdapter,\n});\n\napp.use('\u002Fadmin\u002Fqueues', serverAdapter.getRouter());\n\n## Validation Checks\n\n### Redis connection missing maxRetriesPerRequest\n\nSeverity: ERROR\n\nBullMQ requires maxRetriesPerRequest null for proper reconnection handling\n\nMessage: BullMQ queue\u002Fworker created without maxRetriesPerRequest: null on Redis connection. This will cause workers to stop on Redis connection issues.\n\n### No stalled job event handler\n\nSeverity: WARNING\n\nWorkers should handle stalled events to detect crashed workers\n\nMessage: Worker created without 'stalled' event handler. Stalled jobs indicate worker crashes and should be monitored.\n\n### No failed job event handler\n\nSeverity: WARNING\n\nWorkers should handle failed events for monitoring and alerting\n\nMessage: Worker created without 'failed' event handler. Failed jobs should be logged and monitored.\n\n### No graceful shutdown handling\n\nSeverity: WARNING\n\nWorkers should gracefully shut down on SIGTERM\u002FSIGINT\n\nMessage: Worker file without graceful shutdown handling. Jobs may be orphaned on deployment.\n\n### Awaiting queue.add in request handler\n\nSeverity: INFO\n\nQueue additions should be fire-and-forget in request handlers\n\nMessage: Queue.add awaited in request handler. Consider fire-and-forget for faster response.\n\n### Potentially large data in job payload\n\nSeverity: WARNING\n\nJob data should be small - pass IDs not full objects\n\nMessage: Job appears to have large inline data. Pass IDs instead of full objects to keep Redis memory low.\n\n### Job without timeout configuration\n\nSeverity: INFO\n\nJobs should have timeouts to prevent infinite execution\n\nMessage: Job added without explicit timeout. Consider adding timeout to prevent stuck jobs.\n\n### Retry without backoff strategy\n\nSeverity: WARNING\n\nRetries should use exponential backoff to avoid thundering herd\n\nMessage: Job has retry attempts but no backoff strategy. Use exponential backoff to prevent thundering herd.\n\n### Repeatable job without explicit timezone\n\nSeverity: WARNING\n\nRepeatable jobs should specify timezone to avoid DST issues\n\nMessage: Repeatable job without explicit timezone. Will use server local time which can drift with DST.\n\n### Potentially high worker concurrency\n\nSeverity: INFO\n\nHigh concurrency can overwhelm downstream services\n\nMessage: Worker concurrency is high. Ensure downstream services can handle this load (DB connections, API rate limits).\n\n## Collaboration\n\n### Delegation Triggers\n\n- redis infrastructure|redis cluster|memory tuning -> redis-specialist (Queue needs Redis infrastructure)\n- serverless queue|edge queue|no redis -> upstash-qstash (Need queues without managing Redis)\n- complex workflow|saga|compensation|long-running -> temporal-craftsman (Need workflow orchestration beyond simple jobs)\n- event sourcing|CQRS|event streaming -> event-architect (Need event-driven architecture)\n- deploy|kubernetes|scaling|infrastructure -> devops (Queue needs infrastructure)\n- monitor|metrics|alerting|dashboard -> performance-hunter (Queue needs monitoring)\n\n### Email Queue Stack\n\nSkills: bullmq-specialist, email-systems, redis-specialist\n\nWorkflow:\n\n```\n1. Email request received (API)\n2. Job queued with rate limiting (bullmq-specialist)\n3. Worker processes with backoff (bullmq-specialist)\n4. Email sent via provider (email-systems)\n5. Status tracked in Redis (redis-specialist)\n```\n\n### Background Processing Stack\n\nSkills: bullmq-specialist, backend, devops\n\nWorkflow:\n\n```\n1. API receives request (backend)\n2. Long task queued for background (bullmq-specialist)\n3. Worker processes async (bullmq-specialist)\n4. Result stored\u002Fnotified (backend)\n5. Workers scaled per load (devops)\n```\n\n### AI Processing Pipeline\n\nSkills: bullmq-specialist, ai-workflow-automation, performance-hunter\n\nWorkflow:\n\n```\n1. AI task submitted (ai-workflow-automation)\n2. Job flow created with dependencies (bullmq-specialist)\n3. Workers process stages (bullmq-specialist)\n4. Performance monitored (performance-hunter)\n5. Results aggregated (ai-workflow-automation)\n```\n\n### Scheduled Tasks Stack\n\nSkills: bullmq-specialist, backend, redis-specialist\n\nWorkflow:\n\n```\n1. Repeatable jobs defined (bullmq-specialist)\n2. Cron patterns with timezone (bullmq-specialist)\n3. Jobs execute on schedule (bullmq-specialist)\n4. State managed in Redis (redis-specialist)\n5. Results handled (backend)\n```\n\n## Related Skills\n\nWorks well with: `redis-specialist`, `backend`, `nextjs-app-router`, `email-systems`, `ai-workflow-automation`, `performance-hunter`\n\n## When to Use\n- User mentions or implies: bullmq\n- User mentions or implies: bull queue\n- User mentions or implies: redis queue\n- User mentions or implies: background job\n- User mentions or implies: job queue\n- User mentions or implies: delayed job\n- User mentions or implies: repeatable job\n- User mentions or implies: worker process\n- User mentions or implies: job scheduling\n- User mentions or implies: async processing\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,152,919,"2026-05-16 13:09:32",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":25,"skillCount":32,"createdAt":26},"后端开发","backend","mdi-server","API、数据库、服务端架构",296,[34],{"id":35,"skillId":4,"version":36,"fileName":37,"fileSize":38,"filePath":39,"fileHash":40,"manifest":41,"createdAt":19},"e03f9859-83ff-4d9b-bf94-d7dca7a16f8c","1.0.0","bullmq-specialist.zip",3825,"uploads\u002Fskills\u002F0cec4b91-f402-4c71-8c04-5b46daf94bbe\u002Fbullmq-specialist.zip","991fe73ef1409a0cd9851ec564eaae3aa69791135a4e551f6d1e893d096af1e0","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":10194}]",{"code":43,"message":44,"data":45},200,"success",{"items":46,"stats":47,"page":50},[],{"averageRating":48,"totalRatings":48,"ratingCounts":49},0,[48,48,48,48,48],{"limit":51,"offset":48,"hasMore":52,"nextOffset":51,"ratedOnly":16},15,false]