使用 Instruments/xctrace 分析本机 macOS 或 iOS 应用程序时使用。涵盖正确的二进制选择、CLI 参数、导出和常见问题。
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install instruments-profiling或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install instruments-profiling⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/instruments-profiling/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: instruments-profiling description: Use when profiling native macOS or iOS apps with Instruments/xctrace. Covers correct binary selection, CLI arguments, exports, and common gotchas. metadata: short-description: Instruments profiling for macOS/iOS apps ---
Use this skill when the user wants performance profiling or stack analysis for native apps. Focus: Time Profiler, xctrace CLI, and picking the correct binary/app instance.
xcrun xctrace list templates - xcrun xctrace record --template 'Time Profiler' --time-limit 60s --output /tmp/App.trace --launch -- /path/To/App.app
- Launch app yourself, get PID, then: - xcrun xctrace record --template 'Time Profiler' --time-limit 60s --output /tmp/App.trace --attach
- open -a Instruments /tmp/App.trace
Note: xcrun xctrace --help is not a valid subcommand. Use xcrun xctrace help record.
Gotcha: Instruments may profile the wrong app (e.g., one in /Applications) if LaunchServices resolves a different bundle. Use these rules:
- xcrun xctrace record ... --launch -- /path/App.app/Contents/MacOS/App
.app, ensure it’s the intended bundle: - open -n /path/App.app - Verify with ps -p
/Applications/App.app and a local build exist, explicitly target the local build path.--template 'Time Profiler': template name from xctrace list templates.--launch -- : everything after -- is the target command (binary or app bundle).--attach : attach to running process.--output : .trace output. If omitted, file saved in CWD.--time-limit 60s|5m: set capture duration.--device : required for iOS device runs.--target-stdout -: stream launched process stdout to terminal (useful for CLI tools). - xcrun xctrace export --input /tmp/App.trace --toc
- xcrun xctrace export --input /tmp/App.trace --xpath '/trace-toc/run[@number="1"]/data/table[@schema="time-profile"]' --output /tmp/time-profile.xml
- Hide System Libraries - Invert Call Tree - Separate by Thread - Focus on hot frames and call counts
- Fix: use direct binary path or --attach with known PID.
- Fix: longer capture, trigger workload during recording.
xctrace may need Developer Tools permission.- Fix: System Settings → Privacy & Security → Developer Tools → allow Terminal/Xcode.
time-profile exports are huge.- Fix: filter with XPath and aggregate offline; don’t print to terminal.
xcrun xctrace list devices and --device .xctrace --attach.安装 仪器分析 后,可以对 AI 说这些话来触发它
Help me get started with Instruments Profiling
Explains what Instruments Profiling does, walks through the setup, and runs a quick demo based on your current project
Use Instruments Profiling to use when profiling native macOS or iOS apps with Instruments/xctrace
Invokes Instruments Profiling with the right parameters and returns the result directly in the conversation
What can I do with Instruments Profiling in my developer & devops workflow?
Lists the top use cases for Instruments Profiling, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/instruments-profiling/ 目录(个人级,所有项目可用),或 .claude/skills/instruments-profiling/(项目级)。重启 AI 客户端后,用 /instruments-profiling 主动调用,或让 AI 根据上下文自动发现并使用。
仪器分析 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
仪器分析 可免费安装使用。请查阅仓库了解许可证信息。
使用 Instruments/xctrace 分析本机 macOS 或 iOS 应用程序时使用。涵盖正确的二进制选择、CLI 参数、导出和常见问题。
仪器分析 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my developer & devops tasks using Instruments Profiling
Identifies repetitive steps in your workflow and sets up Instruments Profiling to handle them automatically