koriym/xdebug-mcp/xdebug
Claude Code and agent skill by koriym/xdebug-mcp
- community
Checking that the SKILL.md file is still in the repository.
PHP debugging and analysis tools using Xdebug. Use when asked to trace, debug, profile, analyze coverage, or compare executions of PHP code. Trigger phrases include "trace this function", "profile this code", "check coverage", "debug PHP", "set breakpoint", "find the bottleneck", "why is this slow", "compare two runs", "トレース", "プロファイル", "カバレッジ", "比較".
Install
npx vskill@latest install koriym/xdebug-mcp/xdebugSKILL.md
Xdebug MCP Tools
Non-invasive PHP debugging and analysis tools. No var_dump() or code modification needed.
Tool Paths
Tools are installed globally via composer. Use absolute paths:
| Tool | Path | |
|---|---|---|
| xtrace | ~/.composer/vendor/bin/xtrace | |
| xstep | ~/.composer/vendor/bin/xstep | |
| xprofile | ~/.composer/vendor/bin/xprofile | |
| xcoverage | ~/.composer/vendor/bin/xcoverage | |
| xback | ~/.composer/vendor/bin/xback | |
| xcompare | ~/.composer/vendor/bin/xcompare | |
| xrepl | ~/.composer/vendor/bin/xrepl |
Tool Selection Guide
| User Request | Tool | |
|---|---|---|
| Trace, execution flow, show function calls | xtrace | |
| Step debugging, breakpoints, inspect variables, track variable changes | xstep | |
| Profile, performance, bottlenecks, slow code | xprofile | |
| Coverage, test coverage, which lines tested | xcoverage | |
| Backtrace, call stack, how did we get here | xback | |
| Compare variable states across two runs, normal vs edge case, compare with git branch | xcompare | |
| Interactive debugging, REPL, step manually (human-friendly) | xrepl |
"Trace" Ambiguity
The word "trace" can mean different things:
- Forward Trace →
xtrace(records execution from start to finish) - Backtrace / Stack Trace →
xback(shows call stack at a point) - Step through / Debug (recording) →
xstep(records N steps from a breakpoint, JSON output) - Interactive debugging →
xrepl(human-friendly REPL session, not JSON)
xtrace - Forward Trace (Full)
Trace execution forward from start to finish. Captures complete execution flow, function calls, parameters, and timing data.
Output: Text by default; --json gives JSON with a schema URL for semantic details and AI analysis strategies. Key fields: {lines, functions, max_depth, db_queries}
Examples
When to Use
- "Trace this code"
- "Show execution flow"
- "What functions are called?"
- General PHP debugging (default choice)
xstep - Forward Trace (Step-by-Step)
Stop at breakpoint, step forward N times, record variable changes at each step. See how variable values affect branching ("this variable was X, so it went into this branch").
Output: Slim, deduplicated JSON with a $schema URL — fields you might expect inline can live elsewhere, so read the linked schema to interpret the structure and reconstruct variable state. The schema is the source of truth; do not infer the format from examples.
Options
--break=file.php:line- Single breakpoint location--break=file.php:line:condition- Conditional (e.g.,$user==null)--steps=N- Step forward N times from breakpoint--watch=EXPR- Only record steps when expression value changes (can specify multiple times)
Examples
Workflow Tips
- Need more steps? Set new breakpoint at where you stopped, run again
- Too much variable info? Use xtrace first to see flow, then xstep for details
When to Use
- "Track how variable changes step by step"
- "Why did it branch this way?"
- "What's the variable value at line X?"
xprofile - Performance Profiler
Identify performance bottlenecks with precision data.
Output: Text by default; --json gives JSON with a schema URL. time_ms/memory_mb are measured from the cachegrind summary; bottlenecks is a structured array. Read the linked schema for the field shapes — don't infer the format here. Key fields: {time_ms, memory_mb, bottlenecks}
Examples
When to Use
- "Profile this code"
- "Find bottlenecks"
- "Why is this slow?"
- "Memory usage analysis"
xcoverage - Code Coverage
Collect code coverage data for PHPUnit or any PHP script. Shows only uncovered lines (compact output).
Output: Text by default; --json gives JSON with a $schema URL for semantic details. Key fields: {summary: {coverage_percent, covered_lines, uncovered_lines}, uncovered: {file: [lines]}}
Examples
When to Use
- "Check test coverage"
- "Which lines are tested?"
- "Find untested code"
xback - Backtrace Capture
Get call stack (backtrace) at a specific line. Shows "who called this?" - the chain of function calls that led to this point.
Output: JSON with $schema URL for semantic details. Key fields: {script, breakpoint, stack: [{level, function, file, line}]}
Examples
When to Use
- "Get backtrace at line X"
- "Show call stack"
- "How did execution reach this line?"
xcompare - Breakpoint Comparison
Compare variable states at the same breakpoint across two different executions. Useful for normal vs edge case inputs, success vs failure, or current code vs another git ref.
Output: JSON with $schema URL. diff contains {changed, unchanged, only_in_a, only_in_b} plus analysis_hints. Key fields: {breakpoint, run_a, run_b, diff, analysis_hints}
Options
--label-a/--label-b- Labels for run A/B (default: command or 'HEAD'/ref name)--steps=N- Steps to record after breakpoint (default: 1)--include-vendor- Include vendor packages in trace
Examples
Note: --run-a, --run-b, and --run are executed through the shell — only pass trusted input.
When to Use
- "Compare how different inputs affect variable states"
- "Debug edge cases by comparing normal vs problematic inputs"
- "Compare current code vs another git branch/commit"
xrepl - Interactive REPL Debugger
Human-friendly interactive debugging session with breakpoints and variable inspection. Unlike the other tools, xrepl is an interactive session rather than one-shot JSON output — for AI-driven analysis, prefer xstep.
Commands
s- Step into functiono- Step over lineout- Step out of functionc- Continue executionp <var>- Print variable (e.g.,p $user)bt- Show backtracel- Show current location (stack and variables)q- Quit debugger
Examples
When to Use
- "Let me debug interactively"
- "Step through manually and inspect variables"
- Exploratory debugging by a human at the terminal
Common Options
| Option | Description | |
|---|---|---|
--json | AI-optimized JSON output | |
--context=TEXT | Add description for AI analysis | |
--include-vendor=PATTERNS | Include vendor packages |
Vendor Filtering
By default, vendor code is excluded to focus on your code. Use --include-vendor when needed:
The excluded tree is the vendor/ under the working directory, so run the tools from the project root. Without one, stderr says vendor filter inactive: no vendor/ at <cwd>.
JSON Schemas
- xtrace: https://koriym.github.io/xdebug-mcp/schemas/xtrace.json
- xstep: https://koriym.github.io/xdebug-mcp/schemas/xstep.json
- xprofile: https://koriym.github.io/xdebug-mcp/schemas/xprofile.json
- xcoverage: https://koriym.github.io/xdebug-mcp/schemas/xcoverage.json
- xback: https://koriym.github.io/xdebug-mcp/schemas/xback.json
- xcompare: https://koriym.github.io/xdebug-mcp/schemas/xcompare.json
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/xdebug/SKILL.md
Popularity
- Repository stars
- 50
- Repository forks
- 8
- 7-day trend score
- 20
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 19 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/koriym/xdebug-mcp/xdebug)