brave-search

$npx mdskill add megalithic/dotfiles/brave-search

Searches the web and extracts content via Brave Search API for documentation, facts, or any online information.

  • Helps find web-based information quickly without requiring a browser.
  • Integrates with the Brave Search API and requires an API key from a free subscription.
  • Uses query parameters to filter results by freshness or date range.
  • Outputs search results as text, optionally including page content in markdown format.

SKILL.md

.github/skills/brave-searchView on GitHub ↗
---
name: brave-search
description: Web search and content extraction via Brave Search API. Use for searching documentation, facts, or any web content. Lightweight, no browser required.
script: search.js
---

# Brave Search

Web search and content extraction using the official Brave Search API. No browser required.

**Script location:** `$PI_CODING_AGENT_DIR/skills/brave-search/`

## Setup

Requires a Brave Search API account with a free subscription. A credit card is required to create the free subscription (you won't be charged).

1. Create an account at https://api-dashboard.search.brave.com/register
2. Create a "Free AI" subscription (2,000 queries/month free)
3. Create an API key
4. Add to your agenix secrets (`secrets/env-vars.age`):
   ```bash
   export BRAVE_SEARCH_API_KEY="your-api-key-here"
   ```
5. Dependencies are pre-installed via Nix (no manual npm install needed)

## Search

```bash
$PI_CODING_AGENT_DIR/skills/brave-search/search.js "query"                         # Basic search (5 results)
$PI_CODING_AGENT_DIR/skills/brave-search/search.js "query" -n 10                   # More results (max 20)
$PI_CODING_AGENT_DIR/skills/brave-search/search.js "query" --content               # Include page content as markdown
$PI_CODING_AGENT_DIR/skills/brave-search/search.js "query" --freshness pw          # Results from last week
$PI_CODING_AGENT_DIR/skills/brave-search/search.js "query" --freshness 2024-01-01to2024-06-30  # Date range
$PI_CODING_AGENT_DIR/skills/brave-search/search.js "query" --country DE            # Results from Germany
$PI_CODING_AGENT_DIR/skills/brave-search/search.js "query" -n 3 --content          # Combined options
```

### Options

- `-n <num>` - Number of results (default: 5, max: 20)
- `--content` - Fetch and include page content as markdown
- `--country <code>` - Two-letter country code (default: US)
- `--freshness <period>` - Filter by time:
  - `pd` - Past day (24 hours)
  - `pw` - Past week
  - `pm` - Past month
  - `py` - Past year
  - `YYYY-MM-DDtoYYYY-MM-DD` - Custom date range

## Extract page content

```bash
$PI_CODING_AGENT_DIR/skills/brave-search/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
Age: 2 days ago
Snippet: Description from search results
Content: (if --content flag used)
  Markdown content extracted from the page...

--- Result 2 ---
...

--- Rate Limit Info ---
Requests remaining: 1999/2000
Plan quota remaining: 1999/2000
Resets at: 2/6/2026, 12:00:00 AM
```

## Rate Limits (Free Plan)

- **2,000 queries/month** included free
- 1 query/second rate limit
- Rate limit info shown after each search
- Paid plans available at https://api-dashboard.search.brave.com/app/plans

## 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

More from megalithic/dotfiles

SkillDescription
cli-toolsModern CLI tool usage (fd, rg) for fast file and content searching. Critical for Nix store searches and large codebases. Use when searching files or content, especially in /nix/store.
hsComprehensive guide for Hammerspoon development in this dotfiles repo. Covers config patterns, debugging decision trees, API reference, performance monitoring, and troubleshooting.
image-handlingImage handling for Claude API constraints (5MB max, 8000px max dimension). Use when working with images, screenshots, or MCP browser tools.
jjJujutsu (jj) version control workflow, commands, and best practices. Use when working with version control in jj-enabled repos. Covers commits, bookmarks, workspaces, and safe push patterns.
nixExpert help with Nix, nix-darwin, home-manager, flakes, and nixpkgs. Use for dotfiles configuration, package management, module development, hash fetching, debugging evaluation errors, and understanding Nix idioms and patterns.
notesExpert help with the meganote system - cross-tool note capture, daily notes, and obsidian.nvim integration. Covers Hammerspoon, Shade, nvim, and the full capture → daily note linking pipeline.
nvimComprehensive guide for Neovim configuration in this dotfiles repo. Covers plugin management, LSP debugging, treesitter, keymaps, performance, and troubleshooting decision trees.
previewDisplay code, diffs, images, and other content in a tmux pane or popup. Auto-detects nvim/megaterm for floating popups.
shadeExpert help with Shade - the native Swift note capture app. Use for debugging Shade issues, understanding IPC protocols, implementing Hammerspoon integration, nvim RPC, context gathering, and meganote workflows.
smart-ntfySend intelligent notifications via ~/bin/ntfy with context-aware channel selection. Use when completing tasks, asking questions, encountering errors, or reaching milestones.