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 Wade-DevCode/awesome-coding-skills-cn --skill cocos2dx-luagit clone --depth 1 https://github.com/Wade-DevCode/awesome-coding-skills-cnWrote 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/wade-devcode/awesome-coding-skills-cn/cocos2dx-lua)<a href="https://agentmods.dev/skills/wade-devcode/awesome-coding-skills-cn/cocos2dx-lua"><img src="https://agentmods.dev/badge/skills/wade-devcode/awesome-coding-skills-cn/cocos2dx-lua/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/wade-devcode/awesome-coding-skills-cn/cocos2dx-lua"><img src="https://agentmods.dev/badge/skills/wade-devcode/awesome-coding-skills-cn/cocos2dx-lua.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.00038 | $0.03191 |
| Opus 5.5 | $0.00015 | $0.01276 |
| Sonnet 5.5 | $0.00008 | $0.00638 |
| Haiku 4.5 | $0.00004 | $0.00319 |
Grade A, and why
cocos2dx-lua 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 3mo 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 — 197 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Cocos2d-x Lua 最佳实践
何时用
- 编写任何 Cocos2d-x Lua 场景、Layer、UI 组件脚本前。
- 发现内存持续增长、退出场景后内存未释放时。
- 触摸事件穿透、多层点击响应混乱,或事件监听器未被清理时。
- 动作(Action)执行异常、Scene 切换后动画仍在报错时。
- 调度器回调在节点销毁后仍被调用,导致访问空节点崩溃时。
核心规则
1. 节点生命周期:addChild/removeChild 必须配对,退出前清理一切
规则: 每个 addChild 都要有对应的清理路径(removeChild 或场景切换自动销毁);onEnter/onExit 是注册/注销外部资源(调度器、事件)的标准时机,不要在构造函数或任意时机注册后忘记注销。
为什么: Cocos2d-x 的 C++ 底层使用引用计数(retain/release),Lua 侧持有的 userdata 会阻止对象释放。AI 生成代码时最常犯的错误:在一个 Layer 里 addChild 了子节点,场景切换时只 removeFromParent 了 Layer,但子节点上挂的调度器回调和事件监听器没有清理,C++ 对象引用计数不归零,内存持续增长。新手则常在 init 里注册调度器,在 onExit 里忘记反注册,下次进场景又注册一次,定时器越堆越多。
怎么做:
- 在
onEnter里注册调度器和事件监听器,在onExit里注销。 - 场景/Layer 退出时调用
node:unscheduleAllCallbacks()和eventDispatcher:removeEventListenersForTarget(node)。 - 临时创建的节点用完即
removeFromParent(true)(true = cleanup,会停止其上的 Action 和调度器)。 - 养成习惯:每加一个子节点,立刻想好"它什么时候被移除"。
2. 触摸事件:EventListener 正确注册与移除,处理吞噬与层级冲突
规则: 触摸事件必须用 cc.EventListenerTouchOneByOne 或 cc.EventListenerTouchAllAtOnce 注册到 eventDispatcher,不用旧的 setTouchEnabled;setSwallowTouches(true) 只在确实需要阻止穿透时设置,并理解其对下层 Listener 的影响;节点移除前必须 removeEventListenersForTarget。
为什么: Cocos2d-x Lua 里触摸 bug 几乎全部源于两个问题:(1)新手混用新旧 API——layer:setTouchEnabled(true) 在 3.x 里已废弃,和 EventDispatcher 的优先级体系完全独立,导致点击没响应却不报错,排查极为困难;(2)AI 生成的 Listener 注册了但没有对应的注销,节点 removeChild 后 C++ 对象已析构,触摸事件仍然回调进来,访问已释放的 Lua userdata 直接崩溃。setSwallowTouches 设错方向时,弹窗后面的按钮照样可以被点击,产生逻辑混乱。
怎么做:
- 统一用
cc.EventListenerTouchOneByOne:create()+eventDispatcher:addEventListenerWithSceneGraphPriority(listener, node)。 - 弹窗、遮罩层上设
listener:setSwallowTouches(true)拦截穿透;普通 UI 组件默认不吞噬,让事件往下传。 onExit里:cc.Director:getInstance():getEventDispatcher():removeEventListenersForTarget(self)。- 多层 UI 共存时,用
addEventListenerWithFixedPriority显式指定优先级,避免隐式顺序导致的不确定性。
3. 调度器:用引擎 scheduler,销毁前一定 unschedule
规则: 所有定时逻辑通过 node:scheduleOnce、node:schedule、或 cc.Director:getInstance():getScheduler():scheduleScriptFunc 驱动;不自建基于 update 计数器的"假计时器";节点销毁前调用 node:unscheduleAllCallbacks()。
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.
- 3mo ago First seen · 197 lines · 38 tokens per session scan A 9134c3b9247c
cocos2dx-lua is a skill published in the GitHub repository Wade-DevCode/awesome-coding-skills-cn (7 stars, last pushed 5mo ago), licensed MIT. It adds 38 tokens to every session and 3,191 once invoked, about $0.0002 per session on Opus 5.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.
cocos2dx-lua compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| cocos2dx-luaWade-DevCode/awesome-coding-skills-cn | Skill | 7 | 5mo ago | MIT | A | 38 | Claude Code, Codex |
| bevy-ecs-rustfindscripter/everything-skills | Skill | 12 | today | none | A | 114 | Claude Code |
| executing-plansjnMetaCode/superpowers-zh | Skill | 8.6k | 15d ago | MIT | A | 46 | Claude Code |
| chinese-git-workflowjnMetaCode/superpowers-zh | Skill | 8.6k | 15d ago | MIT | A | 69 | Claude Code |
| chinese-code-reviewjnMetaCode/superpowers-zh | Skill | 8.6k | 15d ago | MIT | A | 62 | Claude Code |
| chinese-commit-conventionsjnMetaCode/superpowers-zh | Skill | 8.6k | 15d ago | MIT | A | 65 | Claude Code |
| chinese-documentationjnMetaCode/superpowers-zh | Skill | 8.6k | 15d ago | MIT | A | 62 | Claude Code |