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.
npx agentmods add skills/wangjianqi/appstore/14-performance-debugnpx skills add wangjianqi/AppStore --skill 14-performance-debuggit clone --depth 1 https://github.com/wangjianqi/AppStoreWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00040 | $0.02617 |
| Opus 5 | $0.00020 | $0.01308 |
| Sonnet 5 | $0.00008 | $0.00523 |
| Haiku 4.5 | $0.00004 | $0.00262 |
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 3d 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.
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 对比 |
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.
- 3d ago First seen · 291 lines · 40 tokens per session scan A 1f7b379e70d0
performance-debug is a skill published in the GitHub repository wangjianqi/AppStore (10 stars, last pushed 3mo ago), licensed MIT. It adds 40 tokens to every session and 2,617 once invoked, about $0.0002 per session on Opus 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.
Other skills, from other repositories
ipaship-audit
Use when auditing iOS/Android app submissions for compliance with Apple App Store Review Guidelines or Google Play Developer Policies. Scan .ipa, .apk, or .zip files against official store policies, generate structured compliance reports, and identify violations with remediation steps.
view-specifications
Guide for writing view specification documents and a starter template for SwiftUI and cross-platform views.
project-structure
Directory layout, file responsibilities, and Xcode integration for meta-loop projects.
analyzing-ios-app-security-with-objection
Runtime iOS app security testing with Objection (Frida): inspect keychain and filesystem data, explore app internals at runtime, and validate/bypass client-side protections during authorized mobile assessments.
serve-sim
Control and stream a running iOS, iPad, or Apple Watch Simulator with npx serve-sim. Use for simulator preview, taps, gestures, hardware buttons, rotation, camera injection, permissions, accessibility, and CoreAnimation debug.
baguette
Drive iOS simulators programmatically via the baguette CLI — taps, swipes, multi-finger gestures, hardware buttons (Home / Lock / Volume / Action / Power), ASCII keyboard text, and frame capture, all without opening Xcode. Use when: (1) an agent needs to drive a booted iOS simulator from a script — tap a coordinate…