functions — Claude Code skill: what it does, how to install
Deploys serverless browser automation as cloud functions using Browserbase. It handles scheduled cron runs and webhook-triggered browser tasks.
npx skills add browserbase/skills --skill functions -a claude-codeWhat functions does
This skill manages headless browser scripts deployed as Browserbase cloud functions. It handles project scaffolding via browse functions init and deployment with browse functions publish.
Functions rely on @browserbasehq/sdk-functions and connect to remote browsers through Playwright's chromium.connectOverCDP. The entry point receives execution parameters and returns JSON results. The dev server browse functions dev reloads on file changes. Testing payloads locally stays quick.
Execution requires Node.js 18+ and the globally installed browse CLI. You also need pnpm or npm and a valid BROWSERBASE_API_KEY. Missing the CLI or key causes immediate terminal errors.
What it helps with
- deploy Playwright automation scripts as serverless cloud functions
- trigger browser automation runs on a cron schedule or via webhooks
- spin up a local dev server to test function payloads before deployment
- scaffold a new Browserbase function project with TypeScript and environment variables
Example prompts for the agent
- Initialize a new Browserbase function project and start the local dev server
- Write a Playwright cloud function that connects over CDP and extracts page titles
- Deploy my finished browser function using browse functions publish
How to install functions
1Skills CLI (Vercel)
npx skills add browserbase/skills --skill functions -a claude-code2Manually: put the files in place
~/.claude/skills/functions/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/functions/
1Skills CLI (Vercel)
npx skills add browserbase/skills --skill functions -a codex2Manually: put the files in place
.agents/skills/functions/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add browserbase/skills --skill functions -a cursor2Manually: put the files in place
.cursor/skills/functions/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install browserbase/skills functions2Manually: put the files in place
.github/skills/functions/SKILL.md1Skills CLI (Vercel)
npx skills add browserbase/skills --skill functions -a gemini-cli2Platform CLI
gemini skills install https://github.com/browserbase/skills --path skills/functionsManually: put the files in place
.devin/skills/functions/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add browserbase/skills --skill functions -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about functions
How to install functions in Claude Code?
Run npx skills add browserbase/skills --skill functions -a claude-code in your terminal to install the skill.
What does the functions skill do?
It assists with scaffolding, testing locally, and publishing serverless browser automation tasks to Browserbase using the browse CLI.
What prerequisites are required for functions?
You need Node.js 18+, npm or pnpm, the globally installed browse CLI, and an exported BROWSERBASE_API_KEY environment variable.
Source text
SKILL.md · MIT
---
name: functions
description: "Deploy serverless browser automation as cloud functions using Browserbase. Use when the user wants to deploy browser automation to run on a schedule or cron, create a webhook endpoint for browser tasks, run automation in the cloud instead of locally, or asks about Browserbase Functions."
compatibility: "Requires the browse CLI (`npm install -g browse`), Node.js 18+ with pnpm or npm, and BROWSERBASE_API_KEY."
license: MIT
allowed-tools: Bash Read Write Edit
---
# Browserbase Functions
Deploy serverless browser automation using the official `browse` CLI.
## Prerequisites
Get an API key from: https://browserbase.com/settings
```bash
export BROWSERBASE_API_KEY="your_api_key"
```
## Creating a Function Project
### 1. Initialize
```bash
browse functions init my-function
cd my-function
```
This creates:
```
my-function/
├── package.json
├── index.ts # Your function code
└── .env # Add credentials here
```
### 2. Add Credentials to .env
```bash
echo "BROWSERBASE_API_KEY=$BROWSERBASE_API_KEY" >> .env
```
### 3. Install Dependencies
```bash
pnpm install
```
## Function Structure
```typescript
import { defineFn } from "@browserbasehq/sdk-functions";
import { chromium } from "playwright-core";
defineFn("my-function", async (context) => {
const { session, params } = context;
// Connect to browser
const browser = await chromium.connectOverCDP(session.connectUrl);
const page = browser.contexts()[0]!.pages()[0]!;
// Your automation
await page.goto(params.url || "https://example.com");
const title = await page.title();
// Return JSON-serializable result
return { success: true, title };
});
```
**Key objects:**
- `context.session.connectUrl` - CDP endpoint to connect Playwright
- `context.params` - Input parameters from invocation
## Development Workflow
### 1. Start Dev Server
```bash
browse functions dev index.ts
```
Server runs at `http://127.0.0.1:14113`
### 2. Test Locally
```bash
curl -X POST http://127.0.0.1:14113/v1/functions/my-function/invoke \
-H "Content-Type: application/json" \
-d '{"params": {"url": "https://news.ycombinator.com"}}'
```
### 3. Iterate
The dev server auto-reloads on file changes. Use `console.log()` for debugging - output appears in the terminal.
## Deploying
```bash
browse functions publish index.ts
```
Output:
```
Function published successfully
Build ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Function ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
```
**Save the Function ID** - you need it to invoke.
## Quick Reference
| Command | Description |
|---------|-------------|
| `browse functions init <name>` | Create new project |
| `browse functions dev <file>` | Start local dev server |
| `browse functions publish <file>` | Deploy to Browserbase |
For invocation examples, common patterns, and troubleshooting, see [REFERENCE.md](REFERENCE.md).
© browserbase · MIT · browserbase/skills