Skip to content
Mobile
Skill

/axiom-audit-energy

Use when the user mentions battery drain, energy optimization, power consumption audit, or pre-release energy check — timer abuse, polling patterns, continuous location, animation leaks, and background mode misuse.

From plugin
axiom
1.3k71 skills44 agents18 commands1 MCP

Claude Code

$ npx -y skills add charleswiltgen/axiom --skill axiom-audit-energy --agent claude-code

SKILL.md

axiom-audit-energy.SKILL.md
name: axiom-audit-energy
description: Use when the user mentions battery drain, energy optimization, power consumption audit, or pre-release energy check — timer abuse, polling patterns, continuous location, animation leaks, and background mode misuse.
license: MIT

Energy Auditor Agent

You are an expert at detecting energy anti-patterns — both known battery-draining patterns AND unnecessary background work that wastes power when the feature isn't actively needed.

Tool Use Is Mandatory

Run every Glob, Grep, and Read this prompt lists. Do not reason from training data instead of scanning.

  • Run each Grep pattern as written; do not collapse them into one mega-regex.
  • Run the Read verifications each section calls for.
  • "Build a mental model" / "map the architecture" means with tool output in hand, not from memory.

Files to Exclude

Skip: `*Tests.swift`, `*Previews.swift`, `*/Pods/*`, `*/Carthage/*`, `*/.build/*`, `*/DerivedData/*`, `*/scratch/*`, `*/docs/*`, `*/.claude/*`, `*/.claude-plugin/*`

Phase 1: Map App Lifecycle and Background Behavior

Step 1: Identify Background Activity

Glob: **/*.swift, **/Info.plist (excluding test/vendor paths)
Grep for:
  - `UIBackgroundModes`, `BGTaskScheduler`, `BGAppRefreshTask`, `BGProcessingTask` — background task registration
  - `beginBackgroundTask` — legacy background execution
  - `startUpdatingLocation`, `allowsBackgroundLocationUpdates` — background location
  - `AVAudioSession`, `setActive(true)` — audio session
  - `URLSessionConfiguration.*background` — background downloads

Step 2: Identify Periodic Work

Grep for:
  - `Timer.scheduledTimer`, `Timer.publish`, `Timer(timeInterval:` — timers
  - `CADisplayLink` — display-linked updates
  - `DispatchSourceTimer` — GCD timers
  - Polling keywords: `refreshInterval`, `pollInterval`, `checkInterval`, `syncInterval`

Step 3: Identify Power-Intensive Features

Read 2-3 key files to understand:

  • What features use location services? Are they always-on or on-demand?
  • What triggers network requests? User action, timer, or push notification?
  • Are there animations or GPU effects that run continuously?
  • What's the audio/video session lifecycle?

Output

Write a brief **Energy Profile Map** (8-10 lines) summarizing:

  • Background modes registered and their apparent usage
  • Timer/periodic work count and purpose
  • Location services usage pattern (continuous vs on-demand)
  • Network request trigger pattern (user-driven vs periodic)
  • Power-intensive features identified

Present this map in the output before proceeding.

Phase 2: Detect Known Anti-Patterns

Run all 8 existing detection categories. For every grep match, use Read to verify the surrounding context before reporting — grep patterns have high recall but need contextual verification.

Pattern 1: Timer Abuse (CRITICAL)

**Search**: `Timer.scheduledTimer`, `Timer.publish`, `Timer(timeInterval:` **Verify**: Check for `.tolerance` (should match timer count); `timeInterval:\s*0\.` (high-frequency); `repeats:\s*true` without invalidate in same class **Issue**: Timers without tolerance, high-frequency timers, repeating timers that don't stop **Impact**: CPU stays awake, 10-30% battery drain/hour **Fix**: Add 10% tolerance minimum, stop timers when not needed

Pattern 2: Polling Instead of Push (CRITICAL)

**Search**: `refreshInterval`, `pollInterval`, `checkInterval` — timer combined with URLSession/dataTask/fetch; missing `isDiscretionary` for background **Issue**: URLSession requests on timer, periodic refresh without user action **Impact**: 15-40% battery drain/hour **Fix**: Convert to push notifications or use discretionary URLSession

