About phaser-design-patterns
A skill for applying design patterns to real Phaser 3 games in JavaScript, mapping them to scenes, game objects, input, and physics. It supports implementation, refactoring, review, and explanation, with attention to runtime checks and avoiding needless complexity.
Key features
- 01Select patterns for concrete game problems
- 02Map patterns to Phaser primitives
- 03Provide game-context JavaScript examples
- 04Identify risks and anti-patterns
- 05Recommend runtime validation
Use cases
- 01Structure entity creation and scenes
- 02Implement AI behavior variations
- 03Decouple gameplay and UI events
- 04Pool large numbers of objects
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ agusstingalvan/ gamedev-skills --skill phaser-design-patternsAfter installing, type/phaser-design-patternsin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
README.mdreferences/patterns-map.mdphaser-snippets.mdstate-machine-pattern-phaser.mdDetails
From the project READMEPhaser Design Patterns
Implement design patterns with a focus on real gameplay, not abstract examples.
When to use
Use this skill when the user needs to apply, refactor, review, or explain design patterns in Phaser 3 (JavaScript), especially for scene architecture, entities, input systems, physics interactions, and performance-sensitive gameplay code.
Workflow
- Identify a real game problem (entity creation, system coordination, behavior variation, etc).
- Choose a pattern that reduces coupling and does not add unnecessary complexity.
- Map the pattern to Phaser primitives (Scene, GameObject, Group, Events, Physics, Time, Input).
- Implement in JavaScript using game-domain naming.
- Validate at runtime (scene loads, input responds, collisions work, no event leaks).
Quick Pattern Selection
- Variable entity creation -> Factory Method / Abstract Factory.
- Step-by-step level or UI construction -> Builder.
- Shared state for thousands of instances -> Flyweight + pooling.
- Rules by AI mode/behavior -> State / Strategy.
- Decoupled events between gameplay and UI -> Observer / Mediator.
- Re-runnable actions (input, replay, undo) -> Command.
Implementation Rules
- Prioritize composition over deep inheritance.
- Keep scenes small and with clear responsibilities.
- Avoid mutable singletons for gameplay logic; reserve them for global services (audio, config).
- Use
deltainupdate(time, delta)when the pattern affects movement or timers. - Unsubscribe events in
shutdown/destroyto avoid memory leaks. - For massive objects (bullets, particles), combine the pattern with pooling (
setActive(false),setVisible(false)).
Expected Deliverables
- Explain in 2-4 lines why the pattern solves the problem.
- Show a JavaScript/Phaser snippet with real game context.
- Include relevant risks and anti-patterns.
- Propose minimum validation (manual test or simple test).
References
- See
references/patterns-map.mdfor a complete pattern -> Phaser usage map. - See
references/phaser-snippets.mdfor ready-to-copy and adapt templates. - See
references/state-machine-pattern-phaser.mdfor a full State + StateMachine implementation (Idle/Move/Action) adapted to Phaser.