Explore Before You Change
Why This Matters
Testers joining a new project read the test suite before touching it. An agent should do the same, and it should not fill its main context with every file it glanced at along the way.
How Claude Code finds its way
Claude Code works like a careful developer in an unfamiliar repository: it searches for file names, searches for content, reads the relevant files, and only then edits. Good sessions show that order. A session that starts editing after reading one file is guessing.
Ask questions first
Start with questions that need no edits:
How does a failure get from
run-1042.jsonto a verdict? Name the functions in order. Do not change anything.
A good answer names loadRun → failedTests → buildTriageMessage → triageFailure → triageResultSchema.safeParse, with file names. If the answer is vague or wrong, you have learned something important before any code changed.
Keep exploration out of the main context
Reading twenty files to answer one question fills the session’s context with material it does not need afterwards. Claude Code can hand exploration to a subagent that reads widely in its own context and returns only a short summary. You can also ask for it explicitly:
Use a subagent to find every place where the API is called, and report file and line only.
The main session gets five lines instead of twenty files.
Is it reading or guessing?
Signs that the agent is guessing:
- it names functions or files that do not exist
- it describes behaviour without having opened the file
- its answer would fit any project
Ask “which file did you read that in?” A grounded answer points to a file and line.
Exercise
Without any edits, have Claude Code answer three questions about TestPilot:
- Where is the failure rate calculated, and which tests cover it?
- What happens when the model’s answer does not match the schema?
- Which files would change if we added a new category
infra_config?
Check each answer against the code yourself.
Show what Claude Code should find
- In
failureRateinsrc/runs.ts: failures divided by the length of the history, and 0 for an empty history. Covered bytests/runs.test.ts(“is 0 for an empty history”, “counts failures as a share of the history”, “does not count skipped as failed”). triageFailureinsrc/triage.tsvalidates withsafeParseand throwsdid not match the schema. The CLI does not catch it, so one bad answer stops the whole run, which is exactly what lesson 13’s per-failuretry/catchfixes.failureCategoriesinsrc/schema.ts, the category definitions in the system prompt insrc/prompt.ts, the tests that list categories, and the golden set and scorecard (module 3), which need examples of the new category.
If Claude Code’s answer names a file or test that does not exist, that is your reminder to check answers against the code, not to trust them.
Compare with solution/lesson-52-claude-code, which has the Claude Code setup for lessons 42–52. Its docs/claude-code-demo.md walks you through all of module 6 in one session.