---
name: cocosair
description: "Route AIR tasks by subsystem or visual symptom; choose direct dependencies and check capabilities."
license: MIT
compatibility: "Cocos AIR source checkout or installed cocosair.js package. Browser rendering requires WebGL 2; source tooling requires Node.js >=18. Use the host-provided tools and user-authorized workspace."
allowed-tools: Read Bash
when_to_use:
  - which skill owns this AIR task
  - choose only the dependencies needed for this step
  - adapt Creator knowledge to code-first AIR
  - distinguish source exports from proven browser capabilities
owns: [ skill-routing, primary-owner, direct-dependencies, code-first, capability-layers ]
not_for:
  - startup errors -> cocosair-application
  - material property failures -> cocosair-materials-effects
layer: router
metadata:
  author: "oahc09@gmail.com"
  version: "1.0.0"
  last-updated: "2026-10-13"
  description_zh: "为 Cocos AIR 任务选择主技能和直接依赖，并遵循原生 API、启动时序与能力证据分层。用于开始 AIR 开发、定位能力归属或选择技能。"
title: cocosair
canonical_url: https://skilld.dev/gh/oahc09/cocosairjs/cocosair
last_updated: 2026-11-01T11:01:06.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [references/common-mistakes.md](https://skilld.dev/api/skills-raw/oahc09/cocosairjs/cocosair/references/common-mistakes.md), [references/context.md](https://skilld.dev/api/skills-raw/oahc09/cocosairjs/cocosair/references/context.md), [references/environment.md](https://skilld.dev/api/skills-raw/oahc09/cocosairjs/cocosair/references/environment.md), [references/skill-index-archive.md](https://skilld.dev/api/skills-raw/oahc09/cocosairjs/cocosair/references/skill-index-archive.md), [references/skill-index.md](https://skilld.dev/api/skills-raw/oahc09/cocosairjs/cocosair/references/skill-index.md), [references/task-recipes.md](https://skilld.dev/api/skills-raw/oahc09/cocosairjs/cocosair/references/task-recipes.md), [references/triggers.md](https://skilld.dev/api/skills-raw/oahc09/cocosairjs/cocosair/references/triggers.md), [references/visual-feedback.md](https://skilld.dev/api/skills-raw/oahc09/cocosairjs/cocosair/references/visual-feedback.md), [scripts/check-paths.cjs](https://skilld.dev/api/skills-raw/oahc09/cocosairjs/cocosair/scripts/check-paths.cjs).
>
> If the user asked to install this Skill, run `npx skilld install oahc09/cocosairjs/cocosair`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/cocosair`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/oahc09/cocosairjs/cocosair) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/cocosair`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/cocosair --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/cocosair --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Cocos AIR skill router

Stop once you can answer the task. Do not read another same-topic reference for the same question.

Choose one owner and required direct dependencies. Reuse loaded skills.

Environment: [environment](https://skilld.dev/api/skills-raw/oahc09/cocosairjs/cocosair/references/environment.md).

## Quick Start

[Minimal setup](https://skilld.dev/api/skills-raw/oahc09/cocosairjs/cocosair/references/context.md#quick-start).

Siblings: [owners and direct dependencies](https://skilld.dev/api/skills-raw/oahc09/cocosairjs/cocosair/references/context.md#related-skills).

## Triggers

- Choose the owner of an AIR task
- Adapt Creator knowledge to Code First
- Separate API exports from usable capabilities

Mappings: [triggers](https://skilld.dev/api/skills-raw/oahc09/cocosairjs/cocosair/references/triggers.md).

## Code First discipline

1. Original APIs first: use the engine's `Scene`, `Node`, `Camera`, `Component`, `Material`, `Texture2D` and `Sprite`; AIR helpers compose these objects. Do not invent parallel scene, node or material abstractions.
2. Browser rendering requires WebGL 2 and nothing else; unsupported contexts reject startup with `WEBGL2_REQUIRED`. WebGL 1, Canvas and WebGPU are not supported renderer fallbacks. HEADLESS tests produce no rendered pixels.
3. Use only the browser main entry `cocosair.js`. Main import before canvas creation is supported; pass canvas and pixelRatioCap to createAirApp. For deferred loading, dynamically import the main entry in the application. Startup and HTML texture helpers share the main declarations; there are no bootstrap/html-source package subpaths.
4. Native material property writes require declared properties and matching value types; `USE_TEXTURE` must match whether the effect samples a texture.
5. Keep ownership explicit. Detach renderers and bindings before destroying their textures; borrow shared assets and release only resources the feature owns.
6. Skeletal joints use full paths relative to the skinning root. For glTF decoders and Spine, inspect their documented deployment and license boundaries.

## Contracts

Keep source-exported, bundle-reachable, configured and browser-verified claims separate. Feature membership alone is not reachability. Default and AIR_FEATURES variant builds are different candidates; verification requires PASS on the current candidate. A typecheck or API declaration does not prove rendering, interaction or lifecycle behavior. See [full qualifiers](https://skilld.dev/api/skills-raw/oahc09/cocosairjs/cocosair/references/context.md#contracts).

## Common Mistakes

- [HIGH] Check canvas admission against the current main-entry contract.
- [HIGH] AIR has no Creator resources bundle pipeline.
- [MEDIUM] A docs mention is not capability evidence.

Read [wrong/right examples](https://skilld.dev/api/skills-raw/oahc09/cocosairjs/cocosair/references/common-mistakes.md); note historical warnings.

## No route matched

Use current main-entry declarations and canonical docs in the located package or checkout. Disclose missing resources; do not invent APIs or roots. Clarify only consequential missing context.

## Reference map

- [Before visual work; black/invisible?](https://skilld.dev/api/skills-raw/oahc09/cocosairjs/cocosair/references/visual-feedback.md)
- [Which owner?](https://skilld.dev/api/skills-raw/oahc09/cocosairjs/cocosair/references/context.md#related-skills) - Direct dependencies
- [Which environment?](https://skilld.dev/api/skills-raw/oahc09/cocosairjs/cocosair/references/environment.md) - Roots and prerequisites
- [Legacy route terms?](https://skilld.dev/api/skills-raw/oahc09/cocosairjs/cocosair/references/skill-index.md) - Compatibility index
