Trigger.dev Background Tasks
papermark/papermark
Guides building durable background tasks, scheduled jobs and queues with Trigger.dev, including retries, waits, idempotency and concurrency limits.
创建或修改 BullMQ 队列任务。当需要创建新队列、添加任务类型、注册 Worker、设置定时任务、或用户请求"添加后台任务/队列处理"时使用
$ npx skills add zhe-qi/clhoria-template --skill bullmq -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install zhe-qi/clhoria-template bullmq --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/zhe-qi/clhoria-template.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/bullmq .claude/skills/bullmq && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "bullmq" agent skill from https://github.com/zhe-qi/clhoria-template/tree/main/.agents/skills/bullmq into .claude/skills/bullmq/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bullmq", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/zhe-qi/clhoria-template/tree/main/.agents/skills/bullmqType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add zhe-qi/clhoria-template --skill bullmq -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install zhe-qi/clhoria-template bullmq --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/zhe-qi/clhoria-template.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/bullmq .agents/skills/bullmq && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "bullmq" agent skill from https://github.com/zhe-qi/clhoria-template/tree/main/.agents/skills/bullmq into .agents/skills/bullmq/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bullmq", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add zhe-qi/clhoria-template --skill bullmq -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install zhe-qi/clhoria-template bullmq --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/zhe-qi/clhoria-template.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/bullmq .cursor/skills/bullmq && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "bullmq" agent skill from https://github.com/zhe-qi/clhoria-template/tree/main/.agents/skills/bullmq into .cursor/skills/bullmq/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bullmq", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/zhe-qi/clhoria-template.git --path .agents/skills/bullmq--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add zhe-qi/clhoria-template --skill bullmq -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install zhe-qi/clhoria-template bullmq --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/zhe-qi/clhoria-template.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/bullmq .gemini/skills/bullmq && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "bullmq" agent skill from https://github.com/zhe-qi/clhoria-template/tree/main/.agents/skills/bullmq into .gemini/skills/bullmq/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bullmq", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install zhe-qi/clhoria-template bullmqInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add zhe-qi/clhoria-template --skill bullmq -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/zhe-qi/clhoria-template.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/bullmq .github/skills/bullmq && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "bullmq" agent skill from https://github.com/zhe-qi/clhoria-template/tree/main/.agents/skills/bullmq into .github/skills/bullmq/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bullmq", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add zhe-qi/clhoria-template --skill bullmq -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install zhe-qi/clhoria-template bullmq --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/zhe-qi/clhoria-template.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/bullmq .opencode/skills/bullmq && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "bullmq" agent skill from https://github.com/zhe-qi/clhoria-template/tree/main/.agents/skills/bullmq into .opencode/skills/bullmq/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bullmq", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
bullmq创建或修改 BullMQ 队列任务。当需要创建新队列、添加任务类型、注册 Worker、设置定时任务、或用户请求"添加后台任务/队列处理"时使用
Bullmq is an agent skill from zhe-qi/clhoria-template. 创建或修改 BullMQ 队列任务。当需要创建新队列、添加任务类型、注册 Worker、设置定时任务、或用户请求"添加后台任务/队列处理"时使用
Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files (for example `examples/email-cleanup-queues.md`, `templates/job-definition.md` and `templates/queue-definition.md`).
It works with Zod and Hono. The repository describes itself as: Production-ready Hono backend template that doubles as an AI agent harness — providing feedforward guides, feedback sensors, and progressive specialization to make AI coding… The licence is MIT.
5 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 589f13e. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Bullmq loads about 1.6k tokens when it runs. Until then it costs about 20 tokens; SKILL.md has 347 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from zhe-qi/clhoria-template at commit 589f13e, republished under its MIT licence (© zhe-qi). 347 words, ~1,630 tokens.
.claude/skills/bullmq/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.maxRetriesPerRequest: null)src/lib/
├── enums/bullmq.ts # 队列和任务名称枚举
├── infrastructure/
│ ├── bullmq/
│ │ └── job-registry.ts # 类型映射和 Zod 验证
│ ├── bullmq-adapter.ts # QueueManager 核心类
│ └── effect/services/bullmq.ts # Effect Layer
│ └── bootstrap.ts # Worker 注册位置
src/routes/admin/
└── queue-board.index.ts # Bull Board UI 路由QueueJobsMapping 确保队列只能使用特定 job nameJobDefinitionRegistry 自动推断 job data 类型JobSchemaRegistry 使用 Zod 验证数据email、cleanup,不用 EMAIL_QUEUE)send-welcome、daily-cleanup)as const(不用 enum)[JobName.XXX]: Schema 形式2024-01-01T00:00:00Z)z.uuid() 验证Effect.tryPromise)Effect.syncError 类型Effect.sync(立即返回 Worker 实例)src/lib/enums/bullmq.ts 添加队列名称job-registry.ts 创建 QueueJobsMapping 映射(初始为 never)src/lib/enums/bullmq.ts 添加任务名称job-registry.ts 创建 Zod schemaJobDefinitionRegistry 类型映射JobSchemaRegistry 验证映射QueueJobsMapping 关联队列queueManager.registerWorkerJob<T> 类型)在业务代码中使用(无需创建文件):
import { Effect } from "effect";
import { queueManager } from "@/lib/infrastructure/bullmq-adapter";
import { JobName, QueueName } from "@/lib/enums/bullmq";
// 添加任务
const program = queueManager.addJob(
QueueName.EMAIL,
JobName.EMAIL_SEND_WELCOME,
{ email: "user@example.com", username: "testuser" },
{ priority: 1, delay: 5000 }, // 可选配置
);
await Effect.runPromise(program);使用 Job Schedulers API(BullMQ v5.16.0+):
// 调度定时任务
const program = queueManager.scheduleJob(
QueueName.CLEANUP,
JobName.CLEANUP_DAILY,
{},
{ pattern: "0 0 * * *" }, // Cron 表达式
);
await Effect.runPromise(program);
// 移除定时任务
await Effect.runPromise(
queueManager.unscheduleJob(QueueName.CLEANUP, JobName.CLEANUP_DAILY),
);包含:
QueueName 枚举定义JobName 枚举定义包含:
JobDefinitionRegistry 类型映射JobSchemaRegistry 验证映射QueueJobsMapping 队列关联包含:
包含:
参考 examples/email-cleanup-queues.md 查看完整的 Email 和 Cleanup 队列实现。
// 添加任务(Effect 封装 + Zod 验证)
addJob<Q, N>(
queueName: Q,
jobName: N,
data: JobDataByName<N>,
opts?: JobsOptions,
): Effect<Job>
// 注册 Worker(Effect 封装)
registerWorker<Q>(
queueName: Q,
processor: (job: Job) => Promise<any>,
options?: WorkerOptions,
): Effect<Worker>
// 调度定时任务(Effect 封装 + Zod 验证)
scheduleJob<Q, N>(
queueName: Q,
jobName: N,
data: JobDataByName<N>,
repeatOptions: RepeatOptions,
): Effect<void>
// 移除定时任务
unscheduleJob(queueName: string, jobName: string): Effect<boolean>
// 查询定时任务
getScheduledJobs(queueName: string): Effect<JobScheduler[]>
// 获取队列实例(用于 Bull Board)
getQueue(name: string): Queue
// 优雅关闭
close(timeoutMs?: number): Effect<void>addJob 和 registerWorker 方法logger.info({ jobId, ... }, "[Queue]: message"))timeoutgetQueue 直接添加任务(绕过类型检查和验证)console.log(使用 logger)QueueJobsMapping 中关联队列和任务import { BullMQService } from "@/lib/infrastructure/effect/services/bullmq";
const program = Effect.gen(function* () {
const qm = yield* BullMQService;
yield* qm.addJob(QueueName.EMAIL, JobName.EMAIL_SEND_WELCOME, data);
});定时任务可能需要查询数据库:
import { subDays } from "date-fns";
import { lt } from "drizzle-orm";
import db from "@/db";
import { auditLogs } from "@/db/schema";
// Worker processor 中
const processor = async (job: Job<CleanupData>) => {
const { daysToKeep } = job.data;
const cutoffDate = subDays(new Date(), daysToKeep);
await db
.delete(auditLogs)
.where(lt(auditLogs.createdAt, cutoffDate.toISOString()));
logger.info({ daysToKeep }, "[Cleanup]: 旧日志已清理");
};访问 /api/admin/queue-board 查看:
在应用启动时(src/lib/infrastructure/bootstrap.ts)注册所有 Worker。
BullMQ 自动重试(默认 3 次)。Worker 可配置:
registerWorker(queueName, processor, {
attempts: 5,
backoff: { type: "exponential", delay: 2000 },
});使用 scheduleJob(内部调用 upsertJobScheduler),相同 schedulerId 会覆盖。
参考 src/lib/infrastructure/__tests__/bullmq-adapter.test.ts:
maxRetriesPerRequest: null)© zhe-qi, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 5 other files in .agents/skills/bullmq of zhe-qi/clhoria-template.
Open the folder on GitHubat commit 589f13e
Bullmq next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Bullmq this skillzhe-qi/clhoria-template | 193 | — | ~1.6k | Automated safety check: Pass | MIT | |
| Trigger.dev Background Taskspapermark/papermark | 9.2k | — | ~2.1k | Automated safety check: Pass | Custom licence | |
| Upstash Workflow Patternslobehub/lobehub | 83k | — | ~1.7k | Automated safety check: Pass | Custom licence | |
| Mastra Honojwynia/agent-skills | 170 | — | ~2.9k | Automated safety check: Pass | MIT | |
| Hono Idiomsirahardianto/awesome-agv | 156 | — | ~3k | Automated safety check: Pass | MIT | |
| Backend ExpertCaoMeiYouRen/caomei-auth | 220 | — | ~329 | Automated safety check: Pass | MIT |
papermark/papermark
Guides building durable background tasks, scheduled jobs and queues with Trigger.dev, including retries, waits, idempotency and concurrency limits.
lobehub/lobehub
Implementation patterns for Upstash Workflow and QStash handlers in the LobeHub codebase: dry runs, fan-out chunking and single-item execution.
jwynia/agent-skills
Develop AI agents, tools, and workflows with Mastra v1 Beta and Hono servers.
irahardianto/awesome-agv
Hono lightweight web framework patterns: type-safe route handlers, middleware composition, Zod validation, and RPC clients for Cloudflare Workers, Node, or Bun.
CaoMeiYouRen/caomei-auth
设计或实现后端 API、服务层、数据库读写、鉴权权限控制、输入校验、事务处理与错误处理时使用。用户提到 API、route、handler、server、auth、permission、drizzle、database、zod、Hono、Nuxt server routes、backend bug 修复时都应触发。
shepherdjerred/monorepo
Hono web framework for edge-first, lightweight APIs - routing, middleware, validation, and multi-runtime support When user works with Hono, builds APIs, creates middleware, uses Zod validation with…
zhe-qi/clhoria-template
Effect v4 模式指南。当需要创建 Effect 服务、定义错误类型、编写 Effect 程序、管理 Layer 组合、或使用 Effect 封装异步操作时使用
zhe-qi/clhoria-template
创建或修改一个新的 API tier。当用户请求“新增 tier / 创建 partner tier / 新增 merchant 端 / 新增 tenant 端 / 新增 API 端 / 新增一套路由层”时使用。目标是在不修改框架核心的前提下,为新 tier 补齐配置、中间件、类型别名、路由入口和测试。
zhe-qi/clhoria-template
创建或修改 CRUD 模块。当需要创建新的增删改查 API、修改现有路由模块、添加新字段、新增接口、或用户请求"创建/修改 XX 管理"时使用
zhe-qi/clhoria-template
创建或修改数据库 Schema。当需要创建新表、修改表结构、定义字段、设置索引约束、或涉及 Drizzle ORM / drizzle-zod 操作时使用
zhe-qi/clhoria-template
Drizzle ORM v1 关系查询指南。当需要定义 Relations v2、编写关系查询、使用 through 多对多、预定义过滤器、或从旧版 Drizzle 迁移时使用
zhe-qi/clhoria-template
Enter explore mode - think through ideas, investigate problems, clarify requirements
创建或修改 BullMQ 队列任务。当需要创建新队列、添加任务类型、注册 Worker、设置定时任务、或用户请求"添加后台任务/队列处理"时使用. Bullmq is an agent skill from zhe-qi/clhoria-template.
Bullmq fits situations like: tasks that involve Background jobs.
Run `npx skills add zhe-qi/clhoria-template --skill bullmq -a claude-code`. Or copy the skill folder (.agents/skills/bullmq in zhe-qi/clhoria-template) into .claude/skills/bullmq in your project. Claude Code loads it when a task matches its description.
Run `npx skills add zhe-qi/clhoria-template --skill bullmq -a codex`. Or copy the skill folder (.agents/skills/bullmq in zhe-qi/clhoria-template) into .agents/skills/bullmq in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add zhe-qi/clhoria-template --skill bullmq -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/bullmq, .gemini/skills/bullmq, .github/skills/bullmq and .opencode/skills/bullmq in your project.
SKILL.md names no scripts, command-line tools or credentials: Bullmq is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Bullmq is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.6k tokens (SKILL.md is roughly 6.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Bullmq: Trigger.dev Background Tasks (papermark/papermark, 9.2k stars), Upstash Workflow Patterns (lobehub/lobehub, 83k stars), Mastra Hono (jwynia/agent-skills, 170 stars) and Hono Idioms (irahardianto/awesome-agv, 156 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
zhe-qi (a GitHub user) maintains it in zhe-qi/clhoria-template, which has 193 GitHub stars. The repository holds 10 skills in this directory. The repository was last updated on July 30, 2026.
Source: zhe-qi/clhoria-template on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.