scraper-builder▌
jwynia/agent-skills · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Generate complete, runnable web scraper projects using the PageObject pattern with Playwright and TypeScript. This skill produces site-specific scrapers with typed data extraction, Docker deployment, and optional agent-browser integration for automated site analysis.
Scraper Builder
Generate complete, runnable web scraper projects using the PageObject pattern with Playwright and TypeScript. This skill produces site-specific scrapers with typed data extraction, Docker deployment, and optional agent-browser integration for automated site analysis.
When to Use This Skill
Use this skill when:
- Building a site-specific web scraper for data extraction
- Generating PageObject classes for a target website
- Scaffolding a complete scraper project with Docker support
- Using agent-browser to analyze a site and auto-generate selectors
- Creating reusable scraping components (pagination, data tables)
Do NOT use this skill when:
- Building API clients (use HTTP client libraries directly)
- Writing QA/E2E test suites (use Playwright test runner with test-focused patterns)
- Mass crawling or spidering entire domains (use Crawlee or Scrapy)
- Scraping sites that require authentication bypass or CAPTCHA solving
Core Principles
1. PageObject Encapsulation
Each page on the target site maps to one PageObject class. Locators are defined in the constructor, and scraping logic lives in methods. Page objects never contain assertions or business logic — they extract and return data.
2. Selector Resilience
Prefer selectors in this order: data-testid > id > semantic HTML (role, aria-label) > structured CSS classes > text content. Avoid positional selectors (nth-child) and layout-dependent paths. See references/playwright-selectors.md for the full hierarchy.
3. Composition Over Inheritance
Reusable UI patterns (pagination, data tables, search bars) are modeled as component classes that page objects compose via properties. Only BasePage uses inheritance — everything else composes.
4. Typed Data Extraction
All scraped data flows through Zod schemas for validation. This catches selector drift (when a site changes its markup) at extraction time rather than downstream. See assets/templates/data-schema.ts.md.
5. Docker-First Deployment
Generated projects include a Dockerfile using Microsoft's official Playwright images and a docker-compose.yml with volume mounts for output data and debug screenshots. This ensures consistent browser environments across machines.
Generation Modes
Mode 1: Agent-Browser Analysis
Use agent-browser to navigate the target site, capture accessibility tree snapshots, and automatically discover selectors. This is the preferred mode when the agent has access to the agent-browser CLI.
Prerequisites: If agent-browser is not already installed, add it as a skill first:
npx skills add vercel-labs/agent-browser
Workflow:
# 1. Open the target page
agent-browser open https://example.com/products
# 2. Capture interactive snapshot with element references
agent-browser snapshot -i --json > snapshot.json
# 3. Capture scoped sections for focused analysis
agent-browser snapshot -i --json -s "main" > main-content.json
agent-browser snapshot -i --json -s "nav" > navigation.json
# 4. Test dynamic behavior (pagination, load-more)
agent-browser click @e3
agent-browser wait --load networkidle
agent-browser snapshot -i --json > after-click.json
# 5. Close when done
agent-browser close
What the agent does with snapshots:
- Parse element references (
@e1,@e2, etc.) and their roles - Group elements by semantic purpose (navigation, data display, forms, actions)
- Map data elements to fields (title, price, image, etc.)
- Generate PageObject classes with discovered selectors
- Identify pagination and dynamic loading patterns
See references/agent-browser-workflow.md for the complete workflow reference.
Mode 2: Manual Description
The user describes the target site's page structure and the agent maps it to page objects. The agent asks structured questions:
- What pages to scrape? — List of URLs or page types
- What data to extract? — Field names and expected types per page
- How is data paginated? — Numbered pages, load-more, infinite scroll, or single page
- What selectors are known? — Any CSS selectors, data-testid values, or XPath the user already knows
The agent then:
- Matches the description to a site archetype from
data/site-archetypes.json - Proposes a page object map with class names and responsibilities
- Generates code after the user confirms the plan
Mode 3: Full Project Scaffold
Generate a complete runnable project in one operation using the scaffolder script:
deno run --allow-read --allow-write scripts/scaffold-scraper-project.ts \
--name "my-scraper" \
--url "https://example.com" \
--pages "ProductListing,ProductDetail" \
--fields "title,price,image_url,description"
This produces a project with all source files, configuration, Docker setup, and an entry point ready to run. See the Scripts Reference section for full options.
Quick Reference
| Category | Approach | Details |
|---|---|---|
| Framework | Playwright | playwright package, not @playwright/test |
| Language | TypeScript | Strict mode, ES2022 target |
| Pattern | PageObject | One class per page, compose components |
| Selectors | Resilient | data-testid > id > role > CSS class > text |
| Wait strategy | Auto-wait | Playwright built-in, plus networkidle for navigation |
| Validation | Zod | Schema per page object's output type |
| Output | JSON + CSV | Configurable via storage utility |
| Docker | Official image | mcr.microsoft.com/playwright:v1.48.0-jammy |
| Retry | Exponential backoff | 3 attempts default, configurable |
| Screenshots | On error | Saved to screenshots/ for debugging |
Generation Process
Follow this sequence when generating a scraper:
Step 1: Gather Requirements
Ask the user for:
- Target site URL(s)
- Data fields to extract
- Number of pages/items expected
- Output format preference (JSON, CSV, both)
- Whether Docker deployment is needed
Step 2: Analyze the Site
Use Mode 1 (agent-browser) or Mode 2 (manual description) to understand:
- Page structure and navigation flow
- Data element locations and selector strategies
- Pagination or infinite scroll patterns
- Dynamic content loading behavior
Step 3: Design the Page Object Map
Create a plan listing:
- Each PageObject class and its URL pattern
- Component classes needed (Pagination, DataTable, etc.)
- Data schema fields and types per page
- The scraper's navigation flow between pages
Step 4: Present the Plan
Show the user the page object map before generating code. Include class names, field names, and the execution flow. Wait for confirmation.
Step 5: Generate Code
Use the templates in assets/templates/ as the foundation:
base-page.ts.md— BasePage abstract classpage-object.ts.md— Site-specific page objectcomponent.ts.md— Reusable componentsscraper-runner.ts.md— Orchestratordata-schema.ts.md— Zod validation schemas
Step 6: Deliver
Provide the complete project with:
- All source files
- Configuration files from
assets/configs/ - A README explaining how to run it
- Docker setup (unless explicitly excluded)
Code Patterns
BasePage
Abstract class providing navigate(), waitForPageLoad(), screenshot(), and getText() helpers. All page objects extend this.
export abstract class BasePage {
constructor(protected readonly page: Page) {}
async navigate(url: string): Promise<void> { /* ... */ }
async screenshot(name: string): Promise<void> { /* ... */ }
}
See: assets/templates/base-page.ts.md
PageObject
Site-specific class with locators as readonly properties, scrape methods returning typed data, and navigation methods for multi-page flows.
export class ProductListingPage extends BasePage {
readonly productCards: Locator;
readonly nextButton: Locator;
async scrapeProducts(): Promise<Product[]> { /* ... */ }
async goToNextPage(): Promise<boolean> { /* ... */ }
}
See: assets/templates/page-object.ts.md
Component
Reusable UI pattern (Pagination, DataTable) that receives a parent locator scope and provides extraction methods.
export class Pagination {
constructor(private page: Page, private scope: Locator) {}
async hasNextPage(): Promise<boolean> { /* ... */ }
async goToNext(): Promise<void> { /* ... */ }
}
See: assets/templates/component.ts.md
ScraperRunner
Orchestrator that launches the browser, creates page objects, iterates through pages, collects data, validates with schemas, and writes output.
export class SiteScraper {
async run(): Promise<void> {
const browser = await chromium.launch();
const page = await browser.newPage();
// navigate, scrape, validate, write
}
}
See: assets/templates/scraper-runner.ts.md
DataSchema
Zod schemas that validate scraped records, catching selector drift and malformed data at extraction time.
export const ProductSchema = z.object({
title: z.string().min(1),
price: z.number().positive(),
});
See: assets/templates/data-schema.ts.md
Anti-Patterns
| Anti-Pattern | Problem | Solution |
|---|---|---|
| Monolith Scraper | All scraping logic in one file | Split into PageObject classes per page |
| Sleep Waiter | Using setTimeout/fixed delays |
Use Playwright auto-wait and networkidle |
| Unvalidated Pipeline | No schema validation on output | Add Zod schemas for every data type |
| Selector Lottery | Fragile positional selectors | Use resilient selector hierarchy |
| Silent Failure | Swallowing errors without logging | Log failures and save debug screenshots |
| Unthrottled Crawler | No delay between requests | Add configurable request delays |
| Hardcoded Config | URLs and selectors in code | Use environment variables and config files |
| No Retry Logic | Single attempt per request | Implement exponential backoff |
See references/anti-patterns.md for the extended catalog with examples and fixes.
Scripts Reference
scaffold-scraper-project.ts
Generate a complete scraper project:
deno run --allow-read --allow-write scripts/scaffold-scraper-project.ts [options]
Options:
--name <name> Project name (required)
--path <path> Target directory (default: ./)
--url <url> Target site base URL
--pages <pages> Comma-separated page names (e.g., ProductListing,ProductDetail)
--fields <fieHow to use scraper-builder on Cursor
AI-first code editor with Composer
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 scraper-builder
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches scraper-builder from GitHub repository jwynia/agent-skills and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate scraper-builder. Access the skill through slash commands (e.g., /scraper-builder) 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
Use Cases▌
Task Automation & Efficiency
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Knowledge Enhancement
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Quality Improvement
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Installation Steps
- 1.Install skill using provided installation command
- 2.Test with simple use case relevant to your work
- 3.Evaluate output quality and relevance
- 4.Iterate on prompts to improve results
- 5.Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices▌
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This▌
✓ Use When
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid When
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path▌
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.6★★★★★46 reviews- ★★★★★Tariq Gill· Dec 20, 2024
scraper-builder reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★James Shah· Dec 8, 2024
I recommend scraper-builder for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Charlotte Gupta· Dec 4, 2024
Registry listing for scraper-builder matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Tariq Ghosh· Dec 4, 2024
We added scraper-builder from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Amelia Kapoor· Nov 27, 2024
scraper-builder reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Zara Chen· Nov 23, 2024
Useful defaults in scraper-builder — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Mei Reddy· Nov 11, 2024
I recommend scraper-builder for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Emma Chawla· Nov 7, 2024
We added scraper-builder from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★James Ramirez· Oct 26, 2024
scraper-builder fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Alexander Mensah· Oct 18, 2024
Registry listing for scraper-builder matched our evaluation — installs cleanly and behaves as described in the markdown.
showing 1-10 of 46