/gameplay-debugging-toolkit:localizing-game-state-divergencefrom Gameplay Verification & Debugging Toolkit
Localizes a reproducible gameplay defect to the first tick where game state violates an invariant, by replaying a deterministic repro case and scanning a per-event observation trace. Use when a game produces wrong values, duplicated/missing effects, or impossible states with no stack trace.
Ships in Gameplay Verification & Debugging Toolkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Find when a gameplay defect happens, in tick order, before anyone argues about where in the code it lives. A semantic game defect — score credited twice, a cooldown that never expires, a resource that refills across a save — throws nothing. There is no stack trace, so backward tracing from an error has no starting point. The starting point has to be constructed: a per-event trace plus a predicate that is true of every healthy state, scanned for the first index where the predicate fails.
The output is a tick index and two states, not a diagnosis and not a patch.
A ReproCase — the minimal contract, inlined here so this skill needs nothing else:
id: # stable name for this defect
seed: # RNG seed, or "none" if the run is seedless
build: # commit / build identifier
setup: # starting state or save slot, if not a fresh run
inputs: # ordered input events with their tick indices — the input tape
observe: # the wrong observable, as a value: "score == 50 at tick 6, expected 30"
expected: # the value a healthy run produces at that point
determinism: # always | intermittent(n/m runs) — intermittent blocks this procedure
Also required:
(state, event) -> state with no
wall clock, unseeded RNG, or I/O in the path. If it is not, extracting one for the affected
subsystem is prerequisite work and outside this procedure. A subsystem harness may be enough,
but extracting one from a non-replayable real project has not yet been validated by this skill;
report that gap instead of treating the harness as routine or proven.Write the oracle before looking at the trace. State the property as a predicate over observed state, in a form that is true at every healthy step and mechanically checkable:
INV-SCORE-ONCE: no entity identity is credited score more than once.INV-<field>-SOURCE: <field> changes only on the event types allowed to change it.INV-<x>-ROUNDTRIP: after a restore, <x> equals the value captured at the matching save.A predicate that can only be evaluated by a human reading the log is not an oracle. If the property cannot be written this way, say so and stop — the defect is not localizable by this method, and a guessed fix is the alternative you are declining.
Emit an observation trace. One record per state transition, not per run. The field list is
in references/observation-event.md. Emit from the replay, not from the live game, so the trace
is reproducible.
Replay and scan. Fold the input tape through the core, keeping every intermediate state. Evaluate every oracle at every index. Record the lowest index at which any oracle first fails. Scan linearly when the trace fits in memory; bisect only when replay is expensive, and only if the oracle is monotone (once false, stays false) — a non-monotone oracle bisects to the wrong index.
Stop conditions, applied in this order:
ReproCase starting state
is wrong, not the game.Separate first violation from first cause. The index where the predicate breaks is where the state became observably wrong. The write that made it possible is often earlier and silent — a flag set, an identity reused, a field left out of a snapshot. Walk backward from the divergent index over the fields the violated oracle reads, and report the earliest event that wrote any of them. Name both indices. Fixing at the violation index without doing this produces a guard that hides the symptom and leaves the bad write in place.
Confirm the localization is causal. Re-run the same tape with the single divergent event removed or its inputs changed. If the oracle still fails at the same index, the localization is wrong — the reported event is a bystander. Report this as a failed localization rather than handing off an unverified index.
A DivergenceReport:
repro: # ReproCase id
oracle: # the predicate that failed, verbatim
first_violation_index: # tick / event index
first_violation_event: # the event at that index
state_before: # observed fields the oracle reads, immediately before
state_after: # the same fields immediately after
earliest_writer_index: # earliest event writing any field the oracle reads
causal_check: # confirmed | failed — result of step 6
unobserved: # state deliberately not in the trace, and why
unobserved is required. A trace that claims full coverage is claiming the defect cannot be
anywhere else, which is almost never true and is the assumption that makes the next bug expensive.
first_violation_index is the lowest failing index, not the first one noticed.causal_check is confirmed, or the report says the localization failed.earliest_writer_index is present and is <= first_violation_index.references/observation-event.md — the per-event trace record, and how it differs from
run-aggregate telemetry.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub abagames/agentic-gamedev-skills --plugin gameplay-debugging-toolkit5 skills in this plugin
/adversarially-validating-game-repairsStress-tests an already-written game bug fix with adversarial cases selected from the state, timing, identity, lifecycle, persistence, and input surfaces the patch can actually reach, then returns a PatchEvidence record covering fail-to-pass, relevant pass-to-pass, inverse-case, invariant, and untested-scope evidence. Use when a fix makes the reported symptom go away and it is still unknown whether the fix is the real one or an overfit, coincidental, or plausible-but-wrong one. Not for finding unknown defects in a build (that is runtime smoke testing), checking one mechanic against its written spec, or judging difficulty, fun, or balance./auditing-gameplay-implementation-coverageAudits a stateful game's specification, phase/state machine, implementation, presentation, and tests for scenario-specific omissions such as one phase missing an input alias, one actor skipping a rule, a state change lacking HUD feedback, an event lacking audio, or a lifecycle boundary failing to reset or freeze state. Use when a game mostly works but may contain unimplemented sibling cases, inconsistent behavior across phases or actors, or important rules with no concrete probe; scope the audit to behavior surfaces changed or plausibly reached by a cross-cutting mechanic, to named high-risk surfaces before release, or to a family implicated by repeated forgotten-case bugs. Do not use for a small isolated change already covered by a direct distinguishing assertion, and do not expand into unrelated behavior surfaces. Not for localizing an already-reproduced semantic divergence, validating an existing patch, measuring balance, or proving exhaustive correctness./implementing-gameplay-invariantsTranslates game design prose into engine-neutral implementation invariants and validation checks. Use when implementing or reviewing game mechanics where idle, hold-only, mashing, spam, safe waiting, or repeated scoring pulses must be prevented from dominating skilled play./verifying-turn-based-gamesVerifies two-player strict-alternating-turn games via a pure-function engine contract and bot-ladder / WP-tension metrics. Use when designing or implementing board/card games that need replay, search, bot ladders, win-rate analysis, tension metrics, or decision-density evaluation. Skip for real-time, simultaneous-action, 3+ player, or single-player puzzle games.Other plugins' skills for the same job