java-debugging
Installation
SKILL.md
Java Debugging
Find the root cause of a Java defect with a reproducible, hypothesis-driven loop, and attach a debugger safely when logs are not enough.
Safety rules
- Bind JDWP to loopback only (
127.0.0.1). Never bind*:5005on a reachable network; use an SSH tunnel orkubectl port-forwardfor remote hosts. - Use
suspend=nfor running applications.suspend=yis acceptable only for short local test runs bound to loopback (waiting for the IDE to attach). Never leave a debug agent enabled on production; JDWP gives full code execution to whoever connects. - Do not attach a debugger to production without explicit user instruction. Prefer reproducing locally or use read-only diagnostics (see the
java-diagnosticsskill). JAVA_TOOL_OPTIONSis picked up by every JVM started in that environment (build tools, forked test JVMs, child processes), causingAddress already in useclashes. Prefer scoping the flag to the one process you want to debug.
Method
Reproduce deterministically, minimize, read the evidence (stack traces), test one falsifiable hypothesis with the least intrusive tool (log line or logpoint before breakpoints), then add a regression test and remove debug flags and temporary logging.