Provides BullMQ queue patterns for game backends: one queue per domain (matchmaking, game-event, reward, notification, analytics), idempotent reward fulfillment, priority rules, and cron schedulers for daily rewards and season rollovers.
Ships in game-dev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Working BullMQ 6 code for a game backend. The code in boilerplate/ and templates/ compiles against bullmq 6.7.6. For any API this skill does not cover, read the BullMQ docs at https://docs.bullmq.io.
bun add bullmq ioredis
BullMQ 6 connects with ioredis by default but lists it only as an optional peer dependency, so install it yourself (https://docs.bullmq.io/guide/connections). redis-game-patterns explains why the bundle uses ioredis.
Then copy the files in the order numbered under Files.
| Queue | Holds | Why it is separate |
|---|---|---|
matchmaking | find-match, cancel | Players are waiting on it |
game-event | match results, action resolution | Changes live game state |
reward | grants, daily login, achievements | Must pay exactly once |
notification | push, in-game mail, email | Bound by a provider's send limit |
analytics | tracking, aggregation | Must never slow the others |
Separate queues let you scale, pause and drain one domain without touching the rest.
priority does not order one queue against another.priority only inside one queue, for example to grant purchase rewards before daily-login rewards. A lower number runs first.priority runs before every prioritized job. In a queue that uses priorities, give every job one.concurrencySettings in templates/queue-config.ts) to its own load. If analytics workers compete for CPU with matchmaking, run them in other processes.BullMQ retries failed jobs and re-runs stalled ones, so any job can run more than once.
idempotencyKey. The worker checks it, applies the change and records the key in one database transaction. Checking and marking in two separate writes pays twice if the worker crashes between them.jobId such as season-end-${seasonId}. A second add with that id is ignored while the first job exists. Ids must not contain colons or be plain integers.reward queue, never inline in a request handler.rewardWorker in boilerplate/workers.ts shows the order: build the key, then call applyRewardOnce(key, (tx) => ...), which records the key and credits currency, items and experience in one transaction, or skips everything if the key is already recorded. Log for analytics after it commits.BROADCAST_PLAYER_ID) is a trigger. The worker enqueues one reward job per eligible player, each keyed <run key>:<playerId>, and grants nothing itself.stripe-game-payments records the purchase, then enqueues reward delivery here. Key that job by the checkout session id (one-time purchase) or the invoice id (subscription period), the same keys its purchase rows are unique on, so a replayed webhook cannot grant twice.queue.upsertJobScheduler(id, { pattern, tz: 'UTC' }, template). BullMQ 6 removed repeat.utc and the legacy Queue.add(..., { repeat }) API.Date.now() in it. rewardWorker builds the per-run key from the produced job's id, which is new for each run and stays the same across retries.delay plus a jobId), not schedulers. A delayed job runs at or after its time, not exactly on it. Close the season by its stored end time, not by the time the job ran.maxRetriesPerRequest: 1 so a Redis outage returns an error to the player instead of hanging. Workers use maxRetriesPerRequest: null; BullMQ throws if a hand-made ioredis client passed to a worker has any other value. templates/queue-config.ts has both.Queue, Worker and QueueEvents uses the same prefix. Without one, QueueEvents listens on the default bull prefix and hears nothing.keyPrefix; BullMQ has its own prefix.removeOnFail keeps them at least 7 days. Alert on the failed event and inspect them there.bullmq and ioredis both in package.json.tz: 'UTC' and carry no per-run values in their template.maxRetriesPerRequest: null.prefix on queues, workers and queue events.monitoring-game-ops).limiter is global for the whole queue. Limit matchmaking requests per player at the API, with the rate limiter in redis-game-patterns.queuedAt in the processor.QueueEvents for dashboards and alerts. worker.on(...) sees only its own process.templates/job-types.ts: copy when you start. Queue names, job payload and result types, job names, the Priority enum.templates/queue-config.ts: copy when you start. Producer and worker connections, the shared key prefix, retries, rate limits, concurrency.boilerplate/queues.ts: copy when you add jobs from the game server. One typed Queue per domain plus QueueEvents for monitoring.boilerplate/workers.ts: copy when you write processors. One Worker per queue; replace the placeholder functions at the bottom.boilerplate/scheduler.ts: copy when you need daily rewards, season ends, timed events or periodic snapshots. It uses the queues from queues.ts, so closeAllQueues() closes them too.references/sources.md: read when you need the doc page and sentence behind a rule above.redis-game-patterns: Redis connection, per-player rate limiting.postgres-game-schema: the processed_events table that applyRewardOnce writes its keys to (shared with stripe-game-payments), and the currency and inventory tables rewards credit.matchmaking-system: the matching logic the matchmaking worker calls.stripe-game-payments: purchases that enqueue reward jobs.game-backend-architecture: the game server, rooms and tick loop that enqueue jobs.monitoring-game-ops: queue alerts and dashboards.What SKILL.md sets; muted values are Claude Code's defaults
39 skills in this plugin
/betterauth-integrationCovers the game-specific layer of Better Auth: player, moderator and admin roles, session checks on game routes and WebSocket handshakes, and keeping the auth session apart from the game session. Use when a game needs player login, moderator or admin powers, or authenticated real-time connections, and the project uses Better Auth./character-design-narrativeCovers designing game characters: NPCs, companions, antagonists, player avatars, character bibles and branching dialogue. Use when a game needs a new character written, an NPC feels flat or interchangeable, or dialogue needs a branching format with conditions and effects./ci-cd-game/game-dev:bullmq-game-queuesfrom game-dev
npx claudepluginhub fcsouza/agent-skills --plugin game-devOther plugins' skills for the same job