Token导航 LogoToken导航

Agent Skill · 前端设计

theone-cocos-standards(theone cocos 标准)

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

theone-cocos-standards 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为只读;许可证为 MIT,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 1,804。

总安装 3,787周安装 161GitHub Stars 71下载 1,327核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:theone-cocos-standards(theone cocos 标准)
来源仓库:https://github.com/the1studio/theone-training-skills
仓库路径:skills/theone-cocos-standards
安装命令:
npx skills add https://github.com/the1studio/theone-training-skills --skill theone-cocos-standards
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/the1studio/theone-training-skills --skill theone-cocos-standards

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

theone-cocos-standards 定义 Cocos Creator 游戏开发的 TypeScript 与架构规范。涵盖组件生命周期、资源管理与性能优化准则。适用于可玩广告与轻量级游戏项目的代码质量控制。集成严格类型检查与现代构建流程要求。建议配合 CI/CD 流水线强制执行代码审查规则。

来源仓库内路径:skills/theone-cocos-standards

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/the1studio/theone-training-skills --skill theo…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它标注为只读,先用只读任务试一次,确认行为符合预期再扩大使用范围。

常见问题

6 条

theone-cocos-standards 怎么安装?

在终端执行 npx skills add https://github.com/the1studio/theone-training-skills --skill theone-cocos-s…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

theone-cocos-standards 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

theone-cocos-standards 需要什么权限?

权限级别是只读。该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

theone-cocos-standards 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

theone-cocos-standards 用的人多吗?

公开数据是累计安装 3,787 次,近一周安装 161 次,下载 1,327 次,GitHub 71 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

theone-cocos-standards 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
theone-cocos-standards

theone cocos 标准 · 本页

3,78771只读MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

TheOne Studio Cocos Creator Development Standards

⚠️ Cocos Creator 3.x (TypeScript 4.1+): All patterns and examples are compatible with Cocos Creator 3.x playable ads development.

Skill Purpose

This skill enforces TheOne Studio's comprehensive Cocos Creator development standards with CODE QUALITY FIRST:

Priority 1: Code Quality & Hygiene (MOST IMPORTANT)

  • TypeScript strict mode, ESLint configuration, access modifiers (public/private/protected)
  • Throw exceptions (never silent errors)
  • console.log for development, remove in production builds
  • readonly for immutable fields, const for constants
  • No inline comments (use descriptive names)
  • Proper error handling and type safety

Priority 2: Modern TypeScript Patterns

  • Array methods (map/filter/reduce) over loops
  • Arrow functions, destructuring, spread operators
  • Optional chaining, nullish coalescing
  • Type guards, utility types (Partial, Required, Readonly)
  • Modern TypeScript features

Priority 3: Cocos Creator Architecture

  • Component-based Entity-Component (EC) system
  • Lifecycle methods: onLoad→start→onEnable→update→onDisable→onDestroy
  • EventDispatcher pattern for custom events
  • Node event system (EventTouch, keyboard events)
  • Resource management and pooling for playables

Priority 4: Playable Ads Performance

  • DrawCall batching (<10 DrawCalls target)
  • Sprite atlas configuration (auto-atlas enabled)
  • GPU skinning for skeletal animations
  • Zero allocations in update() loop
  • Bundle size <5MB (texture compression, code minification)

When This Skill Triggers

  • Writing or refactoring Cocos Creator TypeScript code
  • Implementing playable ads features
  • Working with component lifecycle and events
  • Optimizing performance for playable ads
  • Reviewing code changes or pull requests
  • Setting up playable project architecture
  • Reducing bundle size or DrawCall counts

Quick Reference Guide

What Do You Need Help With?

