game-build

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.

6 stars

Best use case

game-build is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

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.

Teams using game-build should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/game-build/SKILL.md --create-dirs "https://raw.githubusercontent.com/fcsouza/agent-skills/main/skills/game-dev-commands/game-build/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/game-build/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How game-build Compares

Feature / Agentgame-buildStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

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.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Game Build — Component Builder

## Prerequisites

- Requires `docs/mvp-first-draft.md` in the project (run `game-architect` first)

---

## Phase 0 — Context Load (silent, mandatory before writing a single line of code)

Execute in this exact order:

1. Check if `docs/mvp-first-draft.md` exists in the project
   - If it does NOT exist: output `⛔ 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.
2. READ `docs/mvp-first-draft.md` (the MVP plan from game-architect)
   - Check Section 10 (Out of Scope / Deferred): if the component name from the user's message matches any deferred item, output `⚠️ [component] was explicitly deferred: "[reason]". Building now may increase scope. Continue?` and wait for confirmation before proceeding.
3. IDENTIFY which skills are relevant to the component name from the user's message — apply only those skills from: `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-analytics`
4. READ `docs/build-registry.md` if it exists (create it if not, using the template below)
5. READ `docs/world-lore.md` if component touches narrative/quests
6. READ `docs/quest-registry.md` if component touches quests

**Special 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):
```markdown
# 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 -->
```

## Phase 1 — Dependency Check

Before writing any code, resolve the component's dependency graph from the MVP plan:

For each dependency of the component:
- CHECK `docs/build-registry.md` for status
- If already **built**: import from its registered path — do not regenerate
- If **NOT built**: generate a typed mock/stub:
  - Same TypeScript interface as the real implementation will have
  - Returns realistic fake data matching the expected types
  - Clearly marked with: `// MOCK — replace with real implementation via game-build [dependency-name]`
  - Register in `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.

## Phase 2 — Pre-Build Clarification (only if truly ambiguous)

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:
- "The MVP plan lists both REST and WebSocket for this component — which should this implementation use?"
- "[feature] was listed as out-of-scope in MVP Section 10 — confirm you want it now?"

Never ask about naming conventions, code style, or anything the skill files already define.

## Phase 3 — Build the Component

### Code Standards
- **TypeScript strict mode** — no `any`, no implicit types
- **Production-ready** — error handling, edge cases, input validation included
- **Minimal** — only what the MVP plan specifies for this component, nothing beyond
- **No premature abstraction** — optimize for clarity at MVP stage
- **Cite the skill** in inline comments for every major decision:
  ```typescript
  // [→ bullmq-game-queues: retry with exponential backoff]
  const retryConfig = { attempts: 3, backoff: { type: 'exponential', delay: 1000 } }
  ```

### File Output Structure
```
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
```

### Testing Standards (Vitest)
Every component ships with tests. No exceptions.
Required coverage:
1. **Happy path** — core functionality works as expected
2. **Edge cases** — boundary conditions from the skill files
3. **Failure path** — what happens when dependencies throw or return bad data
4. **Mock validation** — confirm mocks match the interface they stand in for

No snapshot tests for game logic — assert on behavior, not structure.

### Technology Integration

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

## Phase 4 — Narrative Coherence Check (only if component touches story/quests)

Skip this phase entirely if the component has no narrative content.

If the component creates or modifies quests, characters, or lore:
1. READ `docs/world-lore.md`
2. READ `docs/quest-registry.md`
3. Verify:
   - No faction/character/location contradictions with existing lore
   - At least one existing world element referenced
   - New content will be registered in `docs/quest-registry.md`
4. If conflict detected: output `⚠️ LORE CONFLICT: [description]` and propose resolution before writing the final implementation

## Phase 5 — Update Build Registry

After every successful build, add/update the component entry in `docs/build-registry.md`:

```markdown
## [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.

## Phase 6 — Output to User

Present in this order:

### 1. Build Summary
```
✅ 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]
```

