data-manager

Manage key-value game state with Phaser 4 DataManager events and storage.

465|41|Updated Aug 4, 2026
One-click install
npx skills add https://github.com/autonomous-ai/openharness --skill data-manager-autonomous-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: data-manager
Source: https://github.com/autonomous-ai/openharness/tree/main/store/agents/phaser/skills/data-manager
Command: npx skills add https://github.com/autonomous-ai/openharness --skill data-manager-autonomous-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Phaser games need a consistent way to store custom data on game objects, scenes, and globally, while reacting to state changes without tight coupling between systems. This Skill provides the patterns and API knowledge to use Phaser's DataManager correctly across all three levels. ## Core Features & Use Cases - Three-Level Data Storage: Store key-value data per-GameObject (setData/getData), per-Scene (this.data), and globally across scenes (this.registry). - Event-Driven Reactivity: Listen to setdata, changedata, changedata-{key}, and removedata events to build reactive UI and game logic without polling. - Helpers and Utilities: Use incData, toggleData, merge, query, pop, and freeze for common state operations, plus localStorage persistence patterns. - Use Case: Build a HUD scene that watches the global registry for score changes set by the gameplay scene, updating the score text automatically whenever the value changes. ## Quick Start Ask the AI to store player health on a sprite with setData and update a health bar whenever the changedata-hp event fires.

Frequently Asked Questions about data-manager

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I store custom data on a Phaser game object?

Call setData on any GameObject, such as sprite.setData('hp', 100), which lazily creates a DataManager on first use. Retrieve values with getData, and use incData or toggleData for numeric and boolean updates.

How do I share game state between Phaser scenes?

Use the global registry via this.registry.set('key', value), which is a DataManager on the Game object shared by all scenes. Listen for changes with this.registry.events.on('changedata-key', handler), and remove listeners on scene shutdown.

Why does changing a stored object not trigger changedata in Phaser?

Mutating a stored object or array in place does not emit changedata because the reference is unchanged. Re-set the key with a new reference, such as setData('inventory', [...inv]), to trigger the event.

What is the difference between Phaser this.data and this.registry?

this.data is a DataManagerPlugin scoped to the current scene, emitting events on the scene's event bus. this.registry is a global DataManager on the Game instance that persists across all scenes and emits on its own registry.events emitter.

Why are my Phaser DataManager set calls doing nothing?

The DataManager is likely frozen. When freeze is true, all set, remove, inc, toggle, pop, and merge operations silently no-op with no error or event. Call setFreeze(false) or set data.freeze = false to resume writes.