PriorityTaskReference
🔴 PRIORITY 1: Code Quality (Check FIRST)
1TypeScript strict mode, ESLint, access modifiersQuality & Hygiene ⭐
1Throw exceptions, proper error handlingQuality & Hygiene ⭐
1console.log (development only), remove in productionQuality & Hygiene ⭐
1readonly/const, no inline comments, descriptive namesQuality & Hygiene ⭐
🟡 PRIORITY 2: Modern TypeScript Patterns
2Array methods, arrow functions, destructuringModern TypeScript
2Optional chaining, nullish coalescingModern TypeScript
2Type guards, utility typesModern TypeScript
🟢 PRIORITY 3: Cocos Architecture
3Component system, @property decoratorComponent System
3Lifecycle methods (onLoad→start→update→onDestroy)Component System
3EventDispatcher, Node events, cleanupEvent Patterns
3Resource loading, pooling, memory managementPlayable Optimization
🔵 PRIORITY 4: Performance & Review
4DrawCall batching, sprite atlas, GPU skinningPlayable Optimization
4Update loop optimization, zero allocationsPerformance
4Bundle size reduction (<5MB target)Size Optimization
4Architecture review (components, lifecycle, events)Architecture Review
4TypeScript quality reviewQuality Review
4Performance review (DrawCalls, allocations)Performance Review

🔴 CRITICAL: Code Quality Rules (CHECK FIRST!)

⚠️ MANDATORY QUALITY STANDARDS

ALWAYS enforce these BEFORE writing any code:

  1. Enable TypeScript strict mode - "strict": true in tsconfig.json
  2. Use ESLint configuration - @typescript-eslint rules enabled
  3. Use access modifiers - public/private/protected on all members
  4. Throw exceptions for errors - NEVER silent failures or undefined returns
  5. console.log for development only - Remove all console statements in production builds
  6. Use readonly for immutable fields - Mark fields that aren't reassigned
  7. Use const for constants - Constants should be const, not let
  8. No inline comments - Use descriptive names; code should be self-explanatory
  9. Proper null/undefined handling - Use optional chaining and nullish coalescing
  10. Type safety - Avoid any type, use proper types and interfaces

Example: Enforce Quality First

// ✅ EXCELLENT: All quality rules enforced
import { _decorator, Component, Node, EventTouch } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('PlayerController')
export class PlayerController extends Component {
    // 3. Access modifier, 6. readonly for immutable
    @property(Node)
    private readonly targetNode: Node | null = null;

    // 7. const for constants
    private static readonly MAX_HEALTH: number = 100;
    private currentHealth: number = 100;

    // Lifecycle: onLoad → start → onEnable
    protected onLoad(): void {
        // 4. Throw exception for errors
        if (!this.targetNode) {
            throw new Error('PlayerController: targetNode is not assigned');
        }

        // 9. Proper event listener setup
        this.node.on(Node.EventType.TOUCH_START, this.onTouchStart, this);
    }

    protected onDestroy(): void {
        // 9. Always cleanup event listeners
        this.node.off(Node.EventType.TOUCH_START, this.onTouchStart, this);
    }

    private onTouchStart(event: EventTouch): void {
        // 5. console.log only for development (remove in production)
        if (CC_DEBUG) {
            console.log('Touch detected');
        }

        this.takeDamage(10);
    }

    // 8. Descriptive method names (no inline comments needed)
    private takeDamage(amount: number): void {
        this.currentHealth -= amount;

        if (this.currentHealth <= 0) {
            this.handlePlayerDeath();
        }
    }

    private handlePlayerDeath(): void {
        // Death logic
    }
}

⚠️ Cocos Creator Architecture Rules (AFTER Quality)

Component System Fundamentals

Entity-Component (EC) System:

  • Components extend Component class
  • Use @ccclass and @property decorators
  • Lifecycle: onLoad → start → onEnable → update → lateUpdate → onDisable → onDestroy

Execution Order:

  1. onLoad() - Component initialization, one-time setup
  2. start() - After all components loaded, can reference other components
  3. onEnable() - When component/node enabled (can be called multiple times)
  4. update(dt) - Every frame (use sparingly for playables)
  5. lateUpdate(dt) - After all update() calls
  6. onDisable() - When component/node disabled
  7. onDestroy() - Cleanup, remove listeners, release resources

Universal Rules:

  • ✅ Initialize in onLoad(), reference other components in start()
  • ✅ Register events in onEnable(), unregister in onDisable()
  • ✅ Always cleanup listeners in onDestroy()
  • ✅ Avoid heavy logic in update() (performance critical for playables)
  • ✅ Use readonly for @property fields that shouldn't be reassigned
  • ✅ Throw exceptions for missing required references

Brief Examples

🔴 Code Quality First

// ✅ EXCELLENT: Quality rules enforced
import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('GameManager')
export class GameManager extends Component {
    @property(Node)
    private readonly playerNode: Node | null = null;

    private static readonly MAX_SCORE: number = 1000;
    private currentScore: number = 0;

    protected onLoad(): void {
        // Throw exception for missing required references
        if (!this.playerNode) {
            throw new Error('GameManager: playerNode is required');
        }

        if (CC_DEBUG) {
            console.log('GameManager initialized'); // Development only
        }
    }

    public addScore(points: number): void {
        if (points <= 0) {
            throw new Error('GameManager.addScore: points must be positive');
        }

        this.currentScore = Math.min(
            this.currentScore + points,
            GameManager.MAX_SCORE
        );
    }
}

🟡 Modern TypeScript Patterns

// ✅ GOOD: Array methods instead of loops
const activeEnemies = allEnemies.filter(e => e.isActive);
const enemyPositions = activeEnemies.map(e => e.node.position);

// ✅ GOOD: Optional chaining and nullish coalescing
const playerName = player?.name ?? 'Unknown';

// ✅ GOOD: Destructuring
const { x, y } = this.node.position;

// ✅ GOOD: Arrow functions
this.enemies.forEach(enemy => enemy.takeDamage(10));

// ✅ GOOD: Type guards
function isPlayer(node: Node): node is PlayerNode {
    return node.getComponent(PlayerController) !== null;
}

🟢 Cocos Creator Component Pattern

import { _decorator, Component, Node, EventTouch, Vec3 } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('TouchHandler')
export class TouchHandler extends Component {
    @property(Node)
    private readonly targetNode: Node | null = null;

    private readonly tempVec3: Vec3 = new Vec3(); // Reusable vector

    // 1. onLoad: Initialize component
    protected onLoad(): void {
        if (!this.targetNode) {
            throw new Error('TouchHandler: targetNode is required');
        }
    }

    // 2. start: Reference other components (if needed)
    protected start(): void {
        // Can safely access other components here
    }

