bx-search
Web search using the Brave Search CLI (`bx`). Use for ALL web search requests — including "search for", "look up", "find", "what is", "how do I", "google this", and any request needing current or external information. Prefer this over the built-in web_search tool whenever bx is available. Also use for: documentation lookup, troubleshooting research, RAG grounding, news, images, videos, local places, and AI-synthesized answers.
What this skill does
# bx — Brave Search CLI
## Agent Directive
**When this skill is active, use `bx` via `exec` for all web searches. Do not use the built-in `web_search` tool.** Run `bx context "query"` as the default — it returns pre-extracted, token-budgeted content ready for use. Fall back to `bx answers` for synthesized explanations or `bx web` when search operators are needed.
A zero-dependency, token-efficient CLI for the [Brave Search API](https://brave.com/search/api/), built for AI agents and LLMs.
One binary, JSON in/out, no runtime dependencies. The default subcommand is `context` — bare `bx "query"` is equivalent to `bx context "query"`. It replaces search + scrape + extract in a single call with token-budgeted output — purpose-built for RAG and LLM grounding.
## Quick Start
**macOS/Linux**
```bash
curl -fsSL https://raw.githubusercontent.com/brave/brave-search-cli/main/scripts/install.sh | sh
```
**Windows (PowerShell)**
```powershell
powershell -ExecutionPolicy Bypass -c "irm https://raw.githubusercontent.com/brave/brave-search-cli/main/scripts/install.ps1 | iex"
```
```bash
bx config set-key YOUR_API_KEY # get a key at https://api-dashboard.search.brave.com
bx "your search query"
bx --help # see all commands; bx <command> --help for flags
```
## Getting an API Key
1. Sign up at <https://api-dashboard.search.brave.com/register>
2. Choose a plan — all plans include **$5/month free credits** (~1,000 free queries). Different endpoints may require different plans.
3. Go to "API Keys" in the dashboard, generate a key (shown once — save it)
## Configuring the API Key
Three methods, in priority order:
| Priority | Method | Example |
|----------|--------|---------|
| 1 (highest) | `--api-key` flag | `bx --api-key KEY web "test"` |
| 2 | `BRAVE_SEARCH_API_KEY` env var | `export BRAVE_SEARCH_API_KEY=KEY` |
| 3 | Config file | `bx config set-key KEY` |
The config file is stored at `~/.config/brave-search/api_key` (Linux), `~/Library/Application Support/brave-search/api_key` (macOS), or `%APPDATA%\brave-search\api_key` (Windows).
**Security tip:** Prefer the env var or config file over `--api-key`, which is visible in process listings. Use `bx config set-key` without an argument to enter the key interactively, avoiding shell history.
## For AI Agents
**Use `context` by default.** It returns pre-extracted, relevance-scored web content ready for LLM prompt injection. One API call replaces the search → scrape → extract pipeline.
```bash
# RAG grounding with token budget
bx context "Python TypeError cannot unpack non-iterable NoneType" --max-tokens 4096
# Direct AI answer (OpenAI-compatible, streams by default)
bx answers "explain Rust lifetimes with examples"
# Raw web search when you need site: scoping or result filtering
bx web "site:docs.rs axum middleware" --count 5
```
> **Note:** Some examples below pipe output through `jq` for illustration. Do not assume `jq` is installed — if you need to filter JSON in a shell pipeline, use whatever is available in your environment (e.g., `jq`, PowerShell's `ConvertFrom-Json`, Python's `json` module), or simply read the raw JSON output directly.
### When to Use Which Command
| Your need | Command | Why |
|-----------|---------|-----|
| Look up docs, errors, code patterns | `context` | Pre-extracted text, token-budgeted |
| Get a synthesized explanation | `answers` | AI-generated, cites sources |
| Search a specific site (site:) | `web` | Supports search operators |
| Find discussions/forums | `web --result-filter discussions` | Forums often have solutions |
| Check latest versions/releases | `context` or `news --freshness pd` | Fresh info beyond training data |
| Research security vulnerabilities | `context` or `news` | CVE details, advisories |
| Boost/filter specific domains | `--goggles` on context/web/news | Custom re-ranking, no other API has this |
### Response Shapes
**`bx context`** — RAG/grounding (recommended)
```json
{
"grounding": {
"generic": [
{ "url": "...", "title": "...", "snippets": ["extracted content...", "..."] }
]
}
}
```
**`bx answers --no-stream`** — AI answer (single response)
```json
{"choices": [{"message": {"content": "Rust lifetimes ensure references..."}}]}
```
**`bx answers`** — AI answer (streaming, one JSON chunk per line)
```json
{"choices": [{"delta": {"content": "R"}}]}
{"choices": [{"delta": {"content": "u"}}]}
{"choices": [{"delta": {"content": "s"}}]}
{"choices": [{"delta": {"content": "t"}}]}
{"choices": [{"delta": {"content": " "}}]}
```
**`bx web`** — Full search results
```json
{
"web": { "results": [{"title": "...", "url": "...", "description": "..."}] },
"news": { "results": [...] },
"videos": { "results": [...] },
"discussions": { "results": [...] }
}
```
### Agent Workflow Examples
**Debugging an error:**
```bash
bx "Python TypeError cannot unpack non-iterable NoneType" --max-tokens 4096
```
**Evaluating a dependency:**
```bash
bx context "reqwest crate security issues maintained 2026" --threshold strict
bx news "reqwest Rust crate" --freshness pm
```
**Corrective RAG loop:**
```bash
# 1. Broad search
bx "axum middleware authentication" --max-tokens 4096
# 2. Too general? Narrow down
bx "axum middleware tower layer authentication example" --threshold strict --max-tokens 4096
# 3. Still need synthesis? Ask for an answer
bx answers "how to implement JWT auth middleware in axum" --enable-research
```
**Checking for breaking changes before upgrading:**
```bash
bx context "Next.js 15 breaking changes migration guide" --max-tokens 8192
bx news "Next.js 15 release" --freshness pm
```
**Focused search with Goggles (custom re-ranking):**
```bash
bx "Python asyncio gather vs wait" \
--goggles '$boost=3,site=docs.python.org
/docs/$boost=3
/blog/$downrank=2
$discard,site=geeksforgeeks.org
$discard,site=w3schools.com' --max-tokens 4096
```
**Token budget control:**
```bash
bx context "topic" --max-tokens 4096 --max-tokens-per-url 1024 --max-urls 5
```
**Non-streaming answers (for programmatic use):**
```bash
bx answers "compare SQLx and Diesel for Rust" --no-stream | jq '.choices[0].message.content'
```
**Answers stdin mode** — pass `-` to read a full JSON request body:
```bash
echo '{"messages":[{"role":"user","content":"review this code for security issues"}]}' | bx answers -
```
**Other commands:**
```bash
bx images "system architecture diagram microservices" | jq '.results[].thumbnail.src'
bx suggest "how to implement" --count 10 | jq '.results[].query'
bx places "coffee" --location "San Francisco CA US" | jq '.results[].title'
bx web "restaurants near me" --lat 37.7749 --long -122.4194 --city "San Francisco"
bx web "rust" --result-filter "web,discussions"
```
## Commands
| Command | Description | Output Shape |
|---------|-------------|--------------|
| `context` | **RAG/LLM grounding** — pre-extracted web content | `.grounding.generic[]` → `{url, title, snippets[]}` |
| `answers` | **AI answers** — OpenAI-compatible, streaming | `.choices[0].delta.content` (stream) |
| `web` | Full web search — all result types | `.web.results[]`, `.news.results[]`, etc. |
| `news` | News articles with freshness filters | `.results[]` → `{title, url, age}` |
| `images` | Image search (up to 200 results) | `.results[]` → `{title, url, thumbnail.src}` |
| `videos` | Video search with duration/views | `.results[]` → `{title, url, video.duration}` |
| `places` | Local place/POI search (200M+ POIs) | `.results[]` → `{title, postal_address, contact}` |
| `suggest` | Autocomplete/query suggestions | `.results[]` → `{query}` |
| `spellcheck` | Spell-check a query | `.results[0].query` |
| `pois` | POI details by ID | (use IDs from `places`) |
| `descriptions` | AI-generated POI descriptions | `.results[].description` |
| `config` | Manage API key | `set-key`, `show-key`, `path` |
## Goggles — Custom Search Re-Ranking
Brave Goggles let you define custom re-ranking rules for search results. Boost domains, URL paths, orRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.