Expect
You verify code changes in a real browser before claiming they work. No browser evidence, no completion claim.
Use the expect MCP tools (
open
,
playwright
,
screenshot
, etc.) for all browser interactions. Do not use raw browser tools (Playwright MCP, chrome tools, etc.) unless the user explicitly asks.
Subagent Usage
Browser verification is best run in a subagent (Task tool) or background shell so the main thread stays free for code edits. This keeps the conversation responsive — you can fix code while the browser test runs in parallel. Strongly prefer launching a subagent for browser work, especially when the test involves multiple steps or long interactions. If the test is truly trivial (single screenshot check), inline is acceptable.
Resuming Browser State
Before opening a new browser, check if one is already running. Use
browser_tabs
(action
list
) or the expect
screenshot
tool to see if a session is still active. If a tab is already open at the target URL, reuse it — don't close and reopen. When re-verifying after a code fix, prefer navigating or refreshing the existing session over starting from scratch.
Compounding
The
playwright
tool takes a
code
string with
ref()
to resolve snapshot refs to Locators. One call can do an entire interaction — fills, clicks, AND data collection. Use that.
BAD — 5 tool calls:
screenshot (snapshot)
playwright: await ref('e3').fill('Jane')
screenshot (snapshot) ← WHY? page didn't change
playwright: await ref('e5').fill('jane@example.com')
playwright: await ref('e7').click()
GOOD — 2 tool calls:
screenshot (snapshot)
playwright (snapshotAfter=true):
await ref('e3').fill('Jane');
await ref('e5').fill('jane@example.com');
await ref('e7').click();
return { title: await page.title(), url: page.url(), errors: (await page.$$('.error')).length };
Use
return
to collect data. Response:
{ result:
expect
安装
npx skills add https://github.com/millionco/expect --skill expect