Skip to main content

playwriter skill

Print the complete Playwriter usage instructions and best practices guide. This outputs the full content of the skill.md file which contains comprehensive guidance for AI agents on using Playwriter effectively.
playwriter skill

Output

Prints the complete skill.md content to stdout, including:
  • CLI usage patterns and session management
  • Context variables available in code execution (state, page, context, require)
  • Best practices for browser automation
  • Interaction feedback loop (observe → act → observe)
  • Common mistakes to avoid
  • Quoting rules for shell commands
  • Working with pages, iframes, and frames
  • Snapshot vs screenshot guidelines
  • Network interception patterns
  • Debugging and troubleshooting tips

Exit Codes

  • 0 - Always succeeds

Examples

playwriter skill

Use Cases

For AI agents

# Get full context about Playwriter usage
playwriter skill

# AI agents can reference this for:
# - Understanding available context variables
# - Learning best practices
# - Finding code examples
# - Troubleshooting common issues

For documentation

# Extract specific sections
playwriter skill | sed -n '/## context variables/,/## rules/p'

For reference

# Quick lookup of best practices
playwriter skill | grep -A 20 "## best practices"

Content Sections

The skill output includes these major sections:
  • Installation options (npm/pnpm/yarn/bunx)
  • Session management commands
  • Execute code with -e flag
  • Quoting rules and multiline code
  • Debugging with logfile command
  • state - Session-isolated persistent storage
  • page - Default page reference
  • context - Browser context
  • require - Node.js module loader
  • Global variables available
  • Initialize state.page first
  • Use multiple execute calls for complex logic
  • Never close browser/context
  • Check state after actions
  • Clean up listeners
  • Snapshot before screenshot
  • Use proper wait strategies
  • The observe → act → observe pattern
  • Complete workflow examples
  • When to wait and retry
  • Verifying action results
  • Common mistakes to avoid
  • Working with iframes and frames
  • Network request interception
  • File uploads and downloads
  • Authentication patterns
  • Debugging with breakpoints
  • Live code editing

Notes

The skill.md file is the authoritative source for Playwriter usage. It’s updated with each release to reflect the latest best practices and features.
AI agents using Playwriter should reference this content to understand the full API surface and recommended usage patterns.

Build docs developers (and LLMs) love