github/awesome-copilot / skills/java-diagnostics
java-diagnostics
VerifiedSymptom-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.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 7.2 KB |
| references/async-profiler.md | markdown | 3.0 KB |
| references/containers.md | markdown | 1.7 KB |
| references/gc.md | markdown | 1.6 KB |
| references/heap.md | markdown | 3.0 KB |
| references/jcmd-basics.md | markdown | 1.9 KB |
| references/jfr.md | markdown | 2.3 KB |
| references/native-memory.md | markdown | 1.5 KB |
| references/thread-dumps.md | markdown | 3.3 KB |
references/jcmd-basics.md
View on GitHub# jps and jcmd basics (Tier 1 for the safe commands; see the sensitive-output warning)
```bash
jps -l # list JVMs with PID and main class/JAR only (no arguments)
jcmd <pid> help # commands supported by that JVM
jcmd <pid> VM.version
jcmd <pid> VM.flags # effective -XX flags (no -D properties)
jcmd <pid> VM.uptime
```
Do NOT run these by default: they can print credentials, tokens, connection strings or other secrets passed as `-D` properties or program arguments, and the output lands in the transcript:
- `jps -v`, `jps -lv`, `jps -m`, and bare `jcmd` (without arguments it also prints each JVM's main class and arguments)
- `jcmd <pid> VM.system_properties`, `jcmd <pid> VM.command_line`, `jinfo`, `ps aux` / `ps -ef` / `/proc/<pid>/cmdline` for a Java process
They need user consent first (explicit tier: Tier 3, sensitive output). Prefer reading only the specific property you need (for example `jcmd <pid> VM.system_properties | grep '^java.version'`), and redact secret values before showing or sharing any output.
- Run as the same OS user as the target JVM, on the same host (or inside the same container). Different users/containers fail with "Unable to open socket file" or "process not found".
- `jcmd` is preferred over `jstack`/`jmap`/`jinfo`, which are older single-purpose tools.
- `-XX:+DisableAttachMechanism` blocks attach; `-XX:+StartAttachListener` forces the listener to start.
- Tools must match (or be newer than) the target JDK major version when possible.
## Crash or hang
- A crash writes `hs_err_pid<pid>.log` (path set by `-XX:ErrorFile`). Read the "Problematic frame" and thread sections first.
- `jhsdb` (Tier 3) attaches to a hung process or core file: `jhsdb jstack --pid <pid>` or `jhsdb jstack --exe <java> --core <core>`. It suspends the process while attached and requires matching JDK; core files contain heap data, so treat them like heap dumps.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |