cloudflare-browser — Claude Code skill: headless Chrome automation via CDP
A skill for controlling headless Chrome through Cloudflare Browser Rendering using Chrome DevTools Protocol over WebSocket.
Apache-2.0 25 installs ★ 9,948 updated 2026-05-09
npx skills add cloudflare/moltworker --skill cloudflare-browser -a claude-codeWhat cloudflare-browser does
Available for Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, and OpenCode. Connects to a worker's CDP endpoint via WebSocket using the CDP_SECRET environment variable. On connect, the worker creates a page target and sends a Target.targetCreated event with a targetId; you then send commands like Page.navigate for URLs, Page.captureScreenshot for PNG or JPEG, and Runtime.evaluate for JavaScript.
Screenshots work in a single pass—the skill waits for rendering and writes the image. Video recording captures frames as you navigate multiple URLs, then stitches them with ffmpeg into MP4. Requires a browser.profiles section in openclaw.json with cdpUrl pointing to your worker endpoint with the secret.
Cold starts can delay responses by 30–60 seconds; increase command timeouts if they hang. If commands time out, verify CDP_SECRET matches the worker config and the page target has been created.
What it helps with
- capture a screenshot of a website from your agent
- create a video from a sequence of URLs
- scrape or parse pages using browser JavaScript execution
- automate navigation and clicks in a headless browser
- set viewport size and emulate mobile devices
Example prompts for the agent
- Take a screenshot of https://example.com and save it to output.png
- Record a video from frames at https://site1.com and https://site2.com into output.mp4
- Navigate to a page, scroll it 300 pixels, and run custom JavaScript
How to install cloudflare-browser
1Skills CLI (Vercel)
npx skills add cloudflare/moltworker --skill cloudflare-browser -a claude-code2Manually: put the files in place
~/.claude/skills/cloudflare-browser/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/cloudflare-browser/
1Skills CLI (Vercel)
npx skills add cloudflare/moltworker --skill cloudflare-browser -a codex2Manually: put the files in place
.agents/skills/cloudflare-browser/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add cloudflare/moltworker --skill cloudflare-browser -a cursor2Manually: put the files in place
.cursor/skills/cloudflare-browser/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install cloudflare/moltworker skills/cloudflare-browser2Manually: put the files in place
.github/skills/cloudflare-browser/SKILL.md1Skills CLI (Vercel)
npx skills add cloudflare/moltworker --skill cloudflare-browser -a gemini-cli2Platform CLI
gemini skills install https://github.com/cloudflare/moltworker --path skills/cloudflare-browserManually: put the files in place
.devin/skills/cloudflare-browser/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add cloudflare/moltworker --skill cloudflare-browser -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 cloudflare-browser
How do I install cloudflare-browser in Claude Code?
Run npx skills add cloudflare/moltworker --skill cloudflare-browser -a claude-code and then open the skill config at ~/.claude/skills/cloudflare-browser/SKILL.md.
What does cloudflare-browser do?
It controls headless Chrome through Cloudflare's CDP protocol. Your agent can capture screenshots, record videos, execute JavaScript, and automate browser navigation.
What do I need to use cloudflare-browser?
Set the CDP_SECRET environment variable, configure a browser profile in openclaw.json with cdpUrl pointing to your Cloudflare Workers endpoint, and have Node.js available to run the scripts.
Source text
SKILL.md · Apache-2.0
---
name: cloudflare-browser
description: Control headless Chrome via Cloudflare Browser Rendering CDP WebSocket. Use for screenshots, page navigation, scraping, and video capture when browser automation is needed in a Cloudflare Workers environment. Requires CDP_SECRET env var and cdpUrl configured in browser.profiles.
---
# Cloudflare Browser Rendering
Control headless browsers via Cloudflare's Browser Rendering service using CDP (Chrome DevTools Protocol) over WebSocket.
## Prerequisites
- `CDP_SECRET` environment variable set
- Browser profile configured in openclaw.json with `cdpUrl` pointing to the worker endpoint:
```json
"browser": {
"profiles": {
"cloudflare": {
"cdpUrl": "https://your-worker.workers.dev/cdp?secret=..."
}
}
}
```
## Quick Start
### Screenshot
```bash
node /path/to/skills/cloudflare-browser/scripts/screenshot.js https://example.com output.png
```
### Multi-page Video
```bash
node /path/to/skills/cloudflare-browser/scripts/video.js "https://site1.com,https://site2.com" output.mp4
```
## CDP Connection Pattern
The worker creates a page target automatically on WebSocket connect. Listen for Target.targetCreated event to get the targetId:
```javascript
const WebSocket = require('ws');
const CDP_SECRET = process.env.CDP_SECRET;
const WS_URL = `wss://your-worker.workers.dev/cdp?secret=${encodeURIComponent(CDP_SECRET)}`;
const ws = new WebSocket(WS_URL);
let targetId = null;
ws.on('message', (data) => {
const msg = JSON.parse(data.toString());
if (msg.method === 'Target.targetCreated' && msg.params?.targetInfo?.type === 'page') {
targetId = msg.params.targetInfo.targetId;
}
});
```
## Key CDP Commands
| Command | Purpose |
|---------|---------|
| Page.navigate | Navigate to URL |
| Page.captureScreenshot | Capture PNG/JPEG |
| Runtime.evaluate | Execute JavaScript |
| Emulation.setDeviceMetricsOverride | Set viewport size |
## Common Patterns
### Navigate and Screenshot
```javascript
await send('Page.navigate', { url: 'https://example.com' });
await new Promise(r => setTimeout(r, 3000)); // Wait for render
const { data } = await send('Page.captureScreenshot', { format: 'png' });
fs.writeFileSync('out.png', Buffer.from(data, 'base64'));
```
### Scroll Page
```javascript
await send('Runtime.evaluate', { expression: 'window.scrollBy(0, 300)' });
```
### Set Viewport
```javascript
await send('Emulation.setDeviceMetricsOverride', {
width: 1280,
height: 720,
deviceScaleFactor: 1,
mobile: false
});
```
## Creating Videos
1. Capture frames as PNGs during navigation
2. Use ffmpeg to stitch: `ffmpeg -framerate 10 -i frame_%04d.png -c:v libx264 -pix_fmt yuv420p output.mp4`
## Troubleshooting
- **No target created**: Race condition - wait for Target.targetCreated event with timeout
- **Commands timeout**: Worker may have cold start delay; increase timeout to 30-60s
- **WebSocket hangs**: Verify CDP_SECRET matches worker configuration
© cloudflare · Apache-2.0 · cloudflare/moltworker