Skip to content

Chapter 3 of 7

Reading, Searching, and Understanding Code

Before changing anything, it often pays to ask Claude to read the existing code. A simple "Read [filename] and explain what it does" or just "Read [filename]" gets Claude oriented, after which you can drill in with follow-up questions. For specific functions, the prompt "Read [file:line_number] and explain what this function does, including its inputs, outputs, and side effects" produces a focused explanation. To find where a symbol or pattern is used, ask "Find all places where [function/variable/pattern] is used" or "Search for files containing [keyword]."

When the codebase is unfamiliar, prompts that invite summarization are especially effective. "Explain the design patterns used in this codebase, why they were chosen, and how they interact with each other" turns Claude into a tutor. You can also test its understanding with "In your own words, explain how [feature/system] works based on the code. Then identify any gaps or potential issues." When chasing a bug, "Walk me through how data flows from [input] to [output] in this code, and identify where [bug symptom] could originate" is a powerful way to surface the root cause without randomly editing files.

For error messages, the best practice is to paste the full text directly into the prompt: "I'm getting this error: [paste error]. What does it mean and how do I fix it?" This gives Claude everything it needs to interpret the message and suggest concrete next steps. The same principle of providing full context applies whether the error is from a tool, a test runner, or a runtime exception.

All chapters
  1. 1Getting Started with Claude Code
  2. 2Project Context and Configuration
  3. 3Reading, Searching, and Understanding Code
  4. 4Writing, Editing, and Refactoring Code
  5. 5Testing, Debugging, and Code Review
  6. 6APIs, Data, and Infrastructure
  7. 7Architecture, Documentation, and Release Workflow

Drill it

Reading is not remembering. These come from the Claude Code Prompts deck:

Q

What is Claude Code?

Claude Code is Anthropic's official AI-powered CLI tool that helps developers write, edit, debug, and understand code directly in the terminal.

Q

How do you start Claude Code?

Run `claude` in your terminal from any project directory to start an interactive session with the AI assistant.

Q

What is the key benefit of working in Claude Code's agentic mode?

Claude Code can read files, write code, run tests, and execute shell commands autonomously, completing complex multi-step tasks end-to-end.

Q

How do you give Claude Code access to your entire project?

Navigate to your project root before starting Claude Code — it will automatically have context of all files in the working directory.