需要 macOS 桌面应用性能分析?见 macOS-Trace。
基于 xctrace 与 Xcode Instruments 的 iOS / iPadOS 自主闭环性能优化引擎。让 AI 编码 Agent(Claude Code、OpenAI Codex、Cursor、Google Antigravity、GitHub Copilot)无需手动操作 Instruments GUI,即可完成:目标对齐 → 无头采样诊断 → 定位瓶颈 → 精准改码 → 复测量化 → 未达标自动迭代。
- 宿主:macOS 12+,完整 Xcode 或 Xcode 命令行工具(
xcrun xctrace version)。 - 目标:iOS/iPadOS App(真机或模拟器)。真机需解锁并信任此 Mac、出现在
== Devices ==列表;调试/开发签名(get-task-allow)用于--attach。 - Python:3.8+(仅标准库,零第三方依赖)。
npx skills add kmgcc/iOS-Trace加 -g 全局安装(所有项目可用),或 -a claude-code -g 指定单个 Agent。
| Agent | 项目级 | 用户级全局 |
|---|---|---|
| Claude Code | .claude/skills/ios-trace |
~/.claude/skills/ios-trace |
| OpenAI Codex | .agents/skills/ios-trace |
~/.codex/skills/ios-trace |
| Cursor | .agents/skills/ios-trace |
~/.cursor/skills/ios-trace |
| OpenCode | .agents/skills/ios-trace |
~/.config/opencode/skills/ios-trace |
| 其他 Agent | .agents/skills/ios-trace |
~/.agents/skills/ios-trace |
git clone https://github.com/kmgcc/iOS-Trace.git ~/.claude/skills/ios-trace安装后,Agent 会根据 description 里的触发条件自动匹配,或直接要求"用 iOS-Trace 优化 XX"。核心运行示例:
SKILL_DIR="$HOME/.claude/skills/ios-trace"
"$SKILL_DIR/scripts/run_trace.sh" --bundle-id "com.example.MyApp" --template power --duration 60s --label "01-baseline"
python3 "$SKILL_DIR/scripts/compare_elements.py" /tmp/ios-traces/01-baseline-power.xml:"Idle" /tmp/ios-traces/02-active-power.xml:"Active"SKILL.md— 核心行为指令:目标对齐、执行规则、4 阶段闭环协议。references/templates.md— Instruments 模板选择(哪种瓶颈用哪个模板)。references/subsystems.md— 各子系统调优知识(射频/ProMotion/媒体解码/音频)。references/workload-reproduction.md— 负载如何复现(Tier 0–3,含模拟器边界)。references/device-commands.md— 真机devicectl/xctrace命令、iOS 版本模板限制、进程匹配与脚本复制规则。
- 能耗/发热/CPU Impact 指标(Power Profiler)模拟器不支持,必须真机。
- Power Profiler 要求 iOS 26+;更低版本真机请用 Time Profiler(热点归属)+ Activity Monitor(每进程 CPU ms/s)组合,见
references/device-commands.md。 - 模拟器 xctrace 录制可能不稳定,批量跑多轮 trace 用真机更可靠。
- 模拟器结果不能代表真机功耗/发热/GPU 行为;模拟器只适合 CPU 热点与逻辑问题的快速定位。
- 需要
--attach的进程必须为 debug/开发签名构建。 - 本 Skill 是测量与调优闭环;若需"AI 自动操作手机复现场景",见
references/workload-reproduction.md。
MIT License。见 LICENSE。