/microscope:profile-run [what to run] [cpu|wall|alloc|lock]from microscope
Records a JFR or async-profiler trace of a benchmark, test, or application, then imports it into Jeffrey Microscope for analysis. Use when profiling something not yet recorded or when choosing profiler settings per JDK version.
Ships in microscope. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Every other skill here starts from a recording that already exists. This one starts from a command
that does not have a recording yet, and ends where analyze-jfr begins.
Requested scope: $ARGUMENTS — what to run, and optionally what to look for. Empty means ask, or
infer from the repository if a benchmark or a test is the obvious thing to profile.
Tool names below omit the prefix your client puts in front of them — mcp__plugin_microscope_jeffrey__ in Claude Code with the microscope plugin, mcp__jeffrey__ in Codex or wherever the server is registered by hand as jeffrey, mcp_jeffrey_ in Gemini CLI; the rest of the name is exact camelCase.
Profiling costs minutes and, for a load test, may touch things outside this machine. Name the command and the recording it will produce, then run it.
Look for the target in this order: a benchmark the user named; a JMH harness (jmh-tests,
*Benchmark.java); the test task; an entry point with a main. If none is obvious, ask — profiling
the wrong workload produces a real recording of an irrelevant thing, which is worse than no recording
because it looks like an answer.
JFR is the default, because it needs nothing installed and every jvm_ tool reads it:
-XX:StartFlightRecording=settings=profile,filename=/absolute/path/run.jfr,dumponexit=true
settings=profile rather than default: it samples allocations twice as often (300/s against 150/s)
and records lock waits from 10 ms rather than 20 ms (compilations from 100 ms rather than 1 s), so
short waits that default drops show up. Socket and file waits follow the lock thresholds on JDK 21;
JDK 25 records them from 1 ms under both, throttled to 300/s under profile against 100/s. Pass the flag through whatever the build uses — Maven's
-DargLine=, Gradle's jvmArgs, JMH's -jvmArgsAppend, or JAVA_TOOL_OPTIONS for an application
started by a script.
Add these when the question calls for them:
settings=profile. jdk.ObjectAllocationSample is what
flamegraph_export graphs with useWeight: true.-agentpath:/path/libasyncProfiler.so=start,event=wall,jfr,file=/absolute/path/run.jfr.jdk.JavaMonitorEnter and jdk.ThreadPark are in settings=profile, but
threshold-gated at 10 ms. Lower it with a custom .jfc when contention is short and frequent.jdk.JavaExceptionThrow is off in both default and profile, and
a recording counts throwables but cannot name them. JDK 25 turns it on but throttles it (300/s under
profile, 100/s under default), so the throws it names are a sample. When the question is about
what was thrown, add jdk.JavaExceptionThrow#enabled=true,jdk.JavaExceptionThrow#throttle=off to the
-XX:StartFlightRecording options: it records every throw on either (JDK 17 or later; a JDK
without the throttle, such as 21, warns that throttle does not exist and ignores it). Between the
two, the JDK's own lib/jfr/profile.jfc says which applies.jdk.MethodTiming#filter=com.example.Repository::count
to the -XX:StartFlightRecording options — invocation count and average, minimum and maximum duration
per method — or jdk.MethodTrace#filter=… for every invocation with its stack. The filter names a class
and method (Class::method), a whole class, or an annotation (@jakarta.ws.rs.GET); keep it to the
methods asked about, since every call is instrumented.-prof jfr gives one recording per
benchmark rather than one for the whole fork.Record long enough to be worth reading. A run of a few seconds produces a few hundred samples, and a flamegraph of a few hundred samples is noise with a shape. Aim for a minute of steady state, after warm-up. For a JIT-sensitive benchmark, discard the first iterations rather than profiling them — they measure the interpreter.
The file has to land where Jeffrey can open it, not merely where you can: same machine, absolute path. If Jeffrey runs in a container, write into a mounted directory.
Say which source ran. Add -Dgit.commit=$(git rev-parse HEAD) to the same JVM options, so the
recording names its commit wherever it is read later, and note whether git status --porcelain
printed anything — a build of uncommitted changes is not the commit it names.
recordings_analyzeFile(path="/absolute/path/run.jfr", force=true, commit="<git rev-parse HEAD>", dirty=<true when git status --porcelain printed anything>)
force=true because this file was just written: a run recorded to the same path as an earlier one
often has the same name and a size Jeffrey already knows, and without it the import hands back the
old profile instead of this run. commit and dirty go with it so profiles_get can tell every
later reader whether their checkout is the code that ran.
A small recording comes back with a profileId. A large one comes back with a status of RUNNING
and an operationId — no recordingId yet, because the copy may still be in flight — and
operations_status(operationId) follows it until the profileId appears. Poll that rather than
calling again. operations_cancel(operationId) stops an import that pointed at the wrong file. The ids live for an hour in Jeffrey's memory.
Then hand off: the analyze-jfr skill has the families, the entry sequence and the flamegraph
choice per question. Start with profiles_summary — it reports what the recording actually captured,
which is the first thing to check after a run you configured yourself. An empty jdk.ObjectAllocationSample
means the settings did not take, and that is a fact about step 2 rather than about the application.
The point of recording rather than reading an old profile is that you can do it twice. After a change, record again the same way and use compare-jfr: it weighs the two against each other and, first of all, says whether they are comparable. Two runs of different lengths, or one warm and one cold, are not — and a comparison that ignores that reports a regression that is really a difference in method.
Keep the profiles named so the pair is obvious later: pass name to recordings_analyzeFile.
Whenever a reply names something Microscope can open — the profile, a flamegraph, an operation, a
trace, an endpoint, a statement group, a GC, JIT or thread page, a heap class or object, a
differential, a catalogue row, a ledger entry — make the name a Markdown link marked with ↗:
[trace 7e34c5994dc96208 ↗](<its uiLink>), and in a table a column of [↗ open](<its uiLink>).
Every link carries the mark — every profile named too, the analysed one and its baseline alike, and
a page named in passing ("the exceptions page"), a profile named under Not assessed or Open
leads, and a figure's source given as the page it was read off ([slowest traces ↗](<its uiLink>)) — the
links most often left bare: [checkout candidate ↗](<its uiLink>) — and never the bare URL. The ↗ is what makes it a link the
user sees: a terminal that renders links shows the text alone, clickable, with the URL behind it,
and an unmarked name reads as plain words. That holds in every reply, not only in a written report:
a finding, a ranked list, a follow-up offer, a sentence in passing. Before you send a reply, check
it: every ]( closes a link text that holds ↗.
uiLink — a trace, an
operation, an exemplar — links with that one; otherwise the answer's uiLink is the page that
shows the row. Quote the uiLinkNote beside it when there is one.profiles_viewLink, one cheap call; the profile itself → profiles_link.[GC page ↗](<its uiLink>) — and
a tool stays in backticks beside it, plain. A tool you did not call — a follow-up on offer, a check under
Not assessed — is named that way and not linked at all: `jvm_safepoints` alone, never
[`jvm_safepoints`](<a link>) and never the profile's own link in place of a page you have no link for.Related skills: analyze-jfr for reading what this produced, compare-jfr for before and after,
optimize-code to turn a hotspot into a change in this repository.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
13 skills in this plugin
/analyze-connectorFinds and analyses JVM recordings that live on the connector (the recording volume on an Azure file share, or in a local directory) rather than in a file the user has — the JFR recordings, heap dumps, application logs, GC logs and crash files a deployed application produced. Use whenever the user asks about what an environment recorded or wrote rather than about a file they have: production, staging, a named service, "the last hour", "since the deploy", "what the connector has", "why was prod slow this morning", "why did the pod's JVM die", "the exceptions in the service log". It locates the session, asks which interval matters, pulls in that part of the recording — or the one file that matters — and hands off to analyze-jfr or analyze-heap, or reads the log itself. For a recording file already on this machine, analyze-jfr applies directly./analyze-exceptionsAnalyses the exceptions an application threw in a Jeffrey profile and traces each one to the code in the current repository that caused it — separates the application's throws (libraries included, so timeouts and connection resets stay) from the JVM's own class-loading and linking noise, finds where the application's code entered each throw, reads that source and recommends the smallest fix. Use whenever the user asks to analyse the exceptions or errors of an application, service or recording, why an application throws so much, what an exception storm or a burst of timeouts in a profile is caused by, whether exceptions are used as control flow, or names an exception class seen in a JFR recording or Microscope's Exceptions page./analyze-heapAnalyses a heap dump held by a running Jeffrey Microscope — what is holding the memory, what is leaking, which class loader survived a redeploy, where the waste is — starting from the catalogue or from a .hprof file Jeffrey has not seen yet. Use whenever the user asks what is holding memory, why the heap keeps growing, why the JVM ran out of memory, what is leaking, or mentions retained size, a dominator tree, GC roots, a heap dump or an .hprof file./analyze-jfrAnalyses a JVM profile held by a running Jeffrey Microscope — CPU, wall-clock, allocation, lock contention, trace latency, and the machine underneath: garbage collection, safepoints, JIT compilation, threads, native memory, the container and the JVM's configuration. Starts from the catalogue or from a .jfr file Jeffrey has not seen yet. Use whenever the user asks why something is slow, where the time goes, what is allocating, why GC pauses are long, what is pausing the JVM, what the JIT compiler or deoptimisation is doing, which threads are burning CPU, why memory grows outside the heap, whether the container is throttling, what a JFR recording or flamegraph shows, or mentions a Jeffrey profile, a .jfr file or async-profiler output. For a heap dump or .hprof file, analyze-heap applies instead./code-insightAnswers questions about the code in the current repository from a Jeffrey profile, asked by the names in the source - whether a method or class is hot, who calls it at runtime, which of its lines the time goes to, what it calls into, which exceptions are thrown under it, which requests run it, which of the repository's own methods a profile's cost is charged to, which lines issue a SQL statement or call and how often one request does (N+1), and what the application did at runtime - its operations, statements, attributes and own events - tied back to the code. Use whenever the user asks about the runtime behaviour of code they are reading or editing - "is this method hot", "who calls this in production", "what does this class cost", "which endpoint runs this", "where does our code spend its time", "which line issues this query", "is there an N+1", "what does this service actually do at runtime" - and a profile of that code exists or can be recorded./compare-jfrCompares two JVM profiles held by a running Jeffrey Microscope — a before and an after — using differential flamegraphs, to answer whether a change made the application slower, faster, or allocate more. Use whenever the user asks if a change regressed performance, what got slower or faster between two runs, to compare two recordings, benchmarks or branches, or mentions a baseline, a before/after or a performance regression. For a single profile, analyze-jfr applies instead; for a heap dump, analyze-heap.npx claudepluginhub petrbouda/jeffrey --plugin microscopeOther plugins' skills for the same job