Provides four Redis patterns for game servers: sorted-set leaderboards, heartbeat presence, sliding-window rate limits, and cache-aside for player data. Uses ioredis.
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.
Redis holds hot, disposable game state. The database holds outcomes. If Redis restarts empty, players should lose nothing that matters: match results, rewards and currency are written to the database first.
The code here uses ioredis 6, because BullMQ 6 creates its Redis connections
with ioredis by default and most game servers in this bundle already run
BullMQ (bullmq-game-queues). The ioredis README says that for new projects
node-redis is the recommended client; if the project has no BullMQ and no
ioredis yet, consider node-redis and port the commands. BullMQ 6 marks ioredis
as an optional peer, so install it explicitly: bun add ioredis.
Every file takes the client as a parameter typed Redis from ioredis.
Create the client once in the server and pass it in. Keep the default
replyMapping: "legacy": the parsers expect WITHSCORES replies as flat
[member, score, ...] string arrays. The code needs Redis 6.2 or newer
(ZRANGE ... REV).
Copy boilerplate/leaderboard.ts when the game ranks players by score.
lb:weekly:2026-W46, lb:season:3.
A new period is a new key; snapshot the old one, then delete it.ZADD overwrites the score. For "best score counts", decide on purpose:
ZADD ... GT keeps the higher value; ZINCRBY adds points.REV), not
by who reached the score first. If first-to-score must win, encode the tie
break into the score, and keep the whole score inside the exact integer
range of a double (2^53).ZREVRANK is zero-based; the boilerplate returns rank 1 for the
top player.snapshot() with a function that writes the rows to
Postgres (postgres-game-schema), then reset the board.Copy templates/ephemeral-state.ts when the game shows who is online, keeps
live match state outside the database, or applies timed buffs.
presence:<playerId> with EX. A missing key means offline, so a crashed
client goes offline without cleanup code. Set the TTL to a few heartbeat
intervals so one lost packet does not flash the player offline.update() reads the JSON, applies your pure function and writes
the result with a compare-and-set Lua script: the write lands only if the
key still holds what was read, else it reads again and retries. Calls for
one match from the same process run one after another, so they never race
each other; the script catches races with other servers. Do not use
WATCH/MULTI here: concurrent updates on one shared client interleave
their WATCH and EXEC and lose writes.EX, plus a per-player sorted set
scored by expiry time to list them. Expiry needs no sweeper job.SET clears an existing TTL unless you pass EX again. Every write in the
template passes it.Copy templates/rate-limiter.ts when an action needs a cooldown or spam cap:
attacks, chat, trades, crafting.
rl:<action>:<playerId>. Limits differ per
action, so one global limit per player is the wrong shape.MULTI, so two concurrent attempts cannot both pass.game-backend-architecture).No file; the code is short enough to write in place.
player:<id> from Redis. On a hit, parse and return it.SET key value EX ttl,
and return it. A missing row stays uncached unless you cache a "not found"
marker with a short TTL.Cache only what the game reads often and can tolerate seeing a few seconds late (profile, loadout, cosmetics). Wallet balances and inventory counts are read from the database inside the transaction that changes them.
update() does), a single command, or MULTI/WATCH on a
connection that no concurrent code shares; a plain pipeline does not stop
another client's command running between yours.bullmq-game-queues).redis.duplicate()).prod:match-events). Pub/Sub
ignores database numbers, so staging and production on one Redis hear each
other.boilerplate/leaderboard.ts: copy when building a ranked board; read when
checking how ranks and snapshots are computed.templates/rate-limiter.ts: copy when adding per-action limits.templates/ephemeral-state.ts: copy when adding presence, live match state
or timed buffs.references/sources.md: read when you need the Redis or ioredis page behind
a rule above.bullmq-game-queues: durable jobs and events on the same Redis.matchmaking-system: queue and lobby state on Redis.gameplay-analytics: event buffering on Redis.postgres-game-schema: where leaderboard snapshots and player data live.game-backend-architecture: where the client is created and passed in.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/game-dev:redis-game-patternsfrom game-dev
npx claudepluginhub fcsouza/agent-skills --plugin game-dev39 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./bullmq-game-queuesBackground job design for game backends on BullMQ and Redis: one queue per game domain, idempotent reward fulfilment, and cron schedulers for daily rewards and season ends. Use when a game needs matchmaking requests, reward grants, match results, notifications or analytics processed off the request path, or recurring and timed jobs such as daily login rewards, leaderboard snapshots and season rollovers./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-gameGitHub Actions pipeline rules for a Bun game backend on Neon and Fly.io: migrations before deploy, one Neon database branch per pull request, a smoke test after deploy, and a pinned Bun version. Use when a game project needs CI, a deploy workflow, preview databases for pull requests, or a safe order for schema migrations and server deploys./elevenlabs-sound-musicCovers generating game audio with ElevenLabs (voice lines, sound effects, music) and Google Lyria 2 (instrumental music clips), and playing it in the browser through an audio state machine with crossfades, per-layer volume and an unlock on the first user input. Use when a game needs sound effects, NPC voice lines or a soundtrack, when music must follow game state (menu, exploration, combat, boss) without hard cuts, when audio stays silent on a phone until the player taps, or when choosing between ElevenLabs and Lyria for music./game-anti-cheatCovers how a developer defends their own online game against cheating: server-side input validation, withholding hidden state, lag-compensation limits, dupe-proof transfers, detection from server data and reports, and enforcement with delayed bans, appeals and refunds to victims. Use when a multiplayer game has speed hacks, wallhacks, aimbots, bots, item or currency dupes, real-money trading, boosting or win trading, or when planning how to detect and ban cheaters.Other plugins' skills for the same job