com um clique
cocos24-ui
根据 UI 截图生成 Cocos Creator 2.4.x 的 UI 控制类和 Model 类代码
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Menu
根据 UI 截图生成 Cocos Creator 2.4.x 的 UI 控制类和 Model 类代码
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Baseado na classificação ocupacional SOC
Iterate plans or implementations through fresh reviewer subagents until convergence. Use when the user explicitly asks for a "fresh reviewer loop", "plan iteration loop", "review and critique until clean", "spin up a reviewer to review my changes", or any phrasing where the goal is delegated adversarial review-then-fix cycles either on a plan before code or on a working implementation after code. Each round uses a new subagent so it has no prior-round context or groupthink.
通过企查查 OpenAPI 查询中国企业的工商、股东、司法、经营、知识产权、招投标、舆情等数据。当用户说"查 XX 公司"、"看 XX 的工商/股东/有没有官司/有没有被执行/有没有商标专利/有没有经营异常"、"XX 是不是空壳"、"XX 法人是谁"、"XX 注册资本"、"查企查查"、"查企业"等任何企业信息查询需求时,使用此技能。已注册 45 个商业接口(用户需自行在企查查后台逐个申请开通)。零依赖纯 Python,跨平台 Mac/Windows/Linux。
Use this skill when the user is working with LyteNyte Grid (@1771technologies/lytenyte-pro or @1771technologies/lytenyte-core), a headless React data grid. Activate for tasks like: installing or licensing the grid, configuring columns or rows, building cell renderers or editors, adding filters or sort controls, grouping or aggregating rows, pivoting, exporting to CSV/Excel/Parquet/Arrow, row selection, cell range selection, theming or styling, TypeScript GridSpec patterns, server-side or tree data, and any PRO component (SmartSelect, PillManager, Menu, Dialog, TreeView, RowGroupCell). Also activate when the user describes grid problems without naming the package — e.g. "my rows won't group", "cells aren't editable", "add a loading overlay", "pin this column", "the filter isn't working", "how do I export this table", "select a range of cells", "copy cells to clipboard".
Design websites and applications that AI agents can consume, navigate, and interact with. Use when building any site, app, or product that agents will use as an end-user — not just crawl or index. Covers semantic structure, accessibility-as-agent-interface, machine-readable data, API-first patterns, and the emerging protocols (llms.txt, MCP, NLWeb, A2UI) that make sites agent-ready. Triggers on: agent-friendly, agent-readable, agent-accessible, AX, agent experience, agentic web, dual-interface, machine-readable, llms.txt, MCP integration, NLWeb, accessibility tree, ARIA for agents, structured data, JSON-LD, Schema.org, API-first design, build for agents, agent-ready.
Design system for AI agents that build UI. Automatically routes to the right quality checks based on the task. Triggers on ANY visual, frontend, UI, design, component, page, layout, or styling work. Includes: anti-pattern detection, state completeness checks, accessibility verification, typography/color/spacing guidance, and creative direction when needed. Install this one skill to get the full system — it orchestrates everything else.
Core pack — always active for visual work. Quality gate for UI, components, pages, layouts, or frontend work. Triggers on any visual/design task automatically. Use before presenting work, during builds, and for design QA.
| name | cocos24-ui |
| description | 根据 UI 截图生成 Cocos Creator 2.4.x 的 UI 控制类和 Model 类代码 |
cocos/
├── SKILL.md # 技能说明文档
├── LoadAsset.ts # [可复用] 资源引用管理器组件
├── LoadSprite.ts # [可复用] 动态图片加载组件
├── ModelValue.ts # [可复用] 可监听数值类型
├── UIManager.ts # [可复用] UI 弹窗管理器
├── UIState.ts # [可复用] UI 状态管理
├── UIExample.ts # [示例] UI 控制类
└── UIModelExample.ts # [示例] UI Model 类
说明:
[可复用] - 最佳实践代码,可直接复制到项目中使用[示例] - 参考规范,新建 UI 时按此结构编写用户提供 UI 截图,生成对应的 TypeScript 代码(UI 控制类 + Model 类)。
执行流程:
生成 UI 代码前,检查以下组件是否存在于项目中,不存在则复制:
| 文件 | 说明 |
|---|---|
LoadAsset.ts | 资源引用管理器,统一管理动态加载资源的引用计数,防止内存泄漏 |
LoadSprite.ts | 动态图片加载组件,配合 LoadAsset 使用 |
ModelValue.ts | 可监听数值类型,解决网络延迟下的即时反馈与数据一致性问题 |
UIManager.ts | UI 弹窗管理器,单例模式管理弹窗生命周期 |
UIState.ts | UI 状态管理,配合 UIManager 使用 |
每个 UI 需要配套一个 Model 类,定义该 UI 所需的所有数据。UI 控制类通过 setData(model) 接收数据。
使用 TypeScript class 定义数据模型,包含 UI 需要展示的所有字段:
/** UI 数据模型示例 */
export class UIModel {
/** 唯一标识 */
id: number;
/** 标题文本 */
title: string = '';
/** 是否解锁 */
isUnlock: boolean = false;
/** 可监听的数值类型 */
value: ModelValue;
/** 最大值 */
maxValue: number = 100;
/** 嵌套子模型 */
items: SubModel[] = [];
}
要点:
Model 结尾ModelValue 类型示例: UIModelExample.ts
创建新的 UI 控制类时,遵循以下结构:
使用 @property 装饰器声明所有需要在编辑器中绑定的组件引用:
@property(cc.Label)
label_name: cc.Label = null;
@property(cc.Node)
node_name: cc.Node = null;
@property(I18nLabel) // 自定义组件
custom_component: CustomComponent = null;
统一使用 setData(data) 作为 UI 初始化入口:
data: DataModel = null;
setData(data: DataModel) {
this.data = data;
this.initListen(); // 初始化事件监听
this.updateUI(); // 更新 UI 显示
}
在节点上绑定 click 事件,通过 currentTarget.name 分发处理:
click(target: cc.Event.EventTouch) {
switch (target.currentTarget.name) {
case 'btn_name_1':
// 处理按钮1点击
break;
case 'btn_name_2':
// 处理按钮2点击
break;
default:
break;
}
}
配对使用 initListen() 和 onDestroy() 管理事件订阅,防止内存泄漏:
isListening: boolean = false;
initListen() {
if (this.isListening) return;
this.isListening = true;
this.data.property.on('valueChanged', this.onValueChanged, this);
}
onDestroy() {
if (!this.isListening) return;
this.isListening = false;
this.data.property.off('valueChanged', this.onValueChanged, this);
}
示例: UIExample.ts