ablevarghese/ios-claude-toolkit/prometheus-performance

Claude Code and agent skill by ablevarghese/ios-claude-toolkit

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

App is slow, takes too long to load, freezing, laggy, battery drain, memory leak. iOS performance profiling and optimization — launch time, memory analysis, retain cycles, CPU profiling, frame rate. Trigger on: 'why is this screen slow', 'app uses too much memory', 'scrolling is janky', 'UI is unresponsive', 'profile with Instruments', 'energy usage is high', 'app got killed in background', or any complaint about speed, responsiveness, or resource usage. For performance crashes (OOM, watchdog) appearing in Sentry, start with sentry-find-bugs.

Install

npx vskill@latest install ablevarghese/ios-claude-toolkit/prometheus-performance

SKILL.md

The same SKILL.md was published earlier as ablevarghese/ios-claude-toolkit/prometheus-performance.

Performance Optimization & Profiling

Iron Law: "Measure before optimizing. Premature optimization without profiling data is guessing."
Project Discovery: Before executing, determine project-specific values (project name, scheme, bundle ID, target) from project configuration files (CLAUDE.md, project.yml, .xcodeproj, Package.swift).

Profile app launch time, analyze memory usage, detect retain cycles, optimize CPU and main thread performance, and enforce performance thresholds. Target: sub-second response times, < 3s cold launch, < 100MB memory footprint.


Rationalizations (Do Not Skip)

RationalizationWhy It's WrongRequired Action
"The app feels fast enough"Human perception adapts. Users notice degradation relative to other apps, not absolute speed. A 200ms delay feels fine until a competitor does it in 50ms.Measure with Instruments. Compare against thresholds, not feelings.
"Users won't notice"Users notice 100ms+ delays subconsciously. Apple reports that every 100ms of launch time improvement increases user retention.Profile the actual user-facing latency. Even "unnoticeable" delays compound.
"We'll optimize later"Performance debt compounds faster than tech debt. A slow screen with 3 callers becomes a slow screen with 30 callers, and now the fix requires rearchitecting.Set performance budgets at feature inception. Measure during development, not after.
"It's only slow on old devices"Old devices are real users' devices. iPhone SE, iPad Air 2, and 3-year-old phones are a significant portion of the install base.Test on the oldest supported device. Optimize for the floor, not the ceiling.
"The profiler is too complex to learn"Instruments has steep learning curve but is the only way to identify real bottlenecks. Guessing which code is slow is wrong more often than right.See references/instruments-guide.md for step-by-step workflows. Start with Time Profiler.
"It's a debug build, of course it's slow"Debug builds have different characteristics but can still reveal algorithmic problems, N+1 queries, and main thread violations.Profile release builds for final measurements. Use debug builds to find structural issues.
"Adding a cache will fix it"Caches add complexity, stale data bugs, and memory pressure. The real question is: why is the operation slow in the first place?Profile first. Fix the root cause. Add caching only if the operation is inherently expensive AND frequently repeated.

Red Flags -- HARD STOP

These are not warnings. Each is a BLOCKING condition that prevents further progress until addressed.

  • BLOCKED: Optimizing without profiling data -- if you haven't run Instruments or measured with concrete numbers, you're guessing. STOP. The bottleneck is rarely where you think it is. Run Instruments first (see references/instruments-guide.md).
  • BLOCKED: Optimizing the wrong layer -- CPU optimization when the bottleneck is network latency. Memory optimization when the bottleneck is main thread blocking. STOP. Match the solution to the MEASURED problem, not the assumed one.
  • BLOCKED: Ignoring memory growth over time -- a 10MB/minute memory leak is invisible in a 2-minute test session but crashes the app after 20 minutes of real usage. STOP. Profile memory over an extended session.
  • BLOCKED: Main thread blocking for any I/O, network, or crypto operation -- this causes visible UI freezes and watchdog kills. There are zero acceptable exceptions. STOP. Move to background immediately.
  • BLOCKED: Adding `DispatchQueue.main.async` without understanding why -- this is often a band-aid for a deeper architectural problem. STOP. Understand the threading model before dispatching. Document why the dispatch is needed.
  • BLOCKED: Cargo-culting `.lazy` or `LazyVStack` without measuring -- lazy views add complexity and can cause their own performance issues (cell reuse bugs, state management). STOP. Measure BEFORE and AFTER to confirm they help.

