firecrawl-migration-deep-dive
Replace complex manual scraping infrastructure like Puppeteer or Playwright with Firecrawl's managed API.
Install
mkdir -p .claude/skills/firecrawl-migration-deep-dive && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/7595" && unzip -o skill.zip -d .claude/skills/firecrawl-migration-deep-dive && rm skill.zipInstalls to .claude/skills/firecrawl-migration-deep-dive
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Migrate to Firecrawl from Puppeteer, Playwright, Cheerio, or other scrapingKey capabilities
- →Replace Puppeteer, Playwright, or Cheerio scraping code
- →Convert scraping pipelines to Firecrawl API
- →Implement adapter patterns for gradual migration
- →Perform site-wide crawls with path filtering
- →Extract structured data using LLM schemas
How it works
The skill provides code patterns to replace manual browser management with Firecrawl API calls. It uses an adapter pattern to facilitate switching between legacy scraping tools and the Firecrawl API.
Inputs & outputs
When to use firecrawl-migration-deep-dive
- →Replace Puppeteer with Firecrawl
- →Migrate legacy Cheerio scrapers
- →Switch from Playwright to Firecrawl API
- →Streamline content ingestion pipelines
About this skill
Firecrawl Migration Deep Dive
Current State
!npm list puppeteer playwright cheerio 2>/dev/null | grep -E "puppeteer|playwright|cheerio" || echo 'No scraping libs found'
Overview
Migrate from custom scraping (Puppeteer, Playwright, Cheerio) or competing APIs to Firecrawl. Firecrawl eliminates browser management, anti-bot handling, and JS rendering infrastructure. This skill shows equivalent code for common scraping patterns.
Migration Comparison
| Feature | Puppeteer/Playwright | Cheerio | Firecrawl |
|---|---|---|---|
| JS rendering | Manual browser | No | Automatic |
| Anti-bot bypass | DIY (stealth plugin) | No | Built-in |
| Output format | Raw HTML | Parsed HTML | Markdown/JSON/HTML |
| Infrastructure | Browser instances | None | API call |
| Concurrent scraping | Manage browser pool | Simple | Managed by Firecrawl |
| Cost model | Compute (CPU/RAM) | Free | Credits per page |
Instructions
Step 1: Replace Puppeteer Single-Page Scrape
// BEFORE: Puppeteer (20+ lines, browser management)
import puppeteer from "puppeteer";
async function scrapePuppeteer(url: string) {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto(url, { waitUntil: "networkidle2" });
const html = await page.content();
const title = await page.title();
await browser.close();
return { html, title };
}
// AFTER: Firecrawl (5 lines, no browser needed)
import FirecrawlApp from "@mendable/firecrawl-js";
const firecrawl = new FirecrawlApp({ apiKey: process.env.FIRECRAWL_API_KEY! });
async function scrapeFirecrawl(url: string) {
const result = await firecrawl.scrapeUrl(url, {
formats: ["markdown"],
onlyMainContent: true,
waitFor: 2000,
});
return { markdown: result.markdown, title: result.metadata?.title };
}
Step 2: Replace Cheerio HTML Parsing
// BEFORE: fetch + cheerio (manual parsing)
import * as cheerio from "cheerio";
async function scrapeCheerio(url: string) {
const html = await fetch(url).then(r => r.text());
const $ = cheerio.load(html);
return {
title: $("h1").first().text(),
content: $("main").text(),
links: $("a").map((_, el) => $(el).attr("href")).get(),
};
}
// AFTER: Firecrawl with extract (LLM-powered, no CSS selectors)
async function extractFirecrawl(url: string) {
const result = await firecrawl.scrapeUrl(url, {
formats: ["extract", "links"],
extract: {
schema: {
type: "object",
properties: {
title: { type: "string" },
content: { type: "string" },
},
},
},
});
return {
title: result.extract?.title,
content: result.extract?.content,
links: result.links,
};
}
Step 3: Replace Crawl Pipeline
// BEFORE: Playwright crawler (100+ lines, queue, browser pool)
// - launch browser pool
// - manage visited URLs set
// - extract links, enqueue
// - handle errors per page
// - close browsers on exit
// AFTER: Firecrawl crawl (10 lines)
async function crawlSite(baseUrl: string) {
const result = await firecrawl.crawlUrl(baseUrl, {
limit: 100,
maxDepth: 3,
includePaths: ["/docs/*", "/api/*"],
excludePaths: ["/blog/*"],
scrapeOptions: {
formats: ["markdown"],
onlyMainContent: true,
},
});
return result.data?.map(page => ({
url: page.metadata?.sourceURL,
title: page.metadata?.title,
content: page.markdown,
}));
}
Step 4: Gradual Migration with Adapter Pattern
// Adapter interface for gradual migration
interface ScrapeAdapter {
scrape(url: string): Promise<{ title: string; content: string }>;
crawl(url: string, maxPages: number): Promise<Array<{ url: string; content: string }>>;
}
class FirecrawlAdapter implements ScrapeAdapter {
private client: FirecrawlApp;
constructor() {
this.client = new FirecrawlApp({ apiKey: process.env.FIRECRAWL_API_KEY! });
}
async scrape(url: string) {
const result = await this.client.scrapeUrl(url, {
formats: ["markdown"],
onlyMainContent: true,
});
return {
title: result.metadata?.title || "",
content: result.markdown || "",
};
}
async crawl(url: string, maxPages: number) {
const result = await this.client.crawlUrl(url, {
limit: maxPages,
scrapeOptions: { formats: ["markdown"], onlyMainContent: true },
});
return (result.data || []).map(page => ({
url: page.metadata?.sourceURL || url,
content: page.markdown || "",
}));
}
}
// Feature flag controlled migration
function getScrapeAdapter(): ScrapeAdapter {
if (process.env.USE_FIRECRAWL === "true") {
return new FirecrawlAdapter();
}
return new LegacyPuppeteerAdapter();
}
Step 5: Remove Old Dependencies
set -euo pipefail
# After migration is complete and verified
npm uninstall puppeteer puppeteer-core
npm uninstall playwright @playwright/test
npm uninstall cheerio
# Remove browser downloads
npx playwright uninstall --all 2>/dev/null || true
# Verify no lingering references
grep -r "puppeteer\|playwright\|cheerio" src/ --include="*.ts" || echo "Clean!"
Migration Checklist
- Install
@mendable/firecrawl-js - Create adapter layer wrapping Firecrawl
- Replace single-page scrapes with
scrapeUrl - Replace crawl loops with
crawlUrl - Replace HTML parsing with
extractor markdown - Feature flag to switch between old and new
- Run both in parallel, compare outputs
- Remove old scraping dependencies
- Delete browser management code
Error Handling
| Issue | Cause | Solution |
|---|---|---|
| Different output format | Puppeteer returns HTML, Firecrawl markdown | Adjust downstream consumers |
| Missing CSS selector data | Firecrawl doesn't use selectors | Use extract with JSON schema |
| Higher latency for single pages | API call vs local browser | Acceptable trade-off for zero infra |
| Content differences | Different JS wait timing | Tune waitFor parameter |
Resources
Next Steps
For advanced troubleshooting, see firecrawl-advanced-troubleshooting.
When not to use it
- →When local browser control is required for complex authentication
- →When high-frequency scraping exceeds credit limits
Prerequisites
Limitations
- →Firecrawl does not use CSS selectors for extraction
- →API calls may have higher latency than local browser execution
How it compares
Unlike manual browser-based scraping, this approach offloads JS rendering, anti-bot handling, and infrastructure management to the Firecrawl API.
Compared to similar skills
firecrawl-migration-deep-dive side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| firecrawl-migration-deep-dive (this skill) | 1 | 26d | Caution | Intermediate |
| telegram-bot-builder | 106 | 6mo | Review | Intermediate |
| playwright-browser-automation | 29 | 7mo | Review | Intermediate |
| oracle | 17 | 2mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by jeremylongshore
View all by jeremylongshore →You might also like
telegram-bot-builder
davila7
Expert in building Telegram bots that solve real problems - from simple automation to complex AI-powered bots. Covers bot architecture, the Telegram Bot API, user experience, monetization strategies, and scaling bots to thousands of users. Use when: telegram bot, bot api, telegram automation, chat bot telegram, tg bot.
playwright-browser-automation
lackeyjb
Complete browser automation with Playwright. Auto-detects dev servers, writes clean test scripts to /tmp. Test pages, fill forms, take screenshots, check responsive design, validate UX, test login flows, check links, automate any browser task. Use when user wants to test websites, automate browser interactions, validate web functionality, or perform any browser-based testing.
oracle
openclaw
Best practices for using the oracle CLI (prompt + file bundling, engines, sessions, and file attachment patterns).
workflow-orchestration-patterns
wshobson
Design durable workflows with Temporal for distributed systems. Covers workflow vs activity separation, saga patterns, state management, and determinism constraints. Use when building long-running processes, distributed transactions, or microservice orchestration.
codex-skill
feiskyer
Use when user asks to leverage codex, gpt-5, or gpt-5.1 to implement something (usually implement a plan or feature designed by Claude). Provides non-interactive automation mode for hands-off task execution without approval prompts.
bullmq-specialist
davila7
BullMQ expert for Redis-backed job queues, background processing, and reliable async execution in Node.js/TypeScript applications. Use when: bullmq, bull queue, redis queue, background job, job queue.