performance-debug

performance-debug is a skill for Claude Code, Codex from wangjianqi/AppStore. It costs 40 tokens per session (2,617 once invoked), scanned A, original, MIT.

A guide to finding and fixing performance problems in iOS apps, including slow startup, memory leaks, large app downloads, interface pauses, and battery use. It covers Apple’s Instruments profiling tool and performance measurements.

In plain words
What is it for?
Use it to investigate startup time, CPU usage, memory growth, leaks, network and database delays, dropped frames, main-thread pauses, app size, and battery consumption.
Why use it?
It gives developers a structured way to identify what makes an app slow, memory-hungry, or unresponsive. It also explains which Instruments templates and checks fit each problem.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to investigate startup time, CPU usage, memory growth, leaks, network and database delays, dropped frames, main-thread pauses, app size, and battery consumption.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/wangjianqi/appstore/14-performance-debug
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.

Any agent
npx skills add wangjianqi/AppStore --skill 14-performance-debug
Clone the repo
git clone --depth 1 https://github.com/wangjianqi/AppStore

Made for: Claude Code, Codex.

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 performance-debug

README.md
[![agentmods](https://agentmods.dev/badge/skills/wangjianqi/appstore/14-performance-debug/github.svg)](https://agentmods.dev/skills/wangjianqi/appstore/14-performance-debug)
Your own site
<a href="https://agentmods.dev/skills/wangjianqi/appstore/14-performance-debug"><img src="https://agentmods.dev/badge/skills/wangjianqi/appstore/14-performance-debug/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for performance-debug

Your own site · 80×15
<a href="https://agentmods.dev/skills/wangjianqi/appstore/14-performance-debug"><img src="https://agentmods.dev/badge/skills/wangjianqi/appstore/14-performance-debug.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,617 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00040 $0.02617
Opus 5.5 $0.00016 $0.01047
Sonnet 5.5 $0.00008 $0.00523
Haiku 4.5 $0.00004 $0.00262

Measured 1mo ago against content hash 1f7b379e70d0, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

performance-debug 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 1mo 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.

ios-claude-skills/14-performance-debug/SKILL.md · 291 lines

How it starts

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

性能优化与调试

性能指标基准

指标 目标值 超标影响
冷启动时间 < 400ms(首屏可交互) 用户流失
热启动时间 < 200ms 体验差
帧率 稳定 60fps(Pro 120fps) 卡顿感
内存占用 < 200MB(常规 App) 系统杀进程
包体积 < 50MB(下载大小) 下载转化率低
ANR(主线程卡顿) > 700ms 即需优化 审核风险

Instruments 使用

常用模板

模板 用途 何时使用
Time Profiler CPU 热点分析 启动慢、操作卡顿
Allocations 内存分配追踪 内存持续增长
Leaks 内存泄漏检测 退出页面后内存不降
Network 网络请求分析 请求慢、流量大
Core Data CoreData 查询性能 数据库操作慢
Hangs 主线程卡顿检测 UI 卡顿

Time Profiler 使用要点

  • 使用 Release 配置(Debug 模式优化被禁用,数据不准)
  • 关注 Self Time(自身耗时),而非 Total Time(含子调用)
  • 系统库调用(UIKit 等)通常无法优化,聚焦业务代码
  • Call Tree 选项:勾选 "Invert Call Tree" + "Hide System Libraries"

Leaks 检测

  • 退出页面后等 10 秒再检查,部分释放是延迟的
  • 常见泄漏源:closure 未用 [weak self]、delegate 声明为 strong、Timer 未 invalidate
  • Instruments Leaks 只能检测循环引用,单边泄漏用 Allocations 的 Mark Generation 对比

启动优化

启动阶段分析

pre-main 阶段(系统加载)
  → dylib loading(动态库加载)
  → rebase/binding(地址修正)
  → ObjC setup(运行时初始化)
  → initializer(+load 和 C++ 构造函数)

post-main 阶段(App 代码)
  → AppDelegate.didFinishLaunching
  → SceneDelegate.sceneDidBecomeActive
  → 首屏渲染完成

pre-main 优化

  • 减少动态库数量:合并小库,目标 < 6 个非系统动态库
  • 移除 +load 方法:改用 +initialize 或 dispatch_once
  • 减少 __attribute__((constructor)):延迟到使用时初始化
  • 检查命令:DYLD_PRINT_STATISTICS=1 打印 pre-main 各阶段耗时

post-main 优化

  • didFinishLaunching 只做必须的初始化(SDK 配置、权限检查)
  • 非首屏功能延迟初始化:登录模块在进入登录页时才初始化
  • 首屏数据预加载:在 willFinishLaunching 阶段发起网络请求
  • 首屏渲染优化:减少 VC 层级,避免嵌套滚动视图

启动耗时测量

func application(_ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    let start = ProcessInfo.processInfo.systemUptime
    DispatchQueue.main.async {
        let elapsed = ProcessInfo.processInfo.systemUptime - start
        print("首帧渲染耗时: \(elapsed * 1000)ms")
    }
    return true
}

内存优化

常见内存问题

问题 症状 排查方式
循环引用 退出页面内存不降 Instruments Leaks
缓存无上限 内存持续增长 Allocations Mark Generation
大图片未压缩 峰值内存飙升 Allocations 按大小排序
定时器未释放 后台持续占用 Leaks + Call Tree
单例持有数据 退出登录内存不降 Allocations 对比

Read the full file on GitHub · 291 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. 1mo ago First seen · 291 lines · 40 tokens per session scan A 1f7b379e70d0

Subscribe to this mod's changes

performance-debug is a skill published in the GitHub repository wangjianqi/AppStore (17 stars, last pushed 4mo ago), licensed MIT. It adds 40 tokens to every session and 2,617 once invoked, about $0.0002 per session on Opus 5.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-08-31.

Related

Other skills, from other repositories

argent-metro-debugger

Debug a JS runtime via CDP using argent debugger tools. Primary path is React Native via Metro (iOS / Android / Vega); a subset of the tools (debugger-connect, debugger-status, debugger-evaluate, debugger-log-registry) also drive a Chromium (CDP) app's renderer (an Electron app, or any Chromium browser exposing CDP)…

software-mansion/argent · 104 tokens

argent-react-native-optimization

Optimizes a React Native app by profiling first to find real bottlenecks, then sweeping for mechanical issues. Entry-point for all performance work. Use when the app feels slow, user asks to optimize, fix re-renders, reduce jank, or improve startup. Delegates to argent-react-native-profiler for measurement.

software-mansion/argent · 71 tokens

argent-native-profiler

Native profiling for CPU hotspots, UI hangs, memory issues. iOS via xctrace; Android via Perfetto. Use when diagnosing native-level performance issues.

software-mansion/argent · 37 tokens

igf

Use Grapefruit's CLI for platform-specific mobile app inspection and managed captures. Query persisted evidence through the REST API. Use Frida directly for custom scripts and generic runtime primitives.

ChiChou/grapefruit · 38 tokens

spm-build-analysis

Analyze Swift Package Manager dependencies, package plugins, module variants, and CI-oriented build overhead that slow Xcode builds. Use when a developer suspects packages, plugins, or dependency graph shape are hurting clean or incremental build performance, mentions SPM slowness, package resolution time, build…

AvdLee/Xcode-Build-Optimization-Agent-Skill · 87 tokens

maui-performance

Fix measurable MAUI performance issues. USE FOR: maui profile startup, Release/physical-device measurements, janky CollectionView, compiled bindings, oversized images, MauiImage BaseSize, thumbnail decoding, trim/NativeAOT regressions, IL2026, source-generated serializers, linker validation. DO NOT USE FOR: generic UI…

dotnet/maui-labs · 85 tokens