expect
Tests and validates UI changes in a live browser environment before deployment.
Install
mkdir -p .claude/skills/expect && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/13068" && unzip -o skill.zip -d .claude/skills/expect && rm skill.zipInstalls to .claude/skills/expect
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Use when editing .tsx/.jsx/.css/.html, React components, pages, routes, forms, styles, or layouts. Also when asked to test, verify, validate, QA, find bugs, check for issues, or fix expect-cli failures.Key capabilities
- →Verify code changes in a real browser
- →Use expect MCP tools for browser interactions
- →Reuse existing browser sessions when active
- →Perform entire interaction sequences in one playwright call
- →Collect data from browser interactions using return values
- →Fix failures and re-verify immediately until zero failures
How it works
The skill verifies code changes by running automated tests in a real browser using expect MCP tools, reusing sessions, and performing compound interactions.
Inputs & outputs
When to use expect
- →Test React components
- →Verify form layouts
- →Validate page navigation
About this skill
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('[email protected]')
playwright: await ref('e7').click()
GOOD — 2 tool calls:
screenshot (snapshot)
playwright (snapshotAfter=true):
await ref('e3').fill('Jane');
await ref('e5').fill('[email protected]');
await ref('e7').click();
return { title: await page.title(), url: page.url(), errors: (await page.$$('.error')).length };
Use return to collect data. Response: { result: <value>, resultFile: "<tmp path>", snapshot: { tree, refs, stats } }. The resultFile persists until close — read or grep it later. Without a return value, responds "OK" (or just the snapshot if snapshotAfter=true).
Re-snapshot only across DOM boundaries. Fills and hovers don't change page structure — keep using the same refs. Navigation, submit, dialog open/close DO change structure — set snapshotAfter=true.
Writing Instructions
Bad: "Check that the login form renders on http://localhost:5173"
Good: "Submit the login form empty, with invalid email, with wrong password, and with valid credentials. Verify error messages, redirect on success, and console errors on http://localhost:5173"
Before Claiming Completion
- Verify in a browser with adversarial instructions.
- Read the full output — check failures, accessibility, performance.
- If ANY failure: fix the code, re-verify immediately. No asking, no waiting.
- Repeat until 0 failures, then state the claim with passing evidence.
Rationalizations
- "I'll run the browser test inline, it's quick" — Probably not. Launch a subagent so you can keep editing code in parallel. Only skip the subagent for a single screenshot sanity check.
- "I'll open a fresh browser to re-test" — Check for an existing session first. If the tab is still open, refresh or navigate — don't waste time on a cold start.
- "I'll make one
playwrightcall per action" — No. Whole sequence in one call. - "I need a snapshot between fills" — No. Fills don't change DOM. Batch them.
- "Let me snapshot to see what changed" — Did the page navigate or submit? No? Use
snapshotAfter=trueon the action that does.
When not to use it
- →When claiming completion without browser evidence
- →When using raw browser tools without explicit user request
- →When re-snapshotting across DOM boundaries unnecessarily
Limitations
- →No browser evidence, no completion claim.
- →Do not use raw browser tools (Playwright MCP, chrome tools, etc.) unless the user explicitly asks.
- →Re-snapshot only across DOM boundaries.
How it compares
This workflow emphasizes browser-based verification and compound playwright calls for efficiency, unlike manual testing or single-action tool calls.
Compared to similar skills
expect side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| expect (this skill) | 0 | 4mo | No flags | Intermediate |
| frontend-testing | 11 | 3mo | Review | Intermediate |
| feature-flags | 6 | 6mo | Review | Intermediate |
| react-web | 1 | 4mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
frontend-testing
langgenius
Generate Vitest + React Testing Library tests for Dify frontend components, hooks, and utilities. Triggers on testing, spec files, coverage, Vitest, RTL, unit tests, integration tests, or write/review test requests.
feature-flags
Use when feature flag tests fail, flags need updating, understanding @gate pragmas, debugging channel-specific test failures, or adding new flags to React.
react-web
alinaqi
React web development with hooks, React Query, Zustand
frontend-api-integration-patterns
TJSNDHU
Production-ready patterns for integrating frontend applications with backend APIs, including race condition handling, request cancellation, retry strategies, error normalization, and UI state management.
harden
Aixbox
Improve interface resilience through better error handling, i18n support, text overflow handling, and edge case management. Makes interfaces robust and production-ready. Use when the user asks to harden, make production-ready, handle edge cases, add error states, or fix overflow and i18n issues.
debugging-skill
bitovi
Always start a fresh browser session after any file change, walk through the full user flow, and monitor for errors before proceeding with further work.