From browserless
Execute custom Puppeteer JavaScript code on the Browserless cloud. Use when the user needs to run arbitrary browser automation scripts, interact with page elements, fill forms, click buttons, or perform complex multi-step browser tasks that go beyond simple scraping.
How this skill is triggered — by the user, by Claude, or both
Slash command
/browserless:functionThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Use the Browserless `/function` REST API to execute custom Puppeteer JavaScript code in a cloud browser.
Use the Browserless /function REST API to execute custom Puppeteer JavaScript code in a cloud browser.
The user's request is: "$ARGUMENTS"
Make a POST request to the Browserless function endpoint:
POST ${BROWSERLESS_API_URL}/function?token=${BROWSERLESS_TOKEN}
Content-Type: application/javascript
OR with JSON payload:
POST ${BROWSERLESS_API_URL}/function?token=${BROWSERLESS_TOKEN}
Content-Type: application/json
Before making the request, source the saved credentials and resolve the token:
source ~/.browserless/.env 2>/dev/null
The token is resolved in this order:
$BROWSERLESS_TOKEN environment variable (if already set in the shell)~/.browserless/.env file (written by /browserless:auth)/browserless:auth to configure their tokenFor the API URL, use $BROWSERLESS_API_URL if set, otherwise default to https://production-sfo.browserless.io.
Send raw JavaScript code directly. The function receives a page (Puppeteer Page) and optional context object, and must return { data, type }.
export default async ({ page, context }) => {
await page.goto("https://example.com");
const title = await page.title();
return {
data: { title },
type: "application/json"
};
};
{
"code": "export default async ({ page, context }) => { await page.goto(context.url); const title = await page.title(); return { data: { title }, type: 'application/json' }; };",
"context": {
"url": "https://example.com"
}
}
Parameters:
code (string, required): ESM JavaScript code. Must export a default async function that receives { page, context } and returns { data, type }.context (object, optional): Data passed into the function for dynamic behavior.The function must return:
data: The result - can be a Buffer, JSON object, or plain text string.type: Content-Type string that determines the response format (e.g., "application/json", "text/plain", "image/png").The response body and content-type match what the function returns.
Use curl via Bash. For simple scripts, use application/javascript content type. For scripts needing dynamic context data, use application/json. Example:
source ~/.browserless/.env 2>/dev/null
curl -s -X POST "${BROWSERLESS_API_URL:-https://production-sfo.browserless.io}/function?token=$BROWSERLESS_TOKEN" \
-H "Content-Type: application/javascript" \
-d 'export default async ({ page }) => {
await page.goto("https://example.com");
const title = await page.title();
return { data: { title }, type: "application/json" };
};'
Write the Puppeteer code based on the user's requirements. Use best practices: wait for selectors before interacting, handle navigation events, and return structured data.
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub browserless/claude-plugin --plugin browserless