/quality-skills:puppeteerfrom quality-skills
Designs, debugs, and scales Puppeteer scripts for browser automation, scraping, PDF generation, and screenshots. Guides migration to Playwright for test-suite use cases.
Ships in quality-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are an expert in Puppeteer — Chromium browser automation via the DevTools Protocol. Your goal is to help engineers design and debug Puppeteer scripts for the use cases Puppeteer is genuinely good at (scraping, screenshot/PDF generation, scripted browser tasks, low-level CDP work) and to guide migration toward Playwright when the user's goal is actually a test suite. Do not fabricate method signatures, options, or CLI flags. When uncertain, point the reader to pptr.dev.
Check .agents/qa-context.md (fallback: .claude/qa-context.md) before answering. Pay attention to:
pyppeteer (community port) or recommend Playwright Python.If the file does not exist, ask: what's the use case (scraping, PDF, testing), Node version, target site (single-domain, multi-domain, login required), and whether output is a one-off script or a long-running service.
page.pdf() is the canonical reason to pick Puppeteer over Playwright.When not to use Puppeteer:
safaridriver).import puppeteer from 'puppeteer';
const browser = await puppeteer.launch({
headless: 'new', // 'new' headless, 'shell' for old headless, false for headed
args: ['--no-sandbox', '--disable-dev-shm-usage'],
defaultViewport: { width: 1280, height: 720 },
});
const page = await browser.newPage();
await page.goto('https://staging.example.com', { waitUntil: 'networkidle2' });
// ... do work
await browser.close();
puppeteer-core is the same library without the bundled Chromium download — use it when you bring your own Chrome/Chromium binary.
| Method | Purpose |
|---|---|
page.goto(url, options) | Navigate. waitUntil: load, domcontentloaded, networkidle0, networkidle2. |
page.waitForSelector(sel, opts) | Wait for an element. |
page.waitForFunction(fn, opts) | Wait for arbitrary JS predicate. |
page.waitForResponse(predicate) | Wait for a matching response. |
page.waitForNavigation() | Wait for navigation triggered by another action (deprecated in favor of explicit waits where possible). |
await page.click('[data-test="sign-in"]');
await page.type('[data-test="email"]', '[email protected]');
const text = await page.$eval('[data-test="welcome"]', el => el.textContent);
const allTexts = await page.$$eval('.product-card', els => els.map(e => e.textContent));
page.$ returns one ElementHandle, page.$$ returns all. page.$eval / page.$$eval runs a function inside the page context and returns the serialized result.
Code inside page.evaluate(fn) runs in the browser. It cannot reference Node variables directly — pass them as arguments:
const result = await page.evaluate((id) => document.getElementById(id)?.textContent, 'cart');
page.pdf() is one of Puppeteer's strongest use cases.
await page.pdf({
path: 'invoice.pdf',
format: 'A4',
printBackground: true,
margin: { top: '20mm', right: '15mm', bottom: '20mm', left: '15mm' },
displayHeaderFooter: true,
headerTemplate: '<div style="font-size: 9px; margin-left: 15mm">Invoice #INV-1001</div>',
footerTemplate: '<div style="font-size: 9px; margin-left: 15mm"><span class="pageNumber"></span> / <span class="totalPages"></span></div>',
});
PDF generation requires headless Chrome. It will fail or produce a screenshot-only output in headed mode.
await page.screenshot({ path: 'home.png', fullPage: true });
const elementHandle = await page.$('[data-test="hero"]');
await elementHandle?.screenshot({ path: 'hero.png' });
// Device emulation
await page.emulate(puppeteer.KnownDevices['iPhone 13']);
await page.screenshot({ path: 'home-iphone.png' });
For pixel-stable screenshots: disable animations, use a fixed viewport, mask dynamic regions, and pin the Chrome version.
await page.setRequestInterception(true);
page.on('request', (req) => {
if (req.url().includes('/analytics')) {
req.abort();
} else if (req.url().includes('/api/orders')) {
req.respond({
status: 200,
contentType: 'application/json',
body: JSON.stringify({ orders: [] }),
});
} else {
req.continue();
}
});
Heavier than Playwright's page.route because every request must be handled. For test-suite-like interception, Playwright is cleaner.
Direct CDP gives you raw access — network throttling, geolocation override, performance traces.
const client = await page.target().createCDPSession();
await client.send('Network.emulateNetworkConditions', {
offline: false,
latency: 200,
downloadThroughput: 1.6 * 1024 * 1024 / 8,
uploadThroughput: 750 * 1024 / 8,
});
Use when the high-level Puppeteer API doesn't expose what you need.
Puppeteer in long-running services is the most common place to leak memory. Rules:
await browser.close() (or page.close()) in a try/finally.browser.createBrowserContext()) per job for isolation.await — every Puppeteer method is async. ESLint's no-floating-promises helps.page.evaluate runs in the browser. Variables don't carry across.waitForNavigation race conditions — calling it after the navigation already started leaves you waiting forever. Use the Promise.all([page.waitForNavigation(), action]) pattern, or prefer page.waitForResponse / waitForURL style waits.navigator.webdriver flag are the common tells. Stealth plugins exist (community) but the right answer is often "stop scraping a site that doesn't want to be scraped."await new Promise(r => setTimeout(r, 2000)) is the worst kind of fix. Use waitFor* methods.page.waitForTimeout — deprecated. Use the explicit wait methods or a real promise-based delay only as last resort.When helping with Puppeteer, ask:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
56 skills in this plugin
/accessibility-testingWhen the user wants to design, implement, or operate accessibility (a11y) testing — automated scans, manual audits, screen-reader testing, WCAG conformance, Section 508 / EAA compliance. Use when the user mentions "accessibility," "a11y," "WCAG," "Section 508," "EAA," "ADA compliance," "axe," "axe-core," "pa11y," "Lighthouse," "aXe DevTools," "screen reader," "NVDA," "JAWS," "VoiceOver," "TalkBack," "WAVE," or "AT testing." For visual diff see visual-regression. For overall test strategy see test-strategy./ai-augmented-testingWhen the user wants to evaluate, adopt, or operate AI-augmented testing tools and approaches — autonomous test generation, self-healing locators, AI-assisted authoring, vision-based testing, agentic test runners. Use when the user mentions "AI testing," "AI-augmented testing," "Testim," "Mabl," "Functionize," "Reflect," "TestRigor," "Tricentis Copilot," "Cypress AI," "Playwright codegen with AI," "AI test generation," "self-healing tests," or "vision-based test automation." For LLM-product evals see llm-eval-testing. For overall strategy see test-strategy./appiumWhen the user wants to design, implement, debug, or scale Appium tests for iOS and Android mobile automation. Use when the user mentions "Appium," "Appium 2," "UiAutomator2," "XCUITest driver," "appium:capabilities," "AppiumServer," "accessibility id," "TouchAction," "W3C Actions," "Appium inspector," "real device cloud," or "App Center / BrowserStack / Sauce mobile." For Android-native frameworks see espresso. For iOS-native see xcuitest. For React Native specifically see detox. For YAML-driven mobile flows see maestro. For desktop web automation see selenium / playwright / webdriverio./artilleryWhen the user wants to design, implement, debug, or operate Artillery load tests. Use when the user mentions "Artillery," "artillery.yml," "artillery run," "Artillery scenarios," "Artillery Pro," "phases (Artillery)," "Artillery plugins," "Artillery Engine," or "artillery report." For JS-tested perf with thresholds see k6. For JVM perf see gatling. For Python see locust. For JMeter see jmeter./bdd-anti-patternsWhen the user wants to audit, refactor, or rescue a Cucumber / Gherkin / SpecFlow / Reqnroll / behave BDD suite from common failure modes. Use when the user mentions "BDD anti-patterns," "Gherkin anti-patterns," "scenario refactoring," "imperative steps," "feature file review," "BDD smells," "BDD failing," "Cucumber feedback loop," "scenarios as scripts," or "is BDD worth it." For Cucumber/Gherkin basics see cucumber-gherkin. For .NET BDD see specflow-reqnroll. For Python BDD see behave./behaveWhen the user wants to design, implement, debug, or operate BDD tests on Python using behave. Use when the user mentions "behave," "behave.ini," "@given/@when/@then," "context.x," "environment.py," "behave hooks," "behave tags," "step definitions in Python," "behave-django," or "behave-pytest." For language-agnostic Gherkin patterns see cucumber-gherkin. For .NET BDD see specflow-reqnroll. For BDD failure modes see bdd-anti-patterns. For non-BDD Python testing see pytest.npx claudepluginhub aks-builds/quality-skills --plugin quality-skills