cocos-creator-ui-list

cocos-creator-ui-list is a skill for Claude Code, Codex from Wade-DevCode/awesome-coding-skills-cn. It costs 27 tokens per session (4,110 once invoked), scanned A, original, MIT.

A Cocos Creator method for displaying long lists efficiently in games. Cocos Creator is a game-development tool, and a virtual list creates only the rows currently visible instead of every row.

In plain words
What is it for?
Use it for leaderboards, friend lists, inventories, chat histories, and other lists with many or frequently changing entries.
Why use it?
Creating hundreds of item nodes at once can cause slow loading, scrolling, and repeated layout work.

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-ui-list
Any agent
npx skills add Wade-DevCode/awesome-coding-skills-cn --skill cocos-creator-ui-list
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-ui-list

README.md
[![agentmods](https://agentmods.dev/badge/skills/wade-devcode/awesome-coding-skills-cn/cocos-creator-ui-list.svg)](https://agentmods.dev/skills/wade-devcode/awesome-coding-skills-cn/cocos-creator-ui-list)
Your own site
<a href="https://agentmods.dev/skills/wade-devcode/awesome-coding-skills-cn/cocos-creator-ui-list"><img src="https://agentmods.dev/badge/skills/wade-devcode/awesome-coding-skills-cn/cocos-creator-ui-list.svg" alt="Measured on agentmods" height="20"></a>
Per session 27 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,110 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.1 $0.00027 $0.04110
Opus 5 $0.00014 $0.02055
Sonnet 5 $0.00005 $0.00822
Haiku 4.5 $0.00003 $0.00411

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

Security

Grade A, and why

cocos-creator-ui-list 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 5d 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-ui-list/SKILL.md · 251 lines

How it starts

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

Cocos Creator 长列表优化

何时用

  • 排行榜、好友列表、背包物品、聊天记录等条目数量超过 50 条时。
  • ScrollView 滑动时帧率下降,Profiler 显示大量 LayoutSprite 更新耗时时。
  • 启动时一次性 instantiate 了几百个 item 节点导致进入场景卡顿时。
  • 列表数据频繁刷新(如实时排行榜推送)但整体 CPU 占用居高不下时。
  • 图片异步加载导致列表滚动时出现闪烁或短暂空白占位时。

核心规则

1. 虚拟列表:只实例化可视区 + 缓冲节点,滚动时复用

规则: 不论列表数据有多少条,同时存在于场景节点树中的 item 节点数量 = 可视区可容纳数量 + 固定缓冲量(通常 4~6 个);滚动时将移出可视区的节点重新定位到新进入可视区的位置并更新数据,不增减节点数量。

为什么: 这是长列表性能的根本问题。AI 生成列表代码时的惯用写法是循环 cc.instantiate(itemPrefab)addChild 全部数据——500 条排行榜就创建 500 个节点,每个节点含 Sprite、Label、Button,光是节点树渲染遍历就够卡的。实测在中端安卓机上,一次性创建 200 个含图片的列表节点耗时超过 1 秒,直接导致进入场景的白屏卡顿。更致命的是:ScrollView 的 content 节点拖 Layout 组件后,每次 addChild 都会触发整个 Layout 的重排,200 次 addChild = 200 次全量重排,复杂度是 O(n²)。

怎么做:

  • 计算可视区高度 / 单个 item 高度,得到可见数量 visibleCount,加缓冲 visibleCount + 6 作为实际节点池大小。
  • onLoad 里只创建这么多节点放入节点池,content 节点不挂 Layout 组件(手动控制 y 坐标)。
  • content 节点高度设为 总条目数 × itemHeight,让 ScrollView 滚动条正确反映总量。
  • 监听 ScrollView 的 SCROLL_EV 或在 update 里用节流检测滚动偏移,计算当前第一个可见索引 firstIndex,遍历节点池把每个节点的 y = -(firstIndex + i) * itemHeight,并调用 refreshItem(node, data[firstIndex + i]) 更新数据。

2. 节点复用池:对象池管理 item 节点,避免滚动时频繁创建销毁

规则: item 节点用 NodePool(或简单数组)管理复用,不在滚动回调里 instantiate/destroy;归还节点时在 unuse 钩子里重置所有可视状态(图片、文字、选中态),避免残留数据。

为什么: 即使实现了虚拟列表,如果每次 item 滑出可视区就 destroy、滑入就 instantiate,性能依然很差。instantiate 一个含多个子节点的 prefab 在移动端耗时 5~20 ms,60fps 的帧预算只有 16ms,几个 item 同时进入视野就直接掉帧。更隐蔽的问题:归还节点时不重置状态,下次从池里取出的节点仍然显示上一个位置的数据(旧头像、旧分数),等异步加载完成后才刷新,用户会看到数据"闪变"。

怎么做:

  • 定义 ItemController 组件,实现 unuse() 方法清空头像 Sprite(this.avatar.spriteFrame = null)、重置文字、隐藏选中态。
  • 对象池声明:private _itemPool: NodePool = new NodePool('ItemController');
  • 取节点:const node = this._itemPool.size() > 0 ? this._itemPool.get()! : instantiate(this.itemPrefab);
  • 还节点:this._itemPool.put(node);(内部自动调用 ItemController.unuse())。
  • onDestroy 里:this._itemPool.clear();,防止场景卸载后池内节点仍挂载于内存。

3. 数据视图分离:滚动只更新可见 item 的数据绑定,不重建节点

规则: 列表的「数据模型」和「节点视图」严格分离;滚动时只调用 itemNode.getComponent(ItemController).refresh(data) 更新绑定数据,绝不销毁重建节点,也不对不可见节点做任何数据操作。

Read the full file on GitHub · 251 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. 5d ago First seen · 251 lines · 27 tokens per session scan A 405faaba13a8

Subscribe to this mod's changes

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

Related

Other skills, from other repositories

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-commit-conventions

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

jnMetaCode/superpowers-zh · 65 tokens

chinese-documentation

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

jnMetaCode/superpowers-zh · 62 tokens

chinese-code-review

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

jnMetaCode/superpowers-zh · 62 tokens

mcp-builder

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

jnMetaCode/superpowers-zh · 32 tokens