Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    WebGL Mobile Crash Fix

    1

    Fix three.js and WebGL apps that crash or reload on phones, with tested drop-in TypeScript modules.

    $12

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    WebGL Mobile Crash Fix

    WebGL Mobile Crash Fix

    Example session with this skill installed

    Our three.js globe works on desktop, but on Android it reloads twice right after opening, and on an older iPhone the tab dies after a minute. What is going on?

    • Read your context and instructions
    • Compiled the webgl mobile crash

    Diagnosis — two different causes

    SymptomCauseFix
    Reloads twice on openvite-plugin-pwa autoUpdate: the new service worker activates and the plugin calls location.reload() mid-session. registerSW({ immediate: false }) does not help — it only delays registration.registerType: 'prompt' + assets/swUpdate.ts — the new version takes over on the next visit
    iPhone tab dies after ~1 minGPU memory: 8K textures (~256 MB each) and DPR 3assets/deviceTier.ts: iOS capped at mid tier → 4K textures, DPR ≤ 1.5

    Wiring (app entry)

    const lite = shouldDemote()                 // crashGuard: 2 unclean boots → lite mode
    const tier = lite ? deviceTier({}) : deviceTier()
    renderer.setPixelRatio(tier.maxDpr)
    watchContextLoss(renderer.domElement, { onLost: pause, onRestored: rebuild })
    

    Verified

    • 18 bundled vitest tests pass (tiering, crash guard, reload guard, context loss).
    • Live deploy check (real run on a production three.js site — the symbol lives in a lazy chunk):
    $ scripts/verify-live-bundle.sh https://earth-pulse-rosy.vercel.app "facingMode"
    FOUND "facingMode" in https://earth-pulse-rosy.vercel.app/assets/ArSky-DaB6Lbu0.js
    

    Next: test on a real low-end phone — desktop emulation does not emulate memory limits.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    A web app running perfectly on a workstation but crashing on an iPad or Android phone is a classic memory and resource management failure. This skill provides the diagnostic logic and drop-in TypeScript modules to stop WebGL, Three.js, and heavy PWA graphics from triggering browser reloads or "Aw, Snap" errors on mobile devices. It replaces generic rendering with a tiered resource strategy that respects hardware limits before the crash happens.

    What it does

    • Device tiering Categorizes hardware based on memory and cores to cap texture sizes, DPR, and object counts.
    • Crash guarding Detects repeated unclean boots via localStorage and automatically demotes to a "lite" mode.
    • Reload protection Limits automated recovery reloads to one per minute to prevent Android process loops.
    • PWA stability Reconfigures service worker updates to prevent disruptive mid-session page reloads.
    • Context management Implements required handlers for WebGL context loss and restoration to prevent black screens.

    How it works

    1. Analyze crash context Identify if the failure occurs at initial boot, during heavy mode transitions, or due to PWA service worker conflicts.
    2. Implement tiering Integrate deviceTier.ts to scale graphics quality based on navigator.deviceMemory and hardwareConcurrency.
    3. Deploy guards Add crashGuard.ts and reloadGuard.ts to the app entry point to handle silent OS-level renderer kills.
    4. Verify bundle Use the provided shell script to confirm the fix is actually present in the live CDN bundle and lazy-loaded chunks.

    Frameworks & tools

    TypeScript, Three.js, React-Three-Fiber, Babylon.js, Globe.gl, Vite-plugin-PWA, Vitest, and WebGL.

    Why this beats prompting it yourself

    Generic AI prompts often suggest generic optimizations that don't account for how Safari handles GPU memory or how PWAs trigger reloads. This skill provides tested, zero-dependency logic specifically designed for the edge cases of mobile browser resource limits and service worker lifecycles.

    Use cases

    • Fixing mobile crashes Stop 3D maps or product configurators from crashing on iPhones.
    • PWA deployment Prevent the "double-reload" bug when a new service worker version is detected.
    • Low-end support Automatically scale down assets for budget Android devices without affecting desktop users.

    Known limitations

    navigator.deviceMemory is Chromium-only, so Safari and Firefox fall to the cautious low tier, and the tiering never puts iOS above mid tier. A single view transition that builds too much in one frame still needs staging — the skill explains how, but it is app-specific code.

    deviceMemory is Chromium-only (Safari/Firefox get the cautious tier); iOS is capped at mid tier on purpose. Heavy one-frame transitions need app-specific staging. The service-worker module targets vite-plugin-pwa.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 1 month ago

    Requires

    TypeScript or JavaScript web project
    Bash
    curl
    vitest
    Node.js

    Permissions

    Terminal / Shell
    Network Access
    Read Files
    Write Files

    Read/Write Files: the agent copies the modules from assets/ into your project and wires them in. Terminal + Network Access: scripts/verify-live-bundle.sh downloads your own public site's JavaScript to confirm the fix is deployed.

    Listed1 month ago

    What's inside

    Frequently Asked Questions

    This skill addresses hardware-level resource exhaustion that leads to 'Aw, Snap!' errors, black screens, and the infinite reload loops often triggered by PWA service workers on iOS and Android.

    Yes. The modules only read device capabilities and manage storage, reloads and the canvas context, so they work with three.js, react-three-fiber, Babylon.js, globe.gl or raw WebGL — you apply the returned budgets (texture size, pixel ratio, object count) in your own renderer.

    Five drop-in TypeScript modules — deviceTier, crashGuard, reloadGuard, contextLoss and a vite-plugin-pwa service-worker helper — with 18 vitest tests, the diagnostic workflow in SKILL.md, README.md, and scripts/verify-live-bundle.sh, which checks that your fix is in the deployed bundle including lazy chunks.

    While Safari restricts certain memory reporting APIs, this skill uses a heuristic-based tiering system specifically designed to handle iOS-specific GPU memory caps that generic tools often miss.

    The modules are designed for zero-dependency integration; you simply import the guards at your application's entry point and wrap your rendering logic in the provided tiering function.

    Any agent that reads SKILL.md: Claude Code, Codex, Cursor, Gemini CLI, Hermes Agent and others. The modules are plain TypeScript, so they work with any build setup.

    New in Mobile Development