Provides PostgreSQL schema conventions for games using Drizzle ORM: players, sessions, items, inventory, events, leaderboards, achievements, currencies, social relations, and guilds.
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.
The schema is the value of this skill. Install, driver setup, config and migrations come from the vendor: use the neon-drizzle skill if it is installed, otherwise https://orm.drizzle.team/docs/get-started.
Target the stable Drizzle line, drizzle-orm 0.45.x. The Drizzle docs install lines use drizzle-orm@rc and drizzle-kit@rc; pin the 0.45 versions instead (see "Drizzle 1.0" below).
Every table and query in a game project follows these. Other skills (stripe-game-payments, gameplay-analytics, game-economy-design) build on them.
item_definitions). Columns are snake_case in SQL and camelCase in TypeScript: playerId: text("player_id"). Indexes are named <table>_<columns>_idx.text("id").primaryKey().$defaultFn(() => crypto.randomUUID()). Player-facing identifiers are never auto-increment integers; sequential ids let anyone enumerate players and items.timestamp(...).notNull().defaultNow(). Entity and catalog tables (players, item_definitions, guilds) carry createdAt and updatedAt; append-only and state rows carry the time that matters (events.createdAt, sessions.startedAt, guild_members.joinedAt). Give a new mutable table both columns. Set updatedAt in every update; a column default fills it only on insert.players has deletedAt: timestamp("deleted_at"); a deleted player keeps their rows for history. Every read that returns players, including joins, filters isNull(players.deletedAt). Add deletedAt to a new entity when its history matters (templates/entity-template.ts pattern 1).jsonb(...).$type<...>().default({}) for per-genre extras: stats, baseStats, properties, metadata. Never add genre columns (swordDamage) to core tables. Use jsonb, not json: PostgreSQL stores jsonb decomposed, processes it faster and can index it.pgEnum for fixed sets that code switches on (rarity, guild role, leaderboard period). Plain text for open sets designers extend (event type, currency type).onDelete: "cascade" from player-owned rows to players. Analytics rows (events) use onDelete: "set null" so history survives. Catalog references (itemDefinitionId) have no cascade.playerId) of every player-owned table. Add a composite index for each common filter, leading with the owner: events (playerId, type), leaderboards (category, period, score). Put a unique index on every natural key an upsert targets (currencies (playerId, currencyType)): PostgreSQL infers the ON CONFLICT target from a unique index.amount = amount + n upsert (addCurrency in templates/query-patterns.ts). Debit with spendCurrency: one UPDATE ... WHERE amount >= cost, and it reports failure when no row was updated, so two parallel spends cannot overdraw. The currencies table also has CHECK (amount >= 0), so a debit that bypasses the guard fails instead of going negative.processed_events holds one row per external event or job already applied (a Stripe event id, a reward job key), with id as the primary key, a kind and created_at. Insert it in the same transaction as the change it guards; a primary-key conflict means the change already happened. stripe-game-payments and bullmq-game-queues use this table.players is the account, keyed to the auth user. characters holds the several characters one account owns, with a name unique per shard among live characters (characters_shard_name_idx is a partial index on deleted_at IS NULL, so deleting a character frees its name; the schema comment says how to reserve names or make them global). The slot limit is a game rule; check it in code.
When the game has characters, the character owns level, xp and stats, and you delete those three columns from players, along with players_level_idx, and point getGuildWithMembers in templates/query-patterns.ts (it selects players.level) at the character. A single-character game skips characters and keeps them on players.
The game decides whether wallets and inventory belong to the account or to a character. The schema ships them on the account (playerId). To move a table to characters:
playerId column with characterId referencing characters.id (keep onDelete: "cascade"), and repoint its indexes.CHECK (amount >= 0) and the guarded spendCurrency as they are.templates/query-patterns.ts, change spendCurrency, addCurrency (including its ON CONFLICT target), getPlayerCurrencies and the inventory queries to take characterId and filter on it. They filter by playerId today, so they read and spend the wrong wallet until you do.A game can also keep both columns and use the character one for per-character rows.
Guild membership stays one guild per player, since a guild is a permanent group and short-lived parties live outside this table. To allow several guilds, see the comment on guild_members_player_idx. Alts also need game rules (gear transfer, risk diversion) that no table enforces.
boilerplate/schema.ts into the project's schema module. Delete tables the game does not need.templates/entity-template.ts, following the conventions above.templates/query-patterns.ts, with the database passed in.Drizzle 1.0 is a release candidate (npm rc tag), not the latest tag. If a project moves to it, these parts change (https://orm.drizzle.team/docs/v0-v1-changes):
relations() is replaced by defineRelations(), passed to the client as drizzle({ client, relations }). The relational query API v1 (db.query with a schema option) is removed.drizzle({ casing }) moves to a table-level API (snakeCase.table(...)).journal.json; running drizzle-kit up upgrades the migration table.drizzle-orm/pg-core exports PgAsyncDatabase and no PgDatabase, so the GameDb type in templates/query-patterns.ts must be redone.events (playerId, type), not two single-column indexes. Add the composite index with the query that needs it.jsonb column serves containment (properties @> '{"key": "value"}'), not properties ->> 'key' = .... For a hot filter, query with @> against a GIN index, add an expression index on that key, or promote the key to a typed column.players; filter isNull(players.deletedAt) there too, as templates/query-patterns.ts does.boilerplate/schema.ts: copy when starting a game database. Thirteen tables (players, characters, sessions, item definitions, inventory, events, leaderboards, achievements, currencies, social relations, guilds, guild members, processed events) and their enums.templates/entity-template.ts: copy when adding a new game entity. Three patterns: an entity a player owns, a definition catalog with player instances, and an enum-driven timed entity.templates/query-patterns.ts: read when writing queries against the schema: inventory join, leaderboard top N, event aggregation, JSONB filters, atomic currency credit, guarded spend, best-score upsert. Each function takes the database as its first argument (GameDb, any Drizzle Postgres database), so it works with whichever driver the project uses.redis-game-patterns for cached leaderboards and presence.bullmq-game-queues for async event processing.betterauth-integration for auth tables.database-performance-tuning for slow queries.Verified citations are in references/sources.md; read it when checking where a claim comes from.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/game-dev:postgres-game-schemafrom 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