agentsclimarketplace

Protocol browser anti stall

Skill kensaurus/cursor-kenji/skills/protocol-browser-anti-stall

πŸ¦–Curated Cursor AI agent skills, slash commands, MCP configs, subagents & rules for full-stack dev β€” React 19, Next.js 15, Supabase, Tailwind v4, TypeScript

Install
npx -y skills add kensaurus/cursor-kenji --skill protocol-browser-anti-stall

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 6 stars6 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Prevent browser automation from freezing, stalling, or colliding between parallel agents, and enforce manual, headed, real-user driving (never scripted). Standardizes on the playwright-cli (`npx --yes @playwright/cli@latest`) with named sessions (`-s=<name>`) so multiple agents each get their own isolated browser β€” replacing the single-instance Playwright MCP, where one shared profile could only be locked by one process at a time. Covers session naming, headed mode, persistent auth profiles, the wait/anti-loop budget, evidence-before-retry, artifact paths, and cleanup. Use BEFORE any browser automation β€” testing webapps, user-story walkthroughs, QA/UX audits, visual verification, or any task that drives a browser.

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

8.9 KB, ~2.1k tokens by cl100k_base, as published. Nobody here has run it

Browser Anti-Stall Protocol (playwright-cli)

Apply these rules to EVERY browser action. No exceptions.

This repo drives browsers with playwright-cli, not the Playwright MCP. The MCP exposes one browser per server and a persistent profile can only be locked by one process at a time, so parallel agents on the same repo fight over tabs and profile locks. The CLI gives every agent its own isolated browser via -s=<session>, costs far fewer tokens (no tool schemas or verbose trees loaded into context), and runs natively in parallel shells.

Read references/mcp-to-cli-map.md if you encounter old browser_* MCP tool calls β€” it maps every tool to its CLI command. Read references/playwright-session-coordination.md before your first command β€” session naming, persistent logins (incl. the Google/CDP block), and cleanup.


Invocation β€” always this form

PW="npx --yes @playwright/cli@latest"     # portable; survives fnm/nvm version switches
$PW -s=<session> <command> [args]
  • -s=<session> is mandatory on every call. Name it after your task or branch (-s=qa-checkout, -s=audit-ux-home). Two agents must never share a session name.
  • Do not rely on a global npm i -g install. Under fnm/nvm the global prefix is per-shell and disappears; npx always resolves.
  • --json / --raw are available when you need machine-readable output.

0. Manual & headed β€” never scripted (read first)

You are driving a real, visible browser to feel what a user feels. A green script proves nothing about UX β€” see the screen and watch the logs.

  1. Headed, always. The CLI defaults to headless β€” you MUST pass --headed on open. If you cannot see the window, say so rather than proceeding blind.
  2. One real action at a time. click, type, fill, select, hover, press, drag exactly as a user would. Never chain a whole flow into one code snippet.
  3. eval / run-code are inspection-only. Use them ONLY to read state (DOM, computed styles, storage, perf) or to wait for an element β€” never to click, type, navigate, or submit. Driving the UI through code bypasses real events and hides the bug you are hunting.
  4. No test files, no runner. Do not write *.spec.ts, run npx playwright test, or use codegen. You are here to experience the flow, not automate past it.
  5. Look after every action. Fresh snapshot + screenshot + console + requests, plus the dev-server terminal. Real pain surfaces on screen and in logs, not in an assertion.

1. Session lifecycle

$PW -s=qa-checkout open --headed http://localhost:3000    # start (once)
$PW -s=qa-checkout goto http://localhost:3000/cart        # navigate within the session
$PW -s=qa-checkout snapshot                               # get refs
$PW -s=qa-checkout close                                  # end YOUR session when done
$PW list                                                  # see all sessions (status, profile, headed)
$PW close-all                                             # only when you own every session
$PW kill-all                                              # last resort: stale/zombie processes
  • open starts a browser; goto navigates an already-open one. Calling open twice on the same session is wasteful β€” use goto.
  • Close only your own session. Never close-all while another agent may be mid-test.
  • Add --browser chrome|firefox|webkit|msedge, --device "iphone 15", or --mobile on open when the task calls for it.

2. Navigation guard

After every open / goto / reload:

  1. snapshot β€” confirm the URL changed and the page has content.
  2. If blank or unchanged β†’ sleep 2 β†’ snapshot again.
  3. Max 3 cycles (~6s). Still not loaded β†’ report a blocker (Β§8) and move on.

Never assume navigation succeeded without a snapshot to confirm it.

3. Waiting β€” there is no wait command

Playwright auto-waits for actionability on click/fill/select, so most explicit waits are unnecessary. When you genuinely must wait:

NeedDo this
Fixed short pausesleep 2 in the shell β€” never more than 3s per pause
Wait for text/elementrun-code "async (page) => { await page.getByText('Dashboard').first().waitFor({ timeout: 5000 }); return 'ready'; }"
Wait for something to disappear...waitFor({ state: 'hidden', timeout: 5000 })
Poll for contentfind "<text>" β†’ if no match, sleep 2 β†’ retry (max 3)

