11.2 WebSearch: Searching from Claude Code
Course: Claude Code - Power User Section: Accessing the Web Video Length: 2-5 minutes Presenter: Daniel Treasure
Opening Hook
"Sometimes you don't know the URL. You have a question: 'How do I handle async errors in Node.js?' or 'What's the latest syntax for React hooks?' WebSearch lets you ask Claude to find the answer for you—no tab-switching, no manual Googling. Just a question and Claude brings back results."
Key Talking Points
1. What WebSearch Does
- Built-in search tool in Claude Code
- Queries the web and returns relevant results
- Claude analyzes the results and answers your question
- Perfect for real-world troubleshooting and learning
- Finds Stack Overflow answers, official docs, blog posts, error explanations
- Supports modern search operators (site:, type filters, etc.)
What to say: "WebSearch is like having a colleague who's super fast at Googling. You ask a question, Claude searches, reads the results, and tells you the answer. All without leaving your coding context."
What to show on screen: Show the WebSearch query interface in Claude Code. Display what a typical search query looks like (natural language, not search engine syntax).
2. When to Use WebSearch
- Troubleshooting errors you've never seen before
- Finding the latest API documentation or syntax
- Looking up best practices or design patterns
- Understanding deprecations or breaking changes
- Finding Stack Overflow solutions to specific problems
- Accessing community knowledge and real-world examples
What to say: "If you have a question but no URL, WebSearch finds the answer. It's faster than manually searching and Claude brings context back to your code."
What to show on screen: Show a few example questions: "What's the difference between useEffect and useLayoutEffect?", "How do I debug CORS errors?", "Latest Node.js async/await patterns?"
3. How WebSearch Works
- Claude formulates a search query from your question
- Sends it to the web search engine (Bing or Google)
- Returns snippets and links from top results
- Claude reads and summarizes the most relevant findings
- Cites sources so you can dive deeper if needed
- Returns current, up-to-date information
What to say: "The magic is that Claude doesn't just dump raw search results at you. It reads them, understands them, and synthesizes an answer based on what it found."
What to show on screen: Flow diagram: Question → Search query formulation → Web search → Result parsing → Answer + citations returned.
4. Search Operators and Refinement
- Use natural language questions for best results
- Can specify domains: "Find Stack Overflow answers about..."
- Can ask for official docs: "What's the official Python logging documentation?"
- Can filter by recency: "Latest React 19 features"
- Can exclude sources: "React documentation but not Medium blogs"
What to say: "WebSearch understands context. Tell it what kind of source you want, and it'll filter accordingly. 'Official docs only' or 'community examples' or 'recent tutorials.'"
What to show on screen: Show a few examples of refined queries and how Claude handles them differently.
Demo Plan
- Demo 1: Simple Error Troubleshooting
- Encounter or simulate an error message in code
- Ask Claude: "I'm getting [error message]. What does it mean and how do I fix it?"
- Show WebSearch running
- Display Stack Overflow or official docs result
-
Show Claude's synthesis and recommendation
-
Demo 2: API or Framework Question
- Ask Claude: "What's the latest way to handle authentication in Next.js 15?"
- Show WebSearch fetching results
-
Display the answer with citations to official docs and blog posts
-
Demo 3: Best Practices
- Ask Claude: "Best practices for structuring a large React project"
- Show WebSearch pulling from multiple sources
- Demonstrate how Claude synthesizes conflicting or varied advice into actionable guidance
Code Examples & Commands
Example 1: Error Troubleshooting
User: "I'm getting 'EADDRINUSE' when starting my Node server. What's happening?"
Claude uses WebSearch to find common causes and solutions, returns:
- What the error means
- Common causes
- How to find and kill the process
Example 2: Framework Question
User: "How do I set up environment variables in a Next.js app?"
Claude searches for official Next.js docs and returns:
- Official method (.env.local files)
- How to access them in components vs. API routes
- Security considerations
Example 3: Dependency/Version Question
User: "I need to upgrade Express. What breaking changes are in v5?"
Claude searches release notes and migration guides:
- Lists major breaking changes
- Provides upgrade paths
- Links to official migration guide
Gotchas & Tips
- Search Quality: Your question phrasing matters. More specific questions get better results. "How do I fix a 404 error?" is less useful than "Getting 404 on API route in Next.js".
- Outdated Results: Web search can return old content. Claude tries to prioritize recent sources, but always check publish dates.
- Stack Overflow Quality: Popular answers aren't always correct. Claude reads multiple sources, but you should verify critical advice.
- Regional/Language Results: Search results are in English by default, but some sites may have regional versions. Specify if needed.
- Third-Party Content: Be careful with sponsored or promotional content mixed into results. Claude usually filters this well, but review if it's critical.
Pro tip: Combine WebSearch with WebFetch. Find something in search results, then use WebFetch to grab the full article or documentation page for deeper context.
Lead-out
"WebSearch keeps you in the flow. No context-switching, no manual Googling. Next, we'll go deeper into browser automation with Playwright—for when you need to actually interact with web pages, not just read them."
Reference URLs
- https://docs.anthropic.com/en/docs/build-a-claude-chatbot-with-a-web-crawler
- https://github.com/anthropics/claude-code
- https://www.bing.com/webmaster/help/webmaster-guidelines-31e81b4d
Prep Reading
- Test WebSearch with 2-3 real coding questions before recording
- Have a good error message or troubleshooting scenario ready
- Prepare an API/framework question that has multiple good sources
- Understand how Claude prioritizes and synthesizes search results
- Know the difference between WebSearch and WebFetch use cases
Notes for Daniel: The energy here should feel like efficiency and relief. This tool removes friction. Show the before/after: "Normally you'd tab-switch to Google, read snippets, come back to code... With WebSearch, you just ask." Keep demos snappy—2-3 searches max. If search takes >5 seconds, show a prerecorded version.