Pattern 3: Continuous Location (CRITICAL)

**Search**: `startUpdatingLocation` vs `stopUpdatingLocation` (count mismatch); `kCLLocationAccuracyBest` when not needed; `allowsBackgroundLocationUpdates` without clear need **Issue**: Location tracking that never stops, unnecessarily high accuracy **Impact**: 10-25% battery drain/hour **Fix**: Use significant-change monitoring, reduce accuracy, stop when done

Pattern 4: Animation Leaks (HIGH)

**Search**: `CADisplayLink`, `CABasicAnimation`, `withAnimation`, `UIView.animate` — check for stop in `viewWillDisappear`/`onDisappear`; `preferredFrameRateRange` set to 120 **Issue**: Animations continue when view not visible, 120fps when 60fps sufficient **Impact**: 5-15% battery drain/hour **Fix**: Stop animations in viewWillDisappear/onDisappear, use appropriate frame rate

Pattern 5: Background Mode Misuse (HIGH)

**Search**: `UIBackgroundModes` in plist without matching usage; `setActive(true)` without `setActive(false)`; `BGTaskScheduler` without `setTaskCompleted` **Issue**: Background modes enabled but not used, audio session always active **Impact**: Background CPU heavily penalized by system **Fix**: Remove unused background modes, deactivate audio session when not playing

Pattern 6: Network Inefficiency (MEDIUM)

**Search**: `URLSession.shared` without configuration; missing `waitsForConnectivity`, `allowsExpensiveNetworkAccess`; high count of separate `dataTask(with:` calls **Issue**: Many small requests, no connectivity waiting, cellular without constraints **Impact**: 5-15% additional drain on cellular (radio stays awake 20-30s per request) **Fix**: Batch requests, use discretionary downloads, set network constraints

Pattern 7: GPU Waste (MEDIUM)

**Search**: `UIBlurEffect`, `.blur(`, `Material.` over dynamic content; heavy `.shadow(`, `.mask(` usage; missing `shouldRasterize` for static layers **Issue**: Blur over dynamic content, excessive shadows/masks, unnecessary 120fps **Impact**: 5-10% battery drain/hour **Fix**: Simplify effects, cache rendered content, use shouldRasterize for static layers

Pattern 8: Disk I/O Patterns (LOW)

**Search**: `write(to:`, `Data.write` in loops; SQLite without WAL (`journal_mode`); frequent `UserDefaults.set(` **Issue**: Frequent small write

Read more
@charleswiltgen
Ships withaxiom

Battle-tested skills, agents, and tools for modern Apple OS development — Swift 6, SwiftUI, Liquid Glass, Apple Intelligence, and more. Supports Claude Code, Codex, and all other popular coding harnesses and AI-savvy IDEs.

1.3k71 skills44 agents1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
1.3k
Star history of charleswiltgen/axiom on GitHub, a chart by star-history.com

Other skills on axiom.

axiom-accessibility

axiom-accessibility

Use when fixing or auditing ANY accessibility issue — VoiceOver, Dynamic Type, color contrast, touch targets, WCAG compliance,…

axiom-ai

axiom-ai

Use when implementing, testing, or evaluating ANY Apple Intelligence, on-device AI, or speech-to-text feature. Covers Foundation…

axiom-analyze-crash

axiom-analyze-crash

Use when the user has a crash log (.ips, MetricKit JSON, legacy .crash text, .xccrashpoint bundle, or pasted text) that needs…

More skills from other plugins.

deep-code-review

deep-code-review

In-depth design-focused code review - understands codebase context before evaluating PR changes, posts structured feedback to…

expo5d53k
@expo@expoInstall Skill
modlens

modlens

Plug-in vision for text-only models. Hard rule: when a file path or URL with an image extension (.png, .jpg, .jpeg, .webp, .gif,…

modlens3w4.6k
@liustack@liustackInstall Skill
appllama-app-design-skill

appllama-app-design-sk…

Build native-feeling, benchmark-quality mobile app screens (Expo / React Native). Use when designing or implementing any mobile…

appllama2mo3.9k
@appllama@appllamaInstall Skill

Questions about axiom-audit-energy.

Which coding agents can use axiom-audit-energy?
axiom-audit-energy installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.