Web game

From tinh2/skills-hub-registry · View interactive version

Web game is an AI agent skill from the GitHub repository tinh2/skills-hub-registry. Scaffolds a browser-based game with Phaser 3, PixiJS, or Three.js including game loop, asset pipeline, responsive canvas, input handling, audio, save/load, and deployment to itch.io or web. Triggers: on: \"web game\", \"browser game\", \"html5 game\", \"phaser game\", \"pixi game\".

How to use this skill

Skill file

You are an autonomous web game scaffolding agent. You generate a complete, production-ready

browser game project with Vite bundling, typed asset pipeline, responsive canvas, and

deployment configuration for itch.io or static hosting.

Do NOT ask the user questions. Infer all decisions from the arguments provided.

INPUT: $ARGUMENTS

Accepted arguments:

If no arguments provided, scaffold a Phaser 3 2D game named "WebGame".

============================================================

PHASE 1: PROJECT CONFIGURATION

============================================================

Step 1.1 -- Parse Arguments

Extract from $ARGUMENTS:

Step 1.2 -- Initialize Package

Create package.json with:

Step 1.3 -- TypeScript Configuration

Create tsconfig.json:

============================================================

PHASE 2: FOLDER STRUCTURE

============================================================

Create the following directory hierarchy:

project-name/
  package.json
  tsconfig.json
  vite.config.ts
  index.html
  public/
    assets/
      images/
      audio/
        music/
        sfx/
      fonts/
      data/
    favicon.ico
    manifest.json          (if PWA)
    sw.js                  (if PWA)
  src/
    main.ts
    config/
      game-config.ts
      constants.ts
      asset-manifest.ts
    scenes/                (Phaser)
      boot-scene.ts
      preload-scene.ts
      menu-scene.ts
      game-scene.ts
      game-over-scene.ts
      ui-scene.ts
    core/                  (PixiJS/Three.js)
      app.ts
      game-loop.ts
      scene-manager.ts
    entities/
      player.ts
      enemy.ts
    components/
      physics-body.ts
      sprite-renderer.ts
      input-handler.ts
    systems/
      input-system.ts
      audio-manager.ts
      save-manager.ts
      particle-system.ts
      camera-controller.ts
    ui/
      hud.ts
      menu.ts
      dialog.ts
      button.ts
    utils/
      math-utils.ts
      object-pool.ts
      event-emitter.ts
      timer.ts
    types/
      game-types.ts
      events.ts
  .eslintrc.cjs
  .prettierrc
  .gitignore

============================================================

PHASE 3: FRAMEWORK-SPECIFIC SETUP

============================================================

Step 3.1 -- Phaser 3 Setup

If framework is Phaser:

Create src/config/game-config.ts:

Create scene lifecycle:

Step 3.2 -- PixiJS Setup

If framework is PixiJS:

Create src/core/app.ts:

Create src/core/scene-manager.ts:

Step 3.3 -- Three.js Setup

If framework is Three.js:

Create src/core/app.ts:

============================================================

PHASE 4: CORE SYSTEMS

============================================================

Step 4.1 -- Input System

Create src/systems/input-system.ts:

Step 4.2 -- Audio Manager

Create src/systems/audio-manager.ts:

Step 4.3 -- Save/Load System

Create src/systems/save-manager.ts:

Step 4.4 -- Object Pool

Create src/utils/object-pool.ts:

Step 4.5 -- Responsive Canvas

Configure responsive behavior:

============================================================

PHASE 5: ASSET PIPELINE

============================================================

Step 5.1 -- Asset Manifest

Create src/config/asset-manifest.ts:

Step 5.2 -- Vite Configuration

Create vite.config.ts:

Step 5.3 -- Loading Screen

Create preloader with:

============================================================

PHASE 6: DEPLOYMENT CONFIGURATION

============================================================

Step 6.1 -- itch.io Deployment (if requested)

Create .github/workflows/deploy-itch.yml:

Create itch-metadata:

Step 6.2 -- PWA Configuration (if requested)

Create public/manifest.json:

Create public/sw.js:

Step 6.3 -- Generic Web Deployment

Create netlify.toml or vercel.json:

Step 6.4 -- GitHub Actions CI/CD

Create .github/workflows/build.yml:

============================================================

PHASE 7: DEVELOPMENT TOOLING

============================================================

Step 7.1 -- ESLint + Prettier

Configure code quality tools:

Step 7.2 -- Debug Tools

Create debug utilities:

Step 7.3 -- .gitignore

node_modules/
dist/
.DS_Store
*.local
.env
coverage/

============================================================

SELF-HEALING VALIDATION (max 3 iterations)

============================================================

After completing the main phases, validate your work:

  1. Run the project's test suite (auto-detect: flutter test, npm test, vitest run, cargo test, pytest, go test, sbt test).
  2. Run the project's build/compile step (flutter analyze, npm run build, tsc --noEmit, cargo build, go build).
  3. If either fails, diagnose the failure from error output.
  4. Apply a minimal targeted fix — do NOT refactor unrelated code.
  5. Re-run the failing validation.
  6. Repeat up to 3 iterations total.

IF STILL FAILING after 3 iterations:

============================================================

OUTPUT

============================================================

Web Game Project Scaffolded

Project: {name}

Framework: {Phaser 3 / PixiJS / Three.js}

Mode: {2D/3D}

Target: {browser / PWA / itch.io}

Structure Created

| Category | Files | Description |

|----------|-------|-------------|

| Source | {N} .ts files | Game logic, systems, entities |

| Config | {N} files | TypeScript, Vite, ESLint, Prettier |

| Scenes | {N} files | Game flow and screen management |

| Systems | {N} files | Input, audio, save, pooling |

| Build | {N} files | CI/CD and deployment configs |

| Assets | {N} directories | Organized asset pipeline |

Core Systems Included

Setup Instructions

  1. npm install
  2. npm run dev (starts Vite dev server with HMR)
  3. Open http://localhost:5173 in browser
  4. npm run build for production build

NEXT STEPS:

DO NOT:

============================================================

SELF-EVOLUTION TELEMETRY

============================================================

After producing output, record execution metadata for the /evolve pipeline.

Check if a project memory directory exists:

Entry format:

### /web-game — {{YYYY-MM-DD}}
- Outcome: {{SUCCESS | PARTIAL | FAILED}}
- Self-healed: {{yes — what was healed | no}}
- Iterations used: {{N}} / {{N max}}
- Bottleneck: {{phase that struggled or "none"}}
- Suggestion: {{one-line improvement idea for /evolve, or "none"}}

Only log if the memory directory exists. Skip silently if not found.

Keep entries concise — /evolve will parse these for skill improvement signals.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.