archive/play-tight/SKILL.md
Context-efficient browser automation using Playwright scripts and subagent isolation. Use when you need to interact with web pages, extract data from websites, verify page elements, or automate browser tasks while avoiding context window pollution from verbose HTML/accessibility trees. Provides both direct script execution and a specialized subagent pattern for complex investigations that generate large intermediate responses.
npx skillsauth add slamb2k/mad-skills play-tightInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Play-Tight provides context-efficient browser automation using Playwright scripts executed via bash, with an optional subagent pattern for isolating verbose browser responses. The skill replaces the verbose Playwright MCP server with optimized scripts and subagent patterns to minimize context window pollution, saving context for actual engineering processes.
Use Play-Tight when you need to:
IMPORTANT: Before using any Playtight script, automatically check if Playwright browsers are installed.
node -e "const { chromium } = require('playwright'); chromium.executablePath()" 2>&1
If the check fails (exit code non-zero or error message):
npm run install-browsers in the scripts directory. Would you like me to do that?"cd ~/.claude/plugins/mad-skills/play-tight/scripts && npm run install-browsers
If npm dependencies are missing (error about 'playwright' module not found):
cd ~/.claude/plugins/mad-skills/play-tight/scripts && npm installnpm run install-browsers# First attempt to use a script
node scripts/check-element.js https://example.com h1
# If error mentions "browserType.launch: Executable doesn't exist"
# Or "Cannot find module 'playwright'"
# Then detect and offer installation:
"I see that Playwright browsers aren't installed yet. I can install them now by running 'npm run install-browsers'. This will download Chromium (~100MB). Would you like me to proceed?"
# On user approval:
cd ~/.claude/plugins/mad-skills/play-tight/scripts && npm install && npm run install-browsers
When to skip detection: If you've already successfully run a Play-Tight script in the current session, browsers are installed and you can skip detection.
For straightforward tasks where responses are compact, use scripts directly:
node scripts/check-element.js <url> <selector>
node scripts/get-text.js <url> [selector]
node scripts/take-screenshot.js <url> <output-path> [selector]
Use when:
For tasks requiring multiple iterations or verbose exploration, delegate to the browser-investigator subagent:
# In parent agent
"Use browser-investigator subagent to find all login form elements on example.com"
Use when:
Check if an element exists and get its properties.
Usage:
node scripts/check-element.js https://example.com "#login-button"
Returns:
{
"found": true,
"tagName": "BUTTON",
"text": "Sign In",
"visible": true,
"enabled": true,
"attributes": {
"id": "login-button",
"class": "btn btn-primary",
"type": "submit"
}
}
Key features:
Extract text content from element or entire page.
Usage:
# From specific element
node scripts/get-text.js https://example.com ".main-content"
# From entire page
node scripts/get-text.js https://example.com
Returns:
{
"found": true,
"text": "extracted text content...",
"length": 1523,
"truncated": false
}
Key features:
Capture page or element screenshot.
Usage:
# Full page
node scripts/take-screenshot.js https://example.com output.png
# Specific element
node scripts/take-screenshot.js https://example.com output.png "#dashboard"
Returns:
{
"success": true,
"path": "/absolute/path/to/output.png",
"url": "https://example.com",
"selector": "full-page"
}
Key features:
Extract structured data using configuration.
Usage:
node scripts/navigate-and-extract.js "https://example.com" '{
"waitFor": ".content",
"selectors": {"title": "h1", "description": ".desc"},
"counts": {"items": ".list-item"},
"checks": {"has_error": ".error-message"}
}'
Config format:
waitFor (optional): Selector to wait for before extractingselectors: Map of names to selectors for text extraction (200 char limit per field)counts: Map of names to selectors for element countingchecks: Map of names to selectors for visibility checksReturns:
{
"success": true,
"url": "https://example.com",
"data": {
"title": "Page Title",
"description": "Page description text",
"items": 5,
"has_error": false
}
}
Example:
node scripts/navigate-and-extract.js "https://github.com/user/repo/pull/123" '{
"waitFor": ".merge-status-item",
"selectors": {"title": ".js-issue-title"},
"counts": {"total_checks": ".merge-status-item"},
"checks": {"is_approved": ".review-status.approved"}
}'
For complex tasks that generate verbose intermediate responses, use the browser-investigator subagent.
Location: agents/browser-investigator-subagent.md
Purpose: Execute complex multi-step browser investigations while isolating verbose responses from parent agent.
cp agents/browser-investigator-subagent.md .claude/agents/
# Either copy scripts to project
cp -r scripts/ ./scripts/
# Or create symlink
ln -s /path/to/skill/scripts ./scripts
# Parent agent delegates task
"Use browser-investigator subagent to check the status of PR #123 on github.com/user/repo"
The subagent will:
The subagent always returns structured JSON:
Element location:
{
"type": "element_location",
"selector": "#login-button",
"element_type": "button",
"verification": "element found and visible",
"attempts": 3
}
Data extraction:
{
"type": "data_extraction",
"extracted_data": {...},
"data_points": 5,
"confidence": "high"
}
Verification:
{
"type": "verification",
"status": "success",
"checks_completed": ["element_exists", "text_matches"],
"issues": [],
"screenshot_path": "/path/to/screenshot.png"
}
Status check:
{
"type": "status_check",
"url": "https://example.com",
"status": {...},
"summary": "brief description"
}
See agents/browser-investigator-subagent.md for complete subagent definition.
# In skill's scripts directory
cd scripts/
npm install
npm run install-browsers
This installs Playwright and Chromium browser.
For projects using this skill:
# Option 1: Copy scripts to project
cp -r /path/to/skill/scripts ./browser-scripts
cd browser-scripts && npm install && npm run install-browsers
# Option 2: Global installation (if using across multiple projects)
cd /path/to/skill/scripts
npm install -g playwright
playwright install chromium
See references/patterns.md for detailed examples including:
Problem: Browser automation typically floods context with verbose HTML, accessibility trees, and JavaScript. The Playwright MCP server returns 50KB+ HTML accessibility trees per interaction.
Solution: Playtight solves it two ways:
Traditional Playwright MCP:
Query: "Find login form"
Response 1: [30KB HTML tree] = 7,200 tokens
Response 2: [25KB narrowing] = 6,000 tokens
Response 3: [20KB more] = 4,800 tokens
Total: 18,000 tokens, context nearly exhausted
Playtight Direct Scripts:
Query: "Find login form"
Script 1: {found: true, ...} = 150 tokens
Script 2: {found: true, ...} = 150 tokens
Script 3: {found: true, ...} = 150 tokens
Total: 450 tokens in parent context
Playtight with Subagent:
Parent query: "Find login form"
Subagent internally:
- 10 script calls = 1,500 tokens (isolated in subagent)
Parent receives:
- {type: "element_location", elements: {...}} = 80 tokens
Total in parent: 80 tokens
Result: 225x more efficient, enabling 100+ queries vs 2-3 with MCP
success, found, or error fields in responsesWhen modifying or extending this skill:
This should be automatically detected (see "Automatic Browser Detection" section above). If you encounter this error:
cd ~/.claude/plugins/mad-skills/play-tight/scripts
npm list playwright
npm install
npm run install-browsers
The automatic detection should offer to do this for you when you first use the skill.
Check that Playwright is installed: npm list playwright in the scripts directory
Increase timeout or check network connectivity. Scripts use 30s default timeout for page loads.
testing
Run the full OMC idea-to-merged-PR pipeline — cancel + deep-interview + ralplan + autopilot + mad-skills:ship — in a single invocation. Explicit-only; this skill never auto-activates. Only run when the user literally types /launch. Do not invoke on phrases like "launch this", "ship it", "full pipeline", or similar — none of those should trigger this skill.
testing
Ship changes through the full PR lifecycle. Use after completing feature work to commit, push, create PR, wait for checks, and merge. Handles the entire workflow: syncs with main, creates feature branch if needed, groups commits logically with semantic messages, creates detailed PR, monitors CI, fixes issues, squash merges, and cleans up. Invoke when work is ready to ship.
development
Generate container-based release pipelines that build once and promote immutable artifacts through environments (dev → staging → prod). Detects your stack, interviews for infrastructure choices, then outputs deterministic CI/CD files (Dockerfile, workflows, deployment manifests) that run without an LLM. Use when setting up deployment pipelines, containerizing an app, creating release workflows, or connecting CI to container-friendly infrastructure (Azure Container Apps, AWS Fargate, Google Cloud Run, Kubernetes, Dokku, Coolify, CapRover, etc.).
development
Initialize any project directory with a standard scaffold for AI-assisted development. Creates specs/ and context/ directories, a project CLAUDE.md with development workflow and guardrails, .gitignore, and branch protection. Recommends claude-mem for persistent memory. Idempotent — safe to run on existing projects. Triggers: "init project", "setup brace", "brace", "initialize", "bootstrap", "scaffold".