r3f-mobile-patterns

r3f-mobile-patterns is a skill for Claude Code from bullish0x/GameStudio. It costs 26 tokens per session (5,291 once invoked), scanned A, original, MIT.

A guide to building mobile 3D games with React Three Fiber, including touch input, device adaptation, battery use, and layouts that respond to screen size and orientation.

In plain words
What is it for?
Use it to add touch controls, adjust visual quality by device, reduce battery use, and support portrait and landscape layouts.
Why use it?
It addresses problems that appear when a 3D game designed for desktop must work across phones, tablets, and devices with different capabilities.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: installed under .agents/ (shared by several agents).

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { useDeviceCapabilities } from '../hooks/useDeviceCapabilities';.

Good fit Use it to add touch controls, adjust visual quality by device, reduce battery use, and support portrait and landscape layouts.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/bullish0x/GameStudio
agentmods
npx agentmods add skills/bullish0x/gamestudio/r3f-mobile-patterns

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for r3f-mobile-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/bullish0x/gamestudio/r3f-mobile-patterns/github.svg)](https://agentmods.dev/skills/bullish0x/gamestudio/r3f-mobile-patterns)
Your own site
<a href="https://agentmods.dev/skills/bullish0x/gamestudio/r3f-mobile-patterns"><img src="https://agentmods.dev/badge/skills/bullish0x/gamestudio/r3f-mobile-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for r3f-mobile-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/bullish0x/gamestudio/r3f-mobile-patterns"><img src="https://agentmods.dev/badge/skills/bullish0x/gamestudio/r3f-mobile-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 26 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,291 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00026 $0.05291
Opus 5 $0.00013 $0.02645
Sonnet 5 $0.00005 $0.01058
Haiku 4.5 $0.00003 $0.00529

Measured 6d ago against content hash e26900f7cc6a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

r3f-mobile-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/r3f-mobile-patterns/SKILL.md · 789 lines

How it starts

The opening of the file, as written. The whole thing — 789 lines — stays where its author put it; the contents beside it link to each section on GitHub.

React Three Fiber Mobile Patterns

When to Use

Use this skill when:

  • Building mobile-first R3F games
  • Implementing touch-based 3D controls
  • Adapting quality for mobile devices
  • Optimizing battery life
  • Creating responsive 3D layouts

Core Principles

  1. Mobile First: Design for mobile, enhance for desktop
  2. Touch Optimized: Gestures over mouse events
  3. Adaptive Quality: Scale based on device capabilities
  4. Battery Aware: Reduce work when battery is low
  5. Responsive: Adapt to screen size and orientation
  6. Progressive Enhancement: Core experience on all devices

Implementation

1. Device Detection Hook

// hooks/useDeviceCapabilities.ts
import { useState, useEffect } from 'react';

export interface DeviceCapabilities {
  isMobile: boolean;
  isTablet: boolean;
  isLowEnd: boolean;
  hasTouchScreen: boolean;
  pixelRatio: number;
  gpuTier: 'low' | 'medium' | 'high';
  maxTextureSize: number;
  screenWidth: number;
  screenHeight: number;
  orientation: 'portrait' | 'landscape';
  batteryLevel?: number;
  isCharging?: boolean;
}

export function useDeviceCapabilities(): DeviceCapabilities {
  const [capabilities, setCapabilities] = useState<DeviceCapabilities>(() => ({
    isMobile: /iPhone|iPad|iPod|Android/i.test(navigator.userAgent),
    isTablet: /iPad|Android/i.test(navigator.userAgent) && window.innerWidth >= 768,
    isLowEnd: navigator.hardwareConcurrency ? navigator.hardwareConcurrency <= 4 : true,
    hasTouchScreen: 'ontouchstart' in window || navigator.maxTouchPoints > 0,
    pixelRatio: Math.min(window.devicePixelRatio || 1, 2),
    gpuTier: 'medium',
    maxTextureSize: 2048,
    screenWidth: window.innerWidth,
    screenHeight: window.innerHeight,
    orientation: window.innerWidth > window.innerHeight ? 'landscape' : 'portrait',
  }));

  useEffect(() => {
    // Detect GPU tier (simplified)
    const canvas = document.createElement('canvas');
    const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');

    if (gl) {
      const debugInfo = gl.getExtension('WEBGL_debug_renderer_info');
      const renderer = debugInfo
        ? gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL)
        : '';

      const maxTexSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);

      let gpuTier: 'low' | 'medium' | 'high' = 'medium';

      if (/Mali-4|Adreno \(TM\) 3|PowerVR SGX/i.test(renderer)) {
        gpuTier = 'low';
      } else if (/Apple A1[2-9]|Adreno \(TM\) [67]|Mali-G7/i.test(renderer)) {
        gpuTier = 'high';
      }

      setCapabilities((prev) => ({
        ...prev,
        gpuTier,
        maxTextureSize: maxTexSize,
      }));
    }

    // Battery API
    if ('getBattery' in navigator) {
      (navigator as any).getBattery().then((battery: any) => {
        const updateBattery = () => {
          setCapabilities((prev) => ({
            ...prev,
            batteryLevel: battery.level,
            isCharging: battery.charging,
          }));
        };

        updateBattery();
        battery.addEventListener('levelchange', updateBattery);
        battery.addEventListener('chargingchange', updateBattery);
      });
    }

    // Orientation changes
    const handleResize = () => {
      setCapabilities((prev) => ({
        ...prev,
        screenWidth: window.innerWidth,
        screenHeight: window.innerHeight,
        orientation: window.innerWidth > window.innerHeight ? 'landscape' : 'portrait',
      }));
    };

    window.addEventListener('resize', handleResize);
    window.addEventListener('orientationchange', handleResize);

    return () => {
      window.removeEventListener('resize', handleResize);
      window.removeEventListener('orientationchange', handleResize);
    };
  }, []);

  return capabilities;
}

Read the full file on GitHub · 789 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 789 lines · 26 tokens per session scan A e26900f7cc6a

Subscribe to this mod's changes

r3f-mobile-patterns is a skill published in the GitHub repository bullish0x/GameStudio (11 stars, last pushed 2mo ago), licensed MIT. It adds 26 tokens to every session and 5,291 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.