From game-dev
Designs genre-agnostic PostgreSQL database schemas for games using Drizzle ORM, covering players, inventory, leaderboards, sessions, events, guilds, and JSONB for extensible data.
npx claudepluginhub fcsouza/agent-skills --plugin standalone-skillsThis skill uses the workspace's default tool permissions.
Genre-agnostic database schema design for games using Drizzle ORM + PostgreSQL.
Builds type-safe database layers with Drizzle ORM in TypeScript: schema design, relational queries, migrations, and serverless integrations like Neon and Supabase.
Guides PostgreSQL and Drizzle ORM usage for type-safe schemas, relations, migrations, queries, indexes, and performance in backend APIs and data models.
Provides Drizzle ORM patterns for schema definition, CRUD operations, relations, queries, transactions, and migrations. Supports PostgreSQL, MySQL, SQLite, MSSQL, CockroachDB.
Share bugs, ideas, or general feedback.
Genre-agnostic database schema design for games using Drizzle ORM + PostgreSQL.
Trigger: database schema, game database, Drizzle schema, players table, inventory, leaderboards, sessions, events, entity system, game data model
None — this is a foundational skill.
Sid Meier: "A game is a series of interesting decisions." Richard Garfield: "The best game systems are elegant rule systems — minimal components that compose into complex behaviors."
bun add drizzle-orm @neondatabase/serverless
bun add -d drizzle-kit
Create drizzle.config.ts at the project root. See boilerplate/migrations.ts for the full config pattern.
Start with the core tables in boilerplate/schema.ts. These cover players, sessions, inventory, items, events, leaderboards, achievements, currencies, social relations, guilds, and guild members.
Extend with custom entities using templates/entity-template.ts.
bunx drizzle-kit generate
bunx drizzle-kit migrate
See templates/query-patterns.ts for common query patterns including inventory lookups, leaderboard queries, event aggregation, and JSONB filtering.
import { players } from './schema';
await db.insert(players).values({
username: 'player1',
email: 'player1@example.com',
displayName: 'Player One',
stats: { health: 100, speed: 10 },
metadata: { tutorial_completed: true },
});
await db.insert(itemDefinitions).values({
name: 'Rare Artifact',
type: 'equipment',
rarity: 'rare',
baseStats: { power: 25, durability: 100 },
metadata: { description: 'A mysterious artifact', tradeable: true },
stackable: false,
});
See boilerplate/schema.ts for full table definitions and templates/query-patterns.ts for advanced queries.
bullmq-game-queues for async event processingredis-game-patterns for cached queriesbetterauth-integration for auth tablesgame-economy-design for economy schemasswordDamage or spellPower columnsdeletedAt timestamps so game history is preserved(playerId, type) indexesSid Meier: Schema should enable "interesting decisions" — flexible enough that any game mechanic can be modeled without schema changes. A well-designed JSONB column lets designers iterate on game mechanics without migrations.
Richard Garfield: Elegant schemas have minimal tables that compose into complex behaviors. Eleven core tables can model inventory, progression, social, economy, and analytics for any genre.