Token导航 LogoToken导航

Agent Skill · 开发

phaser(phaser 命令行)

phaser 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

phaser 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证信息还不明确,第三方扫描已通过,按安装量在开发类的 21,746 个 Skill 里排第 3,901。

总安装 9,715周安装 393GitHub Stars 109下载 3,050核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:phaser(phaser 命令行)
来源仓库:https://github.com/opusgamelabs/game-creator
仓库路径:skills/phaser
安装命令:
npx skills add https://github.com/opusgamelabs/game-creator --skill phaser
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/opusgamelabs/game-creator --skill phaser

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。适合围绕仓库状态、代码变更或协作事项进行整理。通过 npx skills add 命令从 GitHub 仓库安装使用。安装前需确认权限范围、维护状态及是否触发联网或文件操作。

phaser 属于开发类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/phaser

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/opusgamelabs/game-creator --skill phaser;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

phaser 怎么安装?

在终端执行 npx skills add https://github.com/opusgamelabs/game-creator --skill phaser。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

phaser 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

phaser 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

phaser 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

phaser 用的人多吗?

公开数据是累计安装 9,715 次,近一周安装 393 次,下载 3,050 次,GitHub 109 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

phaser 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
phaser

phaser 命令行 · 本页

9,715109操作浏览器未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Phaser 3 Game Development

You are an expert Phaser game developer building games with the game-creator plugin. Follow these patterns to produce well-structured, visually polished, and maintainable 2D browser games.

Core Principles

  1. Core loop first — Implement the minimum gameplay loop before any polish: boot → preload → create → update. Add the win/lose condition and scoring before visuals, audio, or juice. Keep initial scope small: 1 scene, 1 mechanic, 1 fail condition. Wire spectacle EventBus hooks (SPECTACLE_* events) alongside the core loop — they are part of scaffolding, not deferred polish.
  2. TypeScript-first — Always use TypeScript for type safety and IDE support
  3. Scene-based architecture — Each game screen is a Scene; keep them focused
  4. Vite bundling — Use the official phaserjs/template-vite-ts template
  5. Composition over inheritance — Prefer composing behaviors over deep class hierarchies
  6. Data-driven design — Define levels, enemies, and configs in JSON/data files
  7. Event-driven communication — All cross-scene/system communication via EventBus
  8. Restart-safe — Gameplay must be fully restart-safe and deterministic. GameState.reset() must restore a clean slate. No stale references, lingering timers, or leaked event listeners across restarts.

Spectacle Events

Every player action and game event must emit at least one spectacle event. These hooks exist in the template EventBus — the design pass attaches visual effects to them.

EventConstantWhen to Emit
spectacle:entranceSPECTACLE_ENTRANCEIn create() when the player/entities first appear on screen
spectacle:actionSPECTACLE_ACTIONOn every player input (tap, jump, shoot, swipe)
spectacle:hitSPECTACLE_HITWhen player hits/destroys an enemy, collects an item, or scores
spectacle:comboSPECTACLE_COMBOWhen consecutive hits/scores happen without a miss. Pass {combo: n}
spectacle:streakSPECTACLE_STREAKWhen combo reaches milestones (5, 10, 25, 50). Pass {streak: n}
spectacle:near_missSPECTACLE_NEAR_MISSWhen player narrowly avoids danger (within ~20% of collision radius)

Rule: If a gameplay moment has no spectacle event, add one. The design pass cannot polish what it cannot hook into.

Mandatory Conventions

All games MUST follow the game-creator conventions:

  • core/ directory with EventBus, GameState, and Constants
  • EventBus singleton — domain:action event naming, no direct scene references
  • GameState singleton — Centralized state with reset() for clean restarts
  • Constants file — Every magic number, color, speed, and config value — zero hardcoded values
  • Scene cleanup — Remove EventBus listeners in shutdown()

See conventions.md for full details and code examples.

Project Setup

Use the official Vite + TypeScript template as your starting point:

npx degit phaserjs/template-vite-ts my-game
cd my-game && npm install

Required Directory Structure

src/
├── core/
│   ├── EventBus.ts        # Singleton event bus + event constants
│   ├── GameState.ts       # Centralized state with reset()
│   └── Constants.ts       # ALL config values
├── scenes/
│   ├── Boot.ts            # Minimal setup, start Game scene
│   ├── Preloader.ts       # Load all assets, show progress bar
│   ├── Game.ts            # Main gameplay (starts immediately, no title screen)
│   └── GameOver.ts        # End screen with restart
├── objects/               # Game entities (Player, Enemy, etc.)
├── systems/               # Managers and subsystems
├── ui/                    # UI components (buttons, bars, dialogs)
├── audio/                 # Audio manager, music, SFX
├── config.ts              # Phaser.Types.Core.GameConfig
└── main.ts                # Entry point

See project-setup.md for full config and tooling details.

Scene Architecture

  • Lifecycle: init() → preload() → create() → update(time, delta)
  • Use init() for receiving data from scene transitions
  • Load assets in a dedicated Preloader scene, not in every scene
  • Keep update() lean — delegate to subsystems and game objects
  • No title screen by default — boot directly into gameplay. Only add a title/menu scene if the user explicitly asks for one
  • No in-game score HUD — the Play.fun widget displays score in a deadzone at the top of the game. Do not create a separate UIScene or HUD overlay for score display
  • Use parallel scenes for UI overlays (pause menu) only when requested

Play.fun Safe Zone

When games run inside the Play.fun dashboard on mobile Safari, the SDK sets CSS custom properties on the game iframe's document.documentElement:

  • --ogp-safe-top-inset — space below the Play.fun header bubbles (~68px on mobile)
  • --ogp-safe-bottom-inset — space above Safari bottom controls (~148px on mobile)

Both default to 0px when not running inside the dashboard (desktop, standalone).

The template's Constants.js reads these at boot and exposes SAFE_ZONE.TOP and SAFE_ZONE.BOTTOM in canvas pixels (CSS value × DPR). A static fallback (GAME.HEIGHT * 0.08) ensures the top safe zone works even without the SDK.

Rules:

  • All UI text, buttons, and HUD elements must be positioned below SAFE_ZONE.TOP and above GAME.HEIGHT - SAFE_ZONE.BOTTOM
  • Gameplay entities should not spawn in the safe zone areas
  • The game-over screen, score panels, and restart buttons must offset from both SAFE_ZONE.TOP and SAFE_ZONE.BOTTOM
  • Use const usableH = GAME.HEIGHT - SAFE_ZONE.TOP - SAFE_ZONE.BOTTOM for calculating proportional positions in UI scenes
  • Game canvas and backgrounds should fill the full viewport (bleed behind browser chrome)
  • Touch controls at the bottom must account for SAFE_ZONE.BOTTOM
import { SAFE_ZONE } from '../core/Constants.js';

// In any UI scene:
const safeTop = SAFE_ZONE.TOP;
const safeBottom = SAFE_ZONE.BOTTOM;
const usableH = GAME.HEIGHT - safeTop - safeBottom;
const title = this.add.text(cx, safeTop + usableH * 0.15, 'GAME OVER', { ... });
const button = createButton(scene, cx, safeTop + usableH * 0.6, 'PLAY AGAIN', callback);

// Touch controls / bottom HUD:
const bottomY = GAME.HEIGHT - safeBottom - 40 * PX;

How it works in Constants.js:

function _readSafeInsets() {
  const s = getComputedStyle(document.documentElement);
  const top = parseInt(s.getPropertyValue('--ogp-safe-top-inset')) || 0;
  const bottom = parseInt(s.getPropertyValue('--ogp-safe-bottom-inset')) || 0;
  return { top: top * DPR, bottom: bottom * DPR };
}
const _insets = _readSafeInsets();

export const SAFE_ZONE = {
  TOP: Math.max(GAME.HEIGHT * 0.08, _insets.top),
  BOTTOM: _insets.bottom,
  LEFT: 0,
  RIGHT: 0,
};
  • Communicate between scenes via EventBus (not direct references)

See scenes-and-lifecycle.md for patterns and examples.

Game Objects

  • Extend Phaser.GameObjects.Sprite (or other base classes) for custom objects
  • Use Phaser.GameObjects.Group for object pooling (bullets, coins, enemies)
  • Use Phaser.GameObjects.Container for composite objects, but avoid deep nesting
  • Register custom objects with GameObjectFactory for scene-level access

See game-objects.md for implementation patterns.

