Understand an unfamiliar or inherited game project fast before changing it. Automatic project mapping (engine, build tool, entry points, loop, scenes, entities, input, audio, saves, networking, config, assets, tests, docs, CI, largest files), then a guided reading order, running it, tracing one feature end to end, and writing what you learned into the project's docs so nobody has to rediscover ...
Download skill (.zip) Files on GitHubGame codebase discovery
Understand first, change second. Twenty minutes of discovery prevents hours of breaking things you didn’t know existed.
1. Read what already exists
docs/HANDOFF.md → docs/CONTEXT.md → docs/GDD.md → README.md → AGENTS.md (if any). A good handoff makes the rest of
this skill quick. Trust the code over old docs when they disagree, and note the difference.
2. Map it automatically
python3 <skill>/scripts/discover.py <project> # or --json
It reports the engine and tech, build tool and npm scripts, entry points, and file:line locations for the loop, scenes or states, keyboard, pointer and touch, gamepad, audio, saving, networking, physics and randomness, plus classes, storage keys, config files, asset sizes, tests, docs, CI, the largest code files and file types.
3. Run it before reading deeply
Start it (npm script, or a static server for no-build games), open the preview, and play through once. Note what the game does. That’s the map you read the code against. 2D: playwright-game-testing. WebGL: the viewer’s preview only.
4. Read in this order
- Entry point:
index.html→ the first script →main(what’s created at startup). - The loop: how update and render are called, and the time step.
- States / scenes: what screens exist and how they switch.
- The player: input → movement → collisions → damage. This one entity shows most of the conventions.
- Config / data: where the numbers and levels live.
- Persistence and network: saves, server or Bash SDK calls.
5. Trace one feature end to end
Pick something visible (“collecting a coin”), then follow it: input or collision → event → score → HUD → sound → save.
Use rg "coin" to find every place it appears. This shows you the patterns, the coupling and the traps.
6. Write it down (this is the point)
Add or update a short “How the code works” section in README.md or docs/ARCHITECTURE.md (game-documentation):
the folder map, the loop, how to add an entity or a level, where tuning lives, and surprises you found. Note risky areas in the
tech-debt register (game-technical-debt). Tell the user in 2–3 plain sentences what the game is built with and anything worrying.
Red flags to note
Several loops at once, setInterval loops, game logic in render, globals everywhere, no config (magic numbers), one huge file,
unpinned CDN libraries, saves without versions, secrets in frontend code. Note them. Don’t fix them yet unless asked
(game-refactoring, game-code-review).