Skip to content

Guide · Agent skill

How to use the Instruments Profiling agent skill

Updated · written with AI from the project's own documentation and checked against our catalogue data

The instruments-profiling skill teaches an AI agent to measure where a native Mac or iPhone app spends its time, using Apple's Instruments through the command-line xctrace tool. This guide explains what the skill does, how to install it, how to ask for profiling in plain language, and what to check so you can trust the results. You need a Mac with Xcode; the skill does not run on other platforms.

Instruments Profilingsteipete/agent-scripts · MIT

Quick start

  1. 1Download and unzip the skill. Download the ZIP from this page and unzip it so the instruments-profiling folder with SKILL.md sits in ~/.claude/skills/ or a project's .claude/skills/ folder.
  2. 2Check your Mac setup. Confirm Xcode is installed and allow Terminal or Xcode under System Settings → Privacy & Security → Developer Tools.
  3. 3Prepare the build. Have a built app binary or bundle ready, ideally with debug symbols, and know its exact path.
  4. 4Ask for a profile. Describe the slow behavior and the app location in plain language, for example startup of your local build.
  5. 5Let the agent record. The agent launches the app or attaches to its PID and records a Time Profiler trace for the time limit you set.
  6. 6Verify the process. Check that the profiled process path matches your target build before trusting the results.
  7. 7Review the summary. Read the hot functions and call paths the agent exports, and rerun the capture after your change to compare.

What the skill makes the agent do

Once installed, the agent knows how to start a Time Profiler recording, either by launching your app or by attaching to a process that is already running. It records to a .trace file, exports the recorded call stacks, and summarizes the slowest code paths.

The skill also covers common mistakes, such as profiling the wrong copy of an app or getting an empty trace, and tells the agent how to check for them.

  • Records Time Profiler traces with xcrun xctrace
  • Launches an app binary or attaches to a running PID
  • Exports call stacks from the trace for analysis
  • Checks that the profiled process is the build you intended

Install the instruments-profiling skill

Download the skill ZIP from this page and unzip it. The skill is a folder containing a SKILL.md file. Put that folder in one of these locations:

Personal skills folder: ~/.claude/skills/ (available to all your projects).

Project folder: .claude/skills/ inside your project (available only to that project).

You can also upload the ZIP in the Claude apps under Settings → Capabilities → Skills.

  • Option A: unzip into ~/.claude/skills/
  • Option B: unzip into a project's .claude/skills/ folder
  • Option C: upload the ZIP in Settings → Capabilities → Skills

Set up macOS, Xcode and permissions

The skill needs macOS with Xcode, which provides the xcrun and xctrace tools. Your app must exist as a built binary or bundle. Debug symbols are recommended so the stacks show readable function names.

xctrace may need permission to run. Go to System Settings → Privacy & Security → Developer Tools and allow Terminal or Xcode. For iOS, you need a connected device, identified by name or UDID.

  • macOS with Xcode installed
  • Terminal or Xcode allowed under Developer Tools permission
  • A built app binary or bundle
  • Debug symbols (recommended)
  • For iOS: a connected device identified by name or UDID

Trigger the skill with natural requests

You do not need to name the skill or any commands. Describe the performance problem and point the agent at your build. The skill applies when you ask for profiling or stack analysis of a native app.

Be specific about the slow behavior (startup, a button press, scrolling) and the app's location. The more precise you are, the more useful the capture will be.

  • "Profile the startup of my local build at ./build/MyApp.app and tell me the top hot functions."
  • "Attach to the running MyApp process and record 60 seconds of Time Profiler data while I scroll the list."
  • "Record a Time Profiler trace of my iPhone app and summarize the slowest call paths."

Record a Time Profiler trace

To launch an app and record it, the agent runs xctrace with the Time Profiler template, a time limit, an output path and the target after --. To attach to a running app, launch it yourself, get its PID, and use --attach instead. The skill lists the templates available on your machine first, and it uses xctrace help record for flag details because xctrace --help is not a valid subcommand.

To open the result in the Instruments app, the agent runs open -a Instruments on the .trace file.

  • Launch: record with --launch -- /path/To/App.app
  • Attach: record with --attach <pid>
  • Open the result: open -a Instruments /tmp/App.trace
xcrun xctrace record --template 'Time Profiler' --time-limit 60s --output /tmp/App.trace --launch -- /path/To/App.app

Make sure you profile the right build

The main gotcha is that Instruments can profile the wrong app, for example an installed copy in /Applications, when LaunchServices resolves a different bundle. The skill tells the agent to prefer the direct binary path for a predictable launch, and to explicitly target your local build if both exist.

After launch, the agent should confirm the process path before trusting the trace. Checking the process with ps is the recommended way to do this.

  • Prefer the direct binary path, e.g. /path/App.app/Contents/MacOS/App
  • If you launch a .app, open it with open -n and verify with ps -p <pid> -o comm= -o command=
  • If both /Applications/App.app and a local build exist, target the local build path
ps -p <pid> -o comm= -o command=

Export stacks and analyze them

The skill can export the trace's tables and then the raw time-profile samples. First it lists the tables with --toc, then exports a specific table with an XPath query. Time-profile exports can be very large, so the skill filters them and aggregates the data in a script (Python or Rust are mentioned) rather than printing it to the terminal.

Exported stacks can be compared between runs, which helps when you are checking whether a change made things faster.

  • List tables with --toc
  • Export time-profile samples with an XPath filter and --output
  • Aggregate stacks in a script instead of printing the XML
xcrun xctrace export --input /tmp/App.trace --toc

Use the Instruments UI and fix common problems

If you prefer the visual tool, the skill suggests the Time Profiler template, recording the slow path (startup or steady-state), and call tree options such as Hide System Libraries, Invert Call Tree, Separate by Thread, and focusing on hot frames and call counts.

If a trace is empty, the app probably exited quickly or never reached the slow work. Record for longer and trigger the workload while recording. For iOS, the skill notes to use xcrun xctrace list devices to find the device and --device <UDID> for device runs.

  • Empty trace: record longer and trigger the work during the capture
  • Wrong app: use the direct binary path or --attach with a known PID
  • Permission prompt: allow Terminal or Xcode under Developer Tools
  • Missing function names: build with debug symbols
xcrun xctrace list devices

What people use it for

  • Diagnosing slow app startup by recording from launch to first usable screen
  • Finding which functions dominate CPU time during a sluggish interaction like scrolling
  • Attaching to a running macOS app to profile a live problem without restarting it
  • Profiling a connected iPhone app by device name or UDID
  • Exporting stacks from repeated captures to compare performance across changes

Frequently asked questions

How do I install the instruments-profiling skill?

Download the ZIP from this page and unzip it into ~/.claude/skills/ for personal use, or into a project's .claude/skills/ folder. You can also upload the ZIP in the Claude apps under Settings → Capabilities → Skills.

What do I need to use this skill?

You need a Mac with Xcode, which provides xcrun and xctrace, plus a built app binary or bundle. Terminal or Xcode must be allowed under Developer Tools in System Settings, and debug symbols are recommended for readable stacks.

Does the skill work on Windows, Linux or Android?

No. xctrace and Instruments only run on macOS, and the skill does not cover web, Android or cross-platform performance work.

Does the skill run scripts or use the network?

The skill runs scripts, because it executes xcrun and xctrace commands and can post-process exports in a script. It does not use the network. Profiling attaches to live processes and reads their execution data, so only use it on apps you own or have permission to inspect.

Why is my trace empty or showing the wrong app?

An empty trace usually means the app exited quickly or never reached the slow work, so record longer and trigger the workload during capture. Wrong-app traces happen when LaunchServices resolves a different copy, so launch the direct binary path or attach with a known PID and confirm the process path.

Can I profile an iPhone with this skill?

Yes. Find the device with xcrun xctrace list devices and pass it with --device using its name or UDID. The skill also notes that you may need to launch the app via Xcode and attach with xctrace.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

This skill suits Mac and iOS developers who want an agent to run Instruments Time Profiler captures and interpret the call stacks instead of clicking through the UI. It is not suitable without a Mac and Xcode, for non-Apple platforms, or for profiling apps you do not own or have permission to inspect.

Download the skill