skills/game-dev-commands/game-build/SKILL.md
Builds a game component from the MVP plan — production TypeScript + Vitest tests + mock dependencies + build registry tracking. Extract the component name from the user's message (or "status" to check progress). Requires docs/mvp-first-draft.md — run game-architect first.
npx skillsauth add fcsouza/agent-skills game-buildInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
docs/mvp-first-draft.md in the project (run game-architect first)Execute in this exact order:
docs/mvp-first-draft.md exists in the project
⛔ Cannot proceed. Run the game-architect skill first to generate the MVP plan. game-build requires an existing plan to avoid architectural drift. and stop.docs/mvp-first-draft.md (the MVP plan from game-architect)
⚠️ [component] was explicitly deferred: "[reason]". Building now may increase scope. Continue? and wait for confirmation before proceeding.game-backend-architecture, game-design-fundamentals, quest-narrative-coherence, postgres-game-schema, redis-game-patterns, bullmq-game-queues, betterauth-integration, stripe-game-payments, elevenlabs-sound-music, game-state-sync, matchmaking-system, gameplay-analyticsdocs/build-registry.md if it exists (create it if not, using the template below)docs/world-lore.md if component touches narrative/questsdocs/quest-registry.md if component touches questsSpecial case: component name is "status"
Read docs/build-registry.md and output a progress table showing built/mocked/remaining components. Do not build anything. Stop after outputting the status.
Build registry initial template (create at docs/build-registry.md if missing):
# Build Registry
> Managed by game-build skill — do not edit manually
## Summary
- Total components planned: [from MVP plan]
- Built: 0 | Mocked: 0 | Remaining: 0
## Components
<!-- entries added automatically by game-build -->
Before writing any code, resolve the component's dependency graph from the MVP plan:
For each dependency of the component:
docs/build-registry.md for status// MOCK — replace with real implementation via game-build [dependency-name]docs/build-registry.md as status: "mock"List all mocks generated at the top of your output so the user knows what to build next.
Special case: component already in build-registry as "built"
Warn the user: ⚠️ [component] is already marked as built in docs/build-registry.md. Do you want to refactor it instead? Stop and wait for confirmation before regenerating.
Ask at most 2 questions if critical decisions cannot be inferred from the MVP plan. If the MVP plan has the answer, use it — do not ask.
Valid questions:
Never ask about naming conventions, code style, or anything the skill files already define.
any, no implicit types// [→ bullmq-game-queues: retry with exponential backoff]
const retryConfig = { attempts: 3, backoff: { type: 'exponential', delay: 1000 } }
src/
[component-name]/
index.ts ← main entry point / public API
[component].ts ← core logic
[component].test.ts ← Vitest tests (required, no exceptions)
types.ts ← all TypeScript types/interfaces for this component
__mocks__/
[dependency].mock.ts ← any mocks generated in Phase 1
Every component ships with tests. No exceptions. Required coverage:
No snapshot tests for game logic — assert on behavior, not structure.
| If component involves... | Apply skill + patterns |
|---|---|
| DB reads/writes | postgres-game-schema — Drizzle typed queries, no raw SQL strings |
| Cache / realtime | redis-game-patterns — correct data structure, key naming {entity}:{id}:{field} |
| Background jobs | bullmq-game-queues — typed job payload, processor, retry config with attempts+backoff |
| Auth / sessions | betterauth-integration — auth.api.getSession(), never trust client-sent user IDs |
| Payments | stripe-game-payments — verify Stripe-Signature before processing, never fulfill on checkout redirect |
| Audio / SFX | elevenlabs-sound-music — audio state machine, API call with fallback |
| Quest / mission logic | quest-mission-design + quest-narrative-coherence — coherence check FIRST |
| Client-server sync | game-state-sync — server-authoritative, delta encoding, rollback buffer |
| Matchmaking | matchmaking-system — expanding bracket, BullMQ queue, atomic dequeue |
| Analytics | gameplay-analytics — event emit pattern, sessionId not userId for funnels |
Skip this phase entirely if the component has no narrative content.
If the component creates or modifies quests, characters, or lore:
docs/world-lore.mddocs/quest-registry.mddocs/quest-registry.md⚠️ LORE CONFLICT: [description] and propose resolution before writing the final implementationAfter every successful build, add/update the component entry in docs/build-registry.md:
## [component-name]
- **Status:** built
- **Path:** src/[component-name]/index.ts
- **Built at:** [ISO timestamp]
- **Depends on:** [list of real dependencies used]
- **Depended on by:** [leave empty — populated as other components reference this one]
- **Mocks generated:** [list any mocks this build created, or "none"]
- **Skills applied:** [list of skills that informed this build]
- **Open TODOs:** [anything flagged ⚠️ NOT IN PLAN or left incomplete]
Also update the Summary section counts.
Present in this order:
✅ Built: [component-name]
📁 Files created: [list with paths]
🧪 Tests: [X test cases written]
🔗 Dependencies: [real: X | mocked: Y]
⚠️ Mocks to replace (build these next): [list in dependency order]
Output each file in a clearly labeled fenced code block with the filename as the label. Full file — no truncation, no "// rest of file here" shortcuts.
# Commands to run and test this component right now
bun run dev
bun vitest run src/[component-name]/
Based on the MVP plan build sequence (Section 9) and the mocks generated:
Recommended next:
game-build [mock-dependency] ← replaces mock created today
game-build [next-in-sequence] ← next item from MVP plan Section 9
built in docs/build-registry.md — warn the user and stop⚠️ NOT IN PLAN: and ask// MOCK — comments must stay until replaced with real implementationstools
Use when implementing client-server state synchronization, delta compression, optimistic updates, rollback netcode, or real-time game state reconciliation. Triggers: state sync, netcode, delta, rollback, interpolation, prediction.
testing
Use when designing virtual economies, currencies, sink/faucet balance, loot tables, crafting systems, shops, or inflation control. Triggers: economy, currency, sinks, loot, inflation, crafting, shop.
development
Audits existing game code against design principles — checks server-authority, schema conventions, auth security, payment safety, narrative coherence, and MVP scope drift. Extract the optional component name or path from the user's message (defaults to entire src/). Use after building components or before committing.
testing
Designs a single quest end-to-end — coherence check, objective tree, quest brief, and registry entry. Extract the quest name from the user's message. Requires docs/world-lore.md and docs/quest-registry.md.