npx skills add https://github.com/openai/skills --skill develop-web-game以小步快跑的方式构建游戏,并验证每一次变更。将每次迭代视为:实现 → 执行 → 暂停 → 观察 → 调整。
export CODEX_HOME="${CODEX_HOME:-$HOME/.codex}"
export WEB_GAME_CLIENT="$CODEX_HOME/skills/develop-web-game/scripts/web_game_playwright_client.js"
export WEB_GAME_ACTIONS="$CODEX_HOME/skills/develop-web-game/references/action_payloads.json"
用户作用域下的技能安装在 $CODEX_HOME/skills 目录下(默认:~/.codex/skills)。
window.render_game_to_text 函数,以便测试循环可以读取状态。window.advanceTime(ms)。 强烈建议提供一个确定性的步进钩子,以便 Playwright 脚本能够可靠地推进帧;如果没有它,自动化测试可能会不稳定。广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
progress.md 文件存在,首先读取它,并确认原始用户提示记录在顶部(以 Original prompt: 为前缀)。同时注意之前代理留下的任何 TODO 和建议。如果文件缺失,则创建它,并在顶部写入 Original prompt: <prompt>,然后再追加更新内容。playwright 可用(本地依赖或全局安装)。如果不确定,先检查 npx。$WEB_GAME_CLIENT;除非必要,不要发明新的客户端。$WEB_GAME_ACTIONS 构建动作,避免猜测键名。render_game_to_text 反映的屏幕状态与屏幕上显示的一致。如果有任何问题,修复并重新运行。重要交互的示例:移动、跳跃、射击/攻击、交互/使用、菜单中的选择/确认/取消、暂停/恢复、重新开始,以及请求定义的任何特殊能力或解谜动作。多步骤示例:射击敌人应减少其生命值;当生命值达到 0 时,敌人应消失并更新分数;收集钥匙应解锁门并允许关卡推进。示例命令(需要动作):
node "$WEB_GAME_CLIENT" --url http://localhost:5173 --actions-file "$WEB_GAME_ACTIONS" --click-selector "#start-btn" --iterations 3 --pause-ms 250
示例动作(内联 JSON):
{
"steps": [
{ "buttons": ["left_mouse_button"], "frames": 2, "mouse_x": 120, "mouse_y": 80 },
{ "buttons": [], "frames": 6 },
{ "buttons": ["right"], "frames": 8 },
{ "buttons": ["space"], "frames": 4 }
]
}
测试为请求添加的任何新功能以及你的逻辑变更可能影响的任何区域。识别问题,修复它们,并重新运行测试以确认问题已解决。
需要测试的内容示例:
render_game_to_text JSON 输出。暴露一个 window.render_game_to_text 函数,该函数返回一个简洁的 JSON 字符串,表示当前游戏状态。文本应包含足够的信息,以便在没有视觉的情况下也能玩游戏。
最小模式:
function renderGameToText() {
const payload = {
mode: state.mode,
player: { x: state.player.x, y: state.player.y, r: state.player.r },
entities: state.entities.map((e) => ({ x: e.x, y: e.y, r: e.r })),
score: state.score,
};
return JSON.stringify(payload);
}
window.render_game_to_text = renderGameToText;
保持有效载荷简洁,并偏向于屏幕上的/交互元素。优先选择当前可见的实体,而不是完整的历史记录。包含清晰的坐标系说明(原点和轴方向),并编码所有与玩家相关的状态:玩家位置/速度、活动的障碍物/敌人、可收集物、计时器/冷却时间、分数,以及做出正确决策所需的任何模式/状态标志。避免冗长的历史记录;只包含当前相关且可见的内容。
提供一个确定性的时间步进钩子,以便 Playwright 客户端可以按受控增量推进游戏。暴露 window.advanceTime(ms)(或一个转发到游戏更新循环的薄包装器),并让游戏循环在存在时使用它。Playwright 测试脚本在自动化测试期间使用此钩子来确定性步进帧。
最小模式:
window.advanceTime = (ms) => {
const steps = Math.max(1, Math.round(ms / (1000 / 60)));
for (let i = 0; i < steps; i++) update(1 / 60);
render();
};
f)来切换全屏开/关。Esc 退出全屏。如果 progress.md 文件不存在,则创建它,并随着你的进展追加 TODO、笔记、注意事项和未完成事项,以便另一个代理可以无缝接手。如果 progress.md 文件已存在,请首先读取它,包括顶部的原始用户提示(你可能正在继续另一个代理的工作)。不要覆盖原始提示;保留它。在完成每个有意义的工作块(添加功能、发现错误、运行测试或做出决策)后更新 progress.md。在你的工作结束时,在 progress.md 中为下一个代理留下 TODO 和建议。
如果项目已有本地 playwright 依赖,优先使用它。
如果不确定 Playwright 是否可用,检查 npx:
command -v npx >/dev/null 2>&1
如果 npx 缺失,安装 Node/npm,然后全局安装 Playwright:
npm install -g @playwright/mcp@latest
除非明确要求,不要切换到 @playwright/test;坚持使用客户端脚本。
$WEB_GAME_CLIENT(安装默认路径:$CODEX_HOME/skills/develop-web-game/scripts/web_game_playwright_client.js)—— 基于 Playwright 的动作循环,具有虚拟时间步进、截图捕获和控制台错误缓冲功能。你必须通过 --actions-file、--actions-json 或 --click 传递一个动作序列。$WEB_GAME_ACTIONS(安装默认路径:$CODEX_HOME/skills/develop-web-game/references/action_payloads.json)—— 示例动作有效载荷(键盘 + 鼠标,每帧捕获)。使用这些来构建你的动作序列。每周安装量
566
代码仓库
GitHub 星标
15.1K
首次出现
2026年2月1日
安全审计
已安装于
codex500
opencode487
gemini-cli479
github-copilot459
kimi-cli436
amp433
Build games in small steps and validate every change. Treat each iteration as: implement → act → pause → observe → adjust.
export CODEX_HOME="${CODEX_HOME:-$HOME/.codex}"
export WEB_GAME_CLIENT="$CODEX_HOME/skills/develop-web-game/scripts/web_game_playwright_client.js"
export WEB_GAME_ACTIONS="$CODEX_HOME/skills/develop-web-game/references/action_payloads.json"
User-scoped skills install under $CODEX_HOME/skills (default: ~/.codex/skills).
window.render_game_to_text so the test loop can read state.window.advanceTime(ms). Strongly prefer a deterministic step hook so the Playwright script can advance frames reliably; without it, automated tests can be flaky.progress.md exists, read it first and confirm the original user prompt is recorded at the top (prefix with Original prompt:). Also note any TODOs and suggestions left by the previous agent. If missing, create it and write Original prompt: <prompt> at the top before appending updates.playwright is available (local dependency or global install). If unsure, check npx first.$WEB_GAME_CLIENT after each meaningful change; do not invent a new client unless required.$WEB_GAME_ACTIONS to avoid guessing keys.render_game_to_text reflects the same state shown on screen. If anything is off, fix and rerun. Examples of important interactions: move, jump, shoot/attack, interact/use, select/confirm/cancel in menus, pause/resume, restart, and any special abilities or puzzle actions defined by the request. Multi-step examples: shooting an enemy should reduce its health; when health reaches 0 it should disappear and update the score; collecting a key should unlock a door and allow level progression.Example command (actions required):
node "$WEB_GAME_CLIENT" --url http://localhost:5173 --actions-file "$WEB_GAME_ACTIONS" --click-selector "#start-btn" --iterations 3 --pause-ms 250
Example actions (inline JSON):
{
"steps": [
{ "buttons": ["left_mouse_button"], "frames": 2, "mouse_x": 120, "mouse_y": 80 },
{ "buttons": [], "frames": 6 },
{ "buttons": ["right"], "frames": 8 },
{ "buttons": ["space"], "frames": 4 }
]
}
Test any new features added for the request and any areas your logic changes could affect. Identify issues, fix them, and re-run the tests to confirm they’re resolved.
Examples of things to test:
render_game_to_text JSON output.Expose a window.render_game_to_text function that returns a concise JSON string representing the current game state. The text should include enough information to play the game without visuals.
Minimal pattern:
function renderGameToText() {
const payload = {
mode: state.mode,
player: { x: state.player.x, y: state.player.y, r: state.player.r },
entities: state.entities.map((e) => ({ x: e.x, y: e.y, r: e.r })),
score: state.score,
};
return JSON.stringify(payload);
}
window.render_game_to_text = renderGameToText;
Keep the payload succinct and biased toward on-screen/interactive elements. Prefer current, visible entities over full history. Include a clear coordinate system note (origin and axis directions), and encode all player-relevant state: player position/velocity, active obstacles/enemies, collectibles, timers/cooldowns, score, and any mode/state flags needed to make correct decisions. Avoid large histories; only include what's currently relevant and visible.
Provide a deterministic time-stepping hook so the Playwright client can advance the game in controlled increments. Expose window.advanceTime(ms) (or a thin wrapper that forwards to your game update loop) and have the game loop use it when present. The Playwright test script uses this hook to step frames deterministically during automated testing.
Minimal pattern:
window.advanceTime = (ms) => {
const steps = Math.max(1, Math.round(ms / (1000 / 60)));
for (let i = 0; i < steps; i++) update(1 / 60);
render();
};
f) to toggle fullscreen on/off.Esc to exit fullscreen.Create a progress.md file if it doesn't exist, and append TODOs, notes, gotchas, and loose ends as you go so another agent can pick up seamlessly. If a progress.md file already exists, read it first, including the original user prompt at the top (you may be continuing another agent's work). Do not overwrite the original prompt; preserve it. Update progress.md after each meaningful chunk of work (feature added, bug found, test run, or decision made). At the end of your work, leave TODOs and suggestions for the next agent in progress.md.
Prefer a local playwright dependency if the project already has it.
If unsure whether Playwright is available, check for npx:
command -v npx >/dev/null 2>&1
If npx is missing, install Node/npm and then install Playwright globally:
npm install -g @playwright/mcp@latest
Do not switch to @playwright/test unless explicitly asked; stick to the client script.
$WEB_GAME_CLIENT (installed default: $CODEX_HOME/skills/develop-web-game/scripts/web_game_playwright_client.js) — Playwright-based action loop with virtual-time stepping, screenshot capture, and console error buffering. You must pass an action burst via --actions-file, --actions-json, or --click.$WEB_GAME_ACTIONS (installed default: $CODEX_HOME/skills/develop-web-game/references/action_payloads.json) — example action payloads (keyboard + mouse, per-frame capture). Use these to build your burst.Weekly Installs
566
Repository
GitHub Stars
15.1K
First Seen
Feb 1, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
codex500
opencode487
gemini-cli479
github-copilot459
kimi-cli436
amp433
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
136,300 周安装