puppeteer-skill — Claude Code skill for Puppeteer script generation
A Claude Code skill that generates Puppeteer scripts for browser automation, scraping, and PDF output. Activates when you mention Puppeteer, headless Chrome, page.goto, or PDF generation.
MIT 247 installs ★ 393 updated 2026-10-13
npx skills add LambdaTest/agent-skills --skill puppeteer-skill -a claude-codeWhat puppeteer-skill does
The skill picks up requests about Puppeteer, headless Chrome, page.goto, scraping, and PDF generation, then the agent writes JavaScript or TypeScript code.
Inside are ready patterns: launching a browser with headless: 'new', waiting for selectors and navigation, taking screenshots, saving pages as A4 PDFs. Network interception lets you block images or replace API responses with a mock returning status 200. For TestMu AI Cloud, the skill connects to wss://cdp.lambdatest.com/puppeteer with JSON-encoded capabilities.
Deeper topics live in reference/playbook.md: Page Object, iFrames and dialogs, file uploads, Web Vitals, axe-core, GitHub Actions, Docker. Installing the skill adds only SKILL.md, which points to that playbook.
What it helps with
- generate a login script that fills a form
- capture a full-page screenshot
- save a page as an A4 PDF
- mock an API response while testing the frontend
- run Puppeteer in the cloud over a CDP endpoint
Example prompts for the agent
- Write a script that opens example.com, types credentials, and submits the form
- Generate code that waits for
.resultto appear and logs the page title - Intercept the request to
/api/dataand respond with an empty list
How to install puppeteer-skill
1Skills CLI (Vercel)
npx skills add LambdaTest/agent-skills --skill puppeteer-skill -a claude-code2Manually: put the files in place
~/.claude/skills/puppeteer-skill/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/puppeteer-skill/
1Skills CLI (Vercel)
npx skills add LambdaTest/agent-skills --skill puppeteer-skill -a codex2Manually: put the files in place
.agents/skills/puppeteer-skill/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add LambdaTest/agent-skills --skill puppeteer-skill -a cursor2Manually: put the files in place
.cursor/skills/puppeteer-skill/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install LambdaTest/agent-skills puppeteer-skill2Manually: put the files in place
.github/skills/puppeteer-skill/SKILL.md1Skills CLI (Vercel)
npx skills add LambdaTest/agent-skills --skill puppeteer-skill -a gemini-cli2Platform CLI
gemini skills install https://github.com/LambdaTest/agent-skills --path puppeteer-skillManually: put the files in place
.devin/skills/puppeteer-skill/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add LambdaTest/agent-skills --skill puppeteer-skill -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about puppeteer-skill
How do I install puppeteer-skill in Claude Code?
Run npx skills add LambdaTest/agent-skills --skill puppeteer-skill -a claude-code. The skill lands in ~/.claude/skills/puppeteer-skill/SKILL.md.
What does puppeteer-skill do?
Generates Puppeteer scripts for browser automation: navigation, form filling, waiting for elements, screenshots, PDFs, and network request interception.
Which languages does the agent write in?
The skill supports JavaScript and TypeScript. The examples use require('puppeteer') with async/await.
Source text
SKILL.md · MIT
---
name: puppeteer-skill
description: >
Generates Puppeteer scripts for browser automation, scraping, and PDF generation.
Triggers on: "Puppeteer", "headless Chrome", "page.goto", "scrape", "PDF generation".
languages:
- JavaScript
- TypeScript
category: e2e-testing
license: MIT
metadata:
author: TestMu AI
version: "1.0"
---
# Puppeteer Automation Skill
## Core Patterns
### Basic Script
```javascript
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({ headless: 'new' });
const page = await browser.newPage();
await page.setViewport({ width: 1280, height: 720 });
await page.goto('https://example.com', { waitUntil: 'networkidle0' });
await page.type('#username', '[email protected]');
await page.type('#password', 'password123');
await page.click('button[type="submit"]');
await page.waitForNavigation({ waitUntil: 'networkidle0' });
const title = await page.title();
console.log('Title:', title);
await browser.close();
})();
```
### Wait Strategies
```javascript
// Wait for selector
await page.waitForSelector('.result', { visible: true, timeout: 10000 });
// Wait for navigation
await Promise.all([
page.waitForNavigation({ waitUntil: 'networkidle0' }),
page.click('a.nav-link'),
]);
// Wait for function
await page.waitForFunction('document.querySelector(".count").innerText === "5"');
// Wait for network request
const response = await page.waitForResponse(resp =>
resp.url().includes('/api/data') && resp.status() === 200
);
```
### Screenshot & PDF
```javascript
await page.screenshot({ path: 'screenshot.png', fullPage: true });
await page.pdf({ path: 'page.pdf', format: 'A4', printBackground: true });
```
### Network Interception
```javascript
await page.setRequestInterception(true);
page.on('request', request => {
if (request.resourceType() === 'image') request.abort();
else request.continue();
});
// Mock API
page.on('request', request => {
if (request.url().includes('/api/data')) {
request.respond({
status: 200,
contentType: 'application/json',
body: JSON.stringify({ items: [] }),
});
} else request.continue();
});
```
### TestMu AI Cloud
For full setup, capabilities, and shared capability reference, see [reference/cloud-integration.md](reference/cloud-integration.md).
```javascript
const capabilities = {
browserName: 'Chrome', browserVersion: 'latest',
'LT:Options': {
platform: 'Windows 11', build: 'Puppeteer Build',
user: process.env.LT_USERNAME, accessKey: process.env.LT_ACCESS_KEY,
},
};
const browser = await puppeteer.connect({
browserWSEndpoint: `wss://cdp.lambdatest.com/puppeteer?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`,
});
```
## Quick Reference
| Task | Code |
|------|------|
| Launch headed | `puppeteer.launch({ headless: false })` |
| Evaluate JS | `await page.evaluate(() => document.title)` |
| Extract text | `await page.$eval('.el', el => el.textContent)` |
| Extract all | `await page.$$eval('.items', els => els.map(e => e.textContent))` |
| Set cookie | `await page.setCookie({ name: 'token', value: 'abc' })` |
| Emulate device | `await page.emulate(puppeteer.devices['iPhone 12'])` |
## Deep Patterns → `reference/playbook.md`
| § | Section | Lines |
|---|---------|-------|
| 1 | Production Setup & Configuration | Launch options, Jest integration |
| 2 | Page Object Pattern | BasePage, LoginPage, DashboardPage |
| 3 | Network Interception & Mocking | Request mock, response capture |
| 4 | Wait Strategies | DOM, network, custom conditions |
| 5 | Screenshots, PDF & Media | Full page, clip, PDF, video |
| 6 | Authentication & Cookies | API login, session save/restore |
| 7 | iFrame, Dialog & File Operations | Upload, download, dialogs |
| 8 | Performance & Metrics | Web Vitals, Lighthouse, coverage |
| 9 | Accessibility Testing | axe-core integration |
| 10 | CI/CD Integration | GitHub Actions, Docker |
| 11 | Debugging Quick-Reference | 11 common problems |
| 12 | Best Practices Checklist | 13 items |
© TestMu AI · MIT · LambdaTest/agent-skills