360 Secure SkillHub
360 安全技能中心

Brave Web Search

该技能用 Node.js 脚本封装 Brave Search API,提供 brave-search(返回带标题、URL、摘要的排序结果)和 brave-answer(返回 AI 生成的简要事实性答案,失败时给出 fallback_results)两个命令,支持按天/周/月的新鲜度过滤,强调以参数数组方式调用以防 shell 注入。

kghamilton89
kghamilton89
热度 91.63
最近更新 2026-05-11 17:27:24
分类:搜索依赖:代码执行 / 第三方 API应用场景:研究

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add brave-web-search
Metadata
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):

    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.