Physics

  • Arcade Physics — Use for simple games (platformers, top-down). Fast and lightweight.
  • Matter.js — Use when you need realistic collisions, constraints, or complex shapes.
  • Never mix physics engines in the same game.
  • Use the state pattern for character movement (idle, walk, jump, attack).

See physics-and-movement.md for details.

Performance (Critical Rules)

  • Use texture atlases — Pack sprites into atlases, never load individual images at scale
  • Object pooling — Use Groups with maxSize; recycle with setActive(false) / setVisible(false)
  • Minimize update work — Only iterate active objects; use getChildren().filter(c => c.active)
  • Camera culling — Enable for large worlds; off-screen objects skip rendering
  • Batch rendering — Fewer unique textures per frame = better draw call batching
  • Mobile — Reduce particle counts, simplify physics, consider 30fps target
  • pixelArt: true — Enable in game config for pixel art games (nearest-neighbor scaling)

See assets-and-performance.md for full optimization guide.

Advanced Patterns

  • ECS with bitECS — Entity Component System for data-oriented design (used internally by Phaser 4)
  • State machines — Manage entity behavior states cleanly
  • Singleton managers — Cross-scene services (audio, save data, analytics)
  • Event bus — Decouple systems with a shared EventEmitter
  • Tiled integration — Use Tiled map editor for level design

See patterns.md for implementations.

Mobile Input Strategy (60/40 Rule)

All games MUST work on desktop AND mobile unless explicitly specified otherwise. Focus 60% mobile / 40% desktop for tradeoffs. Pick the best mobile input for each game concept:

Game TypePrimary Mobile InputDesktop Input
PlatformerTap left/right half + tap-to-jumpArrow keys / WASD
Runner/endlessTap / swipe up to jumpSpace / Up arrow
Puzzle/matchTap targets (44px min)Click
ShooterVirtual joystick + tap-to-fireMouse + WASD
Top-downVirtual joystickArrow keys / WASD

Implementation Pattern

Abstract input into an inputState object so game logic is source-agnostic:

// In Scene update():
const isMobile = this.sys.game.device.os.android ||
  this.sys.game.device.os.iOS || this.sys.game.device.os.iPad;

let left = false, right = false, jump = false;

// Keyboard
left = this.cursors.left.isDown || this.wasd.left.isDown;
right = this.cursors.right.isDown || this.wasd.right.isDown;
jump = Phaser.Input.Keyboard.JustDown(this.spaceKey);

// Touch (merge with keyboard)
if (isMobile) {
  // Left half tap = left, right half = right, or use tap zones
  this.input.on('pointerdown', (p) => {
    if (p.x < this.scale.width / 2) left = true;
    else right = true;
  });
}

this.player.update({ left, right, jump });

Responsive Canvas Config (Retina/High-DPI)

See project-setup.md for the full responsive canvas config, entity sizing, HTML boilerplate, and portrait-first game patterns.

Visible Touch Controls

Always show visual touch indicators on touch-capable devices — never rely on invisible tap zones. Use capability detection (not OS-based detection) to determine touch support:

// Good — detects touch laptops, tablets, 2-in-1s
const hasTouch = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0);

// Bad — misses touch-screen laptops, iPadOS (reports as desktop)
const isMobile = device.os.android || device.os.iOS;

Render semi-transparent arrow buttons (or direction indicators) at the bottom of the screen. Use TOUCH constants from Constants.js for sizing (12% of canvas width), alpha (0.35 idle / 0.6 active), and margins. Update alpha in the update() loop based on input state for visual feedback.

Enable pointer input (pointerdown, pointermove, pointerup) on all devices — pointer events work for both mouse and touch. This eliminates the need for separate mobile/desktop input code paths.

Minimum Entity Sizes for Mobile

Collectibles, hazards, and interactive items must be at least 7–8% of GAME.WIDTH to be recognizable on phone screens. Smaller entities become indistinguishable blobs on mobile.

// Good — recognizable on mobile
ATTACK_WIDTH: _canvasW * 0.09,
POWERUP_WIDTH: _canvasW * 0.072,

// Bad — too small on phone screens
ATTACK_WIDTH: _canvasW * 0.04,
POWERUP_WIDTH: _canvasW * 0.035,

For the main player character, use 12–15% of GAME.WIDTH (see Entity Sizing above).

Button Pattern (Container + Graphics + Text)

