Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)33k · #8683

develop-web-game

Skill này làm gì

Skill này hướng dẫn AI của bạn xây dựng và kiểm tra một game viết bằng HTML và JavaScript. Nó dành cho lập trình viên muốn lặp lại việc phát triển game trình duyệt với các kiểm tra tự động ở mỗi bước.

Khi nào nên dùng

  • ✓Khi bạn đang xây dựng hoặc thay đổi một game trình duyệt viết bằng HTML và JavaScript.
  • ✓Khi bạn muốn các bài kiểm tra tự động gửi thao tác đầu vào, tạm dừng và kiểm tra trạng thái game.
  • ✓Khi bạn muốn xem lại lỗi console và ảnh chụp màn hình sau mỗi lần thay đổi.

Liên kết skill

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/creative-design/develop-web-game/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/creative-design/develop-web-game/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Hãy giúp tôi làm một game platformer đơn giản trên trình duyệt và kiểm tra từng thay đổi bằng Playwright.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill làm việc theo từng bước nhỏ: triển khai một tính năng, chạy script Playwright với các đợt thao tác và khoảng dừng, rồi kiểm tra ảnh chụp, trạng thái văn bản và lỗi console. Vòng này được lặp lại khi game lớn dần.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Develop Web Game

Build games in small steps and validate every change. Treat each iteration as: implement → act → pause → observe → adjust.

Skill paths (set once)

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).

Workflow

  1. Pick a goal. Define a single feature or behavior to implement.
  2. Implement small. Make the smallest change that moves the game forward.
  3. Ensure integration points. Provide a single canvas and window.render_game_to_text so the test loop can read state.
  4. Add window.advanceTime(ms). Strongly prefer a deterministic step hook so the Playwright script can advance frames reliably; without it, automated tests can be flaky.
  5. Initialize progress.md. If 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.
  6. Verify Playwright availability. Ensure playwright is available (local dependency or global install). If unsure, check npx first.
  7. Run the Playwright test script. You must run $WEB_GAME_CLIENT after each meaningful change; do not invent a new client unless required.
  8. Use the payload reference. Base actions on $WEB_GAME_ACTIONS to avoid guessing keys.
  9. Inspect state. Capture screenshots and text state after each burst.
  10. Inspect screenshots. Open the latest screenshot, verify expected visuals, fix any issues, and rerun the script. Repeat until correct.
  11. Verify controls and state (multi-step focus). Exhaustively exercise all important interactions. For each, think through the full multi-step sequence it implies (cause → intermediate states → outcome) and verify the entire chain works end-to-end. Confirm 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.
  12. Check errors. Review console errors and fix the first new issue before continuing.
  13. Reset between scenarios. Avoid cross-test state when validating distinct features.
  14. Iterate with small deltas. Change one variable at a time (frames, inputs, timing, positions), then repeat steps 7–13 until stable.

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 Checklist

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:

  • Primary movement/interaction inputs (e.g., move, jump, shoot, confirm/select).
  • Win/lose or success/fail transitions.
  • Score/health/resource changes.
  • Boundary conditions (collisions, walls, screen edges).
  • Menu/pause/start flow if present.
  • Any special actions tied to the request (powerups, combos, abilities, puzzles, timers).

Test Artifacts to Review

  • Latest screenshots from the Playwright run.
  • Latest render_game_to_text JSON output.
  • Console error logs (fix the first new error before continuing). You must actually open and visually inspect the latest screenshots after running the Playwright script, not just generate them. Ensure everything that should be visible on screen is actually visible. Go beyond the start screen and capture gameplay screenshots that cover all newly added features. Treat the screenshots as the
Câu hỏi thường gặp

Game cần gì để kiểm thử?

Hướng dẫn yêu cầu một canvas duy nhất và một hook render_game_to_text, cùng với bước advanceTime để các khung hình ổn định.

Có cần cài Playwright không?

Có. Hướng dẫn yêu cầu kiểm tra Playwright đã sẵn sàng trước khi chạy thử nghiệm.

Skill có giữ file theo dõi tiến độ không?

Có. Skill ghi lại prompt gốc và tiến độ vào một file theo dõi.

Chi tiết

Mô tả gốc của tác giả

Use when Codex is building or iterating on a web game (HTML/JS) and needs a reliable development + testing loop: implement small changes, run a Playwright-based test script with short input bursts and intentional pauses, inspect screenshots/text, and review console errors with render_game_to_text.

repo: davila7/claude-code-templates

Độ phổ biến

Sao GitHub
33k
Vị trí xếp hạng
#8683
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự