Browser Game Input Check (keyboard that just works)
/browser-game-input-check
A GameSkill original for keyboard input in browser games: a drop-in input.js that binds physical keys, ignores OS repeats, stops page scrolling, releases keys on alt-tab, never loses quick taps, ignores text fields and leaves browser shortcuts alone, plus a checker that drives the game in headless Chrome and prints PASS / FAIL with a fix for 15 checks, including one press acting once through a slow frame.
- 许可证
- MIT
- 出品
- GameSkill 出品
我们测过
在 Headless Chrome (DevTools protocol) + Node 22 上通过 30/30 项检查(2026-11-09):能触发、有可运行示例、有截图和自检清单、单一职责、中英文文档齐全。触发检查是把提示词和 skill 描述做匹配,不是真实 agent 运行。
测试报告GameSkill 测过的版本
GameSkill 为 gameskill.dev 原创编写并测过。ZIP 里是完整的 skill:SKILL.md 及中文版、脚本、可运行示例、测试、自检清单和我们的测试报告。
GameSkill 原创,协议 MIT。ZIP 保留 LICENSE 和 CREDITS.md,里面列出了流程灵感来源、CC0 测试素材和第三方库及其协议。

自检清单
- 按 event.code 绑定,不用 event.key / Bind by event.code, not event.key
- 每个固定步长调用一次 input.update() / input.update() once per fixed step
- input_check.mjs 带 --count 输出 15/15 passed / input_check.mjs with --count prints 15/15 passed
- 页面比窗口高时方向键和空格不滚动 / Arrows and Space do not scroll a tall page
推荐搭配
中文指南
这个 skill 做什么
GameSkill 原创(MIT)。处理网页游戏的键盘输入:即插即用的 input.js 按物理键(event.code)绑定、忽略系统按键重复、阻止页面滚动、alt-tab 后释放按键、不丢快速点按、忽略输入框、不拦浏览器快捷键;配套的检查器在无界面 Chrome 里驱动游戏,15 项检查逐项输出 PASS / FAIL 和修法,包括固定步长下卡顿帧里按一次只执行一次。
什么时候用
- 任何带键盘操作的 HTML5 / canvas / WebGL 游戏,发布前或 agent 写完输入代码后
- alt-tab 后卡键、方向键滚动页面、AZERTY 键盘上 WASD 不能用
- 帧卡顿时跳跃或射击触发两次
怎么装
下载本页的 ZIP,把 browser-game-input-check/ 文件夹放进 .claude/skills/(Claude Code)或 .agents/skills/(Codex、Cursor),重启 agent。检查器需要 Node 22 以上和 Chrome/Chromium;input.js 本身没有依赖。
最小示例
node tools/input_check.mjs example/lantern-moth/index.html --count "window.__game.state().flares",输出15/15 passed。- 对
example/lantern-moth/broken.html再跑一次:8 项失败(键盘布局、同动作双键、失焦、快速点按两项、卡顿帧、输入框、页面滚动),每项都有修法。
我们怎么测的
示例是我们自己做的小游戏「灯蛾」(Lantern Moth):在夜晚的花园里飞,用光环抓萤火虫。test/run_tests.mjs 共 18 项检查,用 Node 22 和无界面 Chrome 跑:input.js 的 11 项单元测试;游戏 15/15;坏副本(naive-input.js、每显示帧调用一次 update)正好 8 个 FAIL 且每个都有修法;没有探针的页面只有探针一项失败、页面检查照常;会报错的页面判失败;不存在的文件退出码 2。连续多次运行结果一致。结果在 gameskill/test-report.json。
致谢
代码、示例游戏和文字都是我们自己的;input.js 和示例游戏的初稿由 DeepSeek 起草,经我们审查、修正和测试。
搭配
game-ui-de-ai:游戏界面设计web-audio-sfx-synth:网页游戏音效
安装
告诉你的 AI
Install the skill from https://gameskill.dev/skills/browser-game-input-check/install.md
GameSkill 测过的版本
mkdir -p .claude/skills
curl -fsSL https://gameskill.dev/dl/skills/browser-game-input-check.zip -o /tmp/gameskill-browser-game-input-check.zip
unzip -oq /tmp/gameskill-browser-game-input-check.zip -d .claude/skills
rm /tmp/gameskill-browser-game-input-check.zip包含内容
- input.js: held / pressed / released / axis by event.code, edge queue, repeat filter, blur reset, text-field and shortcut safety, debug() probe
- tools/input_check.mjs: 15 checks in headless Chrome over the DevTools protocol, each FAIL with a fix; --count reads a real game action
- Lantern Moth, our own small canvas game, and a broken copy with the usual naive input that fails 8 checks
- 18 checks in test/run_tests.mjs, run on Node 22 and Chrome headless
适合
- Any HTML5, canvas or WebGL game with keyboard controls, before release or after an agent wrote the input code
- Keys that stick after alt-tab, pages that scroll with the arrows, WASD that fails on AZERTY
- A jump or shot that fires twice when a frame is slow
不适合
- Gamepad, touch or key remapping UI
- Native engines (Godot, Unity): their input systems handle this differently
试试这条提示词
My canvas platformer scrolls the page when I press Space, keys stick after alt-tab and sometimes the jump fires twice. Fix the keyboard input and prove it.关于这个 Skill
A GameSkill original. Keyboard code in browser games breaks in the same eight ways: WASD on AZERTY, repeat re-presses, page scrolling, stuck keys after alt-tab, two keys on one action, lost quick taps, typing in a text field, and one press firing several times when a fixed-timestep game has a slow frame. input.js avoids all of them, and tools/input_check.mjs proves it: it starts headless Chrome, sends real key events over the DevTools protocol and prints PASS / FAIL with a fix for 15 checks. Point --count at a real game action and it checks the game, not just the input module.
Agent steps
- Drop in
input.js, bind actions byevent.code, and callinput.update()once per fixed step. - Run
input_check.mjson the game with--countpointed at a game action. - Fix each FAIL from its fix line and run again until it prints 15/15.
Common bugs it catches
event.keybindings, OS key repeat re-firing, and arrows or Space scrolling the page.- Keys stuck after alt-tab, quick taps lost between frames, and the game reacting to typing.
- One press acting two or three times through a slow frame because input is updated per display frame.
Credits
The code, the Lantern Moth example and the text are ours.
环境要求
- Node 22+ (built-in WebSocket); no npm packages
- Google Chrome or Chromium, run headless (set CHROME if it is not on PATH)
相关主题
常见问题
抽卡 Gacha Kit
单抽、十连演出:SSR 蓄力后金光爆发,飞到中央变成跟着鼠标或手机陀螺仪倾斜的全息卡。按稀有度分级演出,可跳过,内置中英文案。
搭配使用
作者标注的相关 Skills,或更适合相邻任务的 Skills。
De-AI Game UI (remove the generic AI look from menus and HUDs, checked by a lint)
A GameSkill original that strips the tells of AI-made game UI (purple-blue gradients, glass panels, neon glows, emoji icons, one big radius, everything centred, identical buttons, epic-journey copy) and rebuilds the screen from the game's own world. Ships a 12-rule lint that reads computed styles in headless Chrome for any framework, a before/after pause menu and a mutation test proving every rule can fail.
Web Audio SFX Synth (no audio files)
A GameSkill original: 12 game sound effects made from code with the Web Audio API, plus the mixer around them: unlock on the first tap, a compressed master bus with mute, pitch and level variation, stereo pan, distance falloff and a voice limiter. Every sound is rendered offline and checked for clipping.
Game Trailer from Code (Steam trailer and store images)
A GameSkill original: turn your own running game into a 15-second Steam gameplay trailer and every store image with code. Frame-exact capture, a JSON cut list, zh/en captions and SRT, a soundtrack synced to game events, an H.264/AAC encode, and a checker for Steam's trailer rules, loudness, the 6-second microtrailer and the capsule sizes. Version 1.1 adds a rhythm tool that finds every cut, dead air and black frames, matches cuts to the cut list and moves them onto the music's beat, plus stage-by-stage confirmation with the user.
相似 skills
Awesome Gamedev Agent Skills
77 portable SKILL.md skills across 12 engines (Godot, Unity, Unreal, Phaser, PixiJS, three.js, Bevy, pygame, LÖVE, Roblox, Defold, Ebitengine), with a router.
Three.js Game Skills
Nine Agent Skills for Codex and Claude Code that build playable Three.js browser games, with a director skill, a Vite scaffold and Playwright QA.
reanimate: clone an animation and prove it moves the same
Rebuild a UI animation from a live page, a screen recording, a gif or a Lottie file in your own code, then record the copy the same way and compare the two frame by frame, fixing timing, easing and stagger until the numbers match. Covers CSS, Web Animations, canvas, WebGL and three.js.
Hand Gestures (webcam hand controls for browser games)
Build webcam hand games and gesture controls for web pages with hand-gesture-kit on MediaPipe: 17 poses (fist, point, thumbs up, pinch…), motions (swipes, circles, taps, throws), two-hand clap and zoom, a mouse fallback, and synthetic hands so games are tested without a camera. Ships a complete three.js starter game with a ?bot=1 player, tests and capture tools, plus Google's hand model, so nothing downloads at setup.