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.
npx skills add guyulong/cn-agent-skills --skill h5-game-perfgit clone --depth 1 https://github.com/guyulong/cn-agent-skillsWrote 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.
[](https://agentmods.dev/skills/guyulong/cn-agent-skills/h5-game-perf)<a href="https://agentmods.dev/skills/guyulong/cn-agent-skills/h5-game-perf"><img src="https://agentmods.dev/badge/skills/guyulong/cn-agent-skills/h5-game-perf/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.
<a href="https://agentmods.dev/skills/guyulong/cn-agent-skills/h5-game-perf"><img src="https://agentmods.dev/badge/skills/guyulong/cn-agent-skills/h5-game-perf.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00016 | $0.00851 |
| Opus 5 | $0.00008 | $0.00426 |
| Sonnet 5 | $0.00003 | $0.00170 |
| Haiku 4.5 | $0.00002 | $0.00085 |
Grade A, and why
h5-game-perf 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 11d 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.
How it starts
The opening of the file, as written. The whole thing — 134 lines — stays where its author put it; the contents beside it link to each section on GitHub.
H5游戏性能优化
使用场景
优化H5游戏的加载速度和运行性能。
优化清单
1. 资源加载优化
- 图片压缩(WebP格式优先)
- 图片懒加载
- 资源预加载关键路径
- 使用CDN分发
- 开启Gzip/Brotli压缩
- 合并小图标为雪碧图
2. Canvas渲染优化
- 减少绘制调用(batch rendering)
- 使用脏矩形渲染(只重绘变化区域)
- 离屏Canvas缓存静态内容
- 控制绘制分辨率
- 避免在渲染循环中创建对象
// 脏矩形渲染
class DirtyRectRenderer {
constructor(canvas) {
this.canvas = canvas;
this.ctx = canvas.getContext('2d');
this.dirtyRects = [];
}
markDirty(x, y, w, h) {
this.dirtyRects.push({ x, y, w, h });
}
render(drawFunc) {
if (this.dirtyRects.length === 0) return;
// 合并脏矩形
const bounds = this.mergeDirtyRects();
// 只重绘脏区域
this.ctx.save();
this.ctx.beginPath();
this.ctx.rect(bounds.x, bounds.y, bounds.w, bounds.h);
this.ctx.clip();
drawFunc();
this.ctx.restore();
this.dirtyRects = [];
}
}
3. 内存管理
- 使用对象池
- 及时释放不用的资源
- 避免内存泄漏(事件监听清理)
- 控制纹理内存
// 对象池
class ObjectPool {
constructor(createFn, resetFn, initialSize = 10) {
this.createFn = createFn;
this.resetFn = resetFn;
this.pool = [];
for (let i = 0; i < initialSize; i++) {
this.pool.push(createFn());
}
}
get() {
if (this.pool.length > 0) {
return this.pool.pop();
}
return this.createFn();
}
release(obj) {
this.resetFn(obj);
this.pool.push(obj);
}
}
4. 游戏逻辑优化
- 使用requestAnimationFrame
- 固定时间步长
- 空间分区碰撞检测
- 避免每帧GC
5. 移动端优化
- 控制Canvas分辨率
- 减少透明度使用
- 避免阴影和模糊效果
- 使用WebGL(如果需要)
性能监控
// FPS监控
class FPSMonitor {
constructor() {
this.fps = 0;
this.frames = 0;
this.lastTime = performance.now();
}
update() {
this.frames++;
const now = performance.now();
if (now - this.lastTime >= 1000) {
this.fps = this.frames;
this.frames = 0;
this.lastTime = now;
}
}
}
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.
- 11d ago First seen · 134 lines · 16 tokens per session scan A d60daa8169ca
h5-game-perf is a skill published in the GitHub repository guyulong/cn-agent-skills (3 stars, last pushed 3mo ago), licensed MIT. It adds 16 tokens to every session and 851 once invoked, about $0.0001 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.
Other skills, from other repositories
umg-widgets
Create and modify UMG Widget Blueprints (UI) — build the widget hierarchy, set properties, style fonts/brushes, author widget animations, bind events, capture previews, run PIE checks, and wire MVVM ViewModels. Use when the user asks to create a UI/HUD/menu, add or arrange widgets (Button, TextBlock, Image, panels)…
traps
The failures in a Lattice game that produce no error and a plausible-looking wrong result — a black screen, a tap that opens the wrong thing, art that floats above its own hill, a frame counter that lies, a game that gets slower at dusk, a save that silently stops being written. Use when something builds and runs but…
hud
Putting numbers, buttons, messages and panels on top of a game — a resource counter, a price, a build button, a toast, a dialog, floating +5s. Use when adding a HUD, an overlay, a score or resource display, a shop button, a notification, a modal; when a tap on the game is being swallowed by the interface; or when the…
input
Taps, drags, pinch-zoom, keyboard and camera control in an isometric game. Use for tap to place or select, drag to pan, pinch or wheel to zoom, a placement ghost that follows the pointer, key bindings, "nothing happens when I tap", a tap that hits the wrong thing or the building behind, taps that land uphill or…
starting
The wiring order for a Lattice game — canvas, surface, camera, palette, light, depth sorter, loop and input — and the shape a first build should take so it does not come out a diorama. Use when starting an isometric game, setting up a Lattice project, writing the boot or main.ts, adding a game loop to a canvas…
world
Terrain, elevation, roads, paths and walkers in an isometric world. Use when adding hills, a heightfield, a river, a coastline, a road or a route, when moving characters or crowds along a path, when things walk in the wrong place or hitch on diagonals, when the map should be endless, or when a tap picks the wrong tile…