This skill should be used when the user asks to "monitor performance", "detect memory leaks", "track frame rate", "profile network requests", "measure launch time", "optimize battery usage", or needs guidance on iOS performance monitoring and optimization.
From ios-dev-toolkitnpx claudepluginhub nbkm8y5/claude-plugins --plugin ios-dev-toolkitThis skill uses the workspace's default tool permissions.
references/integration_guide.mdreferences/performance_patterns.mdscripts/generate_launch_time_analyzer.pyscripts/generate_memory_profiler.pyscripts/generate_network_profiler.pySearches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Guides implementation of event-driven hooks in Claude Code plugins using prompt-based validation and bash commands for PreToolUse, Stop, and session events.
Generate comprehensive performance monitoring infrastructure for iOS applications.
Use this skill when you need to:
This skill generates 6 production-ready Swift files (~1,500 lines total):
All files include:
# Generate memory profiler (MemoryProfiler + FrameRateMonitor)
python3 scripts/generate_memory_profiler.py ./Sources/Performance
# Generate network profiler (NetworkProfiler + BatteryMonitor)
python3 scripts/generate_network_profiler.py ./Sources/Performance
# Generate launch analyzer (LaunchTimeAnalyzer + PerformanceDashboard)
python3 scripts/generate_launch_time_analyzer.py ./Sources/Performance
Drag the generated files into your Xcode project and ensure they're added to your app target.
@main
struct MyApp: App {
init() {
// Start all performance monitoring
PerformanceDashboard.shared.startMonitoring()
// Mark launch phases
LaunchTimeAnalyzer.shared.markPhase(.appInitialization)
}
var body: some Scene {
WindowGroup {
ContentView()
.onAppear {
LaunchTimeAnalyzer.shared.markPhase(.firstFrame)
}
}
}
}
Monitor memory usage and detect leaks:
// Start monitoring
MemoryProfiler.shared.startMonitoring()
// Track objects for leak detection
MemoryProfiler.shared.track(self, identifier: "MyViewController")
// Get current memory usage
let currentMB = MemoryProfiler.shared.currentMemoryUsage()
// Detect leaks
let leaks = MemoryProfiler.shared.detectLeaks()
// Generate report
let report = MemoryProfiler.shared.generateReport()
print(report.formatted())
Track FPS and detect frame drops:
// Start monitoring
FrameRateMonitor.shared.startMonitoring()
// Set callbacks
FrameRateMonitor.shared.onFrameDrop = { fps in
print("Frame drop: \(fps) FPS")
}
// Get current FPS
let fps = FrameRateMonitor.shared.currentFPS()
// Generate report
let report = FrameRateMonitor.shared.generateReport()
Profile network requests:
// Start monitoring
NetworkProfiler.shared.startMonitoring()
// Track a request
let identifier = UUID().uuidString
NetworkProfiler.shared.trackRequestStart(request, identifier: identifier)
// Track completion
NetworkProfiler.shared.trackRequestCompletion(
identifier: identifier,
response: response,
data: data,
error: error
)
// Get statistics
let stats = NetworkProfiler.shared.getStatistics()
Track battery usage:
// Start monitoring
BatteryMonitor.shared.startMonitoring()
// Get battery info
let level = BatteryMonitor.shared.currentBatteryLevel()
let drainRate = BatteryMonitor.shared.estimateDrainRate()
// Generate report
let report = BatteryMonitor.shared.generateReport()
Measure app launch time:
// Mark launch phases
LaunchTimeAnalyzer.shared.markPhase(.appInitialization)
LaunchTimeAnalyzer.shared.markPhase(.dataLoading)
LaunchTimeAnalyzer.shared.markPhase(.uiSetup)
LaunchTimeAnalyzer.shared.markPhase(.firstFrame)
// Get total launch time
let launchTime = LaunchTimeAnalyzer.shared.totalLaunchTime()
// Generate report with phase breakdown
let report = LaunchTimeAnalyzer.shared.generateReport()
Unified monitoring:
// Start all monitoring
PerformanceDashboard.shared.startMonitoring()
// Get quick snapshot
let snapshot = PerformanceDashboard.shared.getSnapshot()
// Generate comprehensive report
let report = PerformanceDashboard.shared.generateComprehensiveReport()
print(report.formatted())
For detailed patterns and integration guides, read the reference files:
Load these files when you need detailed implementation guidance or integration examples.
All profilers support configuration:
// Memory profiler
MemoryProfiler.shared.snapshotInterval = 5.0
MemoryProfiler.shared.warningThresholdMB = 100
MemoryProfiler.shared.criticalThresholdMB = 200
// Frame rate monitor
FrameRateMonitor.shared.targetFPS = 60.0
FrameRateMonitor.shared.warningThreshold = 55.0
// Network profiler
NetworkProfiler.shared.slowRequestThreshold = 2.0
NetworkProfiler.shared.largeResponseThreshold = 1_000_000
// Battery monitor
BatteryMonitor.shared.sampleInterval = 10.0
// Launch time analyzer
LaunchTimeAnalyzer.shared.slowLaunchThreshold = 2.0
Set performance budgets to ensure quality:
struct PerformanceBudget {
static let maxMemoryMB: Double = 150
static let minFPS: Double = 55
static let maxLaunchTimeS: Double = 1.0
static let maxRequestTimeS: Double = 2.0
static let maxBatteryDrainPerHour: Double = 10.0
}
Add performance tests to your test suite:
func testMemoryUsage() {
MemoryProfiler.shared.startMonitoring()
performOperations()
let report = MemoryProfiler.shared.generateReport()
XCTAssertEqual(report.status, .healthy)
XCTAssertLessThan(report.statistics.current, 150.0)
}
func testLaunchTime() {
let report = LaunchTimeAnalyzer.shared.generateReport()
XCTAssertLessThan(report.statistics.averageLaunchTime, 1.0)
}
Enable monitoring conditionally in production:
#if DEBUG
PerformanceDashboard.shared.startMonitoring()
#else
// Enable for 1% of users
if UserDefaults.standard.bool(forKey: "performanceMonitoringEnabled") {
PerformanceDashboard.shared.startMonitoring()
}
#endif
This skill integrates with: