Command reference ยท Claude Code
/debug
Enables debug logging for the current session and helps with troubleshooting via the session debug log.
/debug [description] is a bundled skill that enables debug logging for the current session and then helps evaluate the session debug log to find the cause of a problem. Debug logging is off by default unless the session was started with claude --debug; if /debug is called only mid-session, logs are only recorded from that point on - earlier events are then missing from the log. Optionally, a problem description can be appended to focus the subsequent analysis, for example on a specific MCP server, a single tool call, or a hook issue.
/debug differs from related diagnostic commands: /doctor comprehensively checks installation, configuration, and setup and can partly fix found issues itself; /heapdump writes a JavaScript heap snapshot along with a memory breakdown to ~/Desktop in case of high memory usage. /debug, by contrast, is specifically meant for tracing runtime issues within a running session, such as connection drops to MCP servers or unexpected tool behavior that's otherwise hard to reproduce.
โ WHEN TO USE IT?
Start logging immediately for a reproducible problem
/debug MCP server keeps disconnecting โ right before triggering the problem again.
Systematically enable logging before a hard-to-trace investigation
Call /debug to capture tool calls and errors in the session debug log before trying the next step.
โ WHEN NOT TO?
The error already occurred earlier
/debug only captures logs from the moment it's activated; earlier events are missing from the log.
Better: Restart the session with claude --debug to log from the start.
Diagnosing installation problems or setup errors
/debug deals with the runtime behavior of the current session, not installation, PATH issues, or faulty settings files.
Better: Use /doctor, which runs a setup checkup and partly fixes issues automatically.
SOURCES
- Claude Code docs (official) โ code.claude.com