# /debug Command

> It turns on the debug log and reads it to find a problem.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** /debug, claude --debug, Debug log, --debug-file

## Think of it like

It is like a camera you turn on. Then you watch the tape to see what broke.

## Definition

/debug is a bundled skill that turns on debug logging for the session and then reads that log to find a problem. Logging is off unless you started with claude --debug, so /debug records from the moment you run it. Add a few words about the problem to point Claude at it.

## Example

Jack's hook works in one project but not another. He runs /debug with that note, repeats the step, and Claude finds in the log that the hook's matcher never matched.

## Example code

```console
/debug my PreToolUse hook never runs
```

Log this session and look into the hook.

## Why it matters

Some problems only show while a session runs. The log is where they leave a trace.

## Common mistake

Running /debug after the problem and looking for it in the log. It only writes down what comes next, so make the problem happen again.

## Three principles

- **Turns on the log.** From now on.
- **Reads it for you.** Finds the cause.
- **Say what is wrong.** To focus it.

## Related terms

- [/doctor Command](https://learn.benibix.com/term/ai/doctor-command)
- [/feedback Command](https://learn.benibix.com/term/ai/feedback-command)
- [Debugging](https://learn.benibix.com/term/development/debugging)

## Told apart from

- [/doctor vs /debug](https://learn.benibix.com/compare/doctor-command-vs-debug-command): People often think /doctor and /debug both just find what is wrong. They look in different places. /doctor checks your setup: the install, the settings files, your extensions and CLAUDE.md. It proposes fixes and applies them after you agree. /debug turns on the log of a running session and reads it, to find a problem that shows up while you work. Run /doctor when something will not load, and /debug when something goes wrong mid-task.

## Taught in

- [Install, Update and Doctor](https://learn.benibix.com/learn/ai-claude-code-commands/install-update-and-doctor): Claude Code Commands, 2/17

---

Source: https://learn.benibix.com/term/ai/debug-command
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
