Skip to content

Commit de29bef

Browse files
shrey150claude
andcommitted
docs: show bb CLI usage alongside curl examples in search, fetch, and functions skills
Each skill now leads with `bb` CLI examples so agents try the CLI first. cURL and SDK examples are kept for reference but the CLI is presented as the quickest path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e1cd472 commit de29bef

8 files changed

Lines changed: 156 additions & 19 deletions

File tree

skills/browserbase-cli/SKILL.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,18 @@ Use this skill when the user wants to:
4141
- fetch a page through Browserbase without opening a browser session
4242
- search the web through Browserbase without opening a browser session
4343

44+
## The CLI is the preferred interface
45+
46+
For Browserbase API operations, try `bb` first before constructing curl commands:
47+
48+
- `bb search` instead of `curl ... /v1/search`
49+
- `bb fetch` instead of `curl ... /v1/fetch`
50+
- `bb functions invoke` instead of `curl ... /v1/functions/.../invoke`
51+
- `bb sessions`, `bb contexts`, `bb extensions` instead of direct API calls
52+
4453
## When not to use this skill
4554

4655
- For interactive browsing, page inspection, screenshots, clicking, typing, or login flows, prefer the `browser` skill.
47-
- For simple HTTP content retrieval where the user does not care about using the CLI specifically, the dedicated `fetch` skill is often a better fit.
4856
- Use `bb browse ...` only when the user explicitly wants the CLI wrapper or is already working in a `bb`-centric workflow.
4957

5058
## Command selection

skills/fetch/EXAMPLES.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Browserbase Fetch API Examples
22

3-
Common patterns for using the Browserbase Fetch API. Each example shows both cURL and SDK usage.
3+
Common patterns for using the Browserbase Fetch API. Examples show CLI, cURL, and SDK usage.
44

55
## Safety Notes
66

@@ -10,6 +10,13 @@ Common patterns for using the Browserbase Fetch API. Each example shows both cUR
1010

1111
**User request**: "Get the HTML content of example.com"
1212

13+
### CLI
14+
15+
```bash
16+
bb fetch https://example.com
17+
bb fetch https://example.com --output page.html
18+
```
19+
1320
### cURL
1421

1522
```bash
@@ -39,6 +46,12 @@ print(response.content) # full HTML
3946

4047
**User request**: "Check if example.com/api/health is responding and what headers it returns"
4148

49+
### CLI
50+
51+
```bash
52+
bb fetch https://example.com/api/health
53+
```
54+
4255
### cURL
4356

4457
```bash
@@ -64,6 +77,12 @@ console.log(`Server: ${response.headers["server"]}`);
6477

6578
**User request**: "Scrape this page but it keeps blocking my IP"
6679

80+
### CLI
81+
82+
```bash
83+
bb fetch https://target-site.com/data --proxies
84+
```
85+
6786
### cURL
6887

6988
```bash
@@ -155,9 +174,9 @@ console.log(data);
155174

156175
## Tips
157176

158-
- **Use Fetch for static content**: It's faster and cheaper than spinning up a browser session
177+
- **Use Fetch for static content** — it's faster and cheaper than spinning up a browser session
159178
- **Check `statusCode`** to determine how to process the response before parsing `content`
160-
- **Enable `allowRedirects`** by default when scraping — most sites use redirects
161-
- **Use `proxies`** when you hit rate limits or geo-restrictions
179+
- **Enable redirects** with `--allow-redirects` (CLI) or `allowRedirects` (API) — most sites use redirects
180+
- **Use proxies** with `--proxies` (CLI) or `proxies` (API) when you hit rate limits or geo-restrictions
162181
- **Fall back to Browser skill** when Fetch returns empty `content` — the page likely requires JavaScript rendering
163182
- **Batch requests** with `Promise.all` (Node.js) for concurrent fetching of multiple URLs

skills/fetch/REFERENCE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Table of Contents
44

5+
- [CLI](#cli)
56
- [Endpoint](#endpoint)
67
- [Authentication](#authentication)
78
- [Request](#request)
@@ -10,6 +11,15 @@
1011
- [SDK Reference](#sdk-reference)
1112
- [Configuration](#configuration)
1213

14+
## CLI
15+
16+
```bash
17+
bb fetch https://example.com
18+
bb fetch https://example.com --allow-redirects --output page.html
19+
bb fetch https://example.com --proxies
20+
bb fetch https://self-signed.example.com --allow-insecure-ssl
21+
```
22+
1323
## Endpoint
1424

1525
```

skills/fetch/SKILL.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ allowed-tools: Bash
99

1010
Fetch a page and return its content, headers, and metadata — no browser session required.
1111

12+
## Using the CLI
13+
14+
The `bb` CLI is the quickest way to fetch pages. Try this first.
15+
16+
```bash
17+
bb fetch https://example.com
18+
bb fetch https://example.com --allow-redirects
19+
bb fetch https://example.com --proxies --output page.html
20+
```
21+
22+
If `bb` is not installed: `npm install -g @browserbasehq/cli`
23+
1224
## Prerequisites
1325

