Skip to content
Game dev

Phaser 4 web game

Phaser 4 rules that send the agent to the skills Phaser ships in node_modules, not v3 tutorials: pooled objects, delta movement, play-tested changes.

Verified install Not agent-tested v1.0.0 MIT updated phasertypescriptvite
Equips
  • 1 1 Rules
  • 1 1 Skills
  • – 0 MCP

Phaser 4 changed the renderer, turned FX and masks into filters and reworked tinting, so agents trained on years of Phaser 3 tutorials write code that no longer works. Phaser's answer is to ship agent skills inside the npm package, one per subsystem plus a v3-to-v4 migration guide. This loadout makes the agent read those version-matched skills before using an API, and adds the game rules that keep a web game smooth: scenes per mode, assets in preload, pooled groups, delta-based movement and a play test after every change.

What's in it

  • Reads Phaser's own skills from node_modules/phaser/skills/ for the installed version
  • v3-to-v4 migration skill first when porting old code
  • Pooled Arcade groups; no allocation in update()
  • Delta-based movement and constants in one tuning module
  • Example scene type-checked against Phaser 4.2.1 by the verifier

You'll need

  • Tools: node
Level 1 · automated

Verification

Verified install

Checked at commit 03c1b98 · 9 passed, 0 failed, 1 not applicable

CheckResultWhat we found
Listinglisting.yaml matches the schema and declares every file in the folder. Pass
Schema valid; 5 files declared, none missing or extra
  • tested.status: untested (agent tests are separate from Level 1)
Files parseJSON parses; SKILL.md and .mdc front matter is valid YAML with the fields each agent needs; code fences are closed. Pass All 5 files parse; front matter valid
AdaptersCLAUDE.md imports @AGENTS.md, GEMINI.md imports @./AGENTS.md, and both match the generator. Pass
CLAUDE.md and GEMINI.md import AGENTS.md and are up to date
  • CLAUDE.md: matches the generator
  • GEMINI.md: matches the generator
Install pathsEvery file lands where each agent documents it, with no collisions, and the laid-out project is re-discovered correctly. Pass
Correct paths for all 6 agents; layouts re-discovered
  • Claude Code: 4 files, 1 skill in .claude/skills/
  • Codex CLI: 3 files, 1 skill in .agents/skills/
  • Cursor: 3 files, 1 skill in .agents/skills/
  • Gemini CLI: 4 files, 1 skill in .agents/skills/
  • Antigravity CLI: 3 files, 1 skill in .agents/skills/
  • GitHub Copilot: 3 files, 1 skill in .agents/skills/
MCP configmcp.json is structurally valid, converts to each agent's format, declares no literal secrets, and referenced packages exist on npm/PyPI. Not applicable No MCP servers in this loadout
Safety scanThe intake scanner finds no credentials, risky shell, hidden Unicode or prompt-injection wording, and the listing's network flag is honest. Pass
Clean: no credentials, risky shell or hidden text
  • Scanner intake-precheck/1: verdict clean; network no (listing says yes)
ReferencesLinks and file paths between the loadout's files resolve, including for each agent's installed layout. Pass 1 reference between files resolves for every agent
Size limitsFile count and sizes are within the submission limits; SKILL.md bodies stay under 500 lines. Pass
5 files, 6.1 KB total; largest skills/phaser-feature/references/GameScene.ts 2.2 KB
  • Limits: 30 files, 32 KB per file, 128 KB total, 500 lines per skill or rule
LicenceA recognised SPDX licence, with the licence text available. Pass MIT, by Agent Loadout; text in the repository LICENSE
Starter buildA minimal fixture project with the loadout applied installs and builds or type-checks, and the loadout's own code examples compile. Pass
The phaser-feature skill's example scene type-checks under strict TypeScript against Phaser 4.2.1, and the installed Phaser package ships the version-matched skills AGENTS.md points to
  • Applied 7 loadout files at every agent's paths
  • ✓ place the example scene: cp .agents/skills/phaser-feature/references/GameScene.ts src/GameScene.ts
  • ✓ install: npm ci --no-audit --no-fund
  • ✓ tsc --noEmit (strict): npm run check
  • ✓ Phaser's own skills are where AGENTS.md says: bash -c for s in scenes loading-assets physics-arcade input-keyboard-mouse-touch tweens filters-and-postfx v3-to-v4-migration groups-and-containers; do test -f node_modules/phaser/skills/$s/SKILL.md || { echo "missing: $s"; exit 1; }; done; echo skills ok
  • Covers: Scene with preload, create and delta-based update against Phaser 4 types
  • Covers: Pooled Arcade physics group with maxSize, get() and killAndHide
  • Covers: Keyboard guarded for null; pointer listener removed on shutdown
  • Covers: Every Phaser skill named in AGENTS.md exists in node_modules/phaser/skills/

What this means: a script checked the files themselves: they parse, they install where each agent looks, any MCP config is sound, the safety scan is clean, references between files resolve, and, where a free and repeatable fixture exists, a small starter project builds with the loadout applied. No AI agent was run. Per-agent results ("tested with agent") are separate and stay untested until an agent actually runs.

Install

Choose your agent. Run the commands from your project root, or download a zip already laid out in the right folders.

Claude Code reads CLAUDE.md (imports AGENTS.md with @AGENTS.md) and skills from .claude/skills/.

Download zip
curl -fsSL --create-dirs -o AGENTS.md https://loadout.jnw-it.com/raw/phaser-web-game/1.0.0/AGENTS.md
curl -fsSL --create-dirs -o CLAUDE.md https://loadout.jnw-it.com/raw/phaser-web-game/1.0.0/CLAUDE.md
curl -fsSL --create-dirs -o .claude/skills/phaser-feature/SKILL.md https://loadout.jnw-it.com/raw/phaser-web-game/1.0.0/skills/phaser-feature/SKILL.md
curl -fsSL --create-dirs -o .claude/skills/phaser-feature/references/GameScene.ts https://loadout.jnw-it.com/raw/phaser-web-game/1.0.0/skills/phaser-feature/references/GameScene.ts
FileGoes to
AGENTS.mdAGENTS.md
CLAUDE.mdCLAUDE.md
skills/phaser-feature/SKILL.md.claude/skills/phaser-feature/SKILL.md
skills/phaser-feature/references/GameScene.ts.claude/skills/phaser-feature/references/GameScene.ts

Already have an AGENTS.md or CLAUDE.md? The commands above overwrite it — download the file instead and merge the sections you want.

Files

Rules AGENTS.md Phaser 4 game rules and where the version-matched docs live. 33 lines
Download Raw
# AGENTS.md: Phaser 4 web game

Browser game with Phaser 4, TypeScript and Vite. Check the Phaser version in `package.json`; v3 code and tutorials
often do not work in v4.

## Commands
- Dev server: `npm run dev`. Production build: `npm run build`. Type-check: `npx tsc --noEmit`.
- Done means: type-check and build pass, and you ran the game and played the changed part.

## Phaser docs that match the installed version
- Phaser ships agent skills inside the package: `node_modules/phaser/skills/<topic>/SKILL.md` (scenes, loading-assets,
  physics-arcade, input-keyboard-mouse-touch, tweens, filters-and-postfx, v3-to-v4-migration and more).
  Read the relevant one before using an API you have not used in this project. Prefer it over memory and old tutorials.
- Porting v3 code or a v3 example: read `node_modules/phaser/skills/v3-to-v4-migration/SKILL.md` first. FX and masks
  are filters in v4, pipelines are render nodes, and the tint API changed.

## Game code rules
- One scene per screen or mode (Boot, Preload, Menu, Game, GameOver). Scenes talk through events or the registry,
  not by reaching into each other's fields.
- Load assets in `preload()` with stable keys; files live in `public/assets/`. Never load in `update()`.
- Movement and timers use `delta` or Phaser timers, never frame counts, so speed does not depend on frame rate.
- Reuse objects: physics groups with `maxSize` and `get()` / `disableBody` for bullets, particles and enemies.
  No `new` or `destroy` per frame.
- Keep `update()` cheap: no allocations, DOM access or `console.log` in hot paths.
- Game constants (speeds, sizes, timings) in one config module so tuning does not mean hunting through scenes.
- Input: support keyboard and pointer or touch for anything the player must do. Guard `this.input.keyboard` (it can be
  null when disabled).
- Clean up: remove listeners and timers in the scene's `shutdown` event.

## Scope
- Protect the core loop first. New features only after it plays well; one feature per change, playable after each.
- Use the `phaser-feature` skill for every gameplay change.
Adapter CLAUDE.md Imports AGENTS.md for Claude Code. 10 lines
Download Raw
# CLAUDE.md

