60 / 168 · 01 Agent Skills for Browser Automation · Hybrid Strategies: Using Skills and MCP Together← prev⊞ allnext →☰ Read as one page
9.2Strategy 1: Snapshot for Discovery, Refs for Execution
The Pattern
The discovery/execution split now lives inside the CLI:
Phase 1: Discovery (one snapshot read)
Agent: "What's on this page?"
→ playwright-cli snapshot (returns a file path)
→ Agent reads the YAML: textbox "Email" [ref=e3],
textbox "Password" [ref=e4], button "Sign in" [ref=e5]
Phase 2: Execution (refs, dozens of tokens each)
→ playwright-cli fill e3 "user@test.com"
→ playwright-cli fill e4 "secret"
→ playwright-cli click e5
Token Cost
Discovery phase: ~1,500-5,000 tokens (one snapshot read, sized by page)
Execution phase: ~200 tokens (3 ref commands)
Total: ~2,000-5,000 tokens
vs. Pure MCP: ~15,000-25,000 tokens (schemas every turn + a tree per action)
When to Use
- Always, basically — this is the default working rhythm of a CLI-driven agent
- UI that changes frequently — a fresh snapshot re-discovers refs automatically
- First test run of a new feature — later runs already know the flow
The equivalent MCP pattern (call browser_snapshot, then act) still applies when you're on the MCP transport — the difference is that with MCP you also pay the tree tax on every action, not just on discovery.