battery-optimization

battery-optimization is a skill for Claude Code from bullish0x/GameStudio. It costs 19 tokens per session (4,820 once invoked), scanned A, original, MIT.

A set of techniques for reducing how much power a mobile game uses. It adjusts rendering quality and background activity based on battery and device heat.

In plain words
What is it for?
Use it to adapt graphics quality, reduce updates when a game is inactive, pause background rendering, and manage thermal throttling.
Why use it?
It helps games use less battery and respond to low-power or overheating conditions without running at full cost all the time.

Skill for Claude Code

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

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/bullish0x/gamestudio/battery-optimization
Any agent
npx skills add bullish0x/GameStudio --skill battery-optimization
Clone the repo
git clone --depth 1 https://github.com/bullish0x/GameStudio

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 battery-optimization

README.md
[![agentmods](https://agentmods.dev/badge/skills/bullish0x/gamestudio/battery-optimization.svg)](https://agentmods.dev/skills/bullish0x/gamestudio/battery-optimization)
Your own site
<a href="https://agentmods.dev/skills/bullish0x/gamestudio/battery-optimization"><img src="https://agentmods.dev/badge/skills/bullish0x/gamestudio/battery-optimization.svg" alt="Measured on agentmods" height="20"></a>
Per session 19 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,820 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00019 $0.04820
Opus 5 $0.00010 $0.02410
Sonnet 5 $0.00004 $0.00964
Haiku 4.5 $0.00002 $0.00482

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

Security

Grade A, and why

battery-optimization 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 2d 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/battery-optimization/SKILL.md · 835 lines

How it starts

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

Mobile Battery Optimization

When to Use

Use this skill when:

  • Optimizing for mobile battery life
  • Implementing adaptive quality systems
  • Managing background behavior
  • Reducing power consumption
  • Handling device thermal throttling
  • Creating power-efficient games

Core Principles

  1. Adaptive Quality: Scale based on power state
  2. Intelligent Throttling: Reduce updates when inactive
  3. Background Pause: Stop rendering when hidden
  4. Thermal Management: Detect and respond to heat
  5. Power Awareness: Monitor battery state
  6. Efficient Rendering: Minimize GPU/CPU usage

Battery Optimization Implementation

1. Power State Management

// power/PowerStateManager.ts
export enum PowerState {
  High = 'high', // Plugged in, full quality
  Normal = 'normal', // Good battery, normal quality
  Low = 'low', // Low battery, reduced quality
  Critical = 'critical', // Very low battery, minimal quality
}

export interface PowerMetrics {
  batteryLevel: number; // 0-1
  isCharging: boolean;
  isSaveModeEnabled: boolean;
  temperature?: number; // Device temperature if available
}

export class PowerStateManager {
  private state: PowerState = PowerState.Normal;
  private metrics: PowerMetrics = {
    batteryLevel: 1,
    isCharging: false,
    isSaveModeEnabled: false,
  };

  private listeners = new Set<(state: PowerState) => void>();

  constructor() {
    this.initBatteryAPI();
    this.initVisibilityAPI();
  }

  private async initBatteryAPI(): Promise<void> {
    if ('getBattery' in navigator) {
      try {
        const battery = await (navigator as any).getBattery();

        // Initial state
        this.updateMetrics({
          batteryLevel: battery.level,
          isCharging: battery.charging,
        });

        // Listen for changes
        battery.addEventListener('levelchange', () => {
          this.updateMetrics({ batteryLevel: battery.level });
        });

        battery.addEventListener('chargingchange', () => {
          this.updateMetrics({ isCharging: battery.charging });
        });
      } catch (error) {
        console.warn('Battery API not available:', error);
      }
    }
  }

  private initVisibilityAPI(): void {
    document.addEventListener('visibilitychange', () => {
      if (document.hidden) {
        this.onBackgrounded();
      } else {
        this.onForegrounded();
      }
    });
  }

  private updateMetrics(partial: Partial<PowerMetrics>): void {
    Object.assign(this.metrics, partial);
    this.updatePowerState();
  }

  private updatePowerState(): void {
    const newState = this.calculatePowerState();

    if (newState !== this.state) {
      this.state = newState;
      this.notifyListeners();
    }
  }

  private calculatePowerState(): PowerState {
    // Charging = high performance
    if (this.metrics.isCharging) {
      return PowerState.High;
    }

    // Battery-based states
    if (this.metrics.batteryLevel < 0.1) {
      return PowerState.Critical;
    } else if (this.metrics.batteryLevel < 0.2) {
      return PowerState.Low;
    } else {
      return PowerState.Normal;
    }
  }

  private notifyListeners(): void {
    for (const listener of this.listeners) {
      listener(this.state);
    }
  }

  private onBackgrounded(): void {
    // Notify listeners that app is backgrounded
    for (const listener of this.listeners) {
      listener(PowerState.Critical); // Treat as critical to pause everything
    }
  }

  private onForegrounded(): void {
    // Resume normal power state
    this.updatePowerState();
  }

  getPowerState(): PowerState {
    return this.state;
  }

  getMetrics(): PowerMetrics {
    return { ...this.metrics };
  }

  onStateChange(listener: (state: PowerState) => void): () => void {
    this.listeners.add(listener);
    return () => this.listeners.delete(listener);
  }
}

Read the full file on GitHub · 835 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. 2d ago First seen · 835 lines · 19 tokens per session scan A f8bb1961c6b0

Subscribe to this mod's changes

battery-optimization is a skill published in the GitHub repository bullish0x/GameStudio (10 stars, last pushed 2mo ago), licensed MIT. It adds 19 tokens to every session and 4,820 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.