snake-adventure

snake-adventure is a skill for Claude Code, Codex from sumo1/AI-GAME-COOL. It costs 47 tokens per session (1,112 once invoked), scanned A, original, Apache-2.0.

A recipe for making the classic Snake game, where the player steers a growing snake toward food and loses by hitting a wall or its own body. It defines keyboard controls, scoring, collision handling, and restart behavior.

In plain words
What is it for?
Use it to create and check a playable browser Snake game with arrow-key and WASD controls, continuous movement, a canvas, score display, visible game-over feedback, and a new-game button.
Why use it?
It helps prevent common implementation errors such as reversing into the snake, leaving drawing trails, spawning food on the snake, or showing the game as already over when it starts.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to create and check a playable browser Snake game with arrow-key and WASD controls, continuous movement, a canvas, score display, visible game-over feedback, and a new-game button.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sumo1/ai-game-cool/snake-adventure
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add sumo1/AI-GAME-COOL --skill snake-adventure
Clone the repo
git clone --depth 1 https://github.com/sumo1/AI-GAME-COOL

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for snake-adventure

README.md
[![agentmods](https://agentmods.dev/badge/skills/sumo1/ai-game-cool/snake-adventure/github.svg)](https://agentmods.dev/skills/sumo1/ai-game-cool/snake-adventure)
Your own site
<a href="https://agentmods.dev/skills/sumo1/ai-game-cool/snake-adventure"><img src="https://agentmods.dev/badge/skills/sumo1/ai-game-cool/snake-adventure/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for snake-adventure

Your own site · 80×15
<a href="https://agentmods.dev/skills/sumo1/ai-game-cool/snake-adventure"><img src="https://agentmods.dev/badge/skills/sumo1/ai-game-cool/snake-adventure.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 47 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,112 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00047 $0.01112
Opus 5 $0.00023 $0.00556
Sonnet 5 $0.00009 $0.00222
Haiku 4.5 $0.00005 $0.00111

Measured 12d ago against content hash f82984b6f27e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

snake-adventure scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

game-agent-backend/src/main/resources/skills/snake-adventure/SKILL.md · 55 lines

What it actually says

贪吃蛇

经典贪吃蛇:键盘控制方向,吃食物增长身体,撞墙或撞自身结束。本 SKILL 由任务 260521-playable-snake-evolution 蒸馏,每条规则都来自真实 LLM 生成偏差的修正。

何时使用

用户提到 贪吃蛇 / snake / 蛇 / 吃豆豆(带方向键控制) 等关键词。

生成步骤

  1. canvas 元素 400-600 px 见方,<canvas id="game"> 用 id 便于测试钩子
  2. 键盘事件绑到 document不要绑到 button / canvas(否则需要 focus 才能控制)
  3. 同时支持方向键 + WASD
    if (k === 'ArrowUp' || k === 'w' || k === 'W') ...
    
  4. dir + nextDir 解耦 实现反向键防呆:keydown 写 nextDir,下次 tick 判定再赋给 dir
  5. setInterval 持续驱动 tick(180-300ms),不要"按键时才移动"
  6. 每 tick 清画布ctx.clearRect(0, 0, w, h) 或填充背景色
  7. food 与蛇不重叠placeFood() 用 while 循环检测 snake.some(s=>s.x===fx&&s.y===fy),重叠则重新随机
  8. score 用专门 DOM 元素<span id="score">0</span>,每次吃食物 scoreEl.textContent = score
  9. 游戏结束态明确:撞墙/自撞触发 clearInterval(timer) + 显示 overlay + 鼓励而非惩罚的文案 + 提供"再来一局"重启入口
  10. 初始状态必须是"准备开始"而非"游戏结束":页面加载后 overlay 文案应是"准备好了吗?/ 开始游戏",按钮文案应是"开始游戏"——绝对不能初始就显示"游戏结束 / 再来一局"(那让用户和测试都误以为已经死了)。只有真撞墙后才切换为结束态。

评估重点

  • 键盘事件必须绑到 document(绑 button/canvas 会导致需要先 focus 才能控制)
  • 反向键被防呆(蛇向右走时按左键不能瞬间反向 → 否则秒死)
  • 蛇在 setInterval 里持续移动,不是只在 keydown 时移动
  • canvas 每 tick 清画布,无拖影
  • 食物不能生成在蛇身上
  • 吃食物分数真的涨(DOM 同步更新)
  • 游戏结束态可见(overlay / alert / 状态变化),不是无声死亡
  • 失败文案鼓励("再来一次"、"差一点点"),不要"你输了"这种打击
  • 整页布局必须能在视口内完整呈现(含 canvas + 分数 + 方向键 / 控制条),不出滚动条:固定像素 600×600 + 60px 方向键叠加常会超过移动端视口。具体技法(vh / vmin / aspect-ratio / flex 自适应)任选,关键是儿童 / iPad 触屏场景下方向键被裁掉就等于游戏不能玩。

常见问题

  • 按键无响应 → 检查 keydown 是否绑到 document;如果绑到 button/canvas 需要先 click 才能控制
  • 蛇不动 → 移动逻辑应在 setInterval 里持续 tick,不要只在 keydown 时移动
  • 瞬间死亡 → 反向键应忽略:用 dir + nextDir 解耦,tick 时检查 nextDir.x !== -dir.x 才赋值
  • 吃了食物分数没涨 → score 变量更新后必须 document.getElementById('score').textContent = score
  • canvas 拖影 → 每个 tick 必须 clearRect 整个画布,或 fillRect 整背景
  • 食物和蛇重叠 → placeFood 用 while 循环检测重叠 + 重新随机
  • 撞墙后画面卡死 → gameOver 必须 clearInterval(timer) + 显示结束 overlay 而不是只 return
Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 55 lines · 47 tokens per session scan A f82984b6f27e

Subscribe to this mod's changes

snake-adventure is a skill published in the GitHub repository sumo1/AI-GAME-COOL (5 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 47 tokens to every session and 1,112 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

gameobject-component-destroy

Destroy one or more Components from a target GameObject. Missing (null) components are skipped — they cannot be destroyed. Use 'gameobject-find' and 'gameobject-component-get' to identify the components first.

IvanMurzak/Unity-MCP · 49 tokens

unity-version-split

Split a C# file into Unity 6.5+ and pre-Unity 6.5 variants. Use when a file needs different implementations for different Unity versions due to API changes (e.g., EntityId vs int, GetEntityId vs GetInstanceID).

IvanMurzak/Unity-MCP · 59 tokens

godot-signals-groups

Build event-driven, decoupled Godot 4.7 gameplay with signals and node groups: declare and emit custom signals, connect with Callables (incl. bind/one-shot), and broadcast to many nodes via groups and callgroup. Use when wiring node communication in a Godot project, replacing tight references with signals…

gamedev-skills/awesome-gamedev-agent-skills · 95 tokens

motion

How an agent turns a character mesh into a usable animated FBX — and how to judge whether the result is shippable.

OpenDCAI/GameFactory-3A · 0 tokens

unity-addressables

Manage Addressables groups, entries, profiles and content builds (com.unity.addressables, reflection-based).

Besty0728/Unity-Skills · 25 tokens

threejs-exposure-color-grading

Build a measured exposure and grading path in Three.js. Use for a 64x36 encoded luminance meter, asynchronous readback, weighted log-average exposure, asymmetric adaptation, single tone-map ownership, and a generated 32-cube post-tone-map LUT.

scottstts/Threejs-Awesome-Graphics-Agent-Skills · 60 tokens