Home › Phaser (web games) › Phaser 3 browser game rules

Phaser 3 browser game rules

Windsurf rules for 2D browser games with Phaser 3, TypeScript and Vite.

WindsurfPhaser (web games)

How to use

Save this as .windsurf/rules/phaser.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

.windsurf/rules/phaser.mdDownload  
# Windsurf rules — Phaser 3 + TypeScript

- Phaser 3, TypeScript, Vite. One class per Scene in `src/scenes/` (Boot, Preload, Menu, Game, UI).
- Load all assets in `PreloadScene`; reference them by constant keys from `src/assets/keys.ts`.
- Game objects extend Phaser classes in `src/objects/`. Keep game rules out of scenes when they grow beyond ~200 lines.
- Use Arcade Physics unless the design needs Matter. Use groups + `setActive/setVisible` pooling for bullets and particles.
- Frame-rate independent movement: multiply by `delta / 1000` in `update`.
- UI runs in a separate parallel scene, communicating via `this.events`/the registry.
- Run `pnpm dev` and describe what to test manually; run `pnpm build` before finishing.

Related rules

Web accessibility (WCAG 2.2) rules

Windsurf rules for building accessible web UIs to WCAG 2.2 AA: semantics, keyboard, focus, contrast, and testing.

WindsurfAccessibility

Django Windsurf rules

Windsurf rules for Django 5.2 LTS projects: apps, models and migrations, ORM performance, forms, and tests.

WindsurfDjango

Documentation writing rules

Windsurf rules for writing and updating READMEs, docstrings, ADRs, and changelogs alongside code changes.

WindsurfAgent workflows

Electron app Windsurf rules

Windsurf rules for secure Electron 44 apps: context isolation, preload bridges, typed IPC, and packaging.

WindsurfElectron

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.