Agent Skills
Browser Automation Skill
Automate browser interactions, scrape websites, fill forms, and run end-to-end tests with Playwright while respecting rate limits and ethical guidelines.
Skill Definition
Copy the following content into .autohand/skills/browser-automation/SKILL.md:
---
name: browser-automation
description: Automate browser tasks and web scraping. Use for filling forms, extracting data, testing websites, and automating repetitive web tasks with Playwright.
allowed-tools: run_command read_file write_file browser_action
---
# Skill: Browser automation
## Purpose
Control web browsers programmatically to automate tasks, extract data, and test web applications. This skill uses Playwright for reliable cross-browser automation while following ethical scraping practices and respecting site policies.
## When to use this skill
- Automating **repetitive web tasks** like form filling or data entry.
- Scraping **structured data** from websites.
- Writing and running **E2E test suites** with Playwright.
- Taking **screenshots** for documentation or monitoring.
- Automating **authenticated workflows** on internal tools.
## Inputs
- **Target website or application**: URL and authentication if needed.
- **Task description**: what to automate or extract.
- **Output format**: CSV, JSON, screenshots, test reports.
- **Constraints**: rate limits, allowed domains, time windows.
## Out of scope
- Bypassing **CAPTCHAs or bot detection**.
- Scraping sites that **explicitly prohibit it** in robots.txt or ToS.
- Actions that could **harm target systems** (DDoS-like behavior).
- Accessing **sensitive accounts** without proper authorization.
## Conventions
- Wait for elements to be **visible before interacting**.
- Use **robust selectors** (data-testid, aria labels) over CSS classes.
- Handle **dynamic content** with proper waits, not fixed delays.
- Take **screenshots at key steps** for debugging.
- Respect **rate limits and robots.txt**.
## Required behavior
1. Check **robots.txt and site policies** before scraping.
2. Wait for elements using **Playwright's built-in waits**.
3. Use **retry logic** for flaky operations.
4. Store credentials in **environment variables**.
5. Add **delays between actions** to appear more human-like.
6. Handle **cookie consent banners** gracefully.
## Required artifacts
- **Automation script**: Playwright code with proper error handling.
- **Configuration**: browser settings, timeouts, allowed domains.
- **Output files**: scraped data, screenshots, test reports.
- **Documentation**: how to run the automation, required setup.
## Implementation checklist
1. Verify the task is ethical and allowed by site policies.
2. Set up Playwright with appropriate browser configuration.
3. Navigate to the target and handle initial popups.
4. Implement the core automation with proper waits.
5. Add error handling and retry logic.
6. Capture screenshots for debugging.
7. Export data in the requested format.
8. Test the full flow end-to-end.
## Verification
Before running in production:
- Verify the automation **completes successfully** end-to-end.
- Check that **error handling works** for common failures.
- Confirm **rate limiting is respected**.
- Validate **extracted data is correct**.
The skill is complete when:
- The automation runs reliably without manual intervention.
- Output matches the expected format and quality.
- Error cases are handled gracefully.
- The process is documented and reproducible.
## Safety and escalation
- If a site has **anti-bot measures**, do not attempt to bypass them.
- If scraping could **overload a server**, add rate limiting.
- If the task involves **personal data**, verify compliance requirements.
- If automating **financial transactions**, get explicit approval.
- Never store **passwords in code** or commit credentials.
Example usage
# Scrape data from a website
autohand --skill browser-automation --prompt "Scrape product prices from example.com/products and save to CSV"
# Fill out a form
autohand --skill browser-automation --prompt "Log into the admin panel and export the user report"
# Run E2E tests
autohand --skill browser-automation --prompt "Write Playwright tests for the checkout flow"
# Generate screenshots
autohand --skill browser-automation --prompt "Take screenshots of our landing page at mobile, tablet, and desktop sizes"
# Monitor changes
autohand --skill browser-automation --prompt "Check if our pricing page has changed since yesterday"