game-backend-architecture

game-backend-architecture is a skill for Claude Code from fcsouza/agent-skills. It costs 100 tokens per session (3,164 once invoked), scanned A, original, MIT.

A guide for designing game back ends, the server-side systems that run multiplayer games. It covers game servers, WebSocket connections for two-way live communication, rooms, timed game loops, and server-authoritative rules.

In plain words
What is it for?
Use it when building multiplayer rooms, WebSocket features, game ticks, or an Elysia-based server that controls gameplay.
Why use it?
It helps structure multiplayer systems so the server manages shared game state and player connections consistently. It also provides guidance for real-time communication and recurring game updates.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the game-dev plugin — 39 skills shipped together

Good fit Use it when building multiplayer rooms, WebSocket features, game ticks, or an Elysia-based server that controls gameplay.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/fcsouza/agent-skills/game-backend-architecture
Install

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.

Any agent
npx skills add fcsouza/agent-skills --skill game-backend-architecture
Clone the repo
git clone --depth 1 https://github.com/fcsouza/agent-skills

Made for: Claude Code.

Or install game-dev, the plugin that ships this one along with the rest of its 39 skills.

Wrote 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.

agentmods badge for game-backend-architecture

README.md
[![agentmods](https://agentmods.dev/badge/skills/fcsouza/agent-skills/game-backend-architecture/github.svg)](https://agentmods.dev/skills/fcsouza/agent-skills/game-backend-architecture)
Your own site
<a href="https://agentmods.dev/skills/fcsouza/agent-skills/game-backend-architecture"><img src="https://agentmods.dev/badge/skills/fcsouza/agent-skills/game-backend-architecture/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.

agentmods 80×15 button for game-backend-architecture

Your own site · 80×15
<a href="https://agentmods.dev/skills/fcsouza/agent-skills/game-backend-architecture"><img src="https://agentmods.dev/badge/skills/fcsouza/agent-skills/game-backend-architecture.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 100 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,164 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00100 $0.03164
Opus 5.5 $0.00040 $0.01266
Sonnet 5.5 $0.00020 $0.00633
Haiku 4.5 $0.00010 $0.00316

Measured 19d ago against content hash 07e3cd40b5e8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

game-backend-architecture 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 19d ago.

The scan reads SKILL.md. This mod also ships 5 executable files (boilerplate/fan-out.ts, boilerplate/game-loop.ts, boilerplate/room-manager.ts, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

skills/game-backend-architecture/SKILL.md · 123 lines

How it starts

The opening of the file, as written. The whole thing — 123 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Game backend architecture

The boilerplate targets elysia 1.4.32. Use the elysiajs skill if it is installed, otherwise https://elysiajs.com, and check which Elysia major the project runs: the Elysia 2 beta rewrites the WebSocket API, so the .ws() code here does not carry over unchanged.

Requires

  • betterauth-integration for the Better Auth instance, roles and trusted origins
  • redis-game-patterns for presence keys and per-action rate limits

Decisions

  1. The server is the authority. A client sends what it wants to do (move north), never the result (I am at 100, 200). The server validates the action against its own state, applies it, and tells clients what happened.
  2. Game logic runs on a fixed timestep, separate from network I/O. Every tick sees the same dt, so the same inputs give the same result.
  3. A room owns its state, its action queue, its player set and its GameLoop. Rooms share nothing, and one room runs on one server instance. This holds for session games, where a match has a fixed, small player count. It stops holding when one space must carry more players or entities than one process can tick in its budget; see "When one space outgrows a process".
  4. REST for durable, request-response work (create a room, read a profile, buy an item). WebSocket for the match: actions in, state deltas out.
  5. Authenticate once, on the WebSocket upgrade, from the Better Auth session. The player id comes from that session for the life of the socket, never from a message. Browsers are checked by Origin plus the session cookie. Native clients (game-godot, game-unity) send no Origin and are checked by a bearer session.
  6. Default to 20 ticks per second. One tick then has a 50 ms budget for every room on the instance. Pick another rate per room when the genre needs it.

Wiring the server

  1. Define the protocol first in templates/message-types.ts. Every message is a member of a discriminated union on type. Client messages are one TypeBox schema, clientMessage; ClientMessage is derived from it with Static, and server.ts validates with it, so malformed messages are rejected before your code sees them and the type cannot drift from the check.
  2. Create the server with createGameServer(auth, trustedOrigins), passing the Better Auth instance and the game client origins. Put the same origins in Better Auth's trustedOrigins option.
  3. The upgrade check is the function authorizeUpgrade, called from .derive() on its own Elysia instance, so it does not run on the mounted auth routes. The route never upgrades on a failure. A direct auth.api call skips Better Auth's own origin checks, which is why the server checks Origin itself.
    • With an Origin header (a browser): the origin must be in trustedOrigins, else 403. The session comes from the cookie or a bearer token, as getSession reads it. No session is 401.
    • Without an Origin header (a native client): the request must carry Authorization: Bearer <token>, and the session must come from that token alone, else 403. A cookie on such a request does not count. RFC 6455 says only browser clients must send Origin (section 4.1), and that the check is not meant to keep non-browsers out (section 10.2).
    • An Origin the client sets proves nothing, because only a browser guarantees it. An untrusted Origin is 403 even with a valid token.
    • The token is read from the Authorization header only, never from the query string: a URL ends up in access logs and proxies.
    • This needs the bearer() plugin on the Better Auth instance (betterauth-integration). The token is a session credential: a native client keeps it in the OS secure store (Keychain, Android Keystore), never in a URL, a log line or a crash report.
  4. Put per-request values (the player id) in .derive(), not in store. store is one object shared by every request.
  5. Write game logic in RoomManager.tickRoom and processAction. The pattern for one action:

Read the full file on GitHub · 123 lines

Files

What ships with it

7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

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.

  1. 19d ago Changed · -174 lines · +46 tokens per session 07e3cd40b5e8
  2. 3mo ago First seen · 297 lines · 54 tokens per session scan A 90ee616da2bd

Subscribe to this mod's changes

game-backend-architecture is a skill published in the GitHub repository fcsouza/agent-skills (29 stars, last pushed today), licensed MIT. It adds 100 tokens to every session and 3,164 once invoked, about $0.0004 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.

Related

game-backend-architecture compared with skills from other repositories

game-backend-architecture next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
game-backend-architecturefcsouza/agent-skillsSkill29todayMITA100Claude Code
scenario-godot-multiplayerscenario-labs/skillsSkill4.7kyesterdayMITA132Claude Code
league-akari-sgp-data-sourceLeagueAkari/LeagueAkariSkill4.9kyesterdayMITA50Claude Code, Codex
csharp-godotjame581/GodotPrompterSkill1.0k2d agoMITA34Claude Code
web-servicesjame581/GodotPrompterSkill1.0k2d agoMITA64Claude Code
gamedev-multiplayerericrisco/rsc-harnessSkill707yesterdayMITA86Claude Code, Codex
cloudflare-durable-objectssecondsky/claude-skillsSkill2573d agoMITA43Claude Code