When NOT to Use This Skill

  • The performance issue is actually a crash -- if the app crashes from OOM or watchdog timeout and appears in Sentry, start with sentry-find-bugs to analyze the crash, then return here for optimization.
  • Security review of performance-related code -- if the concern is whether a caching layer introduces security issues, use cipher-security or trailofbits-differential-review.
  • The code hasn't been written yet -- performance optimization applies to existing code. For new features, design with performance budgets in mind but don't optimize prematurely.
  • The bottleneck is server-side -- if profiling shows the client is waiting on API responses, the optimization needs to happen on the backend, not in the iOS app.

Behavioral Enforcement

Phase Gate: MEASUREMENT (Before ANY Optimization)

Cannot propose ANY optimization until:

  • [ ] Current performance MEASURED (not assumed)
  • [ ] Bottleneck IDENTIFIED with profiling data (not guessed)
  • [ ] Baseline metrics recorded (so improvement can be verified)

Hard Stop: If about to optimize without profiling data -- STOP. You are guessing. Premature optimization based on intuition wastes time optimizing the wrong thing. Run Instruments (see references/instruments-guide.md) first.

Counter: Optimization #1 didn't improve the metric? Understand why before #2. At #3 -- question whether you identified the right bottleneck. Re-profile.

Phase Gate: VERIFICATION (After Optimization)

Cannot declare optimization complete until:

  • [ ] Performance re-measured with same methodology as baseline
  • [ ] Improvement quantified: "Before: X, After: Y, Delta: Z"
  • [ ] No regressions in other metrics (faster but uses 10x memory = not an optimization)

Required evidence: Before/after numbers. "It feels faster" is not evidence.

Counter-Based Escalation
  • Optimization #1: Normal. Implement, measure, verify.
  • Optimization #2: Pause. Why didn't #1 achieve the target? Write down what you learned. Is the bottleneck where you think it is?
  • Optimization #3: STOP. Re-profile from scratch. You may be optimizing the wrong thing. Consider: is this an architectural issue that can't be solved with local optimization?
  • Still not meeting target after #3: ESCALATE to human partner with: baseline measurements, optimizations tried, measurements after each attempt, current profile data.

Decision Framework

User reports performance issue
|
+-- What's the symptom?
|
+-- APP LAUNCH IS SLOW (> 3s cold)
| +-- Profile with App Launch template (see references/instruments-guide.md)
| +-- Pre-main time high (> 1s)?
| | +-- Too many dylibs? Reduce dynamic frameworks, use static linking
| | +-- Too many ObjC classes? Reduce +load methods, lazy initialization
| +-- Post-main time high?
| +-- Heavy work in didFinishLaunching? Defer non-critical initialization
| +-- Synchronous network calls? Make async, show skeleton UI
| +-- Core Data migration? Run in background with progress indicator
|
+-- SCREEN LOADS SLOWLY (> 500ms)
| +-- Profile with Time Profiler
| +-- Main thread blocked?
| | +-- Move computation to background actor/queue
| | +-- Use async/await for data loading
| +-- Too many views?
| | +-- Use LazyVStack/LazyHStack (measure first)
| | +-- Reduce view hierarchy depth
| +-- Heavy image loading?
| +-- Downsample images to display size (see references/optimization-cookbook.md)
| +-- Use AsyncImage with placeholder
|
+-- SCROLLING IS JANKY (< 60 FPS)
| +-- Profile with Time Profiler, check main thread
| +-- Cell configuration expensive?
| | +-- Precompute values in ViewModel
| | +-- Cache formatted strings, attributed text
| +-- Images not sized correctly?
| | +-- Downsample to cell size
| | +-- Use thumbnail cache
| +-- Shadows, corner radius, transparency?
| +-- Rasterize layers that don't change
| +-- Use pre-rendered shadow images
|
+-- MEMORY KEEPS GROWING
| +-- Profile with Allocations or Leaks template
| +-- Retain cycle?
| | +-- Check closures for [weak self]
| | +-- Check delegate references
| | +-- Use Debug Memory Graph in Xcode
| +-- Large allocations?
| | +-- Image buffers not released?
| | +-- Data buffers growing unbounded?
| +-- Persistent growth without leaks?
| +-- Cache not bounded?
| +-- Notification observers not removed?
| +-- Timer not invalidated?
|
+-- APP USES TOO MUCH ENERGY
| +-- Profile with Energy Log template
| +-- Excessive location updates?
| +-- Background networking too frequent?
| +-- Timer-based polling? (Use push notifications instead)
| +-- CPU work during idle? (Reduce timer frequency, use reactive patterns)
|
+-- NETWORK IS SLOW
+-- Profile with Network template
+-- Too many sequential requests?
| +-- Use TaskGroup for parallel requests
+-- Large payloads?
| +-- Paginate, compress, reduce response size
+-- Missing caching?
+-- Configure URLCache
+-- Implement conditional requests (ETags, If-Modified-Since)

