К основному содержанию
скилл CX Codex

game-qa — скилл для Claude Code: тесты браузерных игр на Playwright

Скилл для автотестов браузерных игр: проверяет визуал, геймплей, производительность и доступность через Playwright. Пригодится, когда тесты надо писать или разбирать их падения.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add PlayableIntelligence/game-creator --skill game-qa -a claude-code
Открыть на GitHub

Что делает game-qa

Скилл задаёт агенту роль QA-инженера браузерных игр. Он пишет тесты на @playwright/test, сравнивает скриншоты через toHaveScreenshot(), проверяет доступность пакетом @axe-core/playwright и меряет FPS. Отдельно описаны семь инвариантов геймплея: подсчёт очков, смерть, кнопки, аудит сущностей, режим mute и другие.

Внутри — набор справочных файлов: test-patterns.md про фикстуры и boot-тесты, visual-regression.md про маскирование динамичных элементов, clock-control.md про Playwright Clock API для покадровой точности, mobile-tests.md про ввод на телефонах. Есть и playwright-mcp.md про MCP-сервер, если удобнее инспектировать игру вручную.

Чтобы агент видел состояние игры, в main.js нужны глобальные объекты window.__GAME__, window.__GAME_STATE__, window.__EVENT_BUS__ и window.__EVENTS__, плюс функции render_game_to_text() и advanceTime(ms). Без них тесты упрутся в пустое состояние. Заранее поставьте Node.js и Playwright — скилл рассчитан на них.

Какие задачи решает

  • проверить, что игра грузится и сцены переключаются
  • сравнить скриншоты и поймать визуальные регрессии
  • замерить FPS и просадки производительности
  • прогнать проверки доступности через axe-core
  • разобрать, почему упал тест геймплея

Примеры запросов агенту

  • напиши тест на загрузку игры и переход между сценами
  • добавь визуальную регрессию для экрана с очками
  • почему падает perf.spec.js — посмотри трейс

Как установить game-qa

1Через Skills CLI (Vercel)

npx skills add PlayableIntelligence/game-creator --skill game-qa -a claude-code

2Вручную: положить файлы

~/.claude/skills/game-qa/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/game-qa/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Из того же набора27

design-game Проводит аудит визуала и игрового ощущения готовой игры, ставит оценки по областям и вносит правки: фон, частицы, анимации, типографика. CX Codex +1 1 400установок game-audio Генерирует процедурную фоновую музыку и звуковые эффекты для браузерных игр через Web Audio API. Работает без внешних файлов и сторонних пакетов. CX Codex +1 1 300установок game-architecture Скилл задаёт структуру проекта браузерной игры: EventBus, единый GameState, Constants.js и порядок слоёв. Пригодится, когда код игры уже расползается. CX Codex +1 1 200установок make-game Скилл структурирует разработку видеоигр: от проработки геймплея и выбора движка до генерации проекта и исправления багов. CX Codex +1 1 100установок game-3d-assets Подбирает, генерирует и встраивает 3D-модели GLB и GLTF в браузерные игры на Three.js вместо стандартных кубов и сфер. CX Codex +1 1 100установок threejs-game Задаёт структуру проекта и обязательные модули для 3D-игры в браузере на Three.js. Пригодится, когда агенту нужно развернуть сцену и игровой цикл с нуля. CX Codex +1 1 100установок add-audio Скилл добавляет в браузерную игру фоновую музыку и звуковые эффекты на Web Audio API. Никаких аудиофайлов и npm-пакетов — всё синтезируется в браузере. CX Codex +1 1 000установок add-assets Заменяет круги и прямоугольники в 2D-игре на пиксель-арт спрайты персонажей, врагов и предметов. Пригодится, когда прототип уже играется, а смотреть на него больно. CX Codex +1 997установок

Похожие

browser-qa affaan-m Гоняет живой интерфейс через браузерный MCP: ошибки в консоли, Core Web Vitals, формы, скриншоты на трёх ширинах и axe-core. Выносит вердикт SHIP или DO NOT SHIP. CX Codex +1 4 900установок visual-testing kindlmann Скилл для визуального регрессионного тестирования: сравнивает скриншоты с эталонами и ловит различия на уровне пикселей, которые пропускают функциональные тесты. CX Codex +1 1 200установок visual-regression-testing aj-geddes Ловит случайные визуальные изменения интерфейса: снимает скриншоты компонентов и страниц и сравнивает их между версиями. CX Codex +1 718установок visual-regression-tester patricio0312rev Скилл настраивает визуальное регрессионное тестирование: снимает скриншоты, сравнивает их с базовыми и ловит случайные изменения интерфейса. CX Codex +1 330установок game-playtest официальный OpenAI Направляет агента при тестировании браузерных игр и фронтенда. Помогает проверить первый экран, механику, читаемость интерфейса и артефакты WebGL по скриншотам. CX Codex GP ChatGPT 62установок threejs-qa-release majidmanzarpour Проверяет браузерные игры на Three.js перед релизом: игровой цикл, адаптивность, сборку и визуальные артефакты. Нужен после изменений в механиках или перед публикацией. CX Codex +1 3 000установок

