Skip to content
cccskills
FreePublished on GitHubEnglish overview

java-diagnostics

Investigate high CPU usage, memory problems, and slow Java applications with JDK diagnostic tools. Start from symptoms, collect suitable evidence, and narrow down causes while accounting for collection overhead and sensitive data.

OriginalShow the original description

Symptom-first runtime diagnostics for JVM applications using JDK tools: jcmd, jstack, jmap, jstat, JFR, GC logs, async-profiler, Native Memory Tracking, and Eclipse MAT. Use when a Java app has high CPU, memory leaks or OutOfMemoryError, slow startup, deadlocks or thread starvation, long GC pauses, native memory growth, or slow requests. Includes permission tiers for safe use.

Run score Not tested

See how to install

Good for

  • Investigating high CPU usage
  • Finding causes of memory leaks and OutOfMemoryError
  • Diagnosing deadlocks and slow requests
  • Checking long garbage collection pauses

Overview

What it does

This skill investigates high CPU use, memory problems, slow startup, and slow responses in Java applications using tools suited to each symptom. It uses thread information from jcmd and jstack, checks memory collection with jstat and GC logs, and can proceed to JFR or async-profiler to record runtime behavior. It recommends combining repeated samples with another source of evidence to test a cause hypothesis.

When it helps

Use it when a Java application is slow or under strain and you are unsure what evidence to collect. It also covers deadlocks and memory growth outside the Java heap. After a fix, it guides you to measure again using the same method and compare the results.

Example requests

  • “Investigate the Java process with high CPU usage using thread information.”
  • “Lay out collection steps to narrow down the cause of OutOfMemoryError.”

Notes

Run diagnostic tools as the same OS user as the target JVM. Recording or attach operations require consent, and production diagnostics require explicit instruction. Heap dumps may contain sensitive information: analyze them locally, do not share them, and delete them afterward. Account for pauses during collection and available disk space.

This overview was written by AI (OpenAI Codex) from the public SKILL.md. Check the original below for the exact behavior.

Document check

AI checked the SKILL.md for operations that need care and for setup requirements. The score comes only from actually running the skill (hands-on test).

SafetyAre sending data, deleting files, and running commands disclosed?
AGoodTiers state consent and overhead; dumps must stay local and be deleted.
Easy setupDoes it need few tools or API keys, and are they documented?
BPartly lackingLists JDK tools and optional Actuator or BootUI, with limited setup steps.

Not counted in the score. Rated by AI (OpenAI Codex) as of Oct 25, 2026. Treat it as a guide and read the original before installing.

Disagree? Request a re-evaluation

Tell us which point is wrong and why. No login needed. We will check it against the SKILL.md, redo the evaluation, and show the result here.

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

Files included (9)

  • SKILL.md7.2 KB
  • references/async-profiler.md3.0 KB
  • references/containers.md1.7 KB
  • references/gc.md1.6 KB
  • references/heap.md3.0 KB
  • references/jcmd-basics.md1.9 KB
  • references/jfr.md2.3 KB
  • references/native-memory.md1.5 KB
  • references/thread-dumps.md3.3 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Java Diagnostics

Pick the lightest tool that answers the question, starting from the symptom.

Permission tiers (obey them)

TierToolsRule
1. Read-onlyjps -l, jcmd <pid> help/VM.version/VM.flags/Thread.print, jstat, jstack, reading logsMay run after stating the exact command. Class histograms (jcmd <pid> GC.class_histogram, jmap -histo, jmap -histo:live) are NOT Tier 1: they run heap inspection at a safepoint and can pause application threads on a large heap, so treat them as Tier 2 (consent, stated overhead). The default forms and -histo:live additionally force a full GC; -all=true / jmap -histo skip the full GC but still pause during the scan (and count unreachable objects).
2. Recording / attachJFR (JFR.start, -XX:StartFlightRecording), async-profiler, NMT (-XX:NativeMemoryTracking), enabling GC logsRequires user consent. State duration and expected overhead (JFR default profile is about 1-2%; async-profiler depends on mode; NMT summary roughly 5-10%, detail more) before running.
3. Intrusive / sensitiveHeap dumps (GC.heap_dump, jmap -dump), jhsdb, commands that print JVM arguments or system properties (jps -v/-lv/-m, bare jcmd, VM.system_properties, VM.command_line, jinfo, ps aux on a Java process; they can expose secrets, redact output), JDWP with suspend, anything on productionRequires explicit consent, a stated target path, free-disk check (a dump is about the size of the used heap), and a stated pause. Heap dumps contain secrets (passwords, tokens, personal data). Never share or upload them; redaction is NOT a reliable safeguard. Analyze locally and delete afterwards.

Never run Tier 2 or Tier 3 commands against production unless the user explicitly instructs it. Run diagnostic tools as the same OS user as the target JVM. Prefer reproducing on dev or staging.

Decision table

