| name | cocos-mobile-optimizer |
| description | Use when working on mobile-specific performance issues, battery optimization, or platform-specific features. |
Cocos Mobile Optimizer
Overview
This Codex skill adapts the upstream Cocos Creator Claude agent guidance for use in Codex.
Specialist in optimizing Cocos Creator games specifically for mobile platforms (iOS/Android). Use this skill for mobile-specific performance issues, battery optimization, or platform-specific features.
Expertise
- iOS/Android platform specifics
- Touch input optimization
- Battery life management
- Thermal throttling mitigation
- Mobile GPU optimization
- Network optimization for mobile
- App size reduction
- Platform-specific features
Usage Examples
Example 1: Battery Optimization
Context: Game drains battery quickly
User: "Optimize battery consumption on mobile devices"
Assistant: "I will use $cocos-mobile-optimizer"
Commentary: Implements frame rate limiting and GPU optimization
Example 2: Touch Responsiveness
Context: Touch input feels laggy
User: "Improve touch response time for mobile"
Assistant: "I will use $cocos-mobile-optimizer"
Commentary: Optimizes touch handling and reduces input latency
Example 3: App Size Reduction
Context: App exceeds store limits
User: "Reduce APK/IPA size below 150MB"
Assistant: "I will use $cocos-mobile-optimizer"
Commentary: Compresses assets and removes unused code
Mobile Optimization Techniques
Power Management
@ccclass('MobilePowerManager')
export class MobilePowerManager extends Component {
@property
lowPowerMode: boolean = false;
private _originalFPS: number = 60;
onLoad() {
this.detectDeviceCapabilities();
this.setupPowerManagement();
}
detectDeviceCapabilities() {
const canvas = find('Canvas');
const device = sys.platform;
if (device === sys.Platform.IOS || device === sys.Platform.ANDROID) {
this.adjustQualitySettings();
}
}
enterLowPowerMode() {
game.frameRate = 30;
}
}
Platform-Specific Features
iOS Optimization
if (sys.platform === sys.Platform.IOS) {
}
Android Optimization
if (sys.platform === sys.Platform.ANDROID) {
}
Memory Management Mobile
- Texture memory limit: 100MB
- Audio memory limit: 20MB
- Aggressive asset unloading
- Smaller texture formats (ETC1, PVRTC)
Touch Optimization
@ccclass('OptimizedTouch')
export class OptimizedTouch extends Component {
private _touchPool: Touch[] = [];
onEnable() {
this.node.on(Node.EventType.TOUCH_START, this.onTouchStart, this);
this.node.on(Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
this.node.on(Node.EventType.TOUCH_END, this.onTouchEnd, this);
}
onTouchStart(event: EventTouch) {
const touch = this.getTouchFromPool();
}
}
Build Settings
iOS Build
{
"orientation": "portrait",
"deviceOrientation": "portrait",
"renderMode": "metal",
"exactFitScreen": false,
"optimization": {
"codeStripping": true,
"compressTexture": true,
"useMetal": true
}
}
Android Build
{
"packageName": "com.company.game",
"orientation": "portrait",
"renderBackend": "gfx-vulkan",
"optimization": {
"instantApp": false,
"appBundle": true,
"compressTexture": true
}
}
Handoff Guidance
To cocos-performance-optimizer
Trigger: General optimization needed
Handoff: "Mobile-specific optimization done. General optimization for: [areas]"
To cocos-build-engineer
Trigger: Build configuration
Handoff: "Mobile optimization ready. Build setup needed for: [platform]"
To cocos-platform-integrator
Trigger: Native features
Handoff: "Mobile optimization complete. Native integration for: [features]"
References
Read references/mobile-game-development.md when the task needs the full workflow.
Codex Operating Notes
- Prefer inspecting the actual Cocos Creator project before proposing changes.
- Keep edits scoped to the requested game system, platform, or workflow.
- After implementation, run the available TypeScript, lint, build, export, or size checks for the project.
- When the task naturally crosses domains, recommend the next relevant Cocos skill instead of expanding scope silently.