Index of every page on this site: llms.txt
All skills
oahc09 avatar

/cocosair-project-setup

@ed38648
by oahc09oahc09/cocosairjs3 stars
2
Run it yourself

Set up npm imports, package entries, importmap, TypeScript and variant builds. Use for cocosair.js installation, unresolved-import errors, page shells or build artifacts.

  • 9 files
  • 27.7 KB
  • MIT
  • Updated last month
  • GitHub
Use this Skill: https://skilld.dev/gh/oahc09/cocosairjs/cocosair-project-setup

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencescommon-mistakes.md

≈631 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Derived from the cocosair-project-setup skill and its canonical docs/source pointers; reorganized on 2026-10-11. Source annotations below identify repository inputs, not files guaranteed to ship to npm consumers.

Common Mistakes

[HIGH] Importing 'cocosair' from the installed package

Wrong:

import { Scene } from 'cocosair'; // fails to resolve in a bundler app

Correct:

import { Scene } from 'cocosair.js';

Every repo page and manual example uses an importmap alias named cocosair pointing at /build/cocosair.module.js (examples/starter/index.html), so code copied from them keeps the alias; the package name declared in root package.json:2 is cocosair.js with the .js suffix, and no alias exists outside this repo. Resolution fails before any app code runs.

[HIGH] Taking the package surface from src/index.ts

Wrong:

// After reading src/index.ts (8 re-exports, no ui/spine/physics lines), conclude they are unavailable
// and hand-roll a parallel UI layer or import the source file directly.
import { createAirApp } from 'cocosair/src/index';

Correct:

// The shipped surface is src/exports/air.ts (the `air` bundle unit): it re-exports './ui', './spine',
// './physics-framework', './physics-builtin', './physics-cannon' and more. Verify against the
// declaration file, not the source aggregate:
import { Button, RigidBody, Skeleton, createAirApp } from 'cocosair.js';

src/index.ts is a narrower source-form entry whose own header comment claims parity with the build entry - that comment is not true on disk today. Agents trust in-code doc comments, then under-report the package surface or resolve a path the package never exposed. Declaration presence is the export layer only: Skeleton is the core 3D skeletal asset class (build/cocosair.module.d.ts:4247), while Spine playback stays runtime-asset-gated (docs/reference/web-features.md:13, docs/notes/spine-asset-sourcing.md) - a symbol resolving from cocosair.js does not mean spine works out of the box.

[MEDIUM] Expecting deferred loading while statically importing main

A static import evaluates the browser runtime immediately. When deferred loading is useful, use only an application-owned dynamic import:

const cc = await import('cocosair.js');
const app = await cc.createAirApp({ canvas: '#GameCanvas' });

The package exposes only its main entry. Importing main before canvas creation is supported; importing the full engine without browser DOM is not.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at ed38648. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last month
layer
subsystem
All 1 allowed tools
Read Edit Write Bash
Other metadata
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.
when_to_use
[
  "install or import cocosair.js",
  "imports resolve to the wrong entry",
  "TypeScript editor declarations fail",
  "wire a page importmap and canvas",
  "which build command produces this artifact"
]
owns
[
  "package-entries",
  "importmap",
  "typescript",
  "html-shell",
  "feature-flags",
  "build-artifacts"
]
not_for
[
  "createAirApp startup failures -> cocosair-application",
  "live HTML textures or overlays -> cocosair-graphics-and-dom",
  "proving build artifacts -> cocosair-verification"
]
metadata
{
  "author": "oahc09@gmail.com",
  "version": "1.0.0",
  "last-updated": "2026-10-13",
  "description_zh": "安装和配置 Cocos AIR 项目,选择包入口、importmap、TypeScript 声明和变体构建。用于安装导入、页面骨架、类型解析或构建产物问题。"
}

README badge

README badge for oahc09/cocosairjs/cocosair-project-setup