Рядом в теме «Тесты и QA»

Всё по теме «Тесты и QA» →

Вопросы о game-qa

Как установить game-qa в Claude?

Выполните npx skills add PlayableIntelligence/game-creator --skill game-qa -a claude-code. Скилл встанет в ~/.claude/skills/game-qa/SKILL.md.

Что делает game-qa?

Даёт агенту инструкции для автотестов браузерных игр на Playwright: визуальная регрессия, проверка геймплея, производительность и доступность.

Что нужно для работы скилла?

Node.js и Playwright. Игра должна выставлять глобальные объекты на window и функцию render_game_to_text(), иначе агент не увидит состояние.

Исходный текст

SKILL.md · MIT
---
name: game-qa
description: Game QA testing with Playwright — visual regression, gameplay verification, performance, and accessibility for browser games. Use when writing or running game tests, debugging test failures, or building QA infrastructure. This is the reference skill — use qa-game for the user-facing command.
argument-hint: "[topic]"
license: MIT
compatibility: Requires Node.js and Playwright for browser-based game testing.
metadata:
  author: OpusGameLabs
  version: 1.3.0
  tags: [game, qa, testing, playwright]
---

# Game QA with Playwright

You are an expert QA engineer for browser games. You use Playwright to write automated tests that verify visual correctness, gameplay behavior, performance, and accessibility.

## Performance Notes

- Take your time with each step. Quality is more important than speed.
- Do not skip validation steps — they catch issues early.
- Read the full context of each file before making changes.
- Write tests that verify gameplay, not just that the page loads.

## Reference Files

For detailed reference, see companion files in this directory:
- `test-patterns.md` — Custom fixture code, boot tests, gameplay verification tests, scoring tests
- `gameplay-invariants.md` — All 7 core gameplay invariant patterns (scoring, death, buttons, render_game_to_text, design intent, entity audit, mute)
- `visual-regression.md` — Screenshot comparison tests, masking dynamic elements, performance/FPS tests, accessibility tests, deterministic testing patterns
- `clock-control.md` — Playwright Clock API patterns for frame-precise testing
- `playwright-mcp.md` — MCP server setup, when to use MCP vs scripted tests, inspection flow
- `iterate-client.md` — Standalone iterate client usage, action JSON format, output interpretation
- `mobile-tests.md` — Mobile input simulation and responsive layout test patterns

## Tech Stack

- **Test Runner**: Playwright Test (`@playwright/test`)
- **Visual Regression**: Playwright built-in `toHaveScreenshot()`
- **Accessibility**: `@axe-core/playwright`
- **Build Tool Integration**: Vite dev server via `webServer` config
- **Language**: JavaScript ES modules

## Project Setup

When adding Playwright to a game project:

```bash
npm install -D @playwright/test @axe-core/playwright
npx playwright install chromium
```

Add to `package.json` scripts:

```json
{
  "scripts": {
    "test": "npx playwright test",
    "test:ui": "npx playwright test --ui",
    "test:headed": "npx playwright test --headed",
    "test:update-snapshots": "npx playwright test --update-snapshots"
  }
}
```

## Required Directory Structure

```
tests/
├── e2e/
│   ├── game.spec.js       # Core game tests (boot, scenes, input, score)
│   ├── visual.spec.js     # Visual regression screenshots
│   └── perf.spec.js       # Performance and FPS tests
├── fixtures/
│   ├── game-test.js       # Custom test fixture with game helpers
│   └── screenshot.css     # CSS to mask dynamic elements for visual tests
├── helpers/
│   └── seed-random.js     # Seeded PRNG for deterministic game behavior
playwright.config.js
```

## Playwright Config

```js
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
  testDir: './tests',
  fullyParallel: true,
  forbidOnly: !!process.env.CI,
  retries: process.env.CI ? 2 : 0,
  workers: process.env.CI ? 1 : undefined,
  reporter: [['html', { open: 'never' }], ['list']],

  use: {
    baseURL: 'http://localhost:3000',
    trace: 'on-first-retry',
    screenshot: 'only-on-failure',
    video: 'retain-on-failure',
  },

  expect: {
    toHaveScreenshot: {
      maxDiffPixels: 200,
      threshold: 0.3,
    },
  },

  projects: [
    { name: 'chromium', use: { ...devices['Desktop Chrome'] } },
    { name: 'mobile-chrome', use: { ...devices['Pixel 5'] } },
  ],

  webServer: {
    command: 'npm run dev',
    url: 'http://localhost:3000',
    reuseExistingServer: !process.env.CI,
    timeout: 30000,
  },
});
```

