Browse docs

Tutorials

Snake game starter

A practical guided transcript for building a Snake game while learning core Spatial workflow habits.

Before you start

  • Create a fresh session and keep scope to one outcome: a playable browser Snake game.
  • Start in Build mode for straightforward implementation with normal confirmations.
  • Use split layout so you can iterate with browser preview while the agent codes.

Guided transcript (mocked example)

Use this as a template. Prompts are realistic and the agent responses are intentionally stubbed to teach workflow behavior.

text
User prompt 1:
"Build a browser Snake game in TypeScript + HTML canvas. Keep architecture simple and readable.
Include: movement, food spawn, collision, score, restart button.
Use Build mode. Show me a quick plan, then implement."

Agent (mocked):
- Scans project files
- Proposes concise implementation plan
- Asks for confirmation on file edits

User response:
"Approved. Implement with small commits in logical steps and verify each step in preview."
text
User prompt 2:
"Now add quality polish: increasing speed by score, high score persistence, and cleaner HUD styling.
Do not refactor unrelated files."

Agent (mocked):
- Applies focused edits
- Runs checks
- Reports what changed

User response:
"Good. Open preview and validate keyboard controls + game over/restart loop."
text
User prompt 3:
"Add optional modes: Classic (wall collision), Endless (wrap), Time Attack.
Keep mode selection simple in UI."

Agent (mocked):
- Extends game state model
- Implements mode-specific rules
- Updates UI controls

User response:
"Great. Summarize final architecture and list manual test cases."

How to respond effectively during the tutorial

  • Accept or reject changes quickly; avoid vague “keep going” without constraints.
  • When output drifts, re-anchor with explicit scope: "only Snake game files, no global refactor."
  • Use stash/pop if you have an alternate prompt idea you want to test later.
  • If complexity spikes, briefly switch to Plan mode for a checkpoint plan, then return to Build mode.

Feature usage checklist

  • Split layout + browser preview for rapid gameplay iteration.
  • Tool confirmations (Build mode) to stay aware of edits and commands.
  • Context hygiene: keep requests narrow and start fresh session if you pivot to a new project.
  • Keyboard shortcuts: use mode/model cycling and prompt stash/pop to keep momentum.

Next step after Snake

Repeat this workflow with another small project (for example a Todo app or mini dashboard) and keep the same loop: scoped prompt, fast preview validation, explicit follow-up constraints, and clean session boundaries.