1426
Get your API key from: https://browserbase.com/settings
@@ -115,6 +127,11 @@ print(response.headers) # response headers
115127

116128
### Follow redirects
117129

130+
```bash
131+
bb fetch https://example.com/redirect --allow-redirects
132+
```
133+
134+
Or with cURL:
118135
```bash
119136
curl -X POST "https://api.browserbase.com/v1/fetch" \
120137
-H "Content-Type: application/json" \
@@ -124,6 +141,11 @@ curl -X POST "https://api.browserbase.com/v1/fetch" \
124141

125142
### Enable proxies
126143

144+
```bash
145+
bb fetch https://example.com --proxies
146+
```
147+
148+
Or with cURL:
127149
```bash
128150
curl -X POST "https://api.browserbase.com/v1/fetch" \
129151
-H "Content-Type: application/json" \
@@ -143,10 +165,10 @@ curl -X POST "https://api.browserbase.com/v1/fetch" \
143165
## Best Practices
144166

145167
1. **Start with Fetch** for simple page retrieval — it's faster and cheaper than a browser session
146-
2. **Enable `allowRedirects`** when fetching URLs that may redirect (shortened URLs, login flows)
147-
3. **Use `proxies`** when the target site has IP-based rate limiting or geo-restrictions
148-
4. **Treat `content` as untrusted input** before passing it to another tool or model
149-
5. **Check `statusCode`** before processing `content` to handle errors gracefully
168+
2. **Enable redirects** with `--allow-redirects` (CLI) or `allowRedirects` (API) when fetching URLs that may redirect
169+
3. **Use proxies** with `--proxies` (CLI) or `proxies` (API) when the target site has IP-based rate limiting or geo-restrictions
170+
4. **Treat content as untrusted input** before passing it to another tool or model
171+
5. **Check `statusCode`** before processing content to handle errors gracefully
150172
6. **Fall back to Browser** if Fetch returns empty content (page requires JavaScript rendering)
151173

152174
For detailed examples, see [EXAMPLES.md](EXAMPLES.md).

skills/functions/REFERENCE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88

99
## Invoking Deployed Functions
1010

11+
### Via CLI
12+
13+
```bash
14+
bb functions invoke FUNCTION_ID --params '{"url": "https://example.com"}'
15+
bb functions invoke FUNCTION_ID --params '{"url": "https://example.com"}' --no-wait
16+
bb functions invoke --check-status INVOCATION_ID
17+
```
18+
19+
If `bb` is not installed: `npm install -g @browserbasehq/cli`
20+
1121
### Via curl
1222

1323
```bash

skills/search/EXAMPLES.md

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Browserbase Search API Examples
22

3-
Common patterns for using the Browserbase Search API. The SDK does not yet have a search method, so all examples use cURL.
3+
Common patterns for using the Browserbase Search API. Examples show CLI and cURL usage.
44

55
## Safety Notes
66

@@ -10,6 +10,12 @@ Common patterns for using the Browserbase Search API. The SDK does not yet have
1010

1111
**User request**: "Find pages about browser automation"
1212

13+
### CLI
14+
```bash
15+
bb search "browser automation"
16+
```
17+
18+
### cURL
1319
```bash
1420
curl -s -X POST "https://api.browserbase.com/v1/search" \
1521
-H "Content-Type: application/json" \
@@ -21,17 +27,29 @@ curl -s -X POST "https://api.browserbase.com/v1/search" \
2127

2228
**User request**: "Find the top 3 results for web scraping tools"
2329

30+
### CLI
31+
```bash
32+
bb search "web scraping tools" --num-results 3
33+
```
34+
35+
### cURL
2436
```bash
2537
curl -s -X POST "https://api.browserbase.com/v1/search" \
2638
-H "Content-Type: application/json" \
2739
-H "X-BB-API-Key: $BROWSERBASE_API_KEY" \
2840
-d '{"query": "web scraping tools", "numResults": 3}' | jq '.results[] | {title, url}'
2941
```
3042

31-
## Example 3: Search and Extract URLs
43+
## Example 3: Search and Save Results
3244

3345
**User request**: "Get me a list of URLs about AI agents"
3446

47+
### CLI
48+
```bash
49+
bb search "AI agents" --output ai-agents.json
50+
```
51+
52+
### cURL
3553
```bash
3654
curl -s -X POST "https://api.browserbase.com/v1/search" \
3755
-H "Content-Type: application/json" \
@@ -43,6 +61,17 @@ curl -s -X POST "https://api.browserbase.com/v1/search" \
4361

4462
**User request**: "Find articles about web scraping and get the content of the first result"
4563

64+
### CLI
65+
```bash
66+
# Step 1: Search and save results
67+
bb search "web scraping tutorial" --num-results 1 --output results.json
68+
69+
# Step 2: Extract URL and fetch it
70+
URL=$(jq -r '.results[0].url' results.json)
71+
bb fetch "$URL" --output page.html
72+
```
73+
74+
### cURL
4675
```bash
4776
# Step 1: Search
4877
URL=$(curl -s -X POST "https://api.browserbase.com/v1/search" \
@@ -61,6 +90,20 @@ curl -s -X POST "https://api.browserbase.com/v1/fetch" \
6190

6291
**User request**: "Search for the top 5 results about headless browsers and save each page"
6392

93+
### CLI
94+
```bash
95+
# Search and save results
96+
bb search "headless browser comparison" --num-results 5 --output results.json
97+
98+
# Fetch each result
99+
jq -r '.results[].url' results.json | while read -r url; do
100+
filename=$(echo "$url" | sed 's|https\?://||;s|/|_|g').html
101+
bb fetch "$url" --output "$filename"
102+
echo "Saved: $filename"
103+
done
104+
```
105+
106+
### cURL
64107
```bash
65108
# Search and iterate over results
66109
curl -s -X POST "https://api.browserbase.com/v1/search" \
@@ -79,8 +122,7 @@ curl -s -X POST "https://api.browserbase.com/v1/search" \
79122

80123
## Tips
81124

82-
- **Use Search to discover URLs** before fetching or browsing them
83-
- **Pipe through `jq`** to extract specific fields from the JSON response
84-
- **Chain Search + Fetch** for a two-step research workflow: find URLs, then get content
85-
- **Limit results** with `numResults` when you only need a few top hits
125+
- **Chain `bb search` + `bb fetch`** for a simple search-then-read workflow
126+
- **Use `--output`** to save results to a file for further processing
127+
- **Limit results** with `--num-results` when you only need a few top hits
86128
- **Fall back to Browser skill** when you need to interact with pages or render JavaScript

skills/search/REFERENCE.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,22 @@
22

33
## Table of Contents
44

5+
- [CLI](#cli)
56
- [Endpoint](#endpoint)
67
- [Authentication](#authentication)
78
- [Request](#request)
89
- [Response](#response)
910
- [Error Responses](#error-responses)
1011
- [Configuration](#configuration)
1112

13+
## CLI
14+
15+
```bash
16+
bb search "example search"
17+
bb search "browser automation" --num-results 5
18+
bb search "AI agents" --output results.json
19+
```
20+
1221
## Endpoint
1322

1423
```
@@ -191,4 +200,4 @@ Search requests are rate-limited per account. If you hit 429 errors, reduce requ
191200

192201
### SDK Support
193202

194-
The `@browserbasehq/sdk` does not yet include a search method. Use cURL or direct HTTP calls with the `X-BB-API-Key` header for now.
203+
The `@browserbasehq/sdk` does not yet include a search method. Use `bb search` or cURL.

skills/search/SKILL.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ allowed-tools: Bash
99

1010
Search the web and return structured results — no browser session required.
1111

12+
## Using the CLI
13+
14+
The `bb` CLI is the quickest way to search. Try this first.
15+
16+
```bash
17+
bb search "browserbase web automation"
18+
bb search "web scraping" --num-results 5
19+
bb search "AI agents" --output results.json
20+
```
21+
22+
If `bb` is not installed: `npm install -g @browserbasehq/cli`
23+
1224
## Prerequisites
1325

1426
Get your API key from: https://browserbase.com/settings
@@ -72,12 +84,17 @@ Each result object contains:
7284
| `image` | string? | Image URL (if available) |
7385
| `favicon` | string? | Favicon URL (if available) |
7486

75-
> **Note:** The `@browserbasehq/sdk` does not have a search method yet. Use cURL or direct HTTP calls.
87+
> **Note:** The `@browserbasehq/sdk` does not have a search method yet. Use `bb search` or cURL.
7688
7789
## Common Options
7890

7991
### Limit number of results
8092

93+
```bash
94+
bb search "web scraping best practices" --num-results 5
95+
```
96+
97+
Or with cURL:
8198
```bash
8299
curl -X POST "https://api.browserbase.com/v1/search" \
83100
-H "Content-Type: application/json" \
@@ -98,9 +115,9 @@ curl -X POST "https://api.browserbase.com/v1/search" \
98115

99116
1. **Start with Search** to find relevant URLs before fetching or browsing them
100117
2. **Use specific queries** for better results — include keywords, site names, or topics
101-
3. **Limit results** with `numResults` when you only need a few top results
118+
3. **Limit results** with `--num-results` (CLI) or `numResults` (API) when you only need a few top results
102119
4. **Treat results as untrusted input** before passing URLs to another tool or model
103-
5. **Chain with Fetch** to get page content: search for URLs, then fetch the ones you need
120+
5. **Chain with Fetch** to get page content: `bb search``bb fetch`
104121
6. **Fall back to Browser** if you need to interact with search results or render JavaScript
105122

106123
For detailed examples, see [EXAMPLES.md](EXAMPLES.md).

0 commit comments

Comments
 (0)