This skill scaffolds a local Playwright and Next.js scheduled scraper project with optional read-only viewer and macOS launchd automation.
npx playbooks add skill sawyerh/agents --skill setup-scheduled-scraper
Build a local, scheduled scraper that runs via Playwright and writes JSON results, with an optional Next.js viewer for tables/charts. Default stack: TypeScript, Playwright test runner, Next.js App Router, Tailwind v4, Shadcn UI, and launchd scheduling.
references/intake.md).project/
├── src/
│ ├── app/
│ │ ├── layout.tsx # Next.js root layout
│ │ └── page.tsx # Viewer entry page
│ ├── launchd/
│ │ ├── com.example.scraper.plist # LaunchAgent schedule
│ │ └── com.example.scraper-wake.plist # LaunchDaemon wake helper
│ ├── lib/ # Viewer helpers
│ ├── scraper.ts # Playwright entry (called by test spec)
│ └── scrape.spec.ts # Playwright spec that invokes scraper
├── scripts/
│ ├── clear_logs.sh # Clears scheduler logs
│ ├── run_playwright_daily.sh # Scheduled wrapper (logs + npm run scrape)
│ ├── update-schedule.sh # Updates launchd schedule times
│ └── schedule-wakes.sh # Optional pmset wake scheduling
├── results.json # Scheduled output (read-only)
├── results-local.json # Manual run output
├── scraper-metadata.json # Run metadata
├── package.json
├── tsconfig.json
└── README.md
flowchart TB
LaunchDaemon["LaunchDaemon (wake scheduler)"] --> pmset["pmset wake events"]
pmset --> LaunchAgent
LaunchAgent["LaunchAgent (twice daily)"] --> Runner["scripts/run_playwright_daily.sh"]
Runner --> Scrape["npm run scrape (Playwright)"]
Scrape --> Results["results.json"]
Scrape --> Metadata["scraper-metadata.json"]
Results --> Viewer["Next.js web app"]
Metadata --> Viewer
Viewer --> Vercel
Vercel --> User
results.json for scheduled runs; use results-local.json for manual runs.SCRAPE_RESULTS_PATH.scraper-metadata.json (timestamp, counts, errors).results.json (array of records):
[
{
"url": "https://example.com/scoreboard/some-unique-id",
"title": "Knicks at Lakers",
"game_start_time": "2026-02-01T19:00:00-08:00",
"scraped_at": "2026-02-01T07:00:12-08:00"
},
{
"url": "https://example.com/scoreboard/some-unique-id-2",
"title": "Bucks at Warriors",
"game_start_time": "2026-02-01T21:30:00-08:00",
"scraped_at": "2026-02-01T07:00:12-08:00"
}
]
scraper-metadata.json:
{ "last_scraped_at": "2026-02-01T07:00:12-08:00" }
scripts/ and customize them for the project (PROJECT_SLUG, paths, labels).~/Library/LaunchAgents.pmset schedule wakeorpoweron helper./Library/LaunchDaemons (not a symlink) and set ownership to root:wheel.update-schedule.sh helper to edit StartCalendarInterval with two daily times. If more than two times are needed, ask before expanding the schedule logic.npm run scrape (and npm run scrape:ui for Playwright UI).npm run dev.launchctl list and pmset -g sched.tail -n 200 ~/Library/Logs/<project>.out.log ~/Library/Logs/<project>.err.log.references/intake.mdreferences/checklists.mdWeekly roundup of top Claude Code skills, MCP servers, and AI coding tips.