The tool hierarchy is one of the most frequent exam topics. These rules are not intuitive — Read before Edit, Bash only for shell, Grep ≠ Glob — and often appear as practical scenarios.
Objective: create the files that will be used throughout the session. Observe which tools Claude Code invokes to create directories and files.
Open a Claude Code terminal and type this request. Watch closely which tools are invoked in the interface:
Bash for mkdir -p /tmp/cert-training/src, then Write to create each file. It never uses echo > file or cat <<EOF.
Write creates or fully rewrites a file. Use it for: new files + complete rewrites. To modify an existing file, Edit is preferable because it only sends the diff — cheaper and less risky.
Objective: see concretely why Read is preferred over Bash for reading files, and what difference it makes.
Simply ask Claude to display the content of a file:
Read tool, not Bash with cat. The file is displayed with line numbers.
Now ask Claude to explain why it uses Read rather than cat:
The hierarchy: Read > cat/head/tail, Edit > sed/awk, Write > echo/cat <<EOF. Bash is reserved for operations with no dedicated equivalent.
Objective: experience the "Read required before Edit" rule and understand what happens if you bypass it.
Request a precise modification in config.json:
Read, then uses Edit with an old_string and a new_string. It does not rewrite the whole file with Write.
Now test the uniqueness constraint. Add a line that makes old_string ambiguous:
replace_all: true or provide more context to make old_string unique. Observe how it handles this.
1. Read required before Edit in the same conversation. 2. old_string must be unique in the file (otherwise use replace_all: true). 3. Prefer Edit over Write for any targeted modification.
"Claude Code can use Edit on a file without having previously read it in the conversation" → FALSE. Edit fails if Read has not been called at least once in the conversation.
Objective: understand the fundamental difference between Grep (searches within file content) and Glob (finds files by name/path pattern).
First, content search with Grep:
Grep with a pattern. It should find README.md and src/app.py which contain "task" or "Task".
Now, file name pattern search with Glob:
Glob with a pattern like /tmp/cert-training/**/*.py. It finds src/app.py.
Now ask for both to cement the difference:
Grep = searches inside files (like grep in bash). Glob = finds files by their name/path (like find -name). Grep reads content, Glob traverses the directory tree.
Objective: identify the cases where Bash is the only right choice: git, npm/pip, processes, system commands.
Request typically "shell" operations:
Bash for git commands. No Read/Write for these operations — there is no dedicated tool for git.
Test another legitimate Bash case:
Bash: python3 --version, pip install requests, lsof -i :3000. These operations have no dedicated equivalent in Claude Code.
git, npm/pip/yarn, processes (kill, ps, lsof), curl/wget, make, compilers, servers, environment variables. The rule: if a dedicated tool exists (Read, Edit, Write, Grep, Glob), it takes priority over Bash.
"Bash can do everything, so it's always a valid option" → FALSE. The official instruction is to avoid Bash when a dedicated tool exists. Bash for cat/sed/echo = bad practice in Claude Code.