/meta-wearables-webapp-game:validate-webapp-game [project-dir]from meta-wearables-webapp-game
Validates a Meta Display Glasses webapp game against project guidelines: input handling, i18next localization, asset preloading, framework logging, layer boundaries, and drag opt-in. Runs seven checks via a wrapper script and reports PASS/FAIL.
Ships in meta-wearables-webapp-game. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Run the project's validation checks and report a PASS/FAIL summary. This skill is an orchestrator: deterministic work is done by bundled scripts (fast, cheap, exact), and a cheap subagent is used only where a script genuinely can't decide. It makes no changes to the project.
This version runs seven checks from the plugin's docs — an input-handler check, a
localized-string check, a network-load check, a console-logging check, a
display-shell check, a layer-boundary check, and a drag-opt-in check. One wrapper
script (validate-all.mjs) runs them all; the rules each one enforces are below.
1. Input rule (${CLAUDE_PLUGIN_ROOT}/docs/game-architecture.md,
${CLAUDE_PLUGIN_ROOT}/docs/threejs-vs-dom.md): gameplay reads input only through the
InputManager and consumes it from the main game loop. The only sanctioned place that touches DOM
input events is the input layer (src/framework/input/), which attaches to window. Everything
else is a violation:
on*= handler attributes in .html (e.g. onclick=, onkeydown=, onchange=);addEventListener for an input event in .ts/.js — even on window/document —
outside src/framework/input/;el.on<event> = handler assignments (e.g. btn.onclick = …).Non-input listeners are fine anywhere (e.g. document.addEventListener('visibilitychange', …)
to stop the loop when backgrounded).
2. Localization rule (${CLAUDE_PLUGIN_ROOT}/docs/localization.md): all user-facing text goes
through i18next — t('key') for dynamic text in TS/JS, data-i18n="key" for static text in HTML.
Hardcoded human-readable copy written straight into the DOM (a string literal with letters assigned
to .textContent / .innerText / .innerHTML, or passed to insertAdjacentText /
insertAdjacentHTML) is a violation. Bare numbers (String(score)), symbol-only glyphs, and text
already wrapped in t(...) are fine. The src/i18n/ and src/framework/ layers are exempt.
3. Preload rule (${CLAUDE_PLUGIN_ROOT}/docs/loading-screen.md): assets load once up front (the
manifest + the framework AssetLoader); gameplay/UI/config code must not load assets or open
network connections at runtime — a runtime request hitches on the glasses. Outside src/framework/,
instantiating a Three.js/asset loader (new TextureLoader/GLTFLoader/…) or setting a media src
to a network URL is a violation. fetch / XMLHttpRequest / WebSocket / EventSource, and a
media src from a non-literal expression, are ambiguous (they may be an intended API call or a
preloaded blob:/data: URL). In-memory blob: / data: URLs are always fine.
Audio is no exception, and gets it for free: a bank decodes and frees clips whose compressed
bytes the preload manifest already fetched, so loadBank costs a decode and never a request.
Streamed music plays from a blob: URL over those same preloaded bytes. If you see a fetch in an
audio code path, that is a real regression, not a carve-out.
4. Logging rule (${CLAUDE_PLUGIN_ROOT}/docs/logging.md): game code logs through the framework
logger (import { log } from '@/log'), never console.*. A raw console call is invisible on the
glasses — the device has no console and no way to attach one — and it bypasses the level filter,
the ?logview overlay, the remote sink, secret redaction, and the rate limit. Any
console.<method>( outside src/framework/ (which implements the logger and its console sink) is
a violation. There are no ambiguous cases for this check.
5. Display-shell rule (${CLAUDE_PLUGIN_ROOT}/docs/display-guidelines.md): the page shell must
match the device's fixed display. The viewport is width=600, height=600;
<meta name="mrbd-web-app-capable" content="yes"> is present (without it the device never routes
D-pad / EMG input to the page); the page background is pure black (on an additive waveguide a
non-black background glows over the real world); HUD text is >= 16px; the
<meta name="description"> is game-specific rather than the scaffold's placeholder copy; the
<meta name="generator"> attribution marker is present and names the scaffolding skill, a version
and the learn-more URL; and no scaffold placeholder tokens survive. A font-size in rem/em/%
can't be resolved statically and is reported as ambiguous.
A missing generator marker usually means the game was scaffolded before the marker existed, not
that someone deleted it — running update-webapp-game-framework inserts it. The marker's
version is only checked for shape, never against the current plugin version: a game legitimately
lags behind until it re-syncs.
6. Layer rule (${CLAUDE_PLUGIN_ROOT}/docs/core-contract.md section 5): gameplay is renderer-,
input-, and audio-agnostic — it talks to the Renderer / InputManager / AudioPlayer contracts,
and the concrete implementations are injected in main.ts. That is what makes a whole game
unit-testable in plain Node with fakes. Only a few game files are adapters and may cross a
boundary: src/models.ts for three; src/main.ts, src/hud/, and src/log.ts for the DOM;
nothing in game code for the Web Audio API (only src/framework/audio/AudioEngine.ts); and
src/main.ts alone for the concrete audio backend. That last one is the audio counterpart of the
three rule: importing AmpAudioPlayer / AudioEngine / BankStore from gameplay hard-wires it
to the backend even though no forbidden global appears on the line, so FakeAudioPlayer can no
longer stand in. Gameplay takes an injected AudioPlayer<SoundId>; importing the
AudioPlayer contract, the audioSettings schema, or the soundDefinitions builders is fine.
src/framework/ is exempt — it implements those adapters. A dynamic import() with a
non-literal specifier is ambiguous. Comments are stripped before matching, so a prose mention of
AudioContext or window is not a violation.
7. Drag opt-in rule (${CLAUDE_PLUGIN_ROOT}/docs/drag-channel.md): the EMG index
pinch-and-move channel is opt-in, and opting in is three coordinated
edits — touch-action: none in the CSS, { pointerDrag: true } on the PointerKeyboardInput,
and game code that consumes the movement delta. Any two without the third is a violation. The one
that matters most: pointerDrag: true on a game that never drags, which happens when the flag is
switched on so a desktop mouse click produces a pinchTap while iterating in a browser. It is
not a dev convenience — it opts the device into the pointer stream and moves the tap source off
Enter. Enter is the index pinch in a browser too; press that. A pointerDrag whose value is
not a boolean literal is ambiguous. The project's CLAUDE.md must not contradict the mode
either: on a game with pointerDrag: true, an assertion there that the game is tap-only
(this game is tap-only, press \Enter`, don't click) is a violation. That file is the first thing an agent reads, and in drag mode the pinch is a mouse click while Enteris deliberately ignored — so the claim points every future agent at an input the framework drops. Only the assertion form is matched; prose that describes both modes is fine — and the bare imperative is disowned when a clause names the mode it belongs to ("In tap-only mode, pressEnter`, don't
click"), so only an imperative asserted of the game itself counts.
Use the argument if given, else the current directory. Confirm it looks like a scaffolded game
(it has a src/ directory). If not, tell the user and stop.
Every check is fully scriptable, so run them directly — do not spawn a subagent to do the scanning. One wrapper runs all seven; run the plugin-bundled copy so the rules are always current without a project re-sync:
node "${CLAUDE_PLUGIN_ROOT}/skills/validate-webapp-game/scripts/validate-all.mjs" <project-dir> --json
It never stops at the first failure, so a single run reports everything that is wrong. It prints
a one-line-per-check human summary to stderr, and with --json the combined machine-readable
report to stdout. Exit 1 if any check has definite violations (add --ci to fail on ambiguous
cases too).
The JSON is { pass, projectDir, checks: [...] }, one entry per check:
id — input-handlers / localized-strings / network-loads / console-logging /
display-shell / layer-boundaries / drag-optin.pass, filesScanned.violations[] — { file, line, snippet, reason } for definite problems.ambiguous[] — same shape, for what the line-based scan couldn't classify. These are the
only part that needs judgment; Step 3 adjudicates them.Each check also has its own validate-<id>.mjs script taking the same arguments, if you need to
re-run one after a fix. Don't loop over them by hand for a full pass — that is what the wrapper
is for, and seven JSON reports per run is pure context cost.
Definite violations need no adjudication — report them. For each entry in any check's
ambiguous[], spawn a subagent to decide it; this is the part a script can't do. Launch them in
parallel (one message, multiple Task calls) and use a cheap model:
subagent_type: general-purposemodel: haiku${CLAUDE_PLUGIN_ROOT} or
the parsed JSON — give them a real path they can Read).Fan out only where the volume justifies it. input-handlers, localized-strings, and
network-loads can produce many ambiguous entries, so give each its own subagent. The other four
produce at most a handful of one-line judgments (a relative font-size, a computed dynamic
import(), a non-literal pointerDrag) — read those yourself.
Treat a VIOLATION verdict as a violation; OK clears it. Use the prompt for the check that
reported the entry:
input-handlers — ambiguous when addEventListener has a non-literal event name:
Read
<abs-file-path>around line<line>. Snippet:<snippet>. A Meta Display Glasses game must not handle user INPUT through the DOM — all input must go through theInputManager/ the main game loop. The only exception is the input layer undersrc/framework/input/. Non-input listeners (visibilitychange, resize, load, etc.) are fine. Does this line attach a handler for a user-INPUT event (click, key*, pointer*, touch*, mouse*, wheel, input, change, submit, focus, blur, drag*, drop, contextmenu) outside the input layer? Answer strictly asVIOLATIONorOK, then one short sentence of reasoning.
localized-strings — ambiguous when HTML text carries no data-i18n attribute:
Read
<abs-file-path>around line<line>. Snippet:<snippet>. A Meta Display Glasses game must route all user-facing text through i18next: dynamic text viat('key'), static HTML text via adata-i18n="key"attribute. Does this element contain user-facing copy (words a player reads) that lacks adata-i18nattribute? Ignore bare numbers, single symbols/glyphs, and non-visible metadata. Answer strictlyVIOLATIONorOK, then one short sentence.
network-loads — ambiguous for fetch / XMLHttpRequest / WebSocket / EventSource, or
a media src / new Audio(...) from a non-literal expression (which may be a preloaded
blob: / data: URL):
Read
<abs-file-path>around line<line>. Snippet:<snippet>. A Meta Display Glasses game preloads all assets up front and must not load assets over the network at runtime (during gameplay). In-memoryblob:/data:URLs (a preloaded asset) are fine, and an intended non-asset API/live-data call is allowed. Does this line load an ASSET (image, audio, model, texture, data file) over the network after startup? Answer strictlyVIOLATIONorOK, then one short sentence.
console-logging never produces ambiguous entries — a console call is decidable on sight.
display-shell reports only relative font sizes (rem / em / %), which a script can't
resolve: read the stylesheet and decide whether each renders at >= 16px.
layer-boundaries reports dynamic import() calls with a computed specifier: read each and
decide whether it pulls in a renderer, DOM, or audio dependency. Violations also carry a
concern field (three / dom / webAudio) so the fix is unambiguous.
drag-optin reports a pointerDrag whose value isn't a boolean literal: read the one line
and decide. Its report also carries the three facts it derived (dragEnabled, touchActionNone,
dragConsumed) and a notes[] for cases that are deliberately not failures (a project that
builds its own InputManager can't be checked). A CLAUDE.md tap-only claim needs no
adjudication — the mode is already decided from the code, so the contradiction is definite.
Report a single PASS/FAIL across all seven checks:
VIOLATION.file:line — reason with its snippet, and for
each, point to the fix:
InputManager (add/extend it in
src/framework/input/) and consume it from the game loop / Game.update, or make the DOM
element display-only (read state and write DOM, like src/hud/Hud.ts).src/i18n/en.json and reference it with
t('key') (dynamic text) or a data-i18n="key" attribute (static HTML), per
${CLAUDE_PLUGIN_ROOT}/docs/localization.md.preloadManifest (behind the LoadingScreen); at runtime use the preloaded object (or a
blob:/data: URL from a preloaded raw asset), never a network URL. See
${CLAUDE_PLUGIN_ROOT}/docs/loading-screen.md.import { log } from '@/log', then log.info(...) / log.warn(...) / log.error(...) at the appropriate level
(and log.child('scope') to tag a subsystem). See ${CLAUDE_PLUGIN_ROOT}/docs/logging.md.src/index.html / src/style.css: restore
the width=600, height=600 viewport and the mrbd-web-app-capable meta, set the page
background to pure black (bounded surfaces — cards, panels, modals — dark gray rather than
black; the always-on HUD unfilled, as text over the page), raise any HUD text to
>= 16px, write a game-specific <meta name="description">, and replace any surviving
scaffold placeholder token. For the surface colors specifically, read
${CLAUDE_PLUGIN_ROOT}/docs/core-contract.md section 1, which carries the HUD carve-out;
${CLAUDE_PLUGIN_ROOT}/docs/display-guidelines.md covers the rest of the shell but still
states the dark-gray rule unqualified.src/models.ts
(gameplay refers to models by ModelId and calls renderer.addModel(id)), DOM reads/writes
into src/hud/ (which reads game state and writes the DOM, never the reverse) or the
main.ts composition root, and every sound through the injected AudioPlayer
(audio.play(id)) rather than a raw AudioContext or a directly-imported AmpAudioPlayer.
A sound's tuning is not code at all: it belongs in src/audio/audioSettings.json, with its
id in src/audio/soundIds.ts. See ${CLAUDE_PLUGIN_ROOT}/docs/core-contract.md section 5.pointerDrag: true and touch-action: none: the index select still arrives
as Enter → pinchTap, on the device and in a desktop browser. If a drag does drive
gameplay, add whichever of the three is missing, per
${CLAUDE_PLUGIN_ROOT}/docs/drag-channel.md. If the violation is in CLAUDE.md, the code is
the source of truth: replace the tap-only assertion with the scaffold's derivation — tell the
reader to run node scripts/validate-drag-optin.mjs, which prints the mode — and describe
both modes rather than naming one.Add each new check the same way, cheapest tool first:
validate-<id>.mjs under
scripts/ emitting the same { pass, filesScanned, violations[], ambiguous[] } JSON, and add
it to the CHECKS list in scripts/validate-all.mjs so it joins the single run. No subagent.scripts/list-target-files.mjs, which prints one path per line) and spawn one Haiku
subagent per item (like Step 3) — never one big subagent that re-reads the whole project.Both copies of every script must stay byte-identical, and each needs a unit test.
| Issue | Solution |
|---|---|
| A comment or string is flagged | Known regex-scan limitation — confirm and delete the false positive, or move the code so the literal isn't mistaken for a handler. |
| Input layer listener flagged | It must live under src/framework/input/; files there are allowlisted. Move stray input wiring into the input implementation. |
| Legitimate lifecycle listener flagged | Only input events are banned; visibilitychange/resize/load/etc. are ignored. If you see one flagged, check it isn't actually an input event. |
| Everything is "ambiguous" | The event name is computed. Prefer a string literal so the check is exact; otherwise the subagent adjudicates. |
A console. call in the framework is flagged | It shouldn't be — src/framework/ is allowlisted. If it is flagged, the file is outside that directory; move it there or use the shared logger. |
A console. mention in a comment is flagged | Known regex-scan limitation, same as the other checks — reword the comment or confirm and dismiss. (The layer-boundary check is the exception: it strips comments first, because the words it looks for are ordinary prose.) |
| Gameplay legitimately needs the DOM | It doesn't. Read the state in src/hud/ and write the DOM there; gameplay stays a pure state machine so it can be unit-tested with fakes. If the need is input, that belongs in the InputManager. |
A tap-only game passes the drag check with pointerDrag: true | It left a dead consumeMovementDelta() call in update(), which reads as a real consumer — whether a call does anything with its result is undecidable statically. Delete the dead call and re-run. |
Drag check says "builds its own InputManager" | It found no new PointerKeyboardInput(...), so it can't tell the mode. Verify the three edits by hand: touch-action: none, the drag flag, and code that uses the delta. |
| Running standalone in CI | Use the game's own npm run validate (shipped in the scaffold), or add --ci to fail on ambiguous cases too. |
scripts/lib/console-calls.mjs (opens in a new tab)scripts/lib/display-shell.mjs (opens in a new tab)scripts/lib/drag-optin.mjs (opens in a new tab)scripts/lib/layer-boundaries.mjs (opens in a new tab)scripts/lib/localized-strings.mjs (opens in a new tab)scripts/lib/network-loads.mjs (opens in a new tab)scripts/lib/scan.mjs (opens in a new tab)scripts/list-target-files.mjs (opens in a new tab)scripts/validate-all.mjs (opens in a new tab)scripts/validate-console-logging.mjs (opens in a new tab)scripts/validate-display-shell.mjs (opens in a new tab)scripts/validate-drag-optin.mjs (opens in a new tab)scripts/validate-input-handlers.mjs (opens in a new tab)scripts/validate-layer-boundaries.mjs (opens in a new tab)scripts/validate-localized-strings.mjs (opens in a new tab)scripts/validate-network-loads.mjs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub meta/meta-wearables-webapp --plugin meta-wearables-webapp-game7 skills in this plugin
/add-webapp-game-loggingAdd a remote log sink and a passcode-gated web log portal to a webapp game, so logs from the game running on Meta Display Glasses can be read on a laptop. The glasses have no console and cannot be tethered to attach one, so the game POSTs batched log records to serverless endpoints served by its own deployment, and the developer reads them at /logs. Use when the user wants to see logs from the device, debug a glasses-only bug, add a log viewer or log server, or asks why they cannot read console output on the glasses./create-webapp-gameScaffold a new webapp game for Meta Display Glasses using Vite + TypeScript + Three.js + Vitest, with a renderer- and input-agnostic architecture. Supports both 2D and 3D games. Use when the user wants to start a glasses game, build a 2D or 3D game for smart glasses, or scaffold a Three.js game project for Meta Display Glasses./iterate-webapp-gameAutonomously iterate on a webapp game in a real browser via the Chrome DevTools Protocol (CDP): load the running game, take screenshots, click/type/press keys, run console commands, read game state, and capture console errors — then change code and repeat. Also runs a structured verification pass over a finished build (renders at all, visible on the additive display, every input responds, HUD inside the 600x600 stage) using a screenshot-statistics tool, so frames can be checked numerically instead of eyeballed. Drives a Chrome it launches itself, or attaches to one the user started with `npm run chrome` when the agent is sandboxed and cannot launch a browser. Use when the user wants to screenshot the game, see what it looks like, debug it in the browser, click through it, drag in it, reproduce a bug, check the console, inspect runtime state, verify a change visually, or check whether a finished game actually works — all without a headset.Other plugins' skills for the same job