See game-objects.md for the full button implementation pattern (Container + Graphics + Text with hover/press states) and the list of broken patterns to avoid.

Anti-Patterns (Avoid These)

  • Bloated update() methods — Don't put all game logic in one giant update with nested conditionals. Delegate to objects and systems.
  • Overwriting Scene injection map properties — Never name your properties world, input, cameras, add, make, scene, sys, game, cache, registry, sound, textures, events, physics, matter, time, tweens, lights, data, load, anims, renderer, or plugins. These are reserved by Phaser.
  • Creating objects in update() without pooling — This causes GC spikes. Always pool frequently created/destroyed objects. Avoid expensive per-frame allocations — reuse objects, arrays, and temporary variables.
  • Loading individual sprites instead of atlases — Each separate texture is a draw call. Pack them.
  • Tightly coupling scenes — Don't store direct references between scenes. Use EventBus.
  • Ignoring delta in update — Always use delta for time-based movement, not frame-based.
  • Deep container nesting — Containers disable render batching for children. Keep hierarchy flat.
  • Not cleaning up — Remove event listeners and timers in shutdown() to prevent memory leaks. This is critical for restart-safety — stale listeners cause double-firing and ghost behavior after restart.
  • Hardcoded values — Every number belongs in Constants.ts. No magic numbers in game logic.
  • Unwired physics colliders — Creating a static body with physics.add.existing(obj, true) does nothing on its own. You MUST call physics.add.collider(bodyA, bodyB, callback) to connect two bodies. Every static collider (ground, walls, platforms) needs an explicit collider or overlap call wiring it to the entities that should interact with it.
  • Invisible or hidden button elements — Never set setAlpha(0) on an interactive game object and layer Graphics or other display objects on top. For buttons, always use the Container + Graphics + Text pattern (see game-objects.md). Common broken patterns: (1) Drawing a Graphics rect after adding Text, hiding the label behind it. (2) Creating a Zone for hit area with Graphics drawn over it, making the Zone unreachable. (3) Making Text interactive but covering it with a Graphics background drawn afterward. The fix is always: Container first, Graphics added to container, Text added to container (in that order), Container is the interactive element.
  • No mute toggle — See the mute-button rule. Games with audio must have a mute toggle.

Examples

  • Simple Game — Minimal complete Phaser game (collector game)
  • Complex Game — Multi-scene game with state machines, pooling, EventBus, and all conventions

Pre-Ship Validation Checklist

Before considering a game complete, verify:

  • Core loop works — Player can start, play, lose/win, and see the result
  • Restart works cleanly — GameState.reset() restores a clean slate, no stale listeners or timers
  • Touch + keyboard input — Game works on mobile (tap/swipe) and desktop (keyboard/mouse)
  • Responsive canvas — Scale.FIT + CENTER_BOTH + zoom: 1/DPR with DPR-multiplied dimensions, crisp on Retina
  • All values in Constants — Zero hardcoded magic numbers in game logic
  • EventBus only — No direct cross-scene/module imports for communication
  • Scene cleanup — All EventBus listeners removed in shutdown()
  • Physics wired — Every static body has an explicit collider() or overlap() call
  • Object pooling — Frequently created/destroyed objects use Groups with maxSize
  • Delta-based movement — All motion uses delta, not frame count
  • Mute toggle — See mute-button rule
  • Spectacle hooks wired — Every player action and game event emits a SPECTACLE_* event; entrance sequence fires in create()
  • Build passes — npm run build succeeds with no errors
  • No console errors — Game runs without uncaught exceptions or WebGL failures

Reference Files

FileTopic
conventions.mdMandatory game-creator architecture conventions
project-setup.mdScaffolding, Vite, TypeScript config, responsive canvas, entity sizing, portrait mode
scenes-and-lifecycle.mdScene system deep dive
game-objects.mdCustom objects, groups, containers, button pattern
physics-and-movement.mdPhysics engines, movement patterns
assets-and-performance.mdAssets, optimization, mobile
patterns.mdECS, state machines, singletons
no-asset-design.mdProcedural visuals: gradients, parallax, particles, juice

平台分布

Codex

31.94%
按下载量换算974

Claude

31.63%
按下载量换算965

Cursor

18.8%
按下载量换算573

Gemini CLI

9.26%
按下载量换算282

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills