instruments-profiling
Use when profiling native macOS or iOS apps with Instruments/xctrace. Covers correct binary selection, CLI arguments, exports, and common gotchas.
Best use case
instruments-profiling is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Use when profiling native macOS or iOS apps with Instruments/xctrace. Covers correct binary selection, CLI arguments, exports, and common gotchas.
Teams using instruments-profiling should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/instruments-profiling/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How instruments-profiling Compares
| Feature / Agent | instruments-profiling | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Use when profiling native macOS or iOS apps with Instruments/xctrace. Covers correct binary selection, CLI arguments, exports, and common gotchas.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Instruments Profiling (macOS/iOS) 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. ## Quick Start (CLI) - List templates: `xcrun xctrace list templates` - Record Time Profiler (launch): - `xcrun xctrace record --template 'Time Profiler' --time-limit 60s --output /tmp/App.trace --launch -- /path/To/App.app` - Record Time Profiler (attach): - Launch app yourself, get PID, then: - `xcrun xctrace record --template 'Time Profiler' --time-limit 60s --output /tmp/App.trace --attach <pid>` - Open trace in Instruments: - `open -a Instruments /tmp/App.trace` Note: `xcrun xctrace --help` is not a valid subcommand. Use `xcrun xctrace help record`. ## Picking the Correct Binary (Critical) **Gotcha: Instruments may profile the wrong app** (e.g., one in `/Applications`) if LaunchServices resolves a different bundle. Use these rules: - Prefer direct binary path for deterministic launch: - `xcrun xctrace record ... --launch -- /path/App.app/Contents/MacOS/App` - If launching `.app`, ensure it’s the intended bundle: - `open -n /path/App.app` - Verify with `ps -p <pid> -o comm= -o command=` - If both `/Applications/App.app` and a local build exist, explicitly target the local build path. - After launch, confirm the process path before trusting the trace. ## Command Arguments (xctrace) - `--template 'Time Profiler'`: template name from `xctrace list templates`. - `--launch -- <cmd>`: everything after `--` is the target command (binary or app bundle). - `--attach <pid|name>`: attach to running process. - `--output <path>`: `.trace` output. If omitted, file saved in CWD. - `--time-limit 60s|5m`: set capture duration. - `--device <name|UDID>`: required for iOS device runs. - `--target-stdout -`: stream launched process stdout to terminal (useful for CLI tools). ## Exporting Stacks (CLI) - Inspect trace tables: - `xcrun xctrace export --input /tmp/App.trace --toc` - Export raw time-profile samples: - `xcrun xctrace export --input /tmp/App.trace --xpath '/trace-toc/run[@number="1"]/data/table[@schema="time-profile"]' --output /tmp/time-profile.xml` - Post-process in a script (Python/Rust) to aggregate stacks. ## Instruments UI Workflow - Template: Time Profiler - Use “Record” and capture the slow path (startup vs steady-state) - Call Tree tips: - Hide System Libraries - Invert Call Tree - Separate by Thread - Focus on hot frames and call counts ## Gotchas & Fixes - **Wrong app profiled**: LaunchServices resolves installed app instead of local build. - Fix: use direct binary path or `--attach` with known PID. - **No samples / empty trace**: App exits quickly or never hits work. - Fix: longer capture, trigger workload during recording. - **Privacy prompts**: `xctrace` may need Developer Tools permission. - Fix: System Settings → Privacy & Security → Developer Tools → allow Terminal/Xcode. - **Large XML exports**: `time-profile` exports are huge. - Fix: filter with XPath and aggregate offline; don’t print to terminal. ## iOS Specific Notes - Device: use `xcrun xctrace list devices` and `--device <UDID>`. - Launch via Xcode if needed; attach with `xctrace --attach`. - Ensure debug symbols for meaningful stacks. ## Verification Checklist - Confirm trace process path matches target build. - Confirm stacks show expected app frames. - Capture covers the slow operation (startup/refresh). - Export stacks for automated diffing if optimizing.
Related Skills
rust-profiling
Profile Rust code using samply to identify CPU bottlenecks. Use when performance is slow, before optimizing, or when the user asks to profile.
second-opinion
Run an external LLM code review with Codex CLI, Gemini CLI, or both. Use when the user asks for a second opinion, external review, Codex review, Gemini review, or wants a model-vs-model review of current changes, a branch diff, a specific commit, or a GitHub pull request.
seatbelt-sandboxer
Generates minimal macOS Seatbelt sandbox configurations. Use when sandboxing, isolating, or restricting macOS applications with allowlist-based profiles.
screenshot-analyzer
Find and analyze screenshots from ~/Downloads/Screenshots/ for UI/UX review. Use when asked to look at screenshots, review UI designs, inspect interface errors, analyze layout issues, or examine visual problems. Triggers on "check my latest screenshot", "review my UI", "analyze this screen capture".
save-session
Save AI agent session information for later resumption. Use when: (1) Finishing a work session and want to save progress (2) User says "save session", "remember this session", or "save your session ID" (3) Before ending a long coding/debugging session (4) When user wants to be able to resume this conversation later Supports Claude, Codex, Gemini, Copilot, Cursor, and other AI agents.
ratatui-tui
Build terminal UIs with ratatui following 2026 Rust best practices. Use when: (1) Creating new TUI apps, (2) Adding widgets/layouts, (3) Keyboard navigation/state management, (4) Image integration via ratatui-image, (5) Async event handling, (6) Release optimization. Covers v0.30.0+ API, Elm Architecture, StatefulWidget, color-eyre.
orchestrate
Orchestrate multi-step work with Claude Code CLI as a bounded worker while Codex stays lead developer. Use when Codex should split a task into scoped sub-tasks, delegate planning or implementation to Claude with `claude -p`, run parallel Claude sessions, isolate risky edits in worktrees, define custom Claude subagents, or move repeated enforcement into Claude hooks/settings.
karpathy-guidelines
Behavioral checklist for disciplined LLM coding. Use when starting non-trivial tasks to enforce assumption surfacing, minimal changes, and verifiable goals. Derived from Andrej Karpathy's observations on LLM coding pitfalls.
humanizer
Remove signs of AI-generated writing from text. Use when editing or reviewing text to make it sound more natural and human-written. Based on Wikipedia's comprehensive "Signs of AI writing" guide. Detects and fixes patterns including: inflated symbolism, promotional language, superficial -ing analyses, vague attributions, em dash overuse, rule of three, AI vocabulary words, negative parallelisms, and excessive conjunctive phrases. 30c5c8d (Update humanizer plugin to upstream v2.2.0)
html-artifacts
Produce a single self-contained .html artifact (no build, no external assets) when the task is spatial, interactive, visual, multi-axis, or long-running. Triggers on "build me an HTML for X", "make a dashboard / status snapshot / comparison / decision tree / timeline / architecture map", "render this plan as a clickable site", or when content can't fit markdown structurally. Skips short replies, code-only outputs, simple plans.
handoff
Generate optimized handoff prompts for delegating work to another LLM agent. Use when handing work to GPT-5.x/Codex, Claude 4.x, Gemini 3.x, or Grok 4.x, either as a shared-workspace sub-task handoff or a fresh-context handoff for a new session or model. Triggers on requests like "create a handoff prompt", "delegate this task to another agent", "hand this off", or "prepare context for another agent".
go-performance
Measure and improve Go program performance on modern Go (1.24+). Use when profiling Go code, diagnosing CPU or memory bottlenecks, investigating latency or contention, writing or fixing benchmarks, comparing benchmark results, using pprof or trace data, applying PGO, or tuning hot-path Go code.