brave-search
npx machina-cli add skill lancenunes/codex-skills/brave-search --openclawBrave Search
Headless web search and content extraction using Brave Search. No browser required.
Setup
Run once before first use:
cd "${CODEX_HOME:-~/.codex}/skills/brave-search"
npm ci
Needs env: BRAVE_API_KEY (primary) or BRAVE_AI_API_KEY (fallback).
The script tries BRAVE_API_KEY first, then BRAVE_AI_API_KEY if the first is missing or rate-limited. If both fail, it falls back to HTML scraping.
Search
./search.js "query" # Basic search (5 results)
./search.js "query" -n 10 # More results
./search.js "query" --content # Include page content as markdown
./search.js "query" -n 3 --content # Combined
Extract Page Content
./content.js https://example.com/article
Fetches a URL and extracts readable content as markdown.
Output Format
--- Result 1 ---
Title: Page Title
Link: https://example.com/page
Snippet: Description from search results
Content: (if --content flag used)
Markdown content extracted from the page...
--- Result 2 ---
...
When to Use
- Searching for documentation or API references
- Looking up facts or current information
- Fetching content from specific URLs
- Any task requiring web search without interactive browsing
Attribution
This skill was copied from steipete/agent-scripts. Upstream: https://github.com/steipete/agent-scripts License: MIT (see LICENSE)
Source
git clone https://github.com/lancenunes/codex-skills/blob/main/brave-search/SKILL.mdView on GitHub Overview
Brave-search provides headless web search and content extraction using the Brave Search API. It lets you search docs, facts, and any web content without a browser. It also gracefully falls back to HTML scraping if API keys are unavailable or rate-limited.
How This Skill Works
Install the brave-search skill in its directory and set BRAVE_API_KEY (primary) or BRAVE_AI_API_KEY (fallback). The tool queries the Brave Search API for results, returning Title, Link, and Snippet; if keys fail, it falls back to HTML scraping. When content is requested, content.js fetches a URL and extracts readable Markdown content to accompany each result.
When to Use It
- Searching for documentation or API references
- Looking up facts or current information
- Fetching content from specific URLs
- Any task requiring web search without interactive browsing
- Gathering information quickly when a browser isn't available
Quick Start
- Step 1: Setup Brave-search in the skills/brave-search directory and run: cd "${CODEX_HOME:-~/.codex}/skills/brave-search" && npm ci
- Step 2: Ensure BRAVE_API_KEY (or BRAVE_AI_API_KEY) is available in your environment
- Step 3: Run a basic search, e.g. ./search.js "your query" (default 5 results); append --content to fetch page content
Best Practices
- Provide BRAVE_API_KEY first, then BRAVE_AI_API_KEY; if both fail, the tool falls back to HTML scraping.
- Start with a basic 5-result search and increase with -n for more results as needed.
- Use --content to fetch readable page content when you need full paragraphs or code blocks.
- Cross-check critical facts against multiple sources when using API results.
- Review the Output Format to understand how Title, Link, Snippet, and Content are presented.
Example Use Cases
- Search for the Python requests documentation and review the top results for quick references.
- Fetch up-to-date Brave Search API rate limits page to ensure compliant usage.
- Extract content from a specific article URL using the content.js workflow.
- Compare multiple sources for a JavaScript fetch API reference without opening a browser.
- Retrieve API references for a library and verify changes across sources.