Always set an explicit timeout (milliseconds) in waitFor β€” the default 30s is far too long. Use the incremental pattern instead of one long block:

sleep 2 β†’ snapshot β†’ check ↓ not ready
sleep 2 β†’ snapshot β†’ check ↓ not ready
sleep 2 β†’ snapshot β†’ check ↓ still not ready
STOP β†’ report blocker with evidence

This handles cold starts, SPA hydration, and slow APIs without ever blocking blindly.

4. SPA-specific rules

SPAs (React, Next.js, Vue) fire load before hydration completes β€” never trust load events.

  • Wait for a specific UI landmark that proves the app rendered (run-code + waitFor, or find).
  • If a spinner is showing, wait for it to reach state: 'hidden' rather than sleeping.

5. Anti-loop: max 4 attempts per goal

AttemptAction
1Try the action normally
2Alternative approach β€” re-snapshot for a fresh ref, try a CSS selector instead, scroll into view, or find the element
3Gather evidence: console + requests
4STOP. Report what blocked progress, with evidence.

Never repeat the exact same failing action without new evidence.

Fresh refs after every state change. Refs from a stale snapshot are invalid after any navigate/click/fill/hover/key press. Re-snapshot before the next interaction. click also accepts a unique CSS selector, which survives state changes better than a ref.

6. Evidence before retry

When something is not working, gather evidence FIRST, then form a hypothesis:

  1. console β€” JS errors, warnings (console error to filter by level)
  2. requests β€” pending/failed calls; request <n> / response-body <n> for detail
  3. snapshot β€” the actual DOM state, not what you assume
  4. screenshot --filename .playwright-mcp/<name>.png β€” visual state

Only retry once you have a new hypothesis grounded in that evidence.

7. Timeout budget

ScopeMax time
Single interaction (click, fill, select)15 seconds
Navigation + verification30 seconds
Multi-page flow5 minutes
Full session15 minutes

Exceeded? Skip it and log [TIMEOUT] skipped: <step>. One stuck step must not kill the session.

8. Blocker reporting format

BLOCKER:
- Session: [-s= name]
- Page: [current URL]
- Goal: [what I was trying to do]
- Blocked by: [what prevented it]
- Evidence: [console errors / failed requests / screenshot observation]
- Suggestion: [most likely next step or manual action needed]

Actionable information beats a silent freeze.

9. Artifacts

  • Screenshots, snapshots, and logs go under .playwright-mcp/ (gitignored): screenshot --filename .playwright-mcp/home-390.png. Name by route + viewport/step.
  • The CLI also auto-writes snapshot .yml files to .playwright-cli/ in the working directory β€” also gitignored, never committed.
  • Sweep any stray root-level *.png / *.log into .playwright-mcp/ before ending the session.

10. Parallel agents

Session isolation replaces the old tab-sharing etiquette β€” each agent gets its own browser:

# agent A                                  # agent B (simultaneously, no conflict)
$PW -s=audit-ux open --headed …            $PW -s=qa-checkout open --headed …
  • Never reuse another agent's session name; never close/kill-all sessions you did not open.
  • list shows every session with its status, profile, and headed flag β€” check it before assuming.
  • Within one session, multiple tabs are still available (tab-list, tab-new, tab-select, tab-close); the fresh-refs rule applies after every tab switch.
  • Signed-in state is shared through persistent profiles, not shared tabs β€” see references/playwright-session-coordination.md.

What ships with it: 2 files

11.5 KB alongside SKILL.md

Gives 0 of the 12 instructions most quality gates skills give in ~2.1k tokens

Counted across 1,195 of the 2,094 authors here whose files we hold, read 2026-08-07

  • Read the output and check the exit codein 54 of 1195, across 14 files
  • Verify requirements using a line-by-line checklistin 53 of 1195, across 12 files
  • Identify the verification command proving the claimin 51 of 1195, across 12 files
  • Run the full verification commandin 50 of 1195, across 11 files
  • Verify output confirms the claimin 49 of 1195, across 12 files
  • Check version control diff after agent delegationin 46 of 1195, across 6 files
  • State claim with evidencein 44 of 1195, across 4 files
  • Run the test suitein 33 of 1195, across 26 files
  • Keep state in memory by defaultin 27 of 1195, across 6 files
  • Make prototype runnable with one commandin 26 of 1195, across 5 files
  • Produce a verification reportin 25 of 1195, across 14 files
  • Detect the package manager from lockfilesin 24 of 1195, across 5 files

Said here and by no other author read

  • use playwright-cli instead of playwright MCP
  • pass a named session on every call
  • pass the headed flag on every open
  • perform one real action at a time
  • run snapshot after every navigation and state change
  • set explicit timeout in milliseconds

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.

Keep looking

Skills are one crate of 327,069. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.