| name | surf |
| description | Control Chrome browser via CLI - navigate, click, type, screenshot, read pages. Use when user says "open browser", "click on", "fill form", "take screenshot", "navigate to", "automate browser", or needs any browser automation task.
|
| allowed-tools | Bash, Read |
| triggers | ["open browser","click on","fill form","take screenshot","navigate to","automate browser","browser automation","read webpage"] |
| metadata | {"short-description":"Browser automation CLI for AI agents"} |
Surf - Browser Automation
Control Chrome via CLI commands. Zero config, agent-agnostic.
Self-contained skill - auto-installs via npx from GitHub (no global npm install needed).
Simplest Usage
.agents/skills/surf/run.sh go "https://example.com"
npx github:nicobailon/surf-cli go "https://example.com"
./run.sh go "https://example.com"
./run.sh read
./run.sh click e5
./run.sh snap
Common Patterns
Navigate and read a page
surf go "https://example.com"
surf read
Click and type
surf click e5
surf type "hello@example.com"
surf type "search query" --submit
surf type "text" --ref e12
Screenshots
surf snap
surf screenshot --output /tmp/page.png
surf screenshot --annotate
surf screenshot --fullpage
Wait for page states
surf wait 2
surf wait.element ".loaded"
surf wait.network
surf wait.url "/dashboard"
Tab management
surf tab.list
surf tab.new "https://example.com"
surf tab.switch 123
surf tab.close 123
JavaScript execution
surf js "return document.title"
surf js "document.querySelector('.btn').click()"
AI queries (no API keys needed)
surf chatgpt "explain this code"
surf chatgpt "summarize" --with-page
surf chatgpt "analyze" --model gpt-4o
Requires being logged into chatgpt.com in Chrome.
Element References
surf read returns an accessibility tree with stable element refs:
[e1] button "Submit"
[e2] textbox "Email"
[e3] link "Sign up"
Use these refs with surf click e1, surf type "text" --ref e2, etc.
Command Reference
| Category | Commands |
|---|
| Navigation | go, back, forward, tab.reload |
| Reading | read, page.text, page.state |
| Interaction | click, type, key, scroll.* |
| Screenshots | screenshot, snap |
| Tabs | tab.list, tab.new, tab.switch, tab.close, tab.name |
| Waiting | wait, wait.element, wait.network, wait.url |
| Other | js, search, cookie.*, console, network |
Global Options
--tab-id <id>
--json
--soft-fail
--no-screenshot
--full
Prerequisites
- Install:
npm install -g surf-cli
- Load extension in Chrome (chrome://extensions > Load unpacked)
- Install native host:
surf install <extension-id>
- Restart Chrome
Troubleshooting
| Problem | Solution |
|---|
| Socket not found | Run node native/host.cjs or ensure Chrome has extension |
| No response | Check extension loaded at chrome://extensions |
| "Cannot control this page" | Page is restricted - use --soft-fail |
| Slow first operation | Normal - debugger attachment takes ~100-500ms |