Phaser Init logo

Phaser Init

Organization
Yakoub-ai
phaser-init

This skill should be used when the user asks to "create a Phaser game", "initialize a Phaser 4 project", "scaffold a Phaser project", "set up a new game", "start a Phaser project", "bootstrap a game", "npm create phaser", or wants to start a Phaser 4 project from scratch.

Overview

PublisherYakoub-ai
Repositoryphaser4-gamedev
Skill namephaser-init
Stars
29
Forks
3
Bundled files
6
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 6 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by Yakoub-ai on GitHub. Read the source before you install it.

Installation

Install the Phaser Init AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/Yakoub-ai/phaser4-gamedev/tree/main/skills/phaser-init
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Yakoub-ai/phaser4-gamedev.git /tmp/phaser4-gamedev
mkdir -p .claude/skills
cp -r /tmp/phaser4-gamedev/skills/phaser-init .claude/skills/phaser-init
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Phaser Init in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Phaser Init on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Phaser Init is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Phaser 4 Project Initialization

Scaffold a new Phaser 4 (v4.2.1) project with TypeScript and Vite.

Quick Scaffold (Recommended)

Use the official scaffolder for the fastest setup:

bash
npm create @phaserjs/game@latest

This interactive CLI supports React, Vue, Angular, Svelte, Next.js, SolidJS, and plain TypeScript. For beginners: choose TypeScript + Vite when prompted.

After scaffolding, it installs phaser automatically. Run:

bash
cd my-game
npm install
npm run dev

Manual Scaffold

Use this when the user needs a custom setup or wants to understand each piece.

Step 1 — Create Project

bash
mkdir my-game && cd my-game
npm init -y
npm install phaser
npm install -D typescript vite @types/node

Step 2 — Directory Structure

Create this layout:

my-game/
├── index.html
├── package.json
├── tsconfig.json
├── vite.config.ts
├── public/
│   └── assets/
│       ├── images/
│       ├── spritesheets/
│       ├── atlases/
│       ├── audio/
│       └── tilemaps/
└── src/
    ├── main.ts
    └── scenes/
        ├── BootScene.ts
        ├── PreloaderScene.ts
        └── GameScene.ts

Step 3 — Configuration Files

Generate these files exactly as shown in examples/:

  • examples/game-config.ts — Complete main.ts with GameConfig
  • examples/boot-scene.ts — BootScene starter template
  • examples/vite-config.ts — Vite configuration for Phaser 4

Key configuration points:

package.json scripts:

json
{
  "scripts": {
    "dev": "vite",
    "build": "tsc && vite build",
    "preview": "vite preview"
  }
}

tsconfig.json critical fields:

json
{
  "compilerOptions": {
    "target": "ES2022",
    "lib": ["ES2022", "DOM", "DOM.Iterable"],
    "module": "ESNext",
    "moduleResolution": "bundler",
    "strict": true,
    "skipLibCheck": true,
    "noEmit": true,
    "types": ["vite/client"]
  },
  "include": ["src"]
}

Phaser 4 ships its own types through the exports map in its package.json, so moduleResolution: "bundler" (or "node16"/"nodenext") resolves them from a plain import Phaser from 'phaser' with no extra configuration.

types: ["vite/client"] is separate and is needed: it types import.meta.env, which the mandatory __PHASER_GAME__ instrumentation line uses. Without it npx tsc --noEmit fails with TS2339: Property 'env' does not exist on type 'ImportMeta'.

Do not add typeRoots: ["./node_modules/phaser/types"] with types: ["Phaser"]. That was the Phaser 3 / early-v4-RC recipe. Against Phaser 4.2.1 it fails outright with TS2688: Cannot find type definition file for 'Phaser', because the shipped types are a single types/phaser.d.ts file rather than a Phaser/index.d.ts type-root package. If you inherited that config, delete both fields.

Step 4 — Verify Installation

bash
npm run dev

Expected: browser opens at http://localhost:5173 showing a dark canvas (or whatever background color was set). If it shows a blank page, check the browser console for errors.

What to Do After Scaffolding

  1. Replace GameScene.ts with actual game logic (use phaser-coder agent)
  2. Add assets to public/assets/
  3. Design the full scene flow (use phaser-architect agent)
  4. Set arcade: { debug: false } when done debugging

Common Setup Mistakes

  • Assets not loading: In Vite, assets must be in public/. Do NOT import them via import. Reference as 'assets/image.png' (relative to server root).
  • TypeScript errors on Phaser.*: Import Phaser explicitly (import Phaser from 'phaser';) and use moduleResolution: "bundler". If tsconfig still carries typeRoots/types: ["Phaser"] from a v3-era template, remove them — they break the build on v4. See Step 3.
  • phaser not found: Run npm install phaser. Do not use the beta tag — phaser@beta still resolves to 4.0.0-rc.7, which is older than the current stable release.
  • Black screen: Check browser console for 404 errors or JS errors.

Additional Resources

Example Files

Working templates in examples/:

  • examples/game-config.ts — Complete main.ts with scene registration
  • examples/boot-scene.ts — BootScene with minimal asset loading
  • examples/vite-config.ts — Vite config for Phaser 4

Reference Files

  • references/project-templates.md — Complete file listings for TypeScript+Vite, JavaScript+Vite, and HTML-only setups
  • references/template-archetypes.md — Full archetype specs for platformer, top-down RPG, space shooter, and match-3 puzzle games

Template Archetypes

When the user wants a specific type of game rather than a blank scaffold, generate a complete working game from an archetype. The phaser-coder agent uses the archetype specs to produce all files.

Available archetypes (use with /phaser-new [template] or trigger the phaser-coder agent):

ArchetypeCommandCore Features
platformer/phaser-new platformerGravity, jump, platforms, enemies, coins, lives system
topdown/phaser-new topdownZero gravity, 8-dir movement, tilemap world, NPC dialog
shooter/phaser-new shooterScrolling BG, bullet pooling, enemy waves, power-ups
puzzle/phaser-new puzzleMatch-3 grid, tile swapping, cascade matching, score
towerdefense/phaser-new towerdefenseGrid-based tower placement, enemy waves, economy, projectile pooling
runner/phaser-new runnerAuto-scrolling, jump/slide, procedural obstacles, parallax, increasing speed
cardgame/phaser-new cardgameMemory match cards, flip animations, pair matching, move scoring
fighting/phaser-new fightingState machine fighters, 2-player local, hitbox system, round-based
racing/phaser-new racingTop-down rotation steering, tilemap track, checkpoints, AI opponents

All archetypes generate with placeholder assets (solid-color rectangles/circles via Graphics.generateTexture()) so the game runs immediately without real art. Replace with real assets when ready.

Archetype specifications: references/template-archetypes.md

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Phaser Init AI skill do?

This skill should be used when the user asks to "create a Phaser game", "initialize a Phaser 4 project", "scaffold a Phaser project", "set up a new game", "start a Phaser project", "bootstrap a game", "npm create phaser", or wants to start a Phaser 4 project from scratch.

Why use Phaser Init on TypingMind?

Because you install it once and use it with any model. Phaser Init is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Phaser Init in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Yakoub-ai/phaser4-gamedev/tree/main/skills/phaser-init. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Phaser Init?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Phaser Init?

As many as you like. As long as a model supports skills, you can use Phaser Init with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Phaser Init AI skill free?

It is published on GitHub by Yakoub-ai. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