@AGENTS.md

## Claude Code notes
- Skills from this loadout live in `.claude/skills/`: `phaser-feature`. Use them when their description matches the task.
- Follow AGENTS.md above; where this file and AGENTS.md disagree, AGENTS.md wins.

<!-- From the Agent Loadout "Phaser 4 web game" v1.0.0 — https://loadout.jnw-it.com/loadouts/phaser-web-game/ -->
Adapter GEMINI.md Imports AGENTS.md for Gemini CLI. 10 lines
Download Raw
# GEMINI.md

@./AGENTS.md

## Gemini CLI notes
- Skills from this loadout live in `.agents/skills/`: `phaser-feature`. Use them when their description matches the task.
- Follow AGENTS.md above; where this file and AGENTS.md disagree, AGENTS.md wins.

<!-- From the Agent Loadout "Phaser 4 web game" v1.0.0 — https://loadout.jnw-it.com/loadouts/phaser-web-game/ -->
Skill skills/phaser-feature/SKILL.md Gameplay change with Phaser's skills, checks and a play test. 18 lines
Download Raw
---
name: phaser-feature
description: Add a gameplay feature to a Phaser 4 game using the version-matched Phaser skills in node_modules, pooled objects, delta-based movement, and a type-check, build and play test. Use for any gameplay change.
---

# Phaser feature

1. Name the feature in one sentence and the scene it lives in. If it needs a new scene, say so.
2. Read the matching Phaser skill from `node_modules/phaser/skills/` for every subsystem it touches (for example
   `physics-arcade`, `groups-and-containers`, `tweens`). Use the API as written there for the installed version.
3. Implement it like `references/GameScene.ts`: assets in `preload()`, pooled groups, delta-based movement, constants in
   one place, listeners removed on shutdown.
4. Run `npx tsc --noEmit` and `npm run build`.
5. Run `npm run dev`, open the game and play the feature. If you can drive a browser (Playwright MCP or similar), take a
   screenshot of it working; otherwise tell the human exactly what to try.
6. Check the frame rate did not drop (the Phaser debug or browser performance panel) if you added many objects.
7. Report: what changed, how you tested it, any tuning values worth adjusting.
Skill file skills/phaser-feature/references/GameScene.ts Example v4 scene with pooling and delta movement. 65 lines
Download Raw
// Example Phaser 4 scene: assets in preload, pooled bullets, delta-based movement, keyboard and pointer input,
// constants in one place and listeners removed on shutdown.
import Phaser from "phaser";

export const TUNING = {
  playerSpeed: 300, // pixels per second
  bulletSpeed: 600,
  fireCooldownMs: 200,
  maxBullets: 30,
} as const;

export class GameScene extends Phaser.Scene {
  private player!: Phaser.Physics.Arcade.Sprite;
  private bullets!: Phaser.Physics.Arcade.Group;
  private cursors?: Phaser.Types.Input.Keyboard.CursorKeys;
  private lastFired = 0;

  constructor() {
    super("Game");
  }

  preload(): void {
    this.load.image("player", "assets/player.png");
    this.load.image("bullet", "assets/bullet.png");
  }

  create(): void {
    const { width, height } = this.scale;
    this.player = this.physics.add.sprite(width / 2, height - 60, "player");
    this.player.setCollideWorldBounds(true);

    this.bullets = this.physics.add.group({ defaultKey: "bullet", maxSize: TUNING.maxBullets });
    this.cursors = this.input.keyboard?.createCursorKeys();

    this.input.on(Phaser.Input.Events.POINTER_DOWN, this.fire, this);
    this.events.once(Phaser.Scenes.Events.SHUTDOWN, () => {
      this.input.off(Phaser.Input.Events.POINTER_DOWN, this.fire, this);
    });
  }

  update(time: number, delta: number): void {
    const dx = (this.cursors?.left.isDown ? -1 : 0) + (this.cursors?.right.isDown ? 1 : 0);
    this.player.x += dx * TUNING.playerSpeed * (delta / 1000);

    if (this.cursors?.space.isDown && time > this.lastFired + TUNING.fireCooldownMs) {
      this.fire();
      this.lastFired = time;
    }

    // Return off-screen bullets to the pool instead of destroying them.
    for (const child of this.bullets.getChildren()) {
      const b = child as Phaser.Physics.Arcade.Image;
      if (b.active && b.y < -20) this.bullets.killAndHide(b);
    }
  }