### 2. The Code
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.

### 3. How to Run It
```bash
# Commands to run and test this component right now
bun run dev
bun vitest run src/[component-name]/
```

### 4. What to Build Next
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
```

---

## Hard Constraints

1. **Never regenerate** a component marked `built` in `docs/build-registry.md` — warn the user and stop
2. **Never invent** schema, queue names, routes, or features not in the MVP plan — flag with `⚠️ NOT IN PLAN:` and ask
3. **Never skip tests** — a component without tests is considered incomplete
4. **Never remove mock markers** — `// MOCK —` comments must stay until replaced with real implementations
5. **Always cite the skill** that informed each major decision in inline comments
6. **Server-authoritative** for any multiplayer component — client sends intentions, server validates and broadcasts

Related Skills

game-lore

6
from fcsouza/agent-skills

Adds or updates a single world lore entry (faction, location, NPC, or event) — validates against existing lore for consistency, applies the right template, and updates docs/world-lore.md. Extract the entry type (faction/location/npc/event) and name from the user's message.

game-expand

6
from fcsouza/agent-skills

Adds a new feature to an existing MVP plan — scoped architect interview, scope validation against original plan, and integration into the build sequence. Extract the feature name or description from the user's message. Requires docs/mvp-first-draft.md — run game-architect first.

game-balance

6
from fcsouza/agent-skills

Analyzes a game system against design principles — economy health metrics, difficulty curve, reward schedules, and progression cost curves. Flags imbalances with severity levels. Use after creating an MVP plan with game-architect. Extract the analysis scope (economy/difficulty/progression/rewards/all) from the user's message.

game-architect

6
from fcsouza/agent-skills

Comprehensive game MVP interviewer and planner. Interviews you in progressive groups, researches genre conventions and reference games, then produces an actionable MVP First Draft with starter project files. Use when starting a new game project from scratch.

narrative-worldbuilding

6
from fcsouza/agent-skills

Use when creating game worlds, lore, factions, geography, timelines, or establishing world consistency rules. Genre-agnostic — works for fantasy, sci-fi, modern, or abstract settings. Triggers: lore, factions, geography, world bible, world creation.

narrative-story-structure-game

6
from fcsouza/agent-skills

Use when designing interactive narratives, branching storylines, player agency systems, non-linear story structures, or act frameworks for games. Triggers: branching narrative, player agency, story arc, interactive story, dialogue.

infrastructure-monitoring-game-ops

6
from fcsouza/agent-skills

Use when implementing game monitoring, structured logging, player telemetry, alerting rules, or performance budgets. Triggers: monitoring, logging, telemetry, alerts, observability, metrics.

infrastructure-claude-code-game-workflow

6
from fcsouza/agent-skills

Use when starting a game project, choosing which skill to read, or navigating the game-dev skill ecosystem. Entry point for AI agents working on game development. Triggers: workflow, which skill, how to start, game project setup.

infrastructure-ci-cd-game

6
from fcsouza/agent-skills

Use when setting up CI/CD pipelines, GitHub Actions workflows, deployment automation, migration safety, or staging environments for game projects. Triggers: CI/CD, GitHub Actions, deployment, pipeline, staging.

engineering-stripe-game-payments

6
from fcsouza/agent-skills

Use when implementing game payments, in-app purchases, subscriptions, Stripe webhooks, or monetization flows. Triggers: payments, IAP, subscription, Stripe, checkout, webhooks, monetization.

engineering-redis-game-patterns

6
from fcsouza/agent-skills

Use when implementing Redis patterns for games — caching, leaderboards, pub/sub messaging, session storage, rate limiting, or ephemeral game state. Triggers: Redis, cache, leaderboard, pub/sub, rate limit, session.

engineering-postgres-game-schema

6
from fcsouza/agent-skills

Use when designing game database schemas, player data models, inventory systems, or working with Drizzle ORM and PostgreSQL for games. Triggers: database, schema, Drizzle, players, inventory, leaderboards, game data.