| name | game-architecture |
| description | Use when creating or refactoring gameplay code in an Air Jam project and you need guidance on host vs controller vs domain boundaries, modular structure, and when to refactor before implementing. |
Game Architecture
Use this skill when adding new systems or moving code between boundaries.
Read First
docs/generated/project-structure.md
docs/generated/architecture.md
Boundary Model
Prefer this split:
src/airjam.config.ts for catalog metadata plus runtime config such as controllerPath and input schema
src/app.tsx for mounting explicit host/controller runtime boundaries
src/host/ for host-only composition
src/controller/ for controller-only composition
src/game/domain/ for pure rules
src/game/engine/ for orchestration
src/game/systems/ for focused gameplay systems
src/game/adapters/ for framework integration
src/game/ui/ for reusable game-facing UI
src/game/debug/ for debug helpers
Keep runtime ownership explicit:
- mount
airjam.Host / airjam.Controller once at the boundary
- use consumer hooks like
useAirJamHost() and useAirJamController() only below that boundary
- keep gameplay code out of runtime setup and transport bootstrap
Decision Rule
Ask:
- is this pure gameplay logic
- is this runtime orchestration
- is this rendering integration
- is this host-only or controller-only
Put the code where the answer is clearest.
Refactor-First Rule
If new work would harden a mixed boundary, split the structure first or split the task into:
- boundary cleanup
- feature implementation
Anti-Patterns
- one large file that mixes host, controller, domain, and rendering concerns
- React components as the only home for gameplay logic
- adapter code becoming the real game model