  private fire(): void {
    const b = this.bullets.get(this.player.x, this.player.y - 20) as Phaser.Physics.Arcade.Image | null;
    if (!b) return; // pool exhausted: skip this shot rather than allocate
    b.setActive(true).setVisible(true);
    b.enableBody(true, this.player.x, this.player.y - 20, true, true);
    b.setVelocityY(-TUNING.bulletSpeed);
  }
}

All files: source zip · Licence MIT · By Agent Loadout · First listed

Credits

Public work that inspired this loadout. The wording here is our own; follow the links for the originals.

Installing and testing

How do I install Phaser 4 web game in Claude Code?

From your project root, put AGENTS.md, CLAUDE.md, skills/phaser-feature/SKILL.md at .claude/skills/phaser-feature/SKILL.md, skills/phaser-feature/references/GameScene.ts at .claude/skills/phaser-feature/references/GameScene.ts. The "Claude Code" tab on this page has the curl commands, or download https://loadout.jnw-it.com/download/phaser-web-game/claude-code.zip, which is already laid out. Do not overwrite an existing AGENTS.md or CLAUDE.md; merge it.

How do I install Phaser 4 web game in Codex CLI?

From your project root, put AGENTS.md, skills/phaser-feature/SKILL.md at .agents/skills/phaser-feature/SKILL.md, skills/phaser-feature/references/GameScene.ts at .agents/skills/phaser-feature/references/GameScene.ts. The "Codex CLI" tab on this page has the curl commands, or download https://loadout.jnw-it.com/download/phaser-web-game/codex.zip, which is already laid out. Do not overwrite an existing AGENTS.md or CLAUDE.md; merge it.

How do I install Phaser 4 web game in Cursor?

From your project root, put AGENTS.md, skills/phaser-feature/SKILL.md at .agents/skills/phaser-feature/SKILL.md, skills/phaser-feature/references/GameScene.ts at .agents/skills/phaser-feature/references/GameScene.ts. The "Cursor" tab on this page has the curl commands, or download https://loadout.jnw-it.com/download/phaser-web-game/cursor.zip, which is already laid out. Do not overwrite an existing AGENTS.md or CLAUDE.md; merge it.

How do I install Phaser 4 web game in Gemini CLI?

From your project root, put AGENTS.md, GEMINI.md, skills/phaser-feature/SKILL.md at .agents/skills/phaser-feature/SKILL.md, skills/phaser-feature/references/GameScene.ts at .agents/skills/phaser-feature/references/GameScene.ts. The "Gemini CLI" tab on this page has the curl commands, or download https://loadout.jnw-it.com/download/phaser-web-game/gemini-cli.zip, which is already laid out. Do not overwrite an existing AGENTS.md or CLAUDE.md; merge it.

How do I install Phaser 4 web game in Antigravity CLI?

From your project root, put AGENTS.md, skills/phaser-feature/SKILL.md at .agents/skills/phaser-feature/SKILL.md, skills/phaser-feature/references/GameScene.ts at .agents/skills/phaser-feature/references/GameScene.ts. The "Antigravity CLI" tab on this page has the curl commands, or download https://loadout.jnw-it.com/download/phaser-web-game/antigravity-cli.zip, which is already laid out. Do not overwrite an existing AGENTS.md or CLAUDE.md; merge it.

How do I install Phaser 4 web game in GitHub Copilot?

From your project root, put AGENTS.md, skills/phaser-feature/SKILL.md at .agents/skills/phaser-feature/SKILL.md, skills/phaser-feature/references/GameScene.ts at .agents/skills/phaser-feature/references/GameScene.ts. The "GitHub Copilot" tab on this page has the curl commands, or download https://loadout.jnw-it.com/download/phaser-web-game/copilot.zip, which is already laid out. Do not overwrite an existing AGENTS.md or CLAUDE.md; merge it.

Has Phaser 4 web game been tested?

It passed the Level 1 automated install checks on 2026-10-17: the files parse, install to each agent's documented paths, and pass the safety scan. No AI agent has run it yet, so no agent pass or fail is claimed.

More for Claude Code, Codex, Cursor, Gemini CLI, Antigravity CLI and GitHub Copilot.