home / skills / openclaw / skills / brave-web-search

brave-web-search skill

/skills/kghamilton89/brave-web-search

This skill performs real-time web lookups and concise factual answers using Brave Search, returning ranked results or AI summaries.

npx playbooks add skill openclaw/skills --skill brave-web-search

Review the files below or copy the command above to add this skill to your agents.

Files (5)
SKILL.md
2.7 KB
---
name: brave-web-search
description: Searches the web and returns ranked results or AI-generated summarized answers using the Brave Search API. Use for real-time web lookups and factual Q&A.
metadata:
  clawdbot:
    emoji: "🔍"
    requires:
      env: ["BRAVE_SEARCH_API_KEY", "BRAVE_ANSWERS_API_KEY"]
      bins: ["node"]
    primaryEnv: "BRAVE_SEARCH_API_KEY"
    category: "Search & Research"
---

# Brave Web Search

Searches the web and fetches AI-generated summarized answers using the Brave Search API. Exposes two commands: `brave-search` for ranked web results and `brave-answer` for concise AI summaries.

## Instructions

1. **Trigger**: Activate when the user wants to look something up on the web, check recent news, or get a factual answer to a question.
2. **Setup**: No installation step is required — this skill has zero external dependencies and runs on native Node.js.
3. **Command selection**:
   - Use `brave-search` for general web searches where ranked results with URLs and snippets are useful.
   - Use `brave-answer` for direct factual questions where a concise AI summary is more appropriate.
4. **Execution**: Invoke the script by passing the command name and parameters as **separate arguments**, never by interpolating user input into a shell command string. Use an argument array / `execFile`-style invocation so the shell never parses user-supplied values. Example (Node-style pseudo-code):

   ```javascript
   execFile('node', ['index.js', 'brave-search', '--query', userQuery, '--count', '10'])
   ```

   Do **not** construct the command as a single concatenated string such as `"node index.js brave-search --query " + userQuery`.

5. **Freshness**: For time-sensitive queries, pass `--freshness` followed by `pd` (past day), `pw` (past week), or `pm` (past month) as a separate argument to `brave-search`.
6. **Fallback**: If `brave-answer` returns `answer: null`, present the `fallback_results` to the user instead.
7. **Completion**: Present the results clearly, citing titles and URLs for web search results, or the summary text for answer results.

## Security & Privacy

- **Shell Injection Prevention**: User queries **must** be passed as discrete arguments (e.g. via `execFile` or an argv array), never interpolated into a shell command string. Concatenating user input into a shell string (e.g. `shell: true` with template literals) enables shell injection and is strictly forbidden.
- **Instruction Scope**: This skill only sends query strings to the Brave Search and Brave Summarizer APIs.
- **Environment**: It uses the `BRAVE_SEARCH_API_KEY` and `BRAVE_ANSWERS_API_KEY` provided by the OpenClaw environment.
- **Data Access**: It does not read local files or .env files. All configuration is handled by the agent.

Overview

This skill searches the web and returns ranked results or AI-generated summarized answers using the Brave Search API. It exposes two commands: brave-search for ranked results (titles, snippets, URLs) and brave-answer for concise AI summaries. Use it for real-time lookups, news checks, and factual Q&A with citation-ready links.

How this skill works

The skill invokes Brave Search endpoints to fetch ranked web results or the Brave Summarizer to produce concise answers. Queries are passed as discrete command arguments so the shell never interprets user input, preventing injection. If the summarizer returns no answer, the skill falls back to supplying the raw search results for manual review.

When to use it

  • Need ranked web results with titles, snippets, and source URLs.
  • Want a short, factual summary generated from live web content.
  • Checking recent news or time-sensitive information (use freshness flags).
  • Verifying claims or gathering sources for citations.
  • When you require real-time web lookup rather than a static knowledge base.

Best practices

  • Always pass the user query as separate command arguments (execFile/argv style) to avoid shell injection.
  • Choose brave-search for lists of links and brave-answer for direct factual summaries.
  • For time-sensitive queries, include the --freshness flag (pd, pw, pm).
  • If brave-answer returns answer: null, present fallback_results to the user with source URLs.
  • Limit result counts to a reasonable number (e.g., 5–10) for concise output and faster responses.

Example use cases

  • Researching recent developments on a breaking news topic and returning top URLs and snippets.
  • Answering a factual question like "What are the current FDA guidelines for X?" with a concise summarized answer and citations.
  • Gathering sources for a blog post: return ranked results for a topic and highlight authoritative links.
  • Confirming a statistic or claim by returning original sources and summary context.
  • Monitoring a niche topic by searching with a past-day or past-week freshness filter.

FAQ

What is the difference between brave-search and brave-answer?

Use brave-search to retrieve ranked web results with URLs and snippets. Use brave-answer to get a concise AI-generated summary synthesized from web content.

How do I prevent shell injection when running the skill?

Invoke the script with an argument array (execFile or argv-style) and never interpolate user input into a single shell command string.