The Perfetto AI skill is a skill for coding agents such as Claude Code, Codex, OpenCode, Antigravity and Cursor. Point your agent at a trace and ask questions in plain English: it loads the trace into trace_processor, writes the PerfettoSQL and reports what it found. It can also record traces and follow guided workflows for Android memory and GPU analysis. The skill bundles trace_processor, so there is nothing else to install.
Pick your agent. The skill is published to the ai-agents branch with each Perfetto release.
/plugin marketplace add google/perfetto@ai-agents /plugin install perfetto@perfetto
Update through /plugin, which pulls the latest ai-agents branch.
codex plugin marketplace add google/perfetto --ref ai-agents
Then install the perfetto plugin from Codex's plugin list.
Add to opencode.json:
"skills": { "urls": ["https://raw.githubusercontent.com/google/perfetto/ai-agents/plugins/perfetto/skills"] }
The URL always serves the latest published skill.
Use the installer, which needs Python 3:
# macOS / Linux: into an agent's default directory curl -fsSL https://get.perfetto.dev/agents-install | python3 - --agent <claude|codex|opencode|antigravity|pi> # macOS / Linux: into any skills directory, e.g. one committed to your repo curl -fsSL https://get.perfetto.dev/agents-install | python3 - --target <path>
# Windows (use curl.exe, not the PowerShell curl alias) curl.exe -fsSL https://get.perfetto.dev/agents-install | python - --target <path>
Re-run the same command to update. Pass --version vX.Y to pin a release.
Each GitHub release carries a perfetto-ai-skill.zip. Unzip it into your agent's skills directory, for example .claude/skills/. See the offline install docs for seeding the trace_processor cache on a machine with no network.
Offline installs, updating and more are covered in the docs.
Mention a trace file and ask your question:
> Investigate object retention and potential leaks in heap_dump.pftrace.
No trace yet? Let the agent record one:
> Record a Java heap dump of com.example.app from my connected device and find what is keeping memory alive.
You do not need to mention the skill: the agent picks it up whenever the conversation involves a trace or a performance problem. In Claude Code you can also invoke it explicitly with /perfetto:perfetto.
Guided workflows for leaks, OOMs, churn and allocation hot paths.
> Investigate object retention and potential leaks in heap_dump.pftrace. > Why does com.example.app's Java heap keep growing? Compare before.pftrace and after.pftrace. > Analyze native heap allocations and find memory growth hot paths in native_heap.pftrace. > Which code paths allocate the most short-lived objects in java_alloc.pftrace? > Here are 40 heap dumps of com.example.app in ~/dumps/. Cluster them and find the common root causes.
Any question you could answer with PerfettoSQL.
> Load ~/traces/startup.pftrace and tell me which threads used the most CPU in the first two seconds. > Why is app startup slow in startup.pftrace? Break down the main thread. > Find the top causes of uninterruptible sleep for com.example.myapp in trace.pftrace. > Which frames were janky in jank.pftrace and what was the UI thread doing?
Traces from a connected Android device or the local Linux machine.
> Record a 10 second trace of com.example.app starting up on my connected device, then tell me what took the longest.
Is the workload GPU-bound or host-bound, and why. Counter support is deepest for NVIDIA/CUDA today.
> Is this workload GPU-bound or host-bound? The trace is at game.pftrace. > The GPU looks busy but the workload is slow. Was the clock throttled or slow to ramp in gpu.pftrace? > Which kernels dominate this CUDA trace, and are they compute-bound or memory-bound?
trace_processor, bundled inside the skill as a wrapper that downloads the matching prebuilt on first use.SKILL.md) whose description is what makes the agent reach for the skill at all. It names symptoms and file types (slow startup, jank, ANRs, memory growth, GPU, .pftrace, systrace, Chrome JSON) rather than just “Perfetto”, because users describe problems, not tools. The body is short: setup, then “which of these is your situation”, each pointing at one file.workflows/<domain>/*.md) for investigations we know how to do well: Android Java heap dumps, native heap profiles, allocation churn, GPU busy/idle decomposition, frequency residency, compute kernel analysis. Each is a runbook that runs shipped SQL or Python scripts and tells the agent how to read the result.infra-references/querying.md) for everything else: how to keep a trace loaded across many queries, how to discover tables and the SQL standard library instead of guessing, which modules answer the common questions, and a short list of PerfettoSQL rules of thumb.See CONTRIBUTING.md for how the skill is designed, how to change it and how it ships.