playwriter

supercent-io/skills-template · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/supercent-io/skills-template --skill playwriter
0 commentsdiscussion
summary

Browser automation connected to your running Chrome session, preserving logins, cookies, and extensions.

  • Connects to an existing Chrome browser via extension instead of spawning headless instances, enabling authenticated workflows without re-login
  • Exposes full Playwright API through CLI ( -e flag) and MCP integration for Claude Desktop and other AI agent platforms
  • Includes built-in helpers for accessibility snapshots, screenshots with element labels, network interception, and screen
skill.md

playwriter - Playwright Browser Automation for AI Agents

Playwriter connects AI agents to your running Chrome browser instead of spawning a new headless instance. Your existing logins, cookies, extensions, and tab state are all preserved.

When to use this skill

  • Automate sites that require login (Gmail, GitHub, internal tools) without re-authenticating
  • Control your real browser tab with full Playwright API access
  • Run stateful automation that spans multiple steps (shopping carts, multi-step forms)
  • Use MCP integration for Claude Desktop / AI agent browser control
  • Record browser sessions or debug with CDP inspection
  • Remote browser automation via tunnels

vs. agent-browser: agent-browser spawns a fresh headless browser (isolated, CI-friendly). playwriter connects to your existing Chrome session (authenticated, stateful, with your extensions).

Installation

Step 1: Install Chrome Extension

Install the Playwriter Chrome extension from the Web Store (search "Playwriter MCP" or use extension ID jfeammnjpkecdekppnclgkkffahnhfhe).

After installing, click the extension icon on any tab you want to allow automation on. The icon turns green when a tab is enabled for control.

Step 2: Install CLI

npm install -g playwriter
# or run without installing:
npx playwriter@latest --help

The extension auto-starts a WebSocket relay server at localhost:19988.

Core workflow

Always follow the Observe → Act → Observe pattern:

# 1. Create a session
playwriter session new

# 2. Navigate and observe
playwriter -s 1 -e 'await page.goto("https://example.com")'
playwriter -s 1 -e 'await snapshot({ page })'

# 3. Interact based on snapshot output
playwriter -s 1 -e 'await page.locator("aria-ref=e5").click()'

# 4. Re-observe after action
playwriter -s 1 -e 'await snapshot({ page })'

Session management

# Create a new isolated stateful session
playwriter session new

# List all active sessions (shows browser, profile, state info)
playwriter session list

# Delete a session and clear its state
playwriter session delete <sessionId>

# Reset the CDP connection and clear execution environment
playwriter session reset <sessionId>

The -e / --eval flag

Execute arbitrary Playwright code in a session:

# Navigate to a URL
playwriter -s 1 -e 'await page.goto("https://github.com")'

# Fill a form field
playwriter -s 1 -e 'await page.fill("#search", "playwriter"); await page.keyboard.press("Enter")'

# Get accessibility snapshot (preferred over screenshots for text content)
playwriter -s 1 -e 'await snapshot({ page })'

# Take screenshot with visual accessibility labels (color-coded by element type)
playwriter -s 1 -e 'await screenshotWithAccessibilityLabels({ page })'

# Store state between calls (state object persists within session)
playwriter -s 1 -e 'state.url = page.url(); state.title = await page.title()'
playwriter -s 1 -e 'console.log(state.url, state.title)'

Quoting rules: Wrap code in single quotes. For multiline code, use heredoc:

playwriter -s 1 -e "$(cat <<'EOF'
const text = await page.textContent('h1');
state.heading = text;
await snapshot({ page });
EOF
)"

MCP Integration

Claude Desktop config (~/.claude/settings.json or Claude Desktop MCP settings)

{
  "mcpServers": {
    "playwriter": {
      "command": "npx",
      "args": ["-y", "playwriter@latest"]
    }
  }
}

Remote relay server

{
  "mcpServers": {
    "playwriter": {
      "command": "npx",
      "args": ["-y", "playwriter@latest"],
      "env": {
        "PLAYWRITER_HOST": "your-relay-host",
        "PLAYWRITER_TOKEN": "your-secret-token",
        "PLAYWRITER_SESSION": "1"
      }
    }
  }
}

MCP tools exposed

Tool Description
execute Run arbitrary JavaScript Playwright code (code, timeout params)
reset Recreate CDP connection, clear state — use after connection failures

Built-in globals (in execute sandbox)

Global Description
page Current Playwright page
context Browser context
state Persistent object — survives multiple -e calls in same session
snapshot({ page }) Accessibility tree as text (token-efficient)
screenshotWithAccessibilityLabels({ page }) Screenshot with color-coded element markers
getPageMarkdown() Article text via Mozilla Readability
waitForPageLoad() Smart load detection
getLatestLogs() Browser console errors/logs
getCleanHTML() Cleaned DOM HTML
getLocatorStringForElement() Get selector for a DOM element
getReactSource() React component source tree

Accessibility labeling

screenshotWithAccessibilityLabels({ page }) overlays color-coded markers on interactive elements:

Color Element type
Yellow Links
Orange Buttons
Coral Inputs
Pink Checkboxes
Peach Sliders

Click a labeled element using aria-ref:

