$npx -y skills add Amplicode/spring-skills --skill java-debugSafety rules, workflows, and tool reference for debugging applications via IntelliJ debugger: breakpoints, debug sessions, stepping, evaluating expressions, inspecting runtime state. TRIGGER when: user wants to debug, investigate a bug, set breakpoints, inspect runtime behavior,
| 1 | # Preflight: IntelliJ Debug MCP |
| 2 | |
| 3 | This skill is part of the **Spring Agent Toolkit** and is designed to work with the **IntelliJ Debug MCP server** (provided by the Amplicode IntelliJ plugin alongside the main Spring MCP). Before doing anything else, check your tool list for any debug MCP tool — they are exposed under the `intellij-debug` MCP server (e.g. `toggle_breakpoint`, `evaluate_expression`, `get_stack_trace`); harnesses that flatten MCP tools into the tool list use the `mcp__intellij-debug__` prefix on the same names. |
| 4 | |
| 5 | - **If at least one debug tool is available** — MCP is connected. Proceed with the skill below. |
| 6 | - **If none are available** — stop and invoke the **`amplicode-install`** skill (bundled with the Spring Agent Toolkit). It installs the Amplicode plugin and walks the user through the **«Настроить Spring Agent»** welcome-screen button + MCP-client restart. After it completes, the debug MCP tools become available — resume this skill. |
| 7 | - If `amplicode-install` is not registered in your skill list, tell the user (in their language): *"This skill needs the Amplicode IntelliJ plugin and its debug MCP server. Install it from https://amplicode.ru/marketplace into IntelliJ IDEA Ultimate/Community or GigaIDE, open any project, click «Настроить Spring Agent» on the Amplicode welcome screen, then restart your MCP client."* |
| 8 | |
| 9 | --- |
| 10 | |
| 11 | # Debugging with IntelliJ Debug MCP |
| 12 | |
| 13 | This skill guides you through debugging applications via the IntelliJ Debug MCP server. The MCP server runs inside IntelliJ IDEA and gives you programmatic control over the debugger. |
| 14 | |
| 15 | ## SAFETY RULES — Read These First |
| 16 | |
| 17 | These rules prevent you from hanging indefinitely or losing debugging context. They exist because the debugged application can be **suspended on a breakpoint** at any time, which means it stops responding to all requests. |
| 18 | |
| 19 | ### The Suspended-Process Trap |
| 20 | |
| 21 | When the app hits a breakpoint, its threads freeze. Any HTTP request, curl call, or network interaction you make to that app **will hang forever** — the app can't respond until you resume it. This is the single most common mistake. |
| 22 | |
| 23 | **Rule 1: Always use timeouts when talking to the debugged app.** |
| 24 | Use `--max-time 5` with curl, or set `run_in_background: true` on Bash tool calls. Do this even if you just checked that the app is running — it could hit a breakpoint between your check and your request. |
| 25 | |
| 26 | **Rule 2: Check suspension status before network calls.** |
| 27 | Call `list_debug_sessions` and look at `isSuspended`. If the app is suspended, either `resume` it first or accept your request will block. |
| 28 | |
| 29 | **Rule 3: Always verify position after stepping.** |
| 30 | After `step_over`, `step_into`, or `step_out`, call `get_current_position`. Never assume where execution landed — it might have jumped to an unexpected line or even a different file. |
| 31 | |
| 32 | **Rule 4: Check status after resume.** |
| 33 | After calling `resume`, the app may immediately hit another breakpoint. Always call `list_debug_sessions` or `get_current_position` to confirm whether the session is still running or suspended again. |
| 34 | |
| 35 | **Rule 5: Expression evaluation has side effects.** |
| 36 | `evaluate_expression` runs real code in the debugged JVM. Avoid expressions that modify state (like setters or `System.exit(0)`) unless that's specifically what you intend. |
| 37 | |
| 38 | ## Getting Started |
| 39 | |
| 40 | Before using any debug tool, initialize the session: |
| 41 | |
| 42 | 1. Call `initialize` with `projectPath` set to the absolute path of the project root |
| 43 | 2. If you get "project not found", the response lists all open projects — pick the right one and retry |
| 44 | 3. All subsequent tool calls are scoped to this project |
| 45 | |
| 46 | ## Tool Reference |
| 47 | |
| 48 | ### Session |
| 49 | | Tool | Parameters | |
| 50 | |------|-----------| |
| 51 | | `initialize` | `projectPath` (string, required) — absolute path to project root | |
| 52 | |
| 53 | ### Run Configurations |
| 54 | | Tool | Parameters | |
| 55 | |------|-----------| |
| 56 | | `list_run_configurations` | _(none)_ | |
| 57 | | `debug_run_configuration` | `configurationName` (string, required) — exact name of the run config | |
| 58 | | `list_debug_sessions` | _(none)_ — returns session names and `isSuspended` status | |
| 59 | | |