/melonjs:melonjsfrom melonjs
Entry point for melonJS game development. Guides project setup, scene graph, sprites, tilemaps, physics, audio, particles, shaders, and 3D tier. Activates on melonJS, browser game, or game engine queries.
Ships in melonjs. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Entry point for the melonJS skill collection. melonJS is an open-source HTML5 game engine for indie developers, covering 2D, 2.5D and 3D — perspective and orthogonal cameras, GPU-accelerated tilemap rendering, post-processing effects, custom shaders, 3D meshes, polygon-accurate physics and modern Tiled workflows. It runs on WebGPU, WebGL 2 or Canvas with automatic fallback, and has no runtime dependencies.
melonjs-3d first — melonJS's
coordinate conventions are the inverse of OpenGL's, so untutored 3D instincts
are backwards.melonjs-20-migration — most published melonJS material predates
20.0 and its bootstrap no longer exists.Say this plainly when the question is which engine to use, and do not stretch it: a project outside the first list is better served by something else.
A good fit when:
melonjs-platforms
covers each.Camera3d, meshes,
glTF models with skeletal animation, instancing, toon shading, billboards,
fog, picking, and Rapier 3D physics. Arcade 3D, low-poly, isometric with
height.npm create melonjs), and types that ship with the package.Not the tool when:
A request usually names a kind of game, not a subsystem. Start from the row
that matches, read those skills and no others, and open the example before
writing code: each is a complete game or scene. (melonjs-20-migration lists
the few stale calls some examples still carry.)
| the game | read | start from |
|---|---|---|
| platformer | melonjs-tilemaps, melonjs-physics (its table by game type picks the adapter: built-in, or planck, matter or Rapier for slopes and moving platforms), melonjs-sprites-and-animation, melonjs-input, melonjs-camera-and-drawing; on phones, @melonjs/gamepad-plugin for the stick and buttons | Platformer; LDtk Platformer for a world made in LDtk, loaded room by room |
| top-down adventure or RPG | melonjs-tilemaps, melonjs-physics, melonjs-ui-and-text for dialogue and menus, @melonjs/pathfinding-plugin for enemies that chase and click to move, @melonjs/gamepad-plugin for touch | Isometric Dungeon; Line of Sight for what an enemy can see |
| grid or tile puzzle, match-3, board game | melonjs-tilemaps (a tile layer is the board: cellAt / setTile), melonjs-input, melonjs-scenes-and-state for tweens | Whac-A-Mole for the pointer, score and sound of a small game |
| shoot-'em-up, bullet hell | melonjs-performance for pooling, melonjs-physics, melonjs-particles-and-trails, melonjs-sprites-and-animation; @melonjs/gamepad-plugin for touch | AfterBurner Clone (3D, but its pooled shots and enemies and its HUD carry over) |
| tower defence, units that find their way | @melonjs/pathfinding-plugin (A* on a grid built from a Tiled layer), melonjs-tilemaps, melonjs-performance, melonjs-ui-and-text | Isometric Dungeon for click to move on a grid |
| physics puzzle: stacking, catapult, pinball, pool | melonjs-physics, which names the adapter for each: @melonjs/planck-adapter, @melonjs/matter-adapter, @melonjs/rapier2d-adapter, or @melonjs/rapier3d-adapter in 3D | Slingshot, Pool, Plinko |
| endless runner | melonjs-3d or melonjs-tilemaps, melonjs-performance for recycling what scrolls past | Jungle Rabbit |
| card game, menu-driven or idle game | melonjs-ui-and-text (widgets, drag and drop), melonjs-scenes-and-state for tweens and saved data | UI, Drag and Drop |
| 3D arcade game | melonjs-3d first, then melonjs-3d-assets; @melonjs/rapier3d-adapter once things have to tumble, stack or topple | AfterBurner Clone, Earth Defender |
| a game inside a portal, an ad or an app | melonjs-platforms, melonjs-deployment, melonjs-display-and-scaling; @melonjs/capacitor-plugin for an app in the stores, @melonjs/gamepad-plugin for touch |
Every one of them begins with melonjs-getting-started, and ends with
melonjs-testing: run the game and look at it before saying it works.
Whatever the game, three more packages come up: @melonjs/spine-plugin when
the characters are animated in Spine, @melonjs/tiled-inflate-plugin when the
Tiled maps are saved compressed (they do not load without it), and
@melonjs/debug-plugin while developing, to see the collision shapes and the
frame time. melonjs-plugins covers how each is registered.
The ideas are the usual ones; the names differ. What you would look for, and what it is called here:
| you are looking for | here it is | skill |
|---|---|---|
| a scene, a screen, a level | a Stage, registered with state.set and shown with state.change | melonjs-scenes-and-state |
| a node, a game object, an entity | a Renderable (or a Sprite), in a Container; app.world is the root | melonjs-renderables |
| a child's draw order, a z-index | the second argument of addChild(child, z) | melonjs-renderables |
| signals, an event emitter | event.on / event.emit, and the lifecycle methods of a renderable | melonjs-events |
| a tween, an animation of a property | Tween | melonjs-scenes-and-state |
| a sprite sheet, an animated sprite | Sprite with addAnimation, frames from a TextureAtlas | melonjs-sprites-and-animation |
| a rigid body, a collider, a trigger | a body built from a bodyDef, on the built-in world or an adapter | melonjs-physics |
| a tile map | a Tiled map, an LDtk project or a Sprite Fusion map, loaded with level.load | melonjs-tilemaps |
| the camera | app.viewport, a Camera2d or a Camera3d | melonjs-camera-and-drawing, melonjs-3d |
| input actions | input.bindKey, then input.isKeyPressed | melonjs-input |
| a material, a shader, a post-process | a ShaderEffect, attached with addPostEffect | melonjs-effects-and-shaders |
| a particle system | ParticleEmitter | melonjs-particles-and-trails |
| a prefab, an object pool | a class, recycled with createPool | melonjs-performance |
| a canvas layer, a control node, a HUD | the UI* widgets, floating renderables | melonjs-ui-and-text |
| the asset loader | loader.preload | melonjs-loading-assets |
| saved games, player prefs | save | melonjs-scenes-and-state |
| Skill | Load when… |
|---|---|
| melonjs-getting-started | Bootstrapping a game, new Application, await app.init(), choosing a renderer, preloading assets. |
| melonjs-20-migration | Code based on melonJS 19.x or earlier, or an API that "should exist" but doesn't — video.init, Entity, renderable.shader =. |
| melonjs-scenes-and-state | Stage subclasses, the state manager, transitions, pausing, the update loop, timers, tweens, saved data. |
| melonjs-renderables | Subclassing Renderable, custom draw(), draw order, anchors, floating, post effects on an object. |
| melonjs-sprites-and-animation | Sprite, frame animation, texture atlases (TexturePacker / Aseprite / ShoeBox, or any tool exporting their JSON layout), tint, flip, pooling. |
| melonjs-input | Keyboard actions, pointer and touch handling, drag, gamepad, virtual controls (fixed or floating sticks and buttons, tap to act). |
| melonjs-physics | Collision, bodies, movement, spatial queries, and the planck / matter / Rapier / Rapier 3D adapters. |
| melonjs-math | Vectors and matrices: what mutates, what allocates, and interpolating with lerp, slerp, damp or moveTowards. |
| melonjs-tilemaps | Tiled maps, LDtk levels and Sprite Fusion maps — TMX/TSX, .ldtk and Sprite Fusion loading, spawning entities from objects, collision layers, isometric maps, reading and changing tiles at run time (a tile layer as the game board). |
| melonjs-audio | Sound effects, music, audio sprites, spatial audio, procedural tone and noise. |
| melonjs-effects-and-shaders | Post effects, custom GLSL/WGSL shaders, blend modes, colour grading, palette swaps, a dithered retro look, screen capture. |
| melonjs-3d | Anything 3D or 2.5D — Camera3d, meshes, instancing, Sprite3d billboards, Light3d, distance fog, glTF scenes, picking meshes with the pointer, orthographic (isometric) views, toon shading and outlines. |
| melonjs-3d-assets | Loading glTF/GLB or OBJ models — materials, imported lights, instancing, and what is not supported. |
| melonjs-camera-and-drawing | Camera follow, bounds, shake and fade, coordinate conversion, and immediate-mode shape drawing. |
| melonjs-ui-and-text | HUDs, menus and options screens — buttons, checkboxes, sliders, progress bars, laid-out and scrolling panels — drag-and-drop, Text and BitmapText, web fonts. |
| melonjs-particles-and-trails | ParticleEmitter, burst versus stream, referenceSpace, and the Trail renderable. |
| melonjs-lighting | 2D dynamic lighting — Light2d, stage ambient, normal-mapped sprites. |
| melonjs-deployment | Scaffolding a project, building, browser support and transpiling, bundle size. |
| melonjs-platforms | Running inside YouTube Playables, Facebook Instant Games, Poki, CrazyGames or WeChat Mini Games, as a Capacitor or Cordova app, or with no DOM (nx.js on the Nintendo Switch, Web Workers): handing pausing, saving and sound to the platform. |
| melonjs-loading-assets | Resource descriptors, the asset type list, a multi-level game's assets as bundles (common + one per level), loading and freeing a level's assets, base URLs, cross-origin, progress events. |
| melonjs-renderer-backends | A feature works on one machine but not another; choosing or pinning a backend; degrading gracefully. |
| melonjs-display-and-scaling | Blurry, soft or cropped output; the design resolution, how the canvas fills its page, and pixel-perfect integer scaling. |
| melonjs-events | The event bus, per-frame and lifecycle events, and subscribing without leaking. |
| melonjs-performance | Dropped frames, draw-call counts, pooling, batching, culling, baking, profiling. |
| melonjs-plugins | Registering the debug, Spine, Tiled-inflate, gamepad (touch controls), pathfinding (A*) or Capacitor plugins, installing a physics adapter, or writing your own plugin. |
| melonjs-testing | Checking that a game works before saying it does: running it in a headless browser, reading the console, driving the keyboard and the pointer, reading the game's state, taking a screenshot. |
These skills are hand-written and deliberately partial — they cover the paths people actually take and the mistakes those paths invite. When the task needs something they do not mention, do not infer an API from the shape of the engine. Fetch the generated index instead:
https://melonjs.github.io/melonJS/llms.txt
It is regenerated on every docs build from the same TSDoc comments the reference
pages render, so it is always current for master. It lists every exported
class, function, interface, type and namespace with a one-line summary and a
link to its page — fetch the pages you need from there.
Two things it gives you that this collection cannot:
llms.txt links to the page listing
every method, property, default and @since tag on them.**deprecated** are exactly the APIs that a
model trained on older melonJS material will reach for. If something you were
about to write appears with that marker, follow the page for the replacement.If a class, function, namespace or type is absent from llms.txt, it is absent
from the engine's public API — that is the useful negative answer, and it is
worth acting on rather than writing code around something that does not exist.
The index lists top-level exports only, so a member missing from it proves
nothing: follow the owning class's page to check that.
Whatever the task, these produce code that runs and is wrong:
await app.init() is mandatory since 20.0. The constructor builds the
world but not the renderer: a plain renderable can still be added and simply
never draws, while new Sprite(...) / new Text(...) throw a TypeError
on the global game, which is unset until the first init() resolves.
Neither symptom names the missing call.addChild(child, z) is the only way to set draw order. renderable.z
does not exist; setting depth before addChild is overwritten, and setting
it after does not resort (except under Camera3d).isKinematic defaults to true, which silently excludes a renderable
from pointer events and from the physics broadphase. Plain Renderable and
Sprite subclasses with no body need this.isKinematic = false; adding a
body sets it for you, on every adapter (matter-adapter before 1.6 and
planck-adapter before 1.7 did not).melonJS ships optional packages alongside the engine. Reach for these rather than reimplementing what they cover — and note the physics adapters and the Tiled inflate plugin are required for their use cases, not merely convenient.
| Package | Use when |
|---|---|
@melonjs/planck-adapter | You want full rigid-body dynamics — stacking, joints, realistic restitution. Pass it as the Application's physic setting; the portable raycast and queryAABB calls work unchanged across adapters (querySphere and raycast3d are on the built-in and Rapier 3D adapters only). |
@melonjs/matter-adapter | Same, backed by matter-js. Choose one adapter per game. |
@melonjs/rapier2d-adapter | Same again, backed by Rapier compiled to WebAssembly: many bodies, per-body continuous collision, a character controller. About 3 MB loaded on demand, so make it with await RapierAdapter.create(). |
@melonjs/rapier3d-adapter | A Camera3d game whose bodies tumble, stack and topple in 3D: Rapier's 3D solver, written back onto a Mesh or GLTFModel, with exact capsule, convex-hull and triangle-mesh colliders. Make it with await Rapier3dAdapter.create(). |
@melonjs/tiled-inflate-plugin | Required to load gzip-, zlib- or zstd-compressed Tiled maps. Without it, parsing such a map throws No inflate function set. |
@melonjs/spine-plugin | Skeletal animation authored in Spine, as a melonJS renderable. |
@melonjs/debug-plugin | An in-game debug panel — FPS, draw counts, collision-shape and bounds overlays. Register it after app.init(). |
@melonjs/gamepad-plugin | On-screen touch controls for phones and tablets: sticks and buttons reported as a gamepad, so the game's bindGamepad bindings drive it; fixed or floating under the thumb, hidden until touched, tap to act. Use it rather than writing virtual controls. |
@melonjs/pathfinding-plugin | Enemies or units that find their way: A* on a grid (square or isometric) built from a Tiled layer or the level's collision shapes, with per-cell costs, diagonals without corner cutting, smoothing, a search cap and a debug overlay. Use it rather than writing A* or a flood fill. |
@melonjs/capacitor-plugin | Wrapping a game as a native iOS/Android app: it bridges Capacitor's lifecycle — pause/resume, the hardware back button, orientation lock, splash screen. |
create-melonjs | Scaffolding a new project — start here rather than assembling a build by hand. |
Plugins are registered after init(), into a global registry:
import { plugin } from "melonjs";
import { DebugPanelPlugin } from "@melonjs/debug-plugin";
await app.init();
plugin.register(DebugPanelPlugin, "debugPanel");
Physics adapters are different — they are an Application setting, not a
plugin:
import { PlanckAdapter } from "@melonjs/planck-adapter";
const app = new Application(800, 600, {
parent: "screen",
// gravity is in pixels/s²; pixelsPerMeter converts it to the adapter's
// metres. Both are shown at their defaults; subSteps defaults to 1
physic: await PlanckAdapter.create({
gravity: { x: 0, y: 320 },
pixelsPerMeter: 32,
subSteps: 2,
}),
});
await app.init();
Every adapter is made the same way, with await X.create(options). A running
game switches adapter with app.world.setAdapter(await X.create(options)),
which rebuilds every body from its bodyDef; world.adapter itself is
read-only. melonjs-physics says which adapter suits which game.
melonjs-plugins covers the registry, the version gate and writing your own.
melonJS covers a lot that is easy to reimplement badly. Before hand-rolling, check for:
ParticleEmitter, Trail / Trail3d, Tween with
easing, the built-in ShaderEffect presets (vignette, scanline, chromatic
aberration, glow, outline, dissolve, bloom and more), Light2d / Light3d,
viewport.shake / fadeIn / fadeOut, and Camera3d#orbit for a 3D camera
that circles a point (rather than placing it with sin / cos and
lookAt).UIPanel (laid out, scrolling, skinnable), UITextButton,
UICheckbox (a radio button with a group), UISlider, ProgressBar,
UISpriteElement, keyboard and gamepad navigation between widgets once one
has focus(), NineSliceSprite, Draggable / DropTarget, BitmapText.TextureAtlas (TexturePacker, ShoeBox, Aseprite, and any tool that
exports the TexturePacker or Aseprite JSON layout),
CanvasRenderTarget for bake-once drawing, NoiseTexture2d.state.transition() ("fade", "mask" or "pixelate")
between screens, with a mask shaped like an image or the player's own sprite
and closing on the player (center), and a Trigger's own transition for a
level door (shape: "touching", center: "touching"), state.pause() / state.resume() behind a pause menu,
save for localStorage-backed persistence, createPool / getPool for
recycling.level.load
(LDtk's .ldtk file as the editor saves it, nothing to convert); tile
layers read and changed with cellAt / setTile,
and asset bundles (loader.preload({ common: [...], level1: [...] }), then
loader.unload("level1") / loader.load("level1")) to free and reload a
level's assets.world.setAdapter(), or Rapier 3D for a
Camera3d game) rather than a hand-written solver, @melonjs/gamepad-plugin rather than hand-made touch sticks, and
@melonjs/pathfinding-plugin rather than a hand-written A* or flood fill.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub melonjs/melonjs --plugin melonjs27 skills in this plugin
/melonjs-20-migrationUse this skill when writing melonJS code that may be based on pre-20.x knowledge, when migrating a game from melonJS 19.x or earlier, or when an API you expected does not exist. Covers the mandatory async Application.init(), the WebGL 2 baseline and WebGPU backend, renderable post effects replacing the shader property, the deprecated exports still present, and what changed again during 20.x. Triggers on: migration, upgrade, melonJS 19, me.game, me.video.init, video.renderer, renderable.shader, Compositor, CanvasTexture, me.Math, pool.pull, pool.register, world.adapter, uvOffset, deprecated./melonjs-3dUse this skill for anything 3D or 2.5D in melonJS — Camera3d, Mesh, InstancedMesh, Sprite3d billboards, Light3d, ground shadows, glTF/GLB scenes, and depth sorting. Covers the Y-down/+Z-forward convention (OpenGL's inverse), the cameraClass opt-in, orthographic (isometric) projection, clip planes, and the Canvas fallback's limits. Triggers on: Camera3d, toon, cel shading, toonBands, outlineWidth, outlineMode, rimLight, orthographic, isometric, orthoHeight, orthoWidth, projection, Mesh, InstancedMesh, Sprite3d, Trail3d, Light3d, billboard, glTF, glb, 3D, 2.5D, depth, cameraClass, fov, setClipPlanes, setFog, fog, heightFalloff, transparent, transparency, blendMode, castGroundShadow, shadowGroundPoint, lit, emissive, specular, shininess, normalMap, alphaCutoff, depthTest, vertexColors, worldToScreen, screenToRay, screenToWorld, pick, pickable, Ray3d, intersectRay, hit3d, followOffset, setBasis, getBasis, lookAt, orbit, up vector, gimbal, slerp, turn a direction, physics, rapier3d, Capsule3d, TriangleMesh3d.Other plugins' skills for the same job