Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add cass-2003/local-workflow-skill --skill background-jobsgit clone --depth 1 https://github.com/cass-2003/local-workflow-skillWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/cass-2003/local-workflow-skill/background-jobs)<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/background-jobs"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/background-jobs/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/background-jobs"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/background-jobs.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00175 | $0.03676 |
| Opus 5.5 | $0.00070 | $0.01470 |
| Sonnet 5.5 | $0.00035 | $0.00735 |
| Haiku 4.5 | $0.00017 | $0.00368 |
Grade A, and why
background-jobs scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 413 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Background Jobs Skill — 后台任务系统
何时使用
- 把慢操作(发邮件 / 生成 PDF / 转码视频 / 调用第三方 API)从请求路径剥离
- 定时任务(每天清理 / 每小时同步报表)
- 工作流编排(订单 → 库存 → 支付 → 发货 多步事务)
- 重试 / 失败处理 / 死信队列
- 选择 Sidekiq vs Bull vs Celery vs Temporal
一、基本架构
[ HTTP 请求 ]
│ enqueue (毫秒级返回)
▼
[ Queue ] ← Redis / RabbitMQ / SQS / Kafka / Postgres
│
▼
[ Worker(s) ] ← 多实例并行消费
│
▼
[ DB / Email / 3rd-party API ]
核心收益:
- 解耦:请求快返回(用户体验)
- 削峰:突发流量入队,worker 按能力消费
- 重试:失败自动重新尝试
- 调度:未来某时执行
二、何时不要用 background job
- ❌ 简单同步够快(< 100ms)
- ❌ 用户期望立即看到结果(用 SSE / WS 反馈进度)
- ❌ 无幂等设计(队列默认 at-least-once,会重复)
- ❌ 只跑一次的小脚本(用 cron 直接跑)
三、跨语言库选型
| 语言 | 库 | 后端 | 卖点 |
|---|---|---|---|
| Ruby | Sidekiq | Redis | 业界标杆 / 简单 / 高性能 |
| Ruby | GoodJob / SolidQueue | Postgres | Rails 8 默认(无 Redis 依赖) |
| Python | Celery | Redis / RabbitMQ | 老牌 / 配置复杂 |
| Python | RQ | Redis | 简单替代 Celery |
| Python | Dramatiq / arq | Redis | 现代 / async |
| Node | BullMQ | Redis | 业界标准 / TS 友好 |
| Node | Agenda | MongoDB | 时间调度强 |
| Go | asynq | Redis | Sidekiq 风格 |
| Go | River | Postgres | 无 Redis / 事务级一致 |
| Java | Quartz | DB / 内存 | 老牌 / 调度强 |
| 多语言 | Temporal / Cadence | 自家集群 | 工作流 / Saga / 长事务 |
| 云 | AWS SQS + Lambda | / | 全托管 / 无 worker 维护 |
| 云 | GCP Cloud Tasks / Pub/Sub | / | 全托管 |
默认推荐:
- 简单任务:Sidekiq / BullMQ / asynq
- 复杂工作流(多步骤 / 长时间 / 补偿):Temporal
- 不想运维 Redis:River(Go)/ SolidQueue(Rails)
四、BullMQ 标准模式(Node.js)
import { Queue, Worker, QueueEvents } from 'bullmq'
const connection = { host: 'localhost', port: 6379 }
// 入队
const emailQueue = new Queue('email', { connection })
await emailQueue.add('welcome', {
userId: '123',
template: 'signup',
}, {
jobId: `welcome-${userId}`, // 幂等 key(重复 add 同 ID 不入队)
attempts: 3,
backoff: { type: 'exponential', delay: 1000 },
removeOnComplete: { age: 3600, count: 1000 },
removeOnFail: { age: 24 * 3600 },
})
// 延迟任务
await emailQueue.add('reminder', data, { delay: 60_000 })
// 定时任务(cron)
await emailQueue.add('daily-report', {}, {
repeat: { pattern: '0 9 * * *', tz: 'Asia/Tokyo' },
})
// 优先级
await emailQueue.add('urgent', data, { priority: 1 }) // 越小越优先
// Worker
const worker = new Worker('email', async (job) => {
switch (job.name) {
case 'welcome': return sendWelcomeEmail(job.data)
case 'reminder': return sendReminderEmail(job.data)
case 'daily-report': return generateDailyReport()
}
}, {
connection,
concurrency: 10, // 单 worker 并发数
limiter: { max: 100, duration: 60_000 }, // 每分钟 100 个任务
})
worker.on('failed', (job, err) => {
logger.error({ jobId: job?.id, err }, 'job failed')
})
// 优雅停机
process.on('SIGTERM', async () => {
await worker.close() // 等当前 job 处理完
await emailQueue.close()
process.exit(0)
})
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3mo ago First seen · 413 lines · 175 tokens per session scan A 0d54354771de
background-jobs is a skill published in the GitHub repository cass-2003/local-workflow-skill (12 stars, last pushed 4mo ago), licensed MIT. It adds 175 tokens to every session and 3,676 once invoked, about $0.0007 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
background-jobs compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| background-jobscass-2003/local-workflow-skill | Skill | 12 | 4mo ago | MIT | A | 175 | Claude Code, Codex |
| mem0-oss-to-platformmem0ai/mem0 | Skill | 70k | 6d ago | Apache-2.0 | A | 217 | Claude Code, Codex |
| tao-run-inference-serviceNVIDIA/skills | Skill | 4.3k | today | Apache-2.0 | A | 92 | Claude Code |
| azure-mgmt-botservice-dotnetmicrosoft/skills | Skill | 3.3k | today | MIT | A | 78 | Claude Code |
| fastapi-router-pymicrosoft/skills | Skill | 3.3k | today | MIT | A | 46 | Claude Code |
| api-designericrisco/rsc-harness | Skill | 707 | yesterday | MIT | A | 105 | Claude Code, Codex |
| migrate-segw-to-raparc-mcp/arc-1 | Skill | 282 | yesterday | MIT | A | 106 | Claude Code |