cocos-creator-bundle

cocos-creator-bundle is a skill for Claude Code, Codex from Wade-DevCode/awesome-coding-skills-cn. It costs 32 tokens per session (3,296 once invoked), scanned A, original, MIT.

A guide to splitting a Cocos Creator game into separately loaded resource bundles. A bundle is a packaged group of files, such as a scene, interface, sound, or shared resource.

In plain words
What is it for?
Use it when dividing resources by scene or feature, loading remote content, managing bundle versions and caches, sharing common assets, or unloading bundles correctly.
Why use it?
It helps keep the initial download and startup time smaller, avoid packaging shared files repeatedly, and release unused resources from memory after changing scenes.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/wade-devcode/awesome-coding-skills-cn/cocos-creator-bundle
Any agent
npx skills add Wade-DevCode/awesome-coding-skills-cn --skill cocos-creator-bundle
Clone the repo
git clone --depth 1 https://github.com/Wade-DevCode/awesome-coding-skills-cn

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 cocos-creator-bundle

README.md
[![agentmods](https://agentmods.dev/badge/skills/wade-devcode/awesome-coding-skills-cn/cocos-creator-bundle.svg)](https://agentmods.dev/skills/wade-devcode/awesome-coding-skills-cn/cocos-creator-bundle)
Your own site
<a href="https://agentmods.dev/skills/wade-devcode/awesome-coding-skills-cn/cocos-creator-bundle"><img src="https://agentmods.dev/badge/skills/wade-devcode/awesome-coding-skills-cn/cocos-creator-bundle.svg" alt="Measured on agentmods" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,296 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00032 $0.03296
Opus 5 $0.00016 $0.01648
Sonnet 5 $0.00006 $0.00659
Haiku 4.5 $0.00003 $0.00330

Measured 3d ago against content hash f66cf273ab2f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cocos-creator-bundle 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 3d 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.

skills/cocos-creator-bundle/SKILL.md · 262 lines

How it starts

The opening of the file, as written. The whole thing — 262 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Cocos Creator 分包与 AssetBundle

何时用

  • 项目首屏加载慢、初始包体过大,需要按场景/功能拆分资源加载时。
  • 使用远程资源服务器动态下发资源,需要管理 bundle 版本与缓存时。
  • 多个 bundle 之间存在共用贴图、字体、音频等公共资源,担心重复打包导致体积膨胀时。
  • 切换场景后内存异常偏高,怀疑已卸载的 bundle 资源仍驻留时。

核心规则

1. 合理分包:按场景/功能/共享拆分,主包瘦身首屏快

规则: 把非首屏所需的场景、UI、音频拆入独立 bundle;所有 bundle 共用的基础资源(公共 UI 图集、角色骨架、音效库)单独放一个 shared bundle 先行加载;主包只保留启动脚本和 Loading 界面资源。

为什么: AI 生成项目结构时最常见的做法是"把所有资源都放 resources 目录",结果主包体积随着项目增长无节制膨胀,冷启动时间在中低端安卓机上轻松超过 10 秒。具体误区:把战斗场景的 1024×1024 角色图集和大厅场景的 BGM 全部打进主包——用户可能只是点了一下广告入口,根本不会进战斗场景,却已经把战斗资源全下载了。resources 目录下的所有资源会强制进主包,这是另一个常踩的坑。

怎么做:

  • 在编辑器 Asset 面板右键目录 → 「创建 Bundle」,配置 Bundle Name 和优先级。
  • 首屏仅需的资源留在 resources 或主包;战斗、副本、活动等按功能各建一个 bundle。
  • 公共资源建 shared bundle,设置优先级最高,在游戏初始化阶段最先加载。
  • Build 面板检查 「Asset Bundle」标签,确认各 bundle 包含资源列表符合预期。

2. 加载与释放:loadBundle → bundle.load,用完正确释放防泄漏

规则: 通过 assetManager.loadBundle 获取 AssetBundle 对象,再用 bundle.load 加载具体资源;资源用完后调用 bundle.release(path, type)bundle.releaseAll() 释放;bundle 本身用 assetManager.removeBundle(bundle) 卸载,两步缺一不可。

为什么: 只调用 bundle.releaseAll() 而不调用 assetManager.removeBundle 是高频错误:资源引用计数归零了,但 assetManager 内部仍缓存着这个 bundle 的实例,下次 loadBundle 同名 bundle 时直接返回缓存对象而不重新下载——如果服务器上 bundle 已更新,客户端却拿到旧的缓存,就会出现内容错误但不报任何错的诡异 bug。反过来,只调用 removeBundle 而不先 releaseAll,bundle 内资源引用计数不归零,纹理内存永远不释放。

怎么做:

// 加载 bundle
assetManager.loadBundle("battle", (err, bundle) => {
    if (err) { console.error(err); return; }
    // 加载具体资源
    bundle.load("prefabs/Enemy", Prefab, (err, prefab) => {
        if (err) { console.error(err); return; }
        prefab.addRef();          // 手动管理引用计数
        this._enemyPrefab = prefab;
    });
});

// 离开战斗场景时释放
leaveBattle() {
    if (this._enemyPrefab) {
        this._enemyPrefab.decRef();
        this._enemyPrefab = null;
    }
    const bundle = assetManager.getBundle("battle");
    if (bundle) {
        bundle.releaseAll();                    // 先释放 bundle 内所有资源引用计数
        assetManager.removeBundle(bundle);      // 再移除 bundle 缓存
    }
}

Read the full file on GitHub · 262 lines

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. 3d ago First seen · 262 lines · 32 tokens per session scan A f66cf273ab2f

Subscribe to this mod's changes

cocos-creator-bundle is a skill published in the GitHub repository Wade-DevCode/awesome-coding-skills-cn (6 stars, last pushed 2mo ago), licensed MIT. It adds 32 tokens to every session and 3,296 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

chinese-documentation

中文文档排版参考——中英文空格、全半角标点、术语保留、链接格式、中文文案排版指北约定。仅在用户显式 /chinese-documentation 时调用,不要根据上下文自动触发。.

jnMetaCode/superpowers-zh · 62 tokens

chinese-git-workflow

国内 Git 平台配置参考——Gitee、Coding.net、极狐 GitLab、CNB 的 SSH/HTTPS/凭据/CI 接入差异与镜像同步配置。仅在用户显式 /chinese-git-workflow 时调用,不要根据上下文自动触发。.

jnMetaCode/superpowers-zh · 69 tokens

brainstorming

在任何创造性工作之前必须使用此技能——创建功能、构建组件、添加功能或修改行为。在实现之前先探索用户意图、需求和设计。.

jnMetaCode/superpowers-zh · 40 tokens

chinese-code-review

中文 review 沟通参考——话术模板、分级标注(必须修复/建议修改/仅供参考)、国内团队常见反模式应对。仅在用户显式 /chinese-code-review 时调用,不要根据上下文自动触发。.

jnMetaCode/superpowers-zh · 62 tokens

chinese-commit-conventions

中文 commit 与 changelog 配置参考——Conventional Commits 中文适配、commitlint/husky/commitizen 中文模板、conventional-changelog 中文配置。仅在用户显式 /chinese-commit-conventions 时调用,不要根据上下文自动触发。.

jnMetaCode/superpowers-zh · 65 tokens

mcp-builder

MCP 服务器构建方法论 — 系统化构建生产级 MCP 工具,让 AI 助手连接外部能力.

jnMetaCode/superpowers-zh · 32 tokens