playwriter -s 1 -e 'await page.locator("aria-ref=e5").click()'

Network interception and state persistence

# Intercept network requests
playwriter -s 1 -e 'state.requests = []; page.on("request", r => state.requests.push(r.url()))'

# Check collected requests later
playwriter -s 1 -e 'console.log(state.requests.slice(-5).join("\n"))'

# Screen recording
playwriter -s 1 -e 'await recording.start()'
# ... do actions ...
playwriter -s 1 -e 'const video = await recording.stop(); state.video = video'

Remote access

Control Chrome on a remote machine via tunnel:

# On the machine with Chrome:
playwriter serve --token my-secret --replace

# From agent machine:
playwriter --host <ip-or-hostname> --token my-secret -s 1 -e 'await page.goto("https://example.com")'

Best practices

  • Observe → Act → Observe: always call snapshot({ page }) before and after each action
  • Prefer snapshot() over screenshots for text inspection (fewer tokens, faster)
  • Never chain actions blindly — verify state between steps
  • Use stable selectors: prefer aria-ref, data-testid, or accessible roles
  • Store context in state: avoid repeated navigation by persisting page references
  • Use reset on failures: CDP disconnects recover cleanly with playwriter session reset

Troubleshooting

Issue Solution
Extension not connecting Click extension icon on the tab; icon must be green
connection refused :19988 Extension auto-starts server; check Chrome is running with extension installed
Code execution timeout Increase with --timeout 30000 flag
Click fails silently Use snapshot({ page }) — a modal likely intercepts the click
Stale session Run playwriter session reset <id> to restore CDP connection
Remote access failing Confirm playwriter serve is running and token matches

References

how to use playwriter

How to use playwriter on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add playwriter
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/supercent-io/skills-template --skill playwriter

The skills CLI fetches playwriter from GitHub repository supercent-io/skills-template and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/playwriter

Reload or restart Cursor to activate playwriter. Access the skill through slash commands (e.g., /playwriter) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

User Story & Requirements Generation

Create detailed user stories, acceptance criteria, and feature specs

Example

Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios

Reduce spec writing time by 50%, ensure comprehensive coverage

Competitive Analysis

Research competitors, compare features, identify gaps

Example

Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities

Complete competitive research in 2 hours instead of 2 days

Roadmap Prioritization

Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs

Example

Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale

Make data-driven prioritization decisions faster

Stakeholder Communication

Draft PRDs, status updates, and stakeholder presentations

Example

Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement

Save 3-5 hours/week on communication overhead

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client
  • Access to product documentation and roadmap tools (Jira, Notion, etc.)
  • Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
  • Stakeholder contact information and communication channels

Time Estimate

30-60 minutes to see productivity improvements

Installation Steps

  1. 1.Install product management skill
  2. 2.Start with user story generation for known feature
  3. 3.Progress to competitive analysis: research 2-3 competitors
  4. 4.Use for roadmap prioritization: apply RICE/ICE scoring
  5. 5.Draft stakeholder communications and refine based on feedback
  6. 6.Build template library for recurring PM tasks
  7. 7.Share effective prompts with product team

Common Pitfalls

  • Not validating competitive research—verify facts before sharing
  • Accepting user stories without involving engineering team
  • Over-relying on frameworks without qualitative judgment
  • Not customizing outputs to company culture and communication style
  • Skipping stakeholder validation of generated requirements

Best Practices

✓ Do

  • +Validate research and competitive analysis with real data
  • +Collaborate with engineering when generating technical requirements
  • +Customize frameworks and templates to your company context
  • +Use skill for first drafts, refine with stakeholder input
  • +Document successful prompt patterns for PM tasks
  • +Combine AI efficiency with human judgment and intuition

✗ Don't

  • Don't publish competitive analysis without fact-checking
  • Don't finalize user stories without engineering review
  • Don't make prioritization decisions solely on AI scoring
  • Don't skip customer validation of generated requirements
  • Don't ignore company-specific context and culture

💡 Pro Tips

  • Provide context: company goals, constraints, customer feedback
  • Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
  • Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
  • Use skill for 70% generation + 30% customization to company needs

When to Use This

✓ Use When

Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.

✗ Avoid When

Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.

Learning Path

  1. 1Basic: user stories, feature specs, status updates
  2. 2Intermediate: competitive analysis, prioritization frameworks, PRDs
  3. 3Advanced: product strategy, go-to-market planning, OKR setting
  4. 4Expert: product vision, market positioning, business model innovation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.734 reviews
  • Amina White· Dec 24, 2024

    playwriter reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Ganesh Mohane· Dec 4, 2024

    playwriter reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Maya Patel· Dec 4, 2024

    playwriter has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Maya Rao· Nov 27, 2024

    playwriter fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Sakshi Patil· Nov 23, 2024

    I recommend playwriter for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Evelyn Park· Nov 23, 2024

    Keeps context tight: playwriter is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Tariq Rao· Nov 15, 2024

    I recommend playwriter for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Yash Thakker· Nov 3, 2024

    We added playwriter from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Dhruvi Jain· Oct 22, 2024

    playwriter fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Evelyn Haddad· Oct 18, 2024

    We added playwriter from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

showing 1-10 of 34

1 / 4