/microscope:analyze-exceptions [application | profile-id | recording-file] [exception-class]from microscope
Analyzes JFR profile exceptions from Jeffrey/Microscope, traces each throw to the repository source code that caused it, and recommends fixes. Separates application throws from JVM noise.
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.
Exceptions are a cost and a symptom at once. Constructing one walks the whole stack, so a type thrown in a loop shows up nowhere in a flamegraph as itself — and a burst of timeouts is a dependency failing, which no CPU profile names. Jeffrey reads the throw events; this checkout holds the code that threw them. This skill joins the two: it takes the application's throws from the profile, finds the line of this repository that led to each one, reads it, and recommends what to change — then, only when asked, changes it.
Requested scope: $ARGUMENTS — substituted by Claude Code; where a client does not substitute it,
take the same scope from the request itself. An application name, a profile id or a recording file,
then optionally one exception class to focus on. Empty means the profile the conversation is about
(or the most recently modified one in profiles_list).
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.
Two phases with a stop between them — recommend, then change. Track progress:
- [ ] 1. Profile resolved, commit compared with HEAD
- [ ] 2. The application's own packages named from this checkout
- [ ] 3. Throws recorded? Application vs JVM-internal split read
- [ ] 4. Each site's own frame read in source
- [ ] 5. Every site classified from code that was actually read
- [ ] 6. Recommendation written — STOP
- [ ] 7. Accepted edits made, built, tested, re-profiled where possible
The user named an application ("analyze exceptions of orders-service") — match it against the
name and project of the rows profiles_list returns, following nextCursor while hasMore before
deciding it is not there. Several matches → take the newest and name the others in one line; the
user can pick another. No local match, and the name sounds like a deployed service or an
environment ("production", "staging") → switch to the analyze-connector skill, which finds its
recording session on the connector and comes back here with a profileId.
The user named a file → recordings_analyzeFile with its absolute path (the analyze-jfr skill
covers polling a large import).
Then profiles_get and read recordingCommit:
git rev-parse HEAD — say so in one line and continue;null — say the commit is unknown, not that it matched.A heap dump has no throw events: say so and stop, or hand over to analyze-heap if that was the
question.
Jeffrey does not know which packages are yours; this checkout does. Read them off the source tree —
Glob for **/src/main/java/**/*.java and **/src/main/kotlin/**/*.kt, and take the shortest
package roots shared by the files (usually two or three segments: com.acme.orders.). Fall back to
the groupId in pom.xml or the group in build.gradle(.kts). Keep the trailing dot, so
com.acme. does not also match com.acmecorp..
Name them in one line — "matching frames against com.acme.orders., com.acme.shared." — so the
user can correct you before anything depends on it. In a multi-module repository where the user
asked about one service, use that module's packages plus any shared ones it depends on.
jvm_exceptionsOne call. Read, in this order:
exceptionThrowsRecorded — false means the recording cannot name the throws, whatever
totalThrowables says. Stop here: say how many throwables were counted, that their types were not
recorded, and give the remedy — record jdk.JavaExceptionThrow, which the JDK's own default and
profile settings leave off on JDK 21 and throttle on JDK 25:
-XX:StartFlightRecording=settings=profile,jdk.JavaExceptionThrow#enabled=true,jdk.JavaExceptionThrow#throttle=off,…
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), or a custom .jfc with the event on (async-profiler: jfrsync=<that .jfc>).
Do not guess types from the total.applicationThrows against jvmInternalThrows. The JVM-internal ones are the JDK resolving and
linking — ClassNotFoundException while a library probes the classpath, NoSuchMethodException
from reflection, java.lang.invoke linking a call site, a class loader failing to find a resource
in a jar. They are thrown and caught inside the JDK and are not this application's to fix:
name the count in one line and move on, unless the user asked about one of them by name.topApplicationSites — the application's throw sites (libraries included) ranked by count, each
with its throwingFrame and commonest messages. errors and any site with error: true deserve
a look even at a count of one.Put the three or four heaviest sites to the user with their counts as a short table, plus every
Error site. If the user named a class, keep that one. On a recording made with JDK 25's own settings
the throw events are throttled (300/s under profile, 100/s under default): their counts are a
sample, so compare sites by share and take how many were thrown from totalThrowables, which
jdk.ExceptionStatistics counts unthrottled.
A question these answers do not shape — how many distinct messages a type carries (each site lists
only its commonest), the throws per second, the threads they came from — is SQL over the
jdk.JavaExceptionThrow events (thrownClass, message in fields): load the jfr-sql skill
before writing it, and quote the query's answer, not an estimate from the commonest messages.
jvm_exceptionSitesCall it with framePrefixes set to the packages from step 2 (and thrownClass when the user named
one). Each site comes back with:
throwingFrame — the frame that contained the throw;ownFrame and ownFrameDepth — the topmost frame of yours on that stack. Depth 0 means your
code threw; a larger depth means a library or the JDK threw while your code was calling it, and
ownFrame is the line that made that call;stack — the frames from the throw down, to read what happened in between;count, threadCount, messages.For every site with an ownFrame, open the file at that line — Grep for the class
(class OrderService, accounting for nested $Inner names), then Read around the line. Read enough
of the method to see what happens to the exception: is it caught right there, rethrown, logged,
retried, turned into a status code? When the reader has IntelliJ open with the Jeffrey plugin,
ide_resolve gives the exact file and line for anything a grep gets wrong (nested classes, Kotlin
facades, overloads), and ide_source reads library code that is not in this repository.
Who pays for a throw is the next question once its line is read: code_method with the own frame's
class and method (and your framePrefixes) names its callers, the share of CPU its stack holds —
constructing an exception walks the whole stack, so a hot throw costs where it is thrown — and the
traced requests whose spans run it, each with its p95 and link. A throw inside every promo checkout is
a different finding from one in a nightly job.
A site with no ownFrame threw entirely inside the JDK or a library. Read its stack: the deepest
frames name what started the work (a scheduler, a client's I/O thread, a framework's startup). Say
so, rather than inventing a line of this repository to blame. Follow nextCursor only while the
next page could still hold sites the user cares about.
Hold to these rules:
count, its share of applicationThrows, its
threads and its messages.Each site gets exactly one of these, decided from the source you read:
| Kind | What it looks like | Typical fix |
|---|---|---|
| Control flow | A high count, one or two messages, caught right away: NumberFormatException from parsing input, a "not found" exception turned into Optional.empty(), a loop broken by a throw | Check before parsing (tryParse, a format or digits check, containsKey, a validation method), so the same inputs take the same branch with no throw, or return a value instead of throwing. Rewriting the input first — stripping or reformatting it — changes what the method does: a second option at most, said as such |
| Swallowed | Caught and ignored, or logged and continued, at a count that says it happens on every call | Fix the cause, or stop constructing it — a pre-allocated or stackless exception if the type is your own |
| Retry / timeout storm | A library throw (SocketTimeoutException, ConnectException, a pool timeout) with your client call as ownFrame, many threads, bursts | A configuration finding (timeout, pool size, retry policy with backoff) or a dependency's problem — the code change is at the call site: fewer calls, a circuit breaker, a cache |
| Real failure | An Error, or a rare class with varied messages that escapes to the caller | Fix the bug the message describes; traces_operations sorted by ERRORS says which requests it failed, when the profile has traces |
| JVM noise that leaked | A JVM-internal throw the user asked about | Explain what the JDK was doing; usually nothing to change, sometimes a missing optional dependency or a misconfigured classpath |
When the profile has traces, traces_operations with sort: ERRORS ties throws to the requests
they belong to — worth one call for a real failure or a timeout storm. For a control-flow site with a
very high count, the CPU it costs shows up as fillInStackTrace in the on-CPU flamegraph; the
jvm_exceptions follow-up carries that export, but offer it rather than running it — it is a HEAVY
document.
Write it in the report skill's shape:
### <file>: <method> section per site, heaviest first: the exception
and its count, the kind from step 5, what the code does with it (from what you read), and the
smallest behaviour-preserving change in prose. No diffs yet.ownFrame, or whose code is not at this commit.Put each site's Microscope page beside its name — the answer's uiLink opens the Exceptions page,
its link text marked Exceptions page ↗ like every other link; never build a URL by hand.
Then ask which findings to apply, and wait. In Claude Code use AskUserQuestion, one
multi-select option per finding when there are at most four; with more, list them numbered.
For each accepted finding: make the smallest edit, run the project's build and tests, and — when the
workload can be reproduced — re-record, recordings_analyzeFile the new recording and call
jvm_exceptionSites with the same framePrefixes and thrownClass. Report the site's count before
and after. Never claim a reduction you did not measure. A configuration finding takes effect on the
next run of the application, not the next test: say what to watch for instead of reporting it fixed.
Keep the Covered / Open leads / Not assessed ledger as the other skills do, so the report skill
can build its findings from it.
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-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./heap-sqlLoad before the first heap_executeQuery call, whichever skill is driving the analysis: the schema of a Jeffrey heap-dump index (class, instance, outbound_ref, class_instance_field, string_content, gc_root, dominator, retained_size) and the traps that return a wrong answer without an error — the string table is the name pool, not the String contents; outbound_ref.field_id counts the whole field layout; retained sizes need the current tree. Use for what the purpose-built heap tools do not answer: what objects' fields or strings hold across a class, a count or join they do not shape.npx claudepluginhub petrbouda/jeffrey --plugin microscopeOther plugins' skills for the same job