    // 3. onEnable: Register event listeners
    protected onEnable(): void {
        this.node.on(Node.EventType.TOUCH_START, this.onTouchStart, this);
        this.node.on(Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
    }

    // 4. onDisable: Unregister event listeners
    protected onDisable(): void {
        this.node.off(Node.EventType.TOUCH_START, this.onTouchStart, this);
        this.node.off(Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
    }

    // 5. onDestroy: Final cleanup
    protected onDestroy(): void {
        // Release any additional resources
    }

    private onTouchStart(event: EventTouch): void {
        // Handle touch
    }

    private onTouchMove(event: EventTouch): void {
        // Reuse vector to avoid allocations
        this.targetNode!.getPosition(this.tempVec3);
        this.tempVec3.y += 10;
        this.targetNode!.setPosition(this.tempVec3);
    }
}

🟢 Event Dispatcher Pattern

import { _decorator, Component, EventTarget } from 'cc';
const { ccclass } = _decorator;

// Custom event types
export enum GameEvent {
    SCORE_CHANGED = 'score_changed',
    LEVEL_COMPLETE = 'level_complete',
    PLAYER_DIED = 'player_died',
}

export interface ScoreChangedEvent {
    oldScore: number;
    newScore: number;
}

@ccclass('EventManager')
export class EventManager extends Component {
    private static instance: EventManager | null = null;
    private readonly eventTarget: EventTarget = new EventTarget();

    protected onLoad(): void {
        if (EventManager.instance) {
            throw new Error('EventManager: instance already exists');
        }
        EventManager.instance = this;
    }

    public static emit(event: GameEvent, data?: any): void {
        if (!EventManager.instance) {
            throw new Error('EventManager: instance not initialized');
        }
        EventManager.instance.eventTarget.emit(event, data);
    }

    public static on(event: GameEvent, callback: Function, target?: any): void {
        if (!EventManager.instance) {
            throw new Error('EventManager: instance not initialized');
        }
        EventManager.instance.eventTarget.on(event, callback, target);
    }

    public static off(event: GameEvent, callback: Function, target?: any): void {
        if (!EventManager.instance) {
            throw new Error('EventManager: instance not initialized');
        }
        EventManager.instance.eventTarget.off(event, callback, target);
    }
}

// Usage in component
@ccclass('ScoreDisplay')
export class ScoreDisplay extends Component {
    protected onEnable(): void {
        EventManager.on(GameEvent.SCORE_CHANGED, this.onScoreChanged, this);
    }

    protected onDisable(): void {
        EventManager.off(GameEvent.SCORE_CHANGED, this.onScoreChanged, this);
    }

    private onScoreChanged(data: ScoreChangedEvent): void {
        console.log(`Score: ${data.oldScore} → ${data.newScore}`);
    }
}

🔵 Playable Performance Optimization

import { _decorator, Component, Node, Sprite, SpriteAtlas } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('OptimizedSpriteManager')
export class OptimizedSpriteManager extends Component {
    // Use sprite atlas for DrawCall batching
    @property(SpriteAtlas)
    private readonly characterAtlas: SpriteAtlas | null = null;

    // Preallocate arrays to avoid allocations in update()
    private readonly tempNodes: Node[] = [];
    private frameCount: number = 0;

    protected onLoad(): void {
        if (!this.characterAtlas) {
            throw new Error('OptimizedSpriteManager: characterAtlas is required');
        }

        // Prewarm sprite frames from atlas
        this.prewarmSpriteFrames();
    }

    private prewarmSpriteFrames(): void {
        // Load all sprites from atlas (batched in single DrawCall)
        const spriteFrame = this.characterAtlas!.getSpriteFrame('character_idle');
        if (!spriteFrame) {
            throw new Error('Sprite frame not found in atlas');
        }
    }

    // Optimize update: avoid allocations, use object pooling
    protected update(dt: number): void {
        // Run expensive operations every N frames instead of every frame
        this.frameCount++;
        if (this.frameCount % 10 === 0) {
            this.updateExpensiveOperation();
        }
    }

    private updateExpensiveOperation(): void {
        // Reuse array instead of creating new one
        this.tempNodes.length = 0;

        // Batch operations to reduce DrawCalls
    }
}

Code Review Checklist

Quick Validation (before committing)

🔴 Code Quality (CHECK FIRST):

  • TypeScript strict mode enabled in tsconfig.json
  • ESLint rules passing (no errors)
  • All access modifiers correct (public/private/protected)
  • Exceptions thrown for errors (no silent failures)
  • console.log removed or wrapped in CC_DEBUG
  • readonly used for non-reassigned fields
  • const used for constants
  • No inline comments (self-explanatory code)
  • Proper null/undefined handling
  • No any types (use proper types)

🟡 Modern TypeScript Patterns:

  • Array methods used instead of manual loops
  • Arrow functions for callbacks
  • Optional chaining (?.) for safe property access
  • Nullish coalescing (??) for default values
  • Destructuring for cleaner code
  • Type guards for type narrowing

🟢 Cocos Creator Architecture:

  • Component lifecycle methods in correct order
  • onLoad() for initialization, start() for references
  • Event listeners registered in onEnable()
  • Event listeners unregistered in onDisable()
  • Resources released in onDestroy()
  • @property decorator used correctly
  • Required references validated (throw if null)

🔵 Playable Performance:

  • No allocations in update() loop
  • Sprite atlas used for DrawCall batching
  • GPU skinning enabled for skeletal animations
  • Expensive operations throttled (not every frame)
  • Object pooling for frequently created objects
  • Texture compression enabled
  • Bundle size <5MB target
  • DrawCall count <10 target

Common Mistakes to Avoid

❌ DON'T:

  1. Ignore TypeScript strict mode → Enable "strict": true
  2. Silent error handling → Throw exceptions for errors
  3. Leave console.log in production → Remove or wrap in CC_DEBUG
  4. Skip access modifiers → Use public/private/protected
  5. Use any type → Define proper types and interfaces
  6. Add inline comments → Use descriptive names instead
  7. Skip event cleanup → Always unregister in onDisable/onDestroy
  8. Allocate in update() → Preallocate and reuse objects
  9. Forget sprite atlas → Use atlas for DrawCall batching
  10. Heavy logic in update() → Throttle expensive operations
  11. Skip null checks → Validate required references in onLoad
  12. Mutable @property fields → Use readonly when appropriate
  13. Manual loops over arrays → Use map/filter/reduce
  14. Ignore bundle size → Monitor and optimize (<5MB target)

✅ DO:

  1. Enable TypeScript strict mode ("strict": true)
  2. Throw exceptions for errors (never silent failures)
  3. Use console.log for development only (remove in production)
  4. Use access modifiers (public/private/protected)
  5. Define proper types (avoid any)
  6. Use descriptive names (no inline comments)
  7. Always cleanup events (onDisable/onDestroy)
  8. Preallocate objects (reuse in update())
  9. Use sprite atlas (DrawCall batching)
  10. Throttle expensive operations (not every frame)
  11. Validate required references (throw in onLoad if null)
  12. Use readonly for @property (when appropriate)
  13. Use array methods (map/filter/reduce)
  14. Monitor bundle size (<5MB target for playables)

Review Severity Levels

🔴 Critical (Must Fix)

  • TypeScript strict mode disabled - Must enable "strict": true
  • Silent error handling - Must throw exceptions for errors
  • console.log in production code - Remove or wrap in CC_DEBUG
  • Missing access modifiers - All members must have modifiers
  • Using any type without justification - Define proper types
  • Inline comments instead of descriptive names - Rename and remove comments
  • Event listeners not cleaned up - Memory leak, must unregister
  • Missing required reference validation - Must throw in onLoad if null
  • Allocations in update() loop - Performance critical, must preallocate
  • No sprite atlas for multiple sprites - DrawCall explosion, must use atlas
  • Bundle size >5MB - Exceeds playable limit, must optimize

🟡 Important (Should Fix)

  • Missing readonly on @property fields - Should be readonly when not reassigned
  • Missing const for constants - Should use const instead of let
  • Manual loops instead of array methods - Should use map/filter/reduce
  • Missing optional chaining - Should use?. for safe access
  • Missing nullish coalescing - Should use?? for default values
  • Heavy logic in update() - Should throttle expensive operations
  • No object pooling for frequent allocations - Should implement pooling
  • Texture compression not enabled - Should enable for smaller bundle
  • DrawCall count >10 - Should optimize batching

🟢 Nice to Have (Suggestion)

  • Could use arrow function for callback
  • Could destructure for cleaner code
  • Could use type guard for type safety
  • Could improve naming for clarity
  • Could add interface for better typing
  • Could optimize algorithm for better performance

Detailed References

TypeScript Language Standards

Cocos Creator Framework

Code Review

Summary

This skill provides comprehensive Cocos Creator development standards for TheOne Studio's playable ads team:

  • TypeScript Excellence: Strict mode, modern patterns, type safety
  • Cocos Architecture: Component lifecycle, event patterns, resource management
  • Playable Performance: DrawCall batching, GPU skinning, <5MB bundles
  • Code Quality: Enforced quality, hygiene, and performance rules

Use the Quick Reference Guide above to navigate to the specific pattern you need.

平台分布

Claude Code

28.46%
按下载量换算378

Gemini CLI

23.14%
按下载量换算307

Antigravity

17.58%
按下载量换算233

Cursor

12.53%
按下载量换算166

OpenCode

8.06%
按下载量换算107

Codex

3.55%
按下载量换算47

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills