qa-game by opusgamelabs/game-creator
npx skills add https://github.com/opusgamelabs/game-creator --skill qa-game为现有游戏项目添加基于 Playwright 的自动化 QA 测试。测试将验证您的游戏能否正常启动、场景是否正常工作、计分功能是否正常,以及视觉效果是否完好——就像为您的游戏设置了一张安全网。
分析位于 $ARGUMENTS 的游戏项目(如果未提供路径,则分析当前目录)。
首先,加载 game-qa 技能以获取完整的测试模式和固件。
package.json 以确定引擎和开发服务器端口vite.config.js 以获取服务器端口src/main.js 以检查是否暴露了 window.__GAME__、window.__GAME_STATE__、window.__EVENT_BUS__src/core/GameState.js 以了解有哪些状态可用广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
src/core/EventBus.js 以了解存在哪些事件src/core/Constants.js 以了解游戏参数(速率、速度、持续时间、最大值)design-brief.md 则读取它——它记录了预期的机制、量级以及输赢可达性安装依赖项:npm install -D @playwright/test @axe-core/playwright && npx playwright install chromium
使用正确的开发服务器端口和 webServer 配置创建 playwright.config.js
如果尚未存在,在 src/main.js 中暴露 window.__GAME__、window.__GAME_STATE__、window.__EVENT_BUS__、window.__EVENTS__
创建测试目录结构:
tests/
├── e2e/
│ ├── game.spec.js
│ ├── visual.spec.js
│ └── perf.spec.js
├── fixtures/
│ └── game-test.js
└── helpers/
└── seed-random.js
添加 npm 脚本:test、test:ui、test:headed、test:update-snapshots
根据游戏实际功能编写测试:
遵循 game-qa 技能模式。使用 gamePage 固件。使用 page.evaluate() 读取游戏状态。使用 page.keyboard.press() 进行输入。
在 game.spec.js 中添加一个 test.describe('Design Intent') 代码块。这些测试用于捕获技术上存在但过于薄弱而无关紧要的机制。
GameState.js——如果它有 won、result 或类似的布尔/枚举字段,则游戏区分胜利与失败。同时检查 main.js 中的 render_game_to_text()——如果它返回不同的结果模式(例如,'win' 与 'game_over'),则游戏具有失败状态。如果存在失败状态:启动游戏,不提供任何输入,让其运行至完成(使用 page.waitForFunction 并传入 Constants.js 中的回合持续时间)。断言结果是失败的那个(例如,won === false、mode === 'game_over')。
此断言不容协商。 请不要编写一个在玩家不做任何操作就获胜时也能通过的测试。如果当前游戏行为是“玩家无输入获胜”,那是一个错误——编写测试来捕获它。
对手/AI 压力 :如果存在 AI 驱动的机制(自动爬升条、敌人生成、难度递增),测试它是否产生显著的状态变化。在不进行玩家输入的情况下运行游戏一半的持续时间。断言对手的状态至少达到其最大值的 25%。如果存在 design-brief.md,则使用其预期的量级作为阈值。否则,从 Constants.js 推导:计算 rate * duration 并断言其达到有意义的水平。
胜利条件 :测试积极的玩家输入是否会导致胜利。在整个回合中提供快速输入,并断言结果是胜利。
审计碰撞和交互逻辑中可能导致初次玩家困惑的不对称性。
如果 design-brief.md 有“实体交互”部分,则将其用作检查清单。否则,直接审计 GameScene.js:
// QA FLAG: asymmetric interaction 注释,注明实体名称和不对称性这是一个标记,不是硬性失败。某些不对称性是故意的(例如,仅影响玩家的危险物)。该标记确保不对称性是有意识的设计选择,而不是疏忽。
npx playwright test 以执行所有测试npx playwright test --update-snapshots 生成基线用通俗易懂的英语告诉用户:
npm test(无头模式)、npm run test:headed(查看浏览器)、npm run test:ui(交互式仪表板)/qa-game examples/flappy-bird
结果:安装 Playwright → 创建 15 个测试(启动、场景转换、输入、计分、重新开始、游戏结束、视觉回归、FPS、加载时间)→ 生成包含固件和辅助工具的 tests/ 目录 → 所有测试通过。在更改后随时运行 npm test。
告诉用户:
您的游戏现在拥有自动化测试了!最后,运行
/game-creator:review-game进行完整的架构审查——它会检查您的代码结构、性能模式,并为您提供一个带有具体改进建议的评分。流水线进度:
/make-game→/design-game→/add-audio→/qa-game→/review-game
每周安装次数
99
代码仓库
GitHub 星标数
32
首次出现
2026年2月21日
安全审计
已安装于
claude-code85
opencode50
kimi-cli48
gemini-cli48
amp48
github-copilot48
Add automated QA testing with Playwright to an existing game project. Tests verify your game boots, scenes work, scoring functions, and visuals haven't broken — like a safety net for your game.
Analyze the game at $ARGUMENTS (or the current directory if no path given).
First, load the game-qa skill to get the full testing patterns and fixtures.
package.json to identify the engine and dev server portvite.config.js for the server portsrc/main.js to check if window.__GAME__, window.__GAME_STATE__, window.__EVENT_BUS__ are exposedsrc/core/GameState.js to understand what state is availablesrc/core/EventBus.js to understand what events existsrc/core/Constants.js to understand game parameters (rates, speeds, durations, max values)design-brief.md if it exists — it documents expected mechanics, magnitudes, and win/lose reachabilityInstall dependencies: npm install -D @playwright/test @axe-core/playwright && npx playwright install chromium
Create playwright.config.js with the correct dev server port and webServer config
Expose window.__GAME__, window.__GAME_STATE__, window.__EVENT_BUS__, window.__EVENTS__ in src/main.js if not already present
Create the test directory structure:
tests/
├── e2e/
│ ├── game.spec.js
│ ├── visual.spec.js
│ └── perf.spec.js
├── fixtures/
│ └── game-test.js
└── helpers/
└── seed-random.js
Write tests based on what the game actually does:
Follow the game-qa skill patterns. Use gamePage fixture. Use page.evaluate() to read game state. Use page.keyboard.press() for input.
Add a test.describe('Design Intent') block to game.spec.js. These tests catch mechanics that technically exist but are too weak to matter.
GameState.js — if it has a won, result, or similar boolean/enum field, the game distinguishes win from loss. Also check render_game_to_text() in main.js — if it returns distinct outcome modes (e.g., 'win' vs 'game_over'), the game has a lose state.If a lose state exists: start the game, provide NO input, let it run to completion (use page.waitForFunction with the round duration from Constants.js). Assert the outcome is the losing one (e.g., won === false, mode === 'game_over').
This assertion is non-negotiable. Do NOT write a test that passes when the player wins by doing nothing. If the current game behavior is "player wins with no input," that is a bug — write the test to catch it.
Opponent/AI pressure : If an AI-driven mechanic exists (auto-climbing bar, enemy spawning, difficulty ramp), test that it produces substantial state changes. Run the game for half its duration without player input. Assert the opponent's state reaches at least 25% of its maximum. If design-brief.md exists, use its expected magnitudes for thresholds. Otherwise, derive from Constants.js: calculate rate * duration and assert it reaches meaningful levels.
Win condition : Test that active player input leads to a win. Provide rapid input throughout the round and assert the outcome is a win.
Audit collision and interaction logic for asymmetries that would confuse a first-time player.
If design-brief.md has an "Entity Interactions" section, use it as the checklist. Otherwise, audit GameScene.js directly:
// QA FLAG: asymmetric interaction comment in the test file noting the entity name and the asymmetryThis is a flag, not a hard fail. Some asymmetries are intentional (e.g., hazards that only affect the player). The flag ensures the asymmetry is a conscious design choice, not an oversight.
npx playwright test to execute all testsnpx playwright test --update-snapshotsTell the user in plain English:
npm test (headless), npm run test:headed (see the browser), npm run test:ui (interactive dashboard)/qa-game examples/flappy-bird
Result: Installs Playwright → creates 15 tests (boot, scene transitions, input, scoring, restart, game-over, visual regression, FPS, load time) → generates tests/ directory with fixtures and helpers → all tests pass. Run npm test anytime after changes.
Tell the user:
Your game now has automated tests! Finally, run
/game-creator:review-gamefor a full architecture review — it checks your code structure, performance patterns, and gives you a score with specific improvement suggestions.Pipeline progress:
/make-game→/design-game→/add-audio→/qa-game→/review-game
Weekly Installs
99
Repository
GitHub Stars
32
First Seen
Feb 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
claude-code85
opencode50
kimi-cli48
gemini-cli48
amp48
github-copilot48
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
46,600 周安装
Add npm scripts: test, test:ui, test:headed, test:update-snapshots