ホーム 暮らし What is /doctor in Claude Code? How to use it to diagnose the cause of issues instantly when things aren't working

What is /doctor in Claude Code? How to use it to diagnose the cause of issues instantly when things aren't working

藤崎 健人 藤崎 健人 • 更新: • 公開: • 読了約 28 分
目次

"Claude Code is acting weird after I tweaked the config file." "I added an MCP, but I'm not sure if it's connected properly."

Just type /doctor, and Claude Code will provide a list of its own malfunctions. Your time spent guessing the cause ends here.

Once you start using Claude Code, you'll likely go through this at least once. It won't run, the response is strange, or settings aren't taking effect. Even if you copy and search for error messages to find the cause, all you find are cases from other people in different situations. It's common to end up more confused after fiddling with things.

When that happens, the first command you should run is /doctor. Claude Code itself will perform a comprehensive check of your installation, settings, and connections, and provide a list of what is normal and what is suspicious. Since you can act after identifying the likely cause, you won't waste time blindly tweaking settings.

My name is tatsuki (@nobel_824), and I provide AI implementation support for small and medium-sized businesses. While helping with the business adoption of Claude / Codex, I also run Claude Code all day long myself. In support scenarios, I often get consultations about things "just not working," and simply suggesting /doctor first resolves about half of them on its own. It's such an effective entry-level command that it's reassuring to learn it while you're still a beginner.

In this article, I will explain in order what /doctor looks at, how to use it, and how to read the output. The specifications are limited to what is confirmed in the official documentation, and sources will be linked in the text.

What is /doctor?

ne3c77f63cbf8

/doctor is a self-diagnostic command built into Claude Code. In the official command list, it is described as a command to "diagnose and verify installation and configuration" (official commands reference). It's easy to understand if you think of it as the tool checking its own health, like a medical checkup.

Specifically, regarding what it checks, the official troubleshooting page states that /doctor performs the following four checks at once (source):

  • Installation status: Whether the Claude Code binary is installed correctly

  • Settings validity: Whether the contents of the configuration file are corrupted

  • MCP servers: Whether the connection settings for MCP (Model Context Protocol, a mechanism to connect external tools to Claude) are correct

  • Context usage: How much of the context (the amount of information the AI can remember at once) used in the conversation is filled

These four cover most of the reasons why beginners feel things "aren't working." Incorrect installation, typos in settings, MCP not connected, or the conversation being too long and heavy. You can get a lead on any of these with a single /doctor command.

One action you can take today: Try typing /doctor in the Claude Code session you have open right now. Even if nothing is broken, you can see for yourself what is being checked.

There are two ways to use it

There are two entry points for /doctor. You use them differently depending on whether Claude Code is running or not.

One way is to type /doctor within a Claude Code session. Just like when you use slash commands normally, you just type /doctor at the beginning of the input field and execute it.

/doctor

The other way is for when Claude Code won't even start. In this case, you run the command directly from the shell (terminal). The official guide also suggests, "If claude won't start at all, run claude doctor from your shell" (source).

claude doctor

This means that even if it's broken to the point where you can't enter a session, a fallback is provided to diagnose it from the shell side. If you remember "first /doctor, and if that doesn't work, claude doctor," you won't have any trouble.

One action you can take today: Run claude doctor in your terminal once to get a feel for how to diagnose issues without entering a session. You won't panic the day it stops launching.

How to read the output

When you run /doctor, the inspection results are listed item by item with status icons. The official command documentation also states that "results are displayed with status icons" (Official commands reference). You can see at a glance from the icon on each line whether it is normal or requires attention.

As an image, the items are listed vertically like this (actual notation and items may vary depending on the environment and version).

✓ Installation 問題なし
✓ Settings 問題なし
 MCP servers 1件つながっていない
✓ Context 余裕あり

A tip for reading it is not to try to fix everything from the top down. Skip the normal items and look only at the lines with warnings or errors. Since it says "what the problem is" there, it is sufficient to use that as a starting point for addressing it.

Even more convenient is the automatic fix. According to the official documentation, if you press the f key on the screen where the diagnostic results are displayed, you can have Claude fix the reported issues (Official commands reference). It is often faster to try f first before searching for and rewriting configuration files yourself.

However, as described later, automatic fixing with f cannot fix everything. It is safer to check the content once it is displayed before letting it fix what you want fixed.

One action you can take today: If there is a warning in the /doctor results, read only the message on that line and try to see if it can be fixed with f.

When to run it for best effect

/doctor is not just a command for "after it breaks." Rather, if you run it in advance at the following milestones, you can discover troubles before they happen.

  • Immediately after installation: If you check whether the installation type and settings are correct at the beginning, you won't have to worry later that "something was weird from the start"

  • After adding or changing MCPs: MCPs won't connect if you make even a slight mistake in how you write the settings, and the errors are hard to understand. It is safe to make it a habit to check the connection status after adding one

  • After updates or configuration changes: You can catch on the spot whether something has broken due to the changes

  • When you feel "something isn't working": Before searching for error messages, first inspect the whole thing. This is the best time to use it

One action you can take today: Make it a rule for yourself to run /doctor immediately after adding the next MCP or plugin (extensions that add functionality to Claude Code).

Pitfalls and limitations

Although it is a convenient command, /doctor is not omnipotent. If you over-rely on it, you might get stuck, so I will write down three points of caution.

The first is that there are cases where problems remain even if /doctor says "OK." The official documentation explicitly states that even in situations where search is slow across file systems in WSL (a mechanism for running Linux on Windows), "/doctor displays Search as OK" (Source). It is good to keep in the back of your mind that the actual experience can be poor even if the diagnosis is green.

The second is not to take the automatic fix of the f key at face value. Since it is an operation that rewrites configuration files, the possibility that changes you did not intend are mixed in is not zero. It is safer to check the display to see what it is trying to fix before executing it.

The third is that /doctor is just an entrance. Once you know the direction of the cause from the diagnosis, individual handling is required beyond that. The flow is to proceed to the Troubleshooting document at the end of the article for installation-related issues, or to the official MCP guide for MCP settings. It is accurate to think of it as a command that tells you "where to look" rather than one that fixes everything with /doctor.

Differences from similar commands (supplement for intermediate users)

Claude Code has several commands for checking status, which can be confusing at first. Based on the official command list, here is a breakdown of their different roles (all from the official commands reference).

  • /doctor: A "health check" for installation and configuration. Identifies whether there are issues and provides a path to fix them. Use this first when in trouble.

  • /status: A settings screen that displays the version, model, account, and connection status. Used to see "what settings are currently active."

  • /config: A settings screen for adjusting configurations like themes and models. The goal is to change settings, not just check them.

  • /context: Visualizes current context usage with a color-coded grid. Used for checking when conversations feel heavy.

  • /debug: Enables debug logs for the current session and helps isolate issues by reading those logs. While /doctor is a static check for installation and configuration, /debug is used to track the behavior of a running session.

In short, the roles are divided as follows: /doctor for "diagnosing if something is broken," /status for "checking current settings," /config for "changing settings," and /context for "checking conversation weight." A clear workflow is to start troubleshooting with /doctor, and then use /status or /context to check the situation as needed.

The /doctor command within a session and the claude doctor command in the shell perform the same diagnosis. The only difference is the entry point; you can choose which one to use based on whether Claude Code is currently running.

Summary

When trouble occurs, the speed at which you reach the cause differs significantly between someone who copies an error message into a search bar and someone who runs /doctor first. The former ends up swimming in a sea of other people's cases, while the latter can start from the facts of their own environment.

/doctor is a command that checks installation, configuration, MCP, and context all at once, showing you "what looks suspicious" with status icons. You can even leave the fixes to it by pressing the 'f' key, and if it won't start, you have the fallback of running claude doctor in the shell. I think it is the easiest "insurance" policy for beginners to remember first.

3 steps to try starting today

  • [ ] Run /doctor in your currently open Claude Code and visually check the four items being inspected (installation, configuration, MCP, and context).

  • [ ] Try running claude doctor from the terminal once to learn the fallback method for when it won't start.

  • [ ] Make it a habit to run /doctor immediately after adding new MCPs or plugins to verify the connection.

Bonus


Reference Links

  • Troubleshooting (Official Claude Code Documentation) (Covers /doctor inspection targets, claude doctor, and WSL notes)

  • Commands (Claude Code Official Documentation)(Definition of /doctor, f key, and list of related commands)

  • Skills (Claude Code Official Documentation)(How slash commands work. Custom commands are integrated into skills)

同じカテゴリの記事

藤崎 健人

芸能取材歴10年のデスク。所属事務所の公式リリース、番組公式サイト、配信サービスの告知を一次情報として採用し、裏付けの取れない内容は記事にしていません。

おすすめの関連記事