app-game-state-fix

Installation
SKILL.md

App Game State Fix

Target: $ARGUMENTS, or the current project root minus engine source, vendored and generated code when empty.

Adapted from @dannypostma: https://x.com/dannypostma/status/2126101544710091187

Tobi's "scan this codebase for any implicit state machines and make it explicit" is an insanely good prompt to run on an old game codebase.

An implicit state machine in a game is a lifecycle whose legal states and transitions live only in the programmer's head: an int state compared to magic numbers inside update(), booleans on an entity (isJumping, onGround, isAttacking) that must agree, a countdown that flips a mode when it hits zero, an animation-finished callback that decides what the character does next. It works until two pieces drift and the game lands in an impossible state: jumping while grounded, attacking while dead, paused in the middle of a scene load. Players meet these as soft locks, stuck animations and glitches.

Old game codebases rarely have tests, so the pin is a replay: recorded input, fixed seed and fixed timestep, played headless, producing a trace of what the player would see and what gets saved. Same recording, same trace, before and after every change.

Rules

  • A frame is behavior. A transition that took effect on frame N, in a given update order, still does after the change. Enter and exit hooks often shift this by a frame; check it in the trace.
  • Serialized state stays byte-identical: save files, recorded demos, replays and network messages. A machine whose representation is serialized converts only if a load-then-save round trip of existing data still matches; otherwise it goes to For review with the migration it needs.
  • Engine assets (Unity Animator controllers, Godot scenes, Unreal blueprints, level files) are recorded, not hand-edited. Code that sets them by string, such as animator.SetTrigger("Attack"), is part of the machine.

1. Sweep for signals

Installs
2
Repository
lancetw/skills
GitHub Stars
6
First Seen
4 days ago