Skip to content

davila7/claude-code-templates / cli-tool/components/skills/development/brightdata-local-search

brightdata-local-search

Unverified

Set up and run local web searches using Bright Data SERP API with the unfancy-search pipeline (query expansion, SERP retrieval, RRF reranking).

FileKindSize
SKILL.mdskill md4.8 KB
---
name: brightdata-local-search
description: Set up and run local web searches using Bright Data SERP API with the unfancy-search pipeline (query expansion, SERP retrieval, RRF reranking).
---

# Bright Data Local Search

Run powerful web searches locally using Bright Data's SERP API. This skill sets up the [unfancy-search](https://github.com/yaronbeen/unfancy-search) pipeline — a local search engine with query expansion, multi-engine SERP retrieval, RRF reranking, deduplication, and domain clustering.

**Important: This skill uses the LOCAL version only. Do not use the hosted endpoint.**

## Prerequisites

- [Bright Data](https://brightdata.com) account with SERP API access
- [Anthropic API key](https://console.anthropic.com) (for query expansion, optional)
- Docker (recommended) or Node.js 18+ with pnpm

## Setup

### Step 1: Clone and Configure

```bash
git clone https://github.com/yaronbeen/unfancy-search.git
cd unfancy-search
cp .env.example .env
```

### Step 2: Set Environment Variables

Edit `.env` with your credentials:

```env
BRIGHT_DATA_API_TOKEN=your_brightdata_token
BRIGHT_DATA_SERP_ZONE=serp_api1
ANTHROPIC_API_KEY=your_anthropic_key   # Optional: enables AI query expansion
```

Get your Bright Data token from: https://brightdata.com (SERP API section)

### Step 3: Start the Local Server

**Docker (recommended):**
```bash
docker compose up -d
# Server runs at http://localhost:3000
```

**Node.js:**
```bash
pnpm install
pnpm dev
# Server runs at http://localhost:3000
```

## API Endpoints

All requests go to `http://localhost:3000`:

| Endpoint | Method | Description |
|----------|--------|-------------|
| `/api/search` | POST | Start a search job |
| `/api/search-status/{jobId}` | GET | Poll for results |
| `/api/baseline` | POST | Trigger baseline collection |
| `/api/baseline-status/{id}` | GET | Poll baseline progress |

## Running a Search

### Step 1: Submit Search

```bash
curl -X POST http://localhost:3000/api/search \
  -H "Content-Type: application/json" \
  -d '{"query": "your search term"}'
```

The response returns a `jobId`.

### Step 2: Poll for Results

```bash
curl http://localhost:3000/api/search-status/{jobId}
```

Poll every 3 seconds until `status` is `"done"`.

### Search Parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `query` | string | required | Search query |
| `expand` | boolean | `false` | Enable AI query expansion via Claude |
| `research` | boolean | `false` | Research mode (12 sub-queries for max coverage) |
| `engines` | string[] | all | SERP engines to use |
| `geo` | string | — | Geographic region filter |
| `count` | number | 10 | Max results (up to 10) |
| `includeDomains` | string[] | — | Only include results from these domains |
| `excludeDomains` | string[] | — | Exclude results from these domains |

### Search Modes

- **Basic** (`expand: false`): Single query, fastest, no AI cost
- **Expanded** (`expand: true`): Claude Haiku generates 3 sub-queries for broader coverage
- **Research** (`research: true`): 12 sub-queries for maximum coverage

## Usage Examples

### Basic Search from an Agent

```bash
# Start search
JOB_ID=$(curl -s -X POST http://localhost:3000/api/search \
  -H "Content-Type: application/json" \
  -d '{"query": "best practices for API rate limiting"}' | jq -r '.jobId')

# Poll until done
while true; do
  RESULT=$(curl -s http://localhost:3000/api/search-status/$JOB_ID)
  STATUS=$(echo $RESULT | jq -r '.status')
  if [ "$STATUS" = "done" ]; then
    echo $RESULT | jq '.results'
    break
  fi
  sleep 3
done
```

### Research Mode with Domain Filtering

```bash
curl -X POST http://localhost:3000/api/search \
  -H "Content-Type: application/json" \
  -d '{
    "query": "kubernetes scaling strategies",
    "research": true,
    "excludeDomains": ["pinterest.com", "quora.com"]
  }'
```

### Adding Search to an Existing Agent

To give your Claude Code agent search capabilities:

1. Ensure the local server is running (`docker compose up -d` in the unfancy-search directory)
2. Your agent can use `curl` or `fetch` to query `http://localhost:3000/api/search`
3. Parse the ranked results to ground responses with real web data

## Response Format

Results include:
- Ranked URLs with RRF scores
- Domain clustering (grouped by source)
- Cost transparency (per-search expense breakdown)
- Raw and unique result counts
- Search duration

## Troubleshooting

| Issue | Solution |
|-------|----------|
| Server won't start | Verify Docker is running or Node.js 18+ installed |
| No results returned | Check `BRIGHT_DATA_API_TOKEN` is valid and SERP API zone is active |
| Query expansion not working | Verify `ANTHROPIC_API_KEY` is set and valid |
| Slow responses | Disable `expand` mode for faster single-query searches |
| Port 3000 in use | Stop other services or modify the port in docker-compose.yml |
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall