Back to Skills

xdebug

verified

PHP debugging and analysis tools using Xdebug. Use when asked to trace, debug, profile, or analyze coverage of PHP code.

View on GitHub

Marketplace

xdebug-mcp

koriym/xdebug-mcp

Plugin

xdebug

Repository

koriym/xdebug-mcp
29stars

skills/xdebug/SKILL.md

Last Verified

January 20, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/koriym/xdebug-mcp/blob/main/skills/xdebug/SKILL.md -a claude-code --skill xdebug

Installation paths:

Claude
.claude/skills/xdebug/
Powered by add-skill CLI

Instructions

# 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` |

## 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 |

### "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** → `xstep` (interactive with breakpoints)

---

## xtrace - Forward Trace (Full)

Trace execution forward from start to finish. Captures complete execution flow, function calls, parameters, and timing data.

**Output**: JSON with `$schema` URL for semantic details and AI analysis strategies.
**Key fields**: `{lines, functions, max_depth, db_queries}`

```bash
~/.composer/vendor/bin/xtrace [--json] [--context=TEXT] [--include-vendor=PATTERNS] -- command
```

### Examples

```bash
~/.composer/vendor/bin/xtrace --context="Debug login" -- php login.php
~/.composer/vendor/bin/xtrace --context="Test analysis" -- vendor/bin/phpunit tests/UserTest.php
~/.composer/vendor/bin/xtrace --include-vendor="bear/*" -- php app.php
```

### 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 breakpo

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
6360 chars