SymptomFirst stepThenReference
High CPUThread dumps x3 (Tier 1) + top -H to map hot native thread ids to nidJFR or async-profiler CPU flame graph (Tier 2)threads, jfr, async-profiler
Memory leak / OOMjstat -gcutil, GC.class_histogram -all=true twice, minutes apart (Tier 2: safepoint pause even with -all=true; without it a full GC too; get consent on production)Heap dump + Eclipse MAT (Tier 3) or JFR OldObjectSample (Tier 2)heap, gc
Slow startup-Xlog:class+load, framework startup/condition reports, timestamped logsJFR from start, async-profiler wall-clockjfr, async-profiler
Deadlock / thread starvationjcmd <pid> Thread.print (reports deadlocks), compare dumps over timeVirtual threads: Thread.dump_to_filethreads
GC pausesGC log (-Xlog:gc*) and jstat -gcJFR GC events; tune collector/heapgc
Native memory growth (RSS grows, heap does not)Compare RSS vs heap; enable NMT, jcmd VM.native_memory baseline / summary.diff (Tier 2)async-profiler nativemem or allocator toolsnmt, containers
Slow requestsTracing/metrics and logs first; Actuator or Dev UI (see below)JFR (socket/file/lock events), async-profiler wall-clockjfr, async-profiler
JVM crash / hang, no tools respondhs_err_pid*.log, core dumpjhsdb (Tier 3)basics

Start with jps/jcmd basics to identify the target JVM and confirm which JDK version is running.

Workflow

  1. Capture the symptom precisely (when, how often, since which change, JDK version, container limits).
  2. Choose the tier needed; state the command, its overhead, and output location, and get consent for Tier 2/3.
  3. Collect data to a dedicated directory, with timestamps. Prefer several samples over one.
  4. Form a hypothesis from the data, then confirm with a second source (for example a thread dump plus a flame graph).
  5. Fix, re-measure with the same method, and clean up artifacts (dumps, recordings).

Application-level insights (optional)

JDK tools see the JVM; some questions (which endpoint, which SQL query, which bean) are easier at the application level. Optional options, in order of preference:

  • Spring Boot Actuator (metrics, health, loggers, httpexchanges) and Quarkus Dev UI / Micrometer metrics are built in and need no extra tool. Expose Actuator endpoints minimally; For heapdump and threaddump, follow the policy in the spring-observability skill: never expose them over public HTTP; the only exception is a temporary, user-consented window with authentication, TLS and network restriction, removed afterwards.
  • BootUI (https://github.com/jdubois/boot-ui , https://www.julien-dubois.com/boot-ui/): a local-only developer console with an opt-in MCP server for Spring Boot and Quarkus. Optional. Its skill can be installed with gh skill install jdubois/boot-ui skills/bootui.

If considering BootUI:

  • Ask the user for consent before adding any dependency or installing the skill.
  • Use it in a local/dev profile only; never expose it on a network, and never enable its heap dump, thread dump endpoints or MCP server in production.
  • Check the capability and version first (read its README for the supported Spring Boot / Quarkus versions) instead of assuming features.

Follow the project's own documentation for usage; this skill does not reproduce it.

Containers

See containers for attaching tools inside containers, -XX:MaxRAMPercentage, and cgroup memory limits.

References

Official docs (prefer them over this skill for the JDK in use; change 21 to your version): jcmd https://docs.oracle.com/en/java/javase/21/docs/specs/man/jcmd.html, jfr https://docs.oracle.com/en/java/javase/21/docs/specs/man/jfr.html, JFR guide https://docs.oracle.com/en/java/javase/21/jfr/introduction-jdk-flight-recorder.html, troubleshooting guide https://docs.oracle.com/en/java/javase/21/troubleshoot/, async-profiler releases https://github.com/async-profiler/async-profiler/releases.

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Map an existing codebase into seven documents covering its technology, structure, architecture, conventions, integrations, tests, and concerns. Link findings to file evidence, mark unknowns, and highlight differences between stated plans and the actual implementation.

  • Get oriented in an unfamiliar codebase
  • Prepare documentation for a project handover
  • Compare documented architecture with implementation
github/awesome-copilot40.4KUpdated Oct 24, 2026

Assess a repository’s readiness for AI agents with AgentRC and generate a standalone HTML dashboard. Review scores across nine areas, see prioritized improvements, and optionally apply scoring policies tailored to an organization.

  • Assessing a repository’s readiness for AI agents
  • Prioritizing improvements from assessment results
  • Reviewing scores under an organization’s own policy
github/awesome-copilot40.4KUpdated Oct 24, 2026

Generate coding agent instruction files from a project's actual code using AgentRC. Capture detected languages, frameworks, and conventions in one shared file or split rules by topic and project area, with a preview before writing.

  • Create project instructions for VS Code Copilot
  • Refresh agent rules after project changes
  • Split monorepo instructions by project area
github/awesome-copilot40.4KUpdated Oct 24, 2026

Customize AgentRC readiness assessments to match team or organization standards. Choose or create policies that adjust check importance, disable irrelevant checks, set pass thresholds, and define requirements for automated checks in CI workflows.

  • Set shared readiness standards across an organization
  • Focus assessments on AI tooling
  • Adjust the importance of individual checks
github/awesome-copilot40.4KUpdated Oct 24, 2026

Analyze supplied ad performance data to identify wasted spend, strong campaigns, and next tests. Compare channels, assess whether test differences are meaningful, and produce budget reallocation recommendations with a prioritized action plan.

  • Identify ads and keywords to pause
  • Find campaigns and audiences worth scaling
  • Assess whether A/B test results are meaningful
github/awesome-copilot40.4KUpdated Oct 24, 2026

Turn code files into learning resources by adding comments that explain syntax, programming concepts, and design choices. Adjust explanation depth and repetition to the reader’s knowledge while preserving file structure, encoding, and syntax.

  • Add beginner-friendly explanations to existing code
  • Document the reasoning behind syntax and design choices
  • Adjust comment depth for readers with different experience
github/awesome-copilot40.4KUpdated Oct 24, 2026

See all skills by github

Report a problem with this skill