mobile-perf-auditor
Mobile Performance Auditor Protocol
Mobile devices have hard constraints on memory, CPU, and battery. What works fine on a fast developer machine or simulator might cause a crash or severe battery drain on a 4-year-old device. This skill analyzes performance metrics to find the root cause of sluggishness or resource exhaustion.
Core principle: Blaming the user's device is not an option. Find the bottleneck in the code.
Workflow
1. Identify the performance symptom (e.g., slow start, UI stutter, OOM crashes)
2. Determine the context (iOS, Android, React Native, Platform context)
3. Request or analyze profiling data / metrics
4. Correlate metrics with common architectural anti-patterns
5. Propose a targeted, measurable fix
Step 1: Symptom Identification
Categorize the user's complaint:
- Cold Start: Time from tapping the icon to the first meaningful interaction.
- Jank/Stutter: Framerate dropping below 60fps (or 120fps) during scrolling or animations.
- Memory/OOM: Out Of Memory crashes caused by leaks or large resource allocation.
- Battery/Thermal: Phone getting hot or draining battery due to non-stop background work or GPU overwork.
- Bundle Size: App takes too long to download or exceeds over-the-air limits.
Step 2: Contextualize
Understand the environment:
- Is this native (Swift/Kotlin) or cross-platform (React Native/Flutter)?
- Is the issue happening on all devices or specific older models?
Step 3: Analyze Profiling Data
Ask for or analyze existing data from:
- iOS: Xcode Instruments (Time Profiler, Leaks, Allocations), MetricKit.
- Android: Android Studio Profiler (CPU, Memory, Network), Perfetto.
- Cross-Platform: React Native Performance Monitor, Flipper, Flutter DevTools.
Step 4: Diagnosis
Identify common culprits based on data:
- Cold start slow? Heavy synchronous work on the main thread, parsing large JSON files on mount, instantiating too many singletons.
- Scrolling jank? Re-rendering heavy lists, calculating layout inside
onScroll, heavy image decoding on the UI thread. - Memory leaks? Retain cycles (iOS/Swift closures), forgotten listeners (Android contexts), large image caches not being cleared on memory warnings.
Step 5: Actionable Mitigation
Provide a specific code-level or architecture-level fix. "Optimize your images" is not acceptable. "Use downsampling during image decode via BitmapFactory.Options.inSampleSize before loading into memory" is acceptable.
Output Format
# ⚡ Performance Audit Report
**Symptom:** [e.g., UI Scroll Jank on Android]
**Environment:** [e.g., React Native 0.72, Low-end Android devices]
## 🔍 Root Cause Analysis
Based on the provided metrics/context, the bottleneck appears to be:
[Detailed explanation of WHY this is happening. E.g., The JS thread is blocked during scroll because `setState` is being called excessively in the `onScroll` handler, causing a drop below 60FPS.]
## 🛠 Actionable Fix
### Fix 1: [Name of the fix, e.g., Debounce Scroll Events / Use Reanimated]
- **Current Pattern:** [What they are doing wrong]
- **Proposed Pattern:** [What they should do]
- **Code Example (if applicable):**
```javascript
// Optimized code snippet
Fix 2: [Secondary fix or long-term architecture change]
[Explanation]
📏 Measurement Strategy
How to verify this worked: [E.g., "Run the React Native Performance Monitor. You should see the JS thread maintain 60FPS during aggressive scrolling, and the UI frame time should drop below 16ms."]
---
## When to Skip
- The user is asking about network API response times (that is backend latency, not mobile client performance).
- The user is asking about web browser performance (use a web/Lighthouse skill).
---
## Guardrails
- **Main Thread Rule:** Always prioritize freeing up the Main/UI thread. Never suggest solutions that move heavy work back to the main thread.
- **No Silver Bullets:** Do not blindly recommend caching or memoization without proving that re-computation is actually the bottleneck. Over-memoizing causes memory issues.
---
## References
See `references/EXAMPLES.md` for a worked case.
---
## 🔗 Next Steps & Handoffs
If you are executing the **Pre-Release Audit Flow** as defined in the Mobile ECOSYSTEM guide, and this performance audit passes, the next mandatory skill in the sequence is:
- `@mobile-security-auditor`
If you are executing the **Post-Launch Monitoring Flow** and have successfully optimized the app based on a crash/jank report, the flow concludes here or hands back to:
- `@crash-analyst` (to verify the fix in the next release)
More from fatih-developer/fth-skills
task-decomposer
Break down large, complex, or ambiguous tasks into independent subtasks with dependency maps, execution order, and success criteria. Plan first, then execute step by step. Triggers on 'how should I do this', 'where do I start', 'plan the project', 'break it down', 'implement' or whenever a task involves multiple phases.
24context-compressor
Compress long conversation histories, large code files, research results, and documents by 70% without losing critical information. Triggers when context window fills up, when summarizing previous steps in multi-step tasks, before loading large files into context, or on 'summarize', 'compress', 'reduce context', 'save tokens'.
18multi-brain-debate
Two-round debate protocol where perspectives challenge each other before consensus. Round 1 presents independent positions, Round 2 allows counter-arguments and rebuttals. Produces battle-tested decisions for high-stakes choices.
17multi-brain-score
Confidence scoring overlay for multi-brain decisions. Each perspective rates its own confidence (1-10) with justification. Consensus uses scores as weights, flags low-confidence areas, and surfaces uncertainty explicitly.
15checkpoint-guardian
Automatic risk assessment before every critical action in agentic workflows. Detects irreversible operations (file deletion, database writes, deployments, payments), classifies risk level, and requires confirmation before proceeding. Triggers on destructive keywords like deploy, delete, send, publish, update database, process payment.
14parallel-planner
Analyze multi-step tasks to identify which steps can run in parallel, build dependency graphs, detect conflicts (write-write, read-write, resource contention), and produce optimized execution plans. Triggers on 3+ independent steps, 'speed up', 'run simultaneously', 'parallelize', 'optimize' or any task where sequential execution wastes time.
14