excalibur
You are an expert in Excalibur.js, the TypeScript-first 2D game engine built for the web. You help developers build browser games using Excalibur's Actor system, Scene management, Tiled integration, physics, animation, sound, and input handling — with first-class TypeScript support, excellent documentation, and a focus on developer experience over raw performance.
What this skill does
# Excalibur.js — TypeScript-First 2D Game Engine
You are an expert in Excalibur.js, the TypeScript-first 2D game engine built for the web. You help developers build browser games using Excalibur's Actor system, Scene management, Tiled integration, physics, animation, sound, and input handling — with first-class TypeScript support, excellent documentation, and a focus on developer experience over raw performance.
## Core Capabilities
### Game Setup
```typescript
// src/main.ts — Excalibur game
import { Engine, DisplayMode, Color } from "excalibur";
import { LevelOne } from "./scenes/LevelOne";
import { loader } from "./resources";
const game = new Engine({
width: 800,
height: 600,
displayMode: DisplayMode.FitScreen,
backgroundColor: Color.fromHex("#1a1a2e"),
pixelArt: true, // Crisp rendering
pixelRatio: 2,
fixedUpdateFps: 60, // Deterministic physics
});
game.addScene("level-one", new LevelOne());
game.start(loader).then(() => { // Preload assets
game.goToScene("level-one");
});
```
### Actors and Components
```typescript
// src/actors/Player.ts
import { Actor, Color, vec, Keys, CollisionType, Animation, SpriteSheet } from "excalibur";
import { Resources } from "../resources";
export class Player extends Actor {
private speed = 200;
private jumpForce = -400;
private health = 3;
private isGrounded = false;
constructor(x: number, y: number) {
super({
pos: vec(x, y),
width: 16,
height: 24,
collisionType: CollisionType.Active, // Moves and collides
color: Color.Green,
});
}
onInitialize(engine: Engine) {
// Sprite sheet animations
const spriteSheet = SpriteSheet.fromImageSource({
image: Resources.HeroSheet,
grid: { rows: 4, columns: 6, spriteWidth: 16, spriteHeight: 24 },
});
const idle = Animation.fromSpriteSheet(spriteSheet, [0, 1, 2, 3], 200);
const run = Animation.fromSpriteSheet(spriteSheet, [6, 7, 8, 9, 10, 11], 100);
const jump = Animation.fromSpriteSheet(spriteSheet, [12, 13], 150);
this.graphics.add("idle", idle);
this.graphics.add("run", run);
this.graphics.add("jump", jump);
this.graphics.use("idle");
// Ground detection
this.on("postcollision", (evt) => {
if (evt.side === "Bottom") this.isGrounded = true;
});
}
onPreUpdate(engine: Engine, delta: number) {
const kb = engine.input.keyboard;
let moving = false;
if (kb.isHeld(Keys.ArrowLeft)) {
this.vel.x = -this.speed;
this.graphics.flipHorizontal = true;
moving = true;
} else if (kb.isHeld(Keys.ArrowRight)) {
this.vel.x = this.speed;
this.graphics.flipHorizontal = false;
moving = true;
} else {
this.vel.x = 0;
}
if (kb.wasPressed(Keys.Space) && this.isGrounded) {
this.vel.y = this.jumpForce;
this.isGrounded = false;
this.graphics.use("jump");
} else if (moving) {
this.graphics.use("run");
} else {
this.graphics.use("idle");
}
}
takeDamage(amount: number) {
this.health -= amount;
// Flash red
this.actions.blink(100, 100, 5);
if (this.health <= 0) {
this.scene?.engine.goToScene("game-over");
}
}
}
```
### Scenes and Tiled Maps
```typescript
// src/scenes/LevelOne.ts
import { Scene, Engine, TileMap, vec } from "excalibur";
import { TiledResource } from "@excaliburjs/plugin-tiled";
import { Player } from "../actors/Player";
import { Coin } from "../actors/Coin";
export class LevelOne extends Scene {
private tiledMap!: TiledResource;
onInitialize(engine: Engine) {
this.tiledMap = new TiledResource("/maps/level-1.tmx");
// Add tilemap to scene
this.tiledMap.addToScene(this);
// Get spawn point from Tiled object layer
const spawnPoint = this.tiledMap.getObjectsByName("PlayerSpawn")[0];
const player = new Player(spawnPoint.x, spawnPoint.y);
this.add(player);
// Camera follows player
this.camera.strategy.elasticToActor(player, 0.8, 0.9);
this.camera.zoom = 2;
// Spawn coins from object layer
this.tiledMap.getObjectsByType("coin").forEach((obj) => {
this.add(new Coin(obj.x, obj.y));
});
}
}
```
## Installation
```bash
npm install excalibur
npm install @excaliburjs/plugin-tiled # Tiled map support
```
## Best Practices
1. **TypeScript always** — Excalibur is built in TypeScript; use it for full autocompletion and type safety
2. **Actor lifecycle** — Override `onInitialize`, `onPreUpdate`, `onPostUpdate` instead of constructor for game logic
3. **Collision types** — Use `Active` for moving entities, `Fixed` for static platforms, `Passive` for triggers/sensors
4. **Scene transitions** — `engine.goToScene("name", { sceneActivationData })` to pass data between scenes
5. **Tiled plugin** — Use the official Tiled plugin for level design; supports tile layers, object layers, and custom properties
6. **Actions API** — Chain animations: `actor.actions.moveTo(100, 100, 200).delay(500).fade(0, 1000)` for cutscenes and effects
7. **Event system** — Use typed events (`on("precollision")`, `on("kill")`) for clean game logic
8. **Resource loading** — Define all assets in a loader; Excalibur shows a loading screen automatically
Related in Image & Video
watch
IncludedWatch a video (URL or local path). Downloads with yt-dlp, extracts auto-scaled frames with ffmpeg, pulls the transcript from captions (or Whisper API fallback), and hands the result to Claude so it can answer questions about what's in the video.
physical-ai-defect-image-generation
IncludedUse when the user wants to orchestrate defect image generation, run associated setup, or handle outputs on OSMO. The Day 0 path handles cold-start with USD-to-ROI, image-edit augmentation, and AnomalyGen to create initial PCBA datasets. The Day 1 path performs inference and labeling on real images. This skill helps with first-time asset setup, creation of finetuning checkpoints, and configuring deployment. Trigger keywords: defect image generation, dig workflow, dig pipeline, defect image detection workflow, aoi pipeline, aoi anomalygen, usd2roi anomalygen, day 0 pcba, day 1 pcba, day 1 real-photo alignment, day 1 manual roi, metal surface anomaly, glass defect, anomalygen finetune, setup_pcb, setup_metal, setup_glass, setup_pretrained, dig setup, dig datasets, dig pretrained checkpoint, dig image-edit endpoint.
accelint-react-best-practices
IncludedReact performance optimization and best practices. ALWAYS use this skill when working with any React code - writing components, hooks, JSX; refactoring; optimizing re-renders, memoization, state management; reviewing for performance; fixing hydration mismatches; debugging infinite re-renders, stale closures, input focus loss, animations restarting; preventing remounting; implementing transitions, lazy initialization, effect dependencies. Even simple React tasks benefit from these patterns. Covers React 19+ (useEffectEvent, Activity, ref props). Triggers - useEffect, useState, useMemo, useCallback, memo, inline components, nested components, components inside components, re-render, performance, hydration, SSR, Next.js, useDeferredValue, combined hooks.
elevenlabs-agents
IncludedBuild conversational AI voice agents with ElevenLabs Platform using React, JavaScript, React Native, or Swift SDKs. Configure agents, tools (client/server/MCP), RAG knowledge bases, multi-voice, and Scribe real-time STT. Use when: building voice chat interfaces, implementing AI phone agents with Twilio, configuring agent workflows or tools, adding RAG knowledge bases, testing with CLI "agents as code", or troubleshooting deprecated @11labs packages, Android audio cutoff, CSP violations, dynamic variables, or WebRTC config. Keywords: ElevenLabs Agents, ElevenLabs voice agents, AI voice agents, conversational AI, @elevenlabs/react, @elevenlabs/client, @elevenlabs/react-native, @elevenlabs/elevenlabs-js, @elevenlabs/agents-cli, elevenlabs SDK, voice AI, TTS, text-to-speech, ASR, speech recognition, turn-taking model, WebRTC voice, WebSocket voice, ElevenLabs conversation, agent system prompt, agent tools, agent knowledge base, RAG voice agents, multi-voice agents, pronunciation dictionary, voice speed control, elevenlabs scribe, @11labs deprecated, Android audio cutoff, CSP violation elevenlabs, dynamic variables elevenlabs, case-sensitive tool names, webhook authentication
humanizer
IncludedHumanize AI-generated text by detecting and removing patterns typical of LLM output. Rewrites text to sound natural, specific, and human. Uses 28 pattern detectors, 560+ AI vocabulary terms across 3 tiers, and statistical analysis (burstiness, type-token ratio, readability) for comprehensive detection. Use when asked to humanize text, de-AI writing, make content sound more natural/human, review writing for AI patterns, score text for AI detection, or improve AI-generated drafts. Covers content, language, style, communication, and filler categories.
generating-mermaid-diagrams
IncludedSalesforce architecture diagrams using Mermaid with ASCII fallback. Use this skill when generating text-based diagrams for Salesforce architecture, OAuth flows, ERDs, integration sequences, or Agentforce structure. TRIGGER when: user says "diagram", "visualize", "ERD", or asks for sequence diagrams, flowcharts, class diagrams, or architecture visualizations in Mermaid. DO NOT TRIGGER when: user wants PNG/SVG image output (use generating-visual-diagrams), or asks about non-Salesforce systems.