Key points:
- `webServer` auto-starts Vite before tests
- `reuseExistingServer` reuses a running dev server locally
- `baseURL` matches the Vite port configured in `vite.config.js`
- Screenshot tolerance is generous (games have minor render variance)

## Testability Requirements

For Playwright to inspect game state, the game MUST expose these globals on `window` in `main.js`:

### 1. Core globals (required)

```js
// Expose for Playwright QA
window.__GAME__ = game;
window.__GAME_STATE__ = gameState;
window.__EVENT_BUS__ = eventBus;
window.__EVENTS__ = Events;
```

### 2. `render_game_to_text()` (required)

Returns a concise JSON string of the current game state for AI agents to reason about the game without interpreting pixels. Must include coordinate system, game mode, score, and player state.

```js
window.render_game_to_text = () => {
  if (!game || !gameState) return JSON.stringify({ error: 'not_ready' });

  const activeScenes = game.scene.getScenes(true).map(s => s.scene.key);
  const payload = {
    coords: 'origin:top-left x:right y:down',          // coordinate system
    mode: gameState.gameOver ? 'game_over' : 'playing',
    scene: activeScenes[0] || null,
    score: gameState.score,
    bestScore: gameState.bestScore,
  };

  // Add player info when in gameplay
  const gameScene = game.scene.getScene('GameScene');
  if (gameState.started && gameScene?.player?.sprite) {
    const s = gameScene.player.sprite;
    const body = s.body;
    payload.player = {
      x: Math.round(s.x), y: Math.round(s.y),
      vx: Math.round(body.velocity.x), vy: Math.round(body.velocity.y),
      onGround: body.blocked.down,
    };
  }

  // Extend with visible entities as you add them:
  // payload.entities = obstacles.map(o => ({ x: o.x, y: o.y, type: o.type }));

  return JSON.stringify(payload);
};
```

Guidelines for `render_game_to_text()`:
- Keep the payload **succinct** — only current, visible, interactive elements
- Include **coordinate system note** (origin and axis directions)
- Include **player position/velocity**, active obstacles/enemies, collectibles, timers, score, and mode flags
- Avoid large histories; only include what's currently relevant
- The iterate client and AI agents use this to verify game behavior without screenshots

### 3. `advanceTime(ms)` (required)

Lets test scripts advance the game by a precise duration. The game loop runs normally via RAF; this waits for real time to elapse.

```js
window.advanceTime = (ms) => {
  return new Promise((resolve) => {
    const start = performance.now();
    function step() {
      if (performance.now() - start >= ms) return resolve();
      requestAnimationFrame(step);
    }
    requestAnimationFrame(step);
  });
};
```

For frame-precise control in `@playwright/test`, prefer `page.clock.install()` + `page.clock.runFor()`. The `advanceTime` hook is primarily used by the standalone iterate client (`scripts/iterate-client.js`).

For Three.js games, expose the `Game` orchestrator instance similarly.

See `test-patterns.md` for custom fixture code, boot tests, gameplay verification tests, and scoring tests.

See `gameplay-invariants.md` for all 7 core gameplay invariant patterns (scoring, death, buttons, render_game_to_text, design intent, entity audit, mute).

## When Adding QA to a Game

1. Install Playwright: `npm install -D @playwright/test @axe-core/playwright && npx playwright install chromium`
2. Create `playwright.config.js` with the game's dev server port
3. Expose `window.__GAME__`, `window.__GAME_STATE__`, `window.__EVENT_BUS__` in `main.js`
4. Create `tests/fixtures/game-test.js` with the `gamePage` fixture
5. Create `tests/helpers/seed-random.js` for deterministic behavior
6. Write tests in `tests/e2e/`:
   - `game.spec.js` — boot, scene flow, input, scoring, game over
   - `visual.spec.js` — screenshot regression for each scene
   - `perf.spec.js` — load time, FPS budget
7. Add npm scripts: `test`, `test:ui`, `test:headed`, `test:update-snapshots`
8. Generate initial baselines: `npm run test:update-snapshots`

## What NOT to Test (Automated)

- **Exact pixel positions** of animated objects (non-deterministic without clock control)
- **Active gameplay screenshots** — moving objects make stable screenshots impossible; use MCP instead
- **Audio playback** (Playwright has no audio inspection; test that audio objects exist via evaluate)
- **External API calls** unless mocked (e.g., Play.fun SDK — mock with `page.route()`)
- **Subjective visual quality** — use MCP for "does this look good?" evaluations

© OpusGameLabs · MIT · PlayableIntelligence/game-creator

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой