Back to AI Q&A
What should I do if I can't find a document in Claude Code? Add the table of contents and then check the path

What should I do if I can't find a document in Claude Code? Add the table of contents and then check the path

AI Q&A Admin 154 views

Claude Code can't find a file, so let's see which working directories it currently has access to. It doesn't automatically know all the items on your computer; If the file is outside the current directory, add the directory first, or start from the correct project root.

Confirm the current working directory first

Go to the project root and then run Claude Code. Let it execute or read the current directory structure first, such as listing the root directory, viewing the package file, and confirming the Git state. As long as the first step of the table of contents is wrong, no matter how many questions you ask later, you will go astray.

If you're working on issues across two directories, you can add an extra working directory with /add-dir. For example, if the front-end project and the back-end project are separated, don't expect it to automatically go beyond the parent directory to find it.

CLAUDE.md is not a file index

Many people think that if you write 'CLAUDE.md', Claude Code will automatically read all the relevant files. In fact, 'CLAUDE.md' is more like a project memory and work convention, suitable for writing architecture descriptions, common commands, code specifications, and precautions. If you really want to analyze the file, you still need to let it read the corresponding path.

You can write the key directories in 'CLAUDE.md': back-end entrance, front-end entrance, test command, and generation file location. This makes it less likely to go around when searching.

WSL and path problems are also common

If you are using WSL on Windows, make sure that Node, npm, and project are all in the WSL environment. The Anthropic documentation also warns that if you misuse Windows npm or node in WSL, you may encounter various problems such as not finding commands or abnormal paths.

Use 'which node', 'which npm' to see the path. If it points to '/mnt/c/', it is recommended to fix it to the Linux version.

It's best to ask questions like this

"The current project root directory is here. Read 'CLAUDE.md' first, then search for 'src/routes' and 'src/services', not 'dist'. If you can't find the file, let me know which directories you can actually see. ”

This prevents Claude Code from guessing the path itself. When AI programming tools cannot find a file, first fix the visible range and then talk about code capabilities.

Recommended Tools

More