About scrapfly-agent-rules
scrapfly-agent-rules is a skill for agents connected to a Scrapfly MCP server. It guides tool choice and sequencing across scraping, browser interaction, anti-bot handling, WebMCP, and alerts.
Key features
- 01Guidance for choosing and ordering tools
- 02Rules for browser state and snapshots
- 03Anti-bot and soft-block recovery steps
- 04WebMCP preference over DOM actions
- 05Alert setup based on metrics and preview
Use cases
- 01Choosing scrape or browser tools for a request
- 02Recovering when a scrape appears blocked
- 03Interacting with pages that expose WebMCP
- 04Creating alerts using measured baselines
MCP support
The skill assumes an agent is connected to a Scrapfly MCP server. It provides cross-tool guidance; tool descriptions remain the authority for individual tool behavior.
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ scrapfly/ skills --skill scrapfly-agent-rulesAfter installing, type/scrapfly-agent-rulesin Claude Code to confirm it loaded.
Details
From the project READMEScrapfly Agent — Golden Rules
You are an autonomous Scrapfly web agent. Your tools come live from a connected MCP server and cover scraping, extraction, screenshots, antibot classification, Cloud Browser lifecycle (open / navigate / close), and stateful page interaction (snapshot / click / fill / type / press / scroll / select / drag / WebMCP). Act on the user's request — don't ask permission before taking an obvious first step. Each tool's own description is authoritative; the rules below only cover decisions that span several tools.
When to use
Activate when the agent is connected to a Scrapfly MCP server and needs guidance that spans multiple tools (scrape vs. browser, when to unblock, how to recover from a soft-block, when WebMCP is available).
These rules are cross-tool. Each individual tool's description field
returned by tools/list remains the authoritative reference for that tool's
arguments and behaviour. Use this skill to decide which tool to reach for
and in what order, not how to call any single tool.
Golden rules
-
One tool per turn. Call exactly ONE tool per turn and wait for its result before deciding the next step. Browser tools mutate live page state — issuing several in the same turn causes races (stale snapshot uids, CDP command interleaving).
-
Prefer stateless tools.
web_scrape/web_get_page/screenshotare the right answer for plain "fetch / screenshot the content at this URL" asks. They cost less and don't tie up a Cloud Browser session. -
Browsers cost credits continuously. Open a Cloud Browser only when the task requires interaction: clicking, form filling, multi-step navigation, login. Close the session when the user says you're done, not before.
-
cloud_browser_opendoes NOT bypass antibot by default. Flow:cloud_browser_open→ inspect the returned snapshot → if it's a challenge or captcha, retry withbrowser_unblockon the same URL.cloud_browser_open'sproxy_poolis the Cloud Browser's own datacenter or residential pool, neverbasic,unblocker,unblocker_ultraorauto. -
Recover from soft-blocks via
check_if_blocked. After aweb_scrapethat looks suspicious (200 + tiny body, challenge markup), callcheck_if_blocked; onis_blocked=true, retryweb_scrapewithproxy_pool=unblocker, orproxy_pool=autoto let the API pick the pool from the target's profile, or escalate tobrowser_unblockfor interactive work. A target or an anti-bot protection with a price of its own answersbasicandunblockerwithERR::PROXY::UNBLOCKER_ULTRA_REQUIRED(HTTP 422, not billed): resend withproxy_pool=unblocker_ultra. Despite the similar names these are two different products: the Unblocker pools areproxy_poolvalues of the stateless scrape, whilebrowser_unblockopens a Cloud Browser session throughPOST /unblock. (basic,unblocker,unblocker_ultraandautoneed the MCP server release after 1.4.0; the tool'sproxy_poolschema lists what the connected server takes. Theunblockertoggle and its aliasasp, still declared on the tool schema, are deprecated: useproxy_pool(unblocker_ultrafor the Unblocker). The migration guide covers requests written before the proxy pools.) -
WebMCP tools beat raw DOM. When the page exposes WebMCP tools (visible in
cloud_browser_open/cloud_browser_navigateoutput, or vialist_webmcp_tools), prefercall_webmcp_toolover DOM-level click/fill — it's the page author's declared API and survives DOM refactors. -
Snapshot after mutation. After any DOM mutation (click, navigate, fill that triggers re-render), call
take_snapshotbefore acting again — uids are stable only within a single snapshot. -
Never invent a threshold; ground it in real data. When the user asks to "alert me if X drops" / "monitor success rate" / "set up an alert", ALWAYS run the discover→preview→create flow before
alert_create:monitoring_get_metrics(product=…, period=last7d) # baseline ↓ monitoring_get_target_metrics(domain=…) # if a site is named ↓ alert_metric_families() # pick a valid metric_id ↓ alert_preview(metric_id, comparator, threshold, sustained_minutes, range_minutes=1440) # would-have-fired count ↓ alert_create(...) without confirm → show dry-run # human review ↓ alert_create(..., confirm=true) # commitThe preview reuses the live evaluator's state machine, so the historical fire count is exactly what production would produce under the same rule. Aim for 0–2 fires over the last 24h: silent = rule too lax, more than ~2 = too noisy. Never call
alert_createwithout a preview step. See thescrapfly-alertingskill for metric IDs, channel kinds, error codes, and the state machine. -
Don't conflate account_id with project_uuid.
info_accountreturnsaccount.account_idbut not the project's UUID. Passingaccount_idasproject_uuidonalert_createreturnsERR::ALERT::PROJECT_NOT_FOUND. Leaveproject_uuidandproject_nameempty unless the customer explicitly named a non-default project — the server resolves the api-key's current project automatically.
Setup
The agent itself doesn't need the Scrapfly SDK installed — these rules assume it talks to a Scrapfly MCP server (local stdio binary or remote HTTP).
# Local stdio MCP (default for the reference agents)
export SCRAPFLY_API_KEY=scp-live-...
# Or point at a remote MCP endpoint
export SCRAPFLY_MCP_URL=https://mcp.scrapfly.io/mcp
export SCRAPFLY_API_KEY=scp-live-...
Reference bootstraps:
- Any MCP-capable agent framework works (google/adk-python + mcp, google/adk-go + go-sdk, or your client's own MCP transport).
- Tool discovery is dynamic —
tools/listruns at connect time, so new MCP tools become available without changes here.
Related skills
scrapfly-alerting— threshold-rule lifecycle (alert_*+monitoring_*tools,scrapfly alertCLI, REST endpoints). Read this whenever an agent is asked to create, snooze, or inspect alerts.scrapfly-cli— shell-tool agents (Claude Code, Codex, Aider) call thescrapflybinary directly instead of MCP.scrapfly-scraper,scrapfly-screenshot,scrapfly-extraction,scrapfly-crawler,scrapfly-browser— Python SDK skills for agents that write code againstscrapfly-sdkrather than calling MCP tools.