gg-web-engine examples

VerifiedSafe

Create or update demo projects under examples/ in gg-web-engine, including webpack demos and framework integration samples. Use when adding a new example app, not for general app development.

Sby Skills Guide Bot
DevelopmentIntermediate
8/29/2026
Claude Code
#examples#webpack#game-engine#typescript#framework-integration

Recommended for

Automated summary

Adds or updates a demo project under examples/ in the gg-web-engine repo by copying a webpack or framework template and registering the new example.

Strengths

  • Guides template selection by visual-library/physics-engine combination with an explicit naming convention
  • Documents the ES5 tsconfig target trap that surfaces at runtime as 'Class constructor cannot be invoked without new' in the webpack bundle
  • Covers the registration steps (examples-list.txt for version bumping, index.html for the StackBlitz gallery) so examples don't drift
  • Explains how to link the engine locally to exercise unpublished changes instead of faking a version number

Limitations

  • Tightly scoped to the gg-web-engine repository and unusable elsewhere
  • The bash snippet for local linking is cut off in the SKILL.md
  • Offers no automated verification of the example beyond running it manually in a browser
When to use it

When creating a new demo or example app inside the gg-web-engine repository.

When not to use it

When building an application against a published @gg-web-engine version outside this repo.

Security analysis

Safe
Quality score82/100

This is purely a documentation/instruction skill describing repository conventions for adding example projects. The only executable actions referenced are conventional npm install/build/start and helper bash scripts that link/unlink local packages by path — no curl|sh, rm -rf, secret exfiltration, base64 payloads, or safety-disabling instructions. Execution risk is minimal and confined to a local development repo.

Findings
  • •Instructs running local repo scripts (`etc/switch_example_to_local_gg.sh`, `etc/restore_example_from_local_gg.sh`) and standard npm commands (`npm install`, `npm run start`, `npm run build`), but all operate on the local repo with no data exfiltration or destructive/obfuscated behavior.
How this analysis is made

Examples

New plain webpack demo
Add a new plain webpack example under examples/ that demos collision groups with three.js and rapier3d, named collision-groups-three-rapier3d, and register it in examples-list.txt.
Framework integration sample
Create a React integration example for pixi.js + rapier2d under examples/, copying the existing framework-react-three-rapier3d template and wiring world creation/disposal in useEffect.
Debug class constructor error
My new example's production webpack bundle throws 'Class constructor cannot be invoked without new' in the browser — find out why and fix it.

name: gg-engine-examples description: Add or update a demo project under examples/ in gg-web-engine (webpack demos, framework integration samples, or the StackBlitz gallery). Use when the task is to create a new example app, not general app development against a published engine version outside this repo.

Adding an example project

examples/ holds one small, focused demo per feature/combination — they double as manual integration tests (rendering adapters have little automated testing, see gg-engine-visual-adapter) and as the tutorials linked from the README/StackBlitz gallery.

Pick a template

  • Plain webpack demo (most examples): copy the nearest existing example with a matching visual+physics combination, e.g. examples/primitives-three-ammo or examples/primitives-pixi-rapier2d. Contains index.html, index.ts, webpack.config.js (prod build), webpack.dev.config.js (dev server), tsconfig.json, package.json.
  • Framework integration sample: copy examples/framework-angular-three-ammo or examples/framework-react-three-rapier3d instead — these have framework-specific tooling and lifecycle wiring (create the world in ngOnInit/useEffect, dispose on teardown).

Naming convention: <feature-or-topic>-<visual-lib>-<physics-lib> (e.g. collision-groups-pool-three-rapier3d, glb-loader-three-ammo). Physics-only or render-only demos just omit the missing half.

package.json

Pin @gg-web-engine/* and underlying library (three/pixi.js/rapier compat build) versions to whatever packages/core/package.json's current version is — examples are not meant to float on version ranges. Copy the browser field ({"fs": false, "os": false, "path": false}) when the physics lib is Ammo (needed to stub Node built-ins the WASM glue references).

tsconfig target

Set compilerOptions.target in the example's tsconfig.json to ES2020 (the value already used by most examples) or higher — never ES5 and never leave it unset (tsc's default is lower still). packages/core and every adapter are published compiled at target: es2016 (tsconfig.base.json at the repo root), which keeps real ES2015+ class syntax (native classes aren't downleveled at that target, only newer syntax like async/await is). If an example compiles its own code at ES5, tsc/ts-loader downlevels any class ... extends <ImportedBaseClass> in the example (e.g. a custom entity extending IEntity, or Gg3dWorld itself if subclassed) into the ES5 __extends helper, which calls the parent via Base.call(this, ...) instead of new. Calling a real ES2015+ class without new throws TypeError: Class constructor X cannot be invoked without 'new' at runtime — in a webpack production bundle this surfaces minified as Class constructor E cannot be invoked without 'new' at new I, with no build-time error, since both tsc and webpack compile/bundle successfully; it only fails when the bundle actually runs in a browser. This bit essentially every plain-webpack example at once (they'd all copied an ES5 tsconfig.json from an older template) — if a fresh example's bundle throws this in the browser, check its tsconfig.json target before looking anywhere else.

Register the example

  1. Add the directory name (no examples/ prefix) as a new line in examples/examples-list.txt — etc/publish_new_version.sh reads this file to bulk-bump every example's dependency versions after a release. Skipping this means the example silently keeps pointing at an old version.
  2. Add an entry to examples/index.html (the StackBlitz gallery page) if the example should be publicly browsable; it references the same sbBranchSuffix release-branch mechanism used by the release script.

Developing against unpublished engine changes

If the example needs to exercise an in-progress change to core or an adapter (not yet published to npm), don't bump to a fake version — link locally instead:

bash etc/switch_example_to_local_gg.sh examples/<your-example-dir>

This strips the @gg-web-engine/* lines from the example's package.json, npm links the local packages/* builds in by path instead, and patches tsconfig.json path mappings for libraries whose types live under a linked package's own node_modules (three/pixi/ammo — see the fix_*_paths functions in the script). It's idempotent (safe to re-run) and reversible — undo it with bash etc/restore_example_from_local_gg.sh examples/<your-example-dir>. Run npm install at the repo root first if the local adapter packages themselves need to pick up local core changes; for the full "edit core, see it live in this example" watch-mode loop (tsc -b --watch + npm start), see gg-engine-core-development's local dev workflow section.

Running

cd examples/<your-example-dir>
npm install
npm run start   # webpack-dev-server, for plain webpack examples
npm run build   # produces dist/bundle.js for static hosting

Writing the demo itself

Examples are read as documentation — keep index.ts/src/ short, comment the non-obvious parts (why a controller is attached, what a collision group demonstrates), and prefer the same bootstrap shape used in the root README.md quickstart so readers can map one to the other. See gg-engine-app-development for the API surface to draw on.

Give world an explicit type annotation from the visual adapter package (e.g. const world: ThreeGgWorld = new Gg3dWorld({...}), imported from @gg-web-engine/three; pixi equivalents follow the same naming) whenever the demo reaches through world.visualScene for adapter-specific members like nativeScene. Gg3dWorld's generic inference from the constructor argument alone does not carry the concrete visual scene type through — world.visualScene infers as the base IVisualScene3dComponent interface, which doesn't declare adapter-specific members, so any access like world.visualScene.nativeScene fails with TS2339: Property 'nativeScene' does not exist on type 'IVisualScene3dComponent<...>' regardless of which physics adapter is paired with it. The explicit annotation sidesteps the inference entirely and is the pattern already used by examples like collision-groups-three-ammo.

Keep this skill current

This file is read by future agents adding examples to this repo, not by end users of the engine. If the registration steps here turn out incomplete (a build/CI/StackBlitz step this file doesn't mention), or the local-linking workflow needed an extra fix to actually work, add a short note (what went wrong, why, the fix) before finishing — folded into the relevant section rather than left as a loose log entry.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/gg-web-engine-examples-mte1lgaf/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/gg-web-engine-examples-mte1lgaf' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/gg-web-engine-examples-mte1lgaf/download' --output '.skill-downloads/gg-web-engine-examples-mte1lgaf/SKILL.md.part' && mv '.skill-downloads/gg-web-engine-examples-mte1lgaf/SKILL.md.part' '.skill-downloads/gg-web-engine-examples-mte1lgaf/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/gg-web-engine-examples-mte1lgaf/SKILL.md' && test -s '.skill-downloads/gg-web-engine-examples-mte1lgaf/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/gg-engine-examples' && cp -R '.skill-downloads/gg-web-engine-examples-mte1lgaf' '.claude/skills/gg-engine-examples'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/gg-web-engine-examples-mte1lgaf'

openskills read 'gg-web-engine-examples-mte1lgaf'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/gg-web-engine-examples-mte1lgaf/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills