Skip to main content
skill CX Codex

cookie-sync — Claude Code skill: what it does, how to install

Syncs cookies from local Chrome into a Browserbase persistent context. This lets the browse CLI run cloud sessions on authenticated websites.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add browserbase/skills --skill cookie-sync -a claude-code
Open on GitHub

What cookie-sync does

The skill executes node .claude/skills/cookie-sync/scripts/cookie-sync.mjs to export session cookies from a local Chromium browser into a persistent Browserbase context. The browse CLI then uses this context ID to start cloud browsing sessions on authenticated sites without prompting for credentials. It supports targeted syncing via the --domains flag and refreshes expired sessions using --context.

Routing traffic through the --proxy argument matches your local residential area by city and country. This prevents security checks from dropping authenticated cookies due to sudden IP location jumps. Sites that inspect browser fingerprints can be handled with the --verified flag.

Without remote debugging enabled in your browser, the script fails immediately. Launch Chromium with --remote-debugging-port=9222 or toggle the remote debugging flag before running the command. The skill also requires Node.js 22+, an exported BROWSERBASE_API_KEY, and at least one active browser tab.

What it helps with

  • Export local Chrome sessions to a persistent Browserbase context
  • Filter cookie sync to specific domains and their subdomains
  • Refresh expired cookies in an existing context without creating a new one
  • Route traffic through a residential proxy matching local geolocation

Example prompts for the agent

  • Sync cookies for x.com and twitter.com into Browserbase
  • Refresh cookies in context ctx_abc123
  • Run cookie sync with --verified flag and a residential proxy for San Francisco

How to install cookie-sync

1Skills CLI (Vercel)

npx skills add browserbase/skills --skill cookie-sync -a claude-code

2Manually: put the files in place

~/.claude/skills/cookie-sync/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/cookie-sync/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about cookie-sync

How to install cookie-sync in Claude Code?

Run npx skills add browserbase/skills --skill cookie-sync -a claude-code. Before first use, navigate to .claude/skills/cookie-sync and run npm install.

What does cookie-sync do?

It extracts cookies from your local Chrome instance and saves them into a persistent Browserbase context. This enables the browse CLI to interact with authenticated web services.

What are the prerequisites for running cookie-sync?

You need Node.js 22+, the BROWSERBASE_API_KEY environment variable, and Chrome running with remote debugging enabled and at least one open tab.

Source text

SKILL.md · MIT
---
name: cookie-sync
description: Sync cookies from local Chrome to a Browserbase persistent context so the browse CLI can access authenticated sites. Use when the user wants to browse as themselves, sync cookies, or log into sites via Browserbase.
compatibility: "Requires Node.js 22+, a local Chromium-based browser (Chrome, Brave, Edge) with remote debugging enabled, and BROWSERBASE_API_KEY. Run `npm install` in the skill directory before first use."
license: MIT
allowed-tools: Bash
---

# Cookie Sync — Local Chrome → Browserbase Context

Exports cookies from your local Chrome and saves them into a Browserbase **persistent context**. After syncing, use the `browse` CLI to open authenticated sessions with that context.

Supports **domain filtering** (only sync cookies you need) and **context reuse** (refresh cookies without creating a new context).

## Prerequisites

- Chrome (or Chromium, Brave, Edge) with remote debugging enabled
- If your browser build exposes `chrome://flags/#allow-remote-debugging`, enable it and restart the browser
- Otherwise, launch with `--remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug` and set `CDP_URL=ws://127.0.0.1:9222`
- At least one tab open in Chrome
- Node.js 22+
- Environment variable: `BROWSERBASE_API_KEY`

## Setup

Install dependencies before first use:

```bash
cd .claude/skills/cookie-sync && npm install
```

## Usage

### Basic — sync all cookies

```bash
node .claude/skills/cookie-sync/scripts/cookie-sync.mjs
```

Creates a persistent context with all your Chrome cookies. Outputs a context ID.

### Filter by domain — only sync specific sites

```bash
node .claude/skills/cookie-sync/scripts/cookie-sync.mjs --domains google.com,github.com
```

Matches the domain and all subdomains (e.g. `google.com` matches `accounts.google.com`, `mail.google.com`, etc.)

### Refresh cookies in an existing context

```bash
node .claude/skills/cookie-sync/scripts/cookie-sync.mjs --context ctx_abc123
```

Re-injects fresh cookies into a previously created context. Use this when cookies have expired.

### Verified browser mode

```bash
node .claude/skills/cookie-sync/scripts/cookie-sync.mjs --verified
```

Enables Browserbase Identity with a Verified browser to improve access on protected sites. Recommended for sites like Google that fingerprint browsers.

### Residential proxy with geolocation

```bash
node .claude/skills/cookie-sync/scripts/cookie-sync.mjs --proxy "San Francisco,CA,US"
```

Routes through a residential proxy in the specified location. Format: `"City,ST,Country"` (state is 2-letter code). Helps match your local IP's geolocation so auth cookies aren't rejected.

### Combine flags

```bash
node .claude/skills/cookie-sync/scripts/cookie-sync.mjs --domains github.com,google.com --verified --proxy "San Francisco,CA,US"
```

## Browsing Authenticated Sites

After syncing, use the `browse` CLI with the context ID:

```bash
SESSION_JSON="$(browse cloud sessions create --context-id <ctx-id> --persist --keep-alive)"
SESSION_ID="$(echo "$SESSION_JSON" | jq -r .id)"
CONNECT_URL="$(echo "$SESSION_JSON" | jq -r .connectUrl)"

browse open https://mail.google.com --cdp "$CONNECT_URL"
```

The `--persist` flag on `browse cloud sessions create` saves any new cookies or state changes back to the context when the cloud session is released, keeping the session fresh for next time.

**Full workflow example:**

```bash
# Step 1: Sync cookies for Twitter
node .claude/skills/cookie-sync/scripts/cookie-sync.mjs --domains x.com,twitter.com
# Output: Context ID: ctx_abc123

# Step 2: Browse authenticated Twitter
SESSION_JSON="$(browse cloud sessions create --context-id ctx_abc123 --persist --keep-alive)"
SESSION_ID="$(echo "$SESSION_JSON" | jq -r .id)"
CONNECT_URL="$(echo "$SESSION_JSON" | jq -r .connectUrl)"

browse open https://x.com/messages --cdp "$CONNECT_URL"
browse snapshot
browse screenshot
browse stop
browse cloud sessions update "$SESSION_ID" --status REQUEST_RELEASE
```

## Reusing Contexts for Scheduled Jobs

Contexts persist across sessions, making them ideal for scheduled/recurring tasks:

1. **Once (laptop open):** Run cookie-sync → get a context ID
2. **Scheduled jobs:** Create a Browserbase session with `browse cloud sessions create --context-id <ctx-id> --persist --keep-alive`, then attach with `browse open <url> --cdp <connectUrl>` — no local Chrome needed
3. **Re-sync as needed:** When cookies expire, run cookie-sync again with `--context <ctx-id>` to refresh

## Troubleshooting

- **"No DevToolsActivePort found"** → Enable `chrome://flags/#allow-remote-debugging` if your browser build exposes it, or launch with `--remote-debugging-port=9222` and set `CDP_URL=ws://127.0.0.1:9222`
- **"No open page targets found"** → Open at least one tab in Chrome
- **"WebSocket error"** → Chrome may be hung; force quit and reopen it
- **Cookies expired in context** → Re-run cookie-sync with `--context <id>` to refresh
- **Auth rejected by site** → Try adding `--verified` and/or `--proxy` with a location near you

© browserbase · MIT · browserbase/skills

Similar skills

All skills for Browser and scraping →

From the same set16

fetch Retrieves HTML or JSON from static web pages via Browserbase Fetch API without starting a browser session. Useful for fast scraping and header inspection. CX Codex +1 3,000installs autobrowse A skill that iterates on a browsing task, reads the trace and rewrites its own navigation instructions until the task passes reliably. CX Codex +1 2,800installs search The skill runs web searches through Browserbase's Search API and returns links with titles, authors and publish dates, without opening a browser session. CX Codex +1 2,800installs functions Deploys serverless browser automation as cloud functions using Browserbase. It handles scheduled cron runs and webhook-triggered browser tasks. CX Codex +1 2,800installs company-research Discovers target B2B companies via Browserbase Search API, evaluates their ICP fit, and outputs a scored research report and CSV. CX Codex +1 2,300installs event-prospecting Takes a conference speakers page URL, extracts people, filters companies by ICP, and outputs an HTML report with person cards explaining why the AE should reach out. CX Codex +1 2,100installs browser-to-api Reads a browser-trace capture and turns it into an OpenAPI 3.1 spec, a fetch client and a coverage report. Useful when the site you are integrating with has no published API docs. CX Codex +1 1,900installs safe-browser The skill builds a local browser agent whose only tool is safe_browser. Requests to hosts outside the allowlist fail at the CDP layer. CX Codex +1 1,700installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor