How to Add a Second Game Mechanic With AI Without Breaking the First One
Freeze the first mechanic as an explicit behavioral contract, map the shared state, add the second mechanic behind the smallest interface possible, and rerun the first mechanic’s acceptance tests before tuning the new one.

Freeze the first mechanic as an explicit behavioral contract, map the shared state, add the second mechanic behind the smallest interface possible, and rerun the first mechanic’s acceptance tests before tuning the new one.
The first mechanic needs a contract before it gets a neighbor
Write down its inputs, state it owns, outputs/events, and its acceptance test. This converts “it works right now” into something the AI can preserve. Microsoft research on vibe coding emphasizes that developer expertise shifts toward context management and evaluation; this is exactly that work.
Map shared state before generating code
Two mechanics often collide through player state, timing, input, animation, or global managers. Identify those intersections before asking the agent to implement anything. If both mechanics write the same variable, define ownership first.
Add through an interface, not a rewrite
Prefer an event, method, or small state transition that lets the new mechanic cooperate with the old one. Do not ask the AI to “integrate everything cleanly” unless you are deliberately doing architecture work.
Run old tests before celebrating the new feature
The new mechanic is not done when it works in isolation. Re-run the original acceptance test plus one interaction test between the mechanics. Community reports about AI coding frequently describe one fix or feature creating multiple new bugs; regression discipline is the countermeasure.
Working template
EXISTING MECHANIC CONTRACT INPUTS: [...] OWNS STATE: [...] OUTPUTS/EVENTS: [...] MUST STILL PASS: [...] NEW MECHANIC MAY TOUCH: [...] SHARED STATE RULE: [...] DONE: old test + new test + interaction test all pass.
Source and verification note
This guide was checked against Microsoft Research: Vibe coding and Microsoft Research: Good Vibrations? and Vibe Coding in Software Development: Multivocal Review and updated Sep 5, 2026. The research describes patterns and risks rather than guaranteeing outcomes for every project; validate the workflow in your own codebase.