claude-search
npx machina-cli add skill dceoy/ai-coding-agent-skills/claude-search --openclawFiles (1)
SKILL.md
2.7 KB
Claude Search Skill
Use Anthropic Claude's web search tool via the Messages API to perform read-only web research with citations.
When to Use
- The user asks for current docs, best practices, or library comparisons
- The user needs up-to-date troubleshooting or security guidance
- The user requests sources, links, or citations
- The topic is time-sensitive (news, releases, versions, policies)
Prerequisites
ANTHROPIC_API_KEYis set- Web search is enabled for the org/project in the Anthropic Console
- Use a model that supports web search (check Anthropic docs for the current list)
Basic Usage
Step 1: Frame the Research Query
- Be specific about the goal and scope
- Prefer official documentation and authoritative sources
- Add date constraints when recency matters
Step 2: Call the Messages API with the Web Search Tool
curl https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "MODEL_NAME",
"max_tokens": 1000,
"messages": [
{"role": "user", "content": "Research: [QUERY]. Provide a concise answer and cite sources."}
],
"tools": [
{
"type": "web_search_20250305",
"name": "web_search",
"max_uses": 3,
"allowed_domains": ["example.com"]
}
]
}'
Step 3: Present Results with Citations
- Summary: direct answer in 2-3 sentences
- Key findings: bullet points with citations
- Sources: list of URLs referenced
Domain Filtering and Location
- Use
allowed_domainsorblocked_domainsto constrain sources - Use
user_locationto bias results toward a region when needed - Increase
max_usesfor broader coverage (keep it minimal to reduce cost)
Best Practices
- Prefer official docs, standards bodies, and vendor sources
- Request dates in the response for time-sensitive info
- Ask for alternative approaches if multiple options exist
- Keep the prompt explicit about citation requirements
Error Handling
- If web search is not enabled, ask the user to enable it in the Anthropic Console
- If the model lacks web search support, switch to a supported model
- If results are thin, broaden the query or remove domain filters
Related Skills
codex-searchfor OpenAI Codex CLI web searchclaude-askfor read-only codebase understandingclaude-execfor code modifications
Source
git clone https://github.com/dceoy/ai-coding-agent-skills/blob/main/skills/claude-search/SKILL.mdView on GitHub Overview
This skill uses Anthropic Claude's web search tool via the Messages API to perform read-only web research with citations. It helps you retrieve up-to-date documentation, best practices, comparisons, and troubleshooting information with clear sources.
How This Skill Works
Frame a specific research query and then call the Claude Messages API with the web_search tool (e.g., web_search_20250305) to fetch results. Present results as a concise summary, followed by key findings with citations and a list of source URLs; you can constrain sources using allowed_domains or location filters.
When to Use It
- User needs current docs, best practices, or library comparisons
- User requires up-to-date troubleshooting or security guidance
- User requests sources, links, or citations
- Topic is time-sensitive (news, releases, versions, policies)
- You need verifiable sources and citations for claims
Quick Start
- Step 1: Frame the research query with a clear goal and date constraints
- Step 2: Call the Messages API with the web_search tool and appropriate domain filters
- Step 3: Present results with a 2-3 sentence summary, key findings, and sources
Best Practices
- Prefer official docs, standards bodies, and vendor sources
- Request dates in the response for time-sensitive information
- Ask for alternative approaches if multiple options exist
- Keep the prompt explicit about citation requirements
Example Use Cases
- Research current API docs for Claude web search
- Compare Claude web search results with other search tools
- Obtain troubleshooting guidance with citations from official sources
- Fetch security guidance and policy updates with dates
- Provide a list of sources with URLs for user review
Frequently Asked Questions
Add this skill to your agents