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 agentmods add skills/wade-devcode/awesome-coding-skills-cn/cocos-creator-ui-listnpx skills add Wade-DevCode/awesome-coding-skills-cn --skill cocos-creator-ui-listgit 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/cocos-creator-ui-list)<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>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.00027 | $0.04110 |
| Opus 5 | $0.00014 | $0.02055 |
| Sonnet 5 | $0.00005 | $0.00822 |
| Haiku 4.5 | $0.00003 | $0.00411 |
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.
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 显示大量
Layout或Sprite更新耗时时。 - 启动时一次性
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) 更新绑定数据,绝不销毁重建节点,也不对不可见节点做任何数据操作。
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.
- 5d ago First seen · 251 lines · 27 tokens per session scan A 405faaba13a8
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.
Other skills, from other repositories
chinese-git-workflow
国内 Git 平台配置参考——Gitee、Coding.net、极狐 GitLab、CNB 的 SSH/HTTPS/凭据/CI 接入差异与镜像同步配置。仅在用户显式 /chinese-git-workflow 时调用,不要根据上下文自动触发。.
brainstorming
在任何创造性工作之前必须使用此技能——创建功能、构建组件、添加功能或修改行为。在实现之前先探索用户意图、需求和设计。.
chinese-commit-conventions
中文 commit 与 changelog 配置参考——Conventional Commits 中文适配、commitlint/husky/commitizen 中文模板、conventional-changelog 中文配置。仅在用户显式 /chinese-commit-conventions 时调用,不要根据上下文自动触发。.
chinese-documentation
中文文档排版参考——中英文空格、全半角标点、术语保留、链接格式、中文文案排版指北约定。仅在用户显式 /chinese-documentation 时调用,不要根据上下文自动触发。.
chinese-code-review
中文 review 沟通参考——话术模板、分级标注(必须修复/建议修改/仅供参考)、国内团队常见反模式应对。仅在用户显式 /chinese-code-review 时调用,不要根据上下文自动触发。.
mcp-builder
MCP 服务器构建方法论 — 系统化构建生产级 MCP 工具,让 AI 助手连接外部能力.