Performance Thresholds

MetricTargetAcceptableCriticalHow to Measure
Cold Launch< 2s< 3s> 5sInstruments App Launch template
Warm Launch< 500ms< 1s> 2sInstruments App Launch template
Screen Load< 300ms< 500ms> 1sTime Profiler + signpost markers
API Response< 200ms< 500ms> 1sNetwork template + URLSession metrics
Memory Usage< 80MB< 100MB> 200MBAllocations template
Frame Rate60 FPS45 FPS< 30 FPSCore Animation template
Time to Interactive< 1s< 2s> 3sCustom signpost markers
Image Load< 100ms< 200ms> 500msTime Profiler
Energy ImpactLowMediumHighEnergy Log template
Setting Performance Budgets

For each screen, define a budget BEFORE development:

Screen: Transaction History
- Load time budget: 300ms (fetch + decode + render)
- Memory budget: 20MB (including image cache)
- Frame rate budget: 60 FPS during scroll
- Network budget: 1 request for initial load, pagination for scroll
Breakdown:
- API fetch: 150ms
- JSON decode: 30ms
- View model mapping: 20ms
- View rendering: 100ms

Standard Operating Procedures

SOP-1: Profile App Launch

See references/instruments-guide.md for detailed step-by-step Instruments workflows.

bash
# Use Xcode Instruments (substitute actual device UDID)
xcrun xctrace record --device <device-udid> \
--template 'App Launch' \
--launch {BUNDLE_ID} \
--output launch_profile.trace
# Analyze results
xcrun xctrace export --input launch_profile.trace --output launch_data
SOP-2: Memory Analysis
swift
// In-app memory tracking
#if DEBUG
func reportMemoryUsage() {
var info = mach_task_basic_info()
var count = mach_msg_type_number_t(MemoryLayout<mach_task_basic_info>.size)/4
let result = withUnsafeMutablePointer(to: &info) {
$0.withMemoryRebound(to: integer_t.self, capacity: 1) {
task_info(mach_task_self_, task_flavor_t(MACH_TASK_BASIC_INFO), $0, &count)
}
}
if result == KERN_SUCCESS {
let memoryMB = info.resident_size / 1024 / 1024
logger.debug("memory_usage", ["resident_mb": memoryMB])
}
}
#endif
SOP-3: Detect Retain Cycles
swift
// Common retain cycle patterns to watch for:
// PATTERN 1: Closures capturing self strongly
// BAD -- strong reference cycle if closure is stored
class ViewModel: ObservableObject {
var onUpdate: (() -> Void)?
func setup() {
onUpdate = { self.refresh() } // Retains self
}
}

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/ablevarghese/ios-claude-toolkit/prometheus-performance/badge)](https://verified-skill.com/skills/ablevarghese/ios-claude-toolkit/prometheus-performance)

Something wrong with this skill or its page? Tell us.