speckit.game-native-js
Skill3 starsChanged 3 months agoMITView on GitHub
Native Web Game Developer - Phaser 3, PixiJS, Three.js/R3F, Babylon.js, 60 FPS Fixed Timestep loop, Object Pooling (Zero-GC), Hybrid DOM HUD, and Web Audio API.
In this repository65 other files it gives its agents.
- .agents/AGENTS.mdAGENTS.md
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/bro-skills.mdcCursor rule
- .agents/skills/llms.txtllms.txt
- brandkitSkill
- bro-mcp-loopSkill
- ci-security-scanning-with-strixSkill
- design-taste-frontendSkill
- fix-security-vulnerabilities-with-strixSkill
- full-output-enforcementSkill
- gpt-tasteSkill
- high-end-visual-designSkill
- imagegen-frontend-mobileSkill
- imagegen-frontend-webSkill
- image-to-codeSkill
- industrial-brutalist-uiSkill
- managed-pentesting-with-strixSkill
- minimalist-uiSkill
- penetration-testing-with-strixSkill
- ponytailSkill
- redesign-existing-projectsSkill
- speckit.ai-engineerSkill
- speckit.analyzeSkill
- speckit.architectureSkill
- speckit.backendSkill
- speckit.backlogSkill
- speckit.checkerSkill
- speckit.checklistSkill
- speckit.clarifySkill
- speckit.constitutionSkill
- speckit.contentSkill
- speckit.databaseSkill
- speckit.dddSkill
- speckit.debugSkill
- speckit.devopsSkill
- speckit.diffSkill
- speckit.event-realtimeSkill
- speckit.frontendSkill
- speckit.game-embeddedSkill
- speckit.geoSkill
- speckit.identity-accessSkill
- speckit.identitySkill
- speckit.implementSkill
- speckit.mapSkill
- speckit.migrateSkill
- speckit.payment-fintechSkill
- speckit.planSkill
- speckit.quizmeSkill
- speckit.reviewerSkill
- speckit.roadmapSkill
- speckit.securitySkill
- speckit.seoSkill
- speckit.specifySkill
- speckit.sre-observabilitySkill
- speckit.statusSkill
- speckit.tasksSkill
- speckit.taskstoissuesSkill
- speckit.testerSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Read .agents/specs/[feature]/spec.md, plan.md, tasks.md, target engine specs, core gameplay loop definitions, and asset balance …
- Very specific: line 29
Spatial Partitioning: Use Flat TypedArrays (Float32Array, Int32Array) with Grid or QuadTree indexing for broadphase collision detection.
- Very specific: line 32
Externalized Config: All gameplay parameters (HP, Speed, Cooldown, Damage, Drop rates, Wave progression) MUST be defined in …
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Mission
Architect and build high-performance native JavaScript/TypeScript web games running at steady 60-144 FPS. Ensure instant loading (< 2s), zero Garbage Collection spikes via strict Object Pooling, data-driven game balance, hybrid Canvas + DOM HUD architectures, and multi-input responsiveness (touch, gamepad, keyboard).
Inputs and Outputs
- Read
.agents/specs/[feature]/spec.md,plan.md,tasks.md, target engine specs, core gameplay loop definitions, and asset balance configurations. - Produce core engine initialization and scene manager (
src/game/), fixed timestep game loop with object pool managers (src/game/pools/), balance configuration files, hybrid canvas + DOM overlays, and multi-channel Web Audio manager.
Protocol
1. 60 FPS Fixed Game Loop & Timestep Management
- Decoupled Physics & Render:
- Physics/Game State MUST update in a fixed timestep
FixedUpdate(fixedDelta)(e.g. 50Hz / 20ms or 60Hz / 16.6ms). - Rendering updates on every
requestAnimationFrame(time)with state interpolation (lerp) to prevent jitter on high refresh rate monitors (120Hz/144Hz).
- Physics/Game State MUST update in a fixed timestep
- Delta-Time Clamping: Clamp maximum frame delta (e.g.,
Math.min(dt, 0.1)) to avoid physics tunneling or simulation explosions when tabs are backgrounded or during frame drops.
2. Zero-Allocation in Hot Loops (Anti-GC Stutter)
- Object Pooling: Pre-allocate and reuse memory pools for all ephemeral entities:
- Bullets / Projectiles
- Particle Emitters / Explosions
- Floating Damage Numbers / Combat Text
- Enemies & Spawners
Rule: NEVER call
new Object(),new Array(), or allocate closures inside the main tick/update loop.
- Texture Atlases & SpriteSheets: Combine individual sprites into unified texture atlases using TexturePacker to minimize WebGL batch draw calls.
- Spatial Partitioning: Use Flat TypedArrays (
Float32Array,Int32Array) with Grid or QuadTree indexing for broadphase collision detection.
3. Data-Driven Game Design & Balancing
- Externalized Config: All gameplay parameters (HP, Speed, Cooldown, Damage, Drop rates, Wave progression) MUST be defined in
src/config/balance/*.jsonor CSV files. - Type-Safe Validation: Validate balance JSON files at build time / game boot using Zod or TypeScript schemas to catch missing stats or type mismatches immediately.
4. Hybrid UI & Responsive Multi-Resolution
- Rendering Separation:
- Canvas / WebGL: Dedicated exclusively to gameplay entities, map tiles, and in-world visual effects.
- DOM / TailwindCSS Layer (HUD Overlay): Renders vector-sharp UI (Health bars, Skill hotbars, Inventory, Dialog boxes, Leaderboards, Settings).
- Viewport Scaling: Configure logical virtual resolution (e.g.
1280x720or1920x1080) withScale.FIT/Scale.ENVELOPand auto-centering to support mobile portrait, landscape, and desktop ultrawide seamlessly.
5. Web Audio API & Sound Bus Architecture
- Multi-Channel Sound Bus:
[AudioContext] ➔ [Master Gain] ┬➔ [BGM Gain] ├➔ [SFX Gain] (Spatial Audio / PannerNode) └➔ [UI Gain] - Autoplay Policy Handling: Initialize
AudioContextin a suspended state; automatically resume on the first user pointer/touch interaction (pointerdown). - Audio Pooling: Pre-instantiate sound instances to avoid latency and audio glitching during heavy combat SFX.
6. Multi-Input Pipeline
- Input Abstraction Layer: Map abstract actions (
MOVE_UP,MOVE_DOWN,PRIMARY_FIRE,DASH,PAUSE) across:- Keyboard & Mouse
- Virtual Touch Joystick / On-screen Action Buttons (Mobile)
- Gamepad API (Xbox / PlayStation controller with dynamic button glyphs)
Completion Gate
Game loop sustains 60 FPS under simulated peak load, memory profile confirms zero ephemeral allocations in tick loops, balance schemas validate without errors, and audio resumes only after user interaction.
Guard Rails
- FORBIDDEN: Allocating new objects or arrays inside hot update loops (violates 60 FPS zero-allocation rule).
- FORBIDDEN: Hardcoding combat stats, damage multipliers, or enemy attributes in game logic code.
- FORBIDDEN: Triggering un-resumed Web Audio before user interaction (browser console error & silence).
- FORBIDDEN: Using unclamped variable
dtin physics calculation (leads to wall glitching & physics breaking).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

