Skills for Claude Code CLI such as full stack dev Cloudflare, React, Tailwind v4, and AI integrations.
Python aianthropicautomationclaude-codeclaude-skillscloudflaredevtoolsproductivityreactskillstailwindvite
feat(firecrawl): Add 5 new API features and update to v4.13.0
Jeremy Dawes30ebebea7578
diff --git a/planning/research-logs/external-cloudflare-skill-evaluation.md b/planning/research-logs/external-cloudflare-skill-evaluation.mdnew file mode 100644index 00000000..a697e211--- /dev/null+++ b/planning/research-logs/external-cloudflare-skill-evaluation.md@@ -0,0 +1,61 @@+# External Cloudflare Skill Evaluation++**Date**: 2026-01-20+**Evaluated**: https://github.com/dmmulroy/cloudflare-skill+**Author**: Dillon Mulroy (Cloudflare DevRel)+**Decision**: Not incorporated++---++## What It Is++A comprehensive Cloudflare platform reference skill covering 60+ products. Organized with decision trees ("I need to store data" → options) and consistent file structure (README, api.md, configuration.md, patterns.md, gotchas.md per product).++**Strengths**:+- Broad coverage (60 products vs our 16)+- Clean decision tree navigation+- Well-organized reference structure+- Created by Cloudflare DevRel (authoritative)++---++## Why We Didn't Incorporate++**1. Different purpose**: It's curated documentation, not production error logs. Our skills have specific GitHub issue links for errors we've actually hit. His skill has general best practices from docs.++**2. Our skills are deeper where it matters**:+- Our cloudflare-worker-base: 8 specific errors with sources, working Hono templates+- His workers reference: General patterns, recommends "use Hono for production"++**3. Breadth we don't need**: 44 of his 60 products are things we don't use (WAF, Spectrum, Argo Smart Routing, etc.)++**4. Repo history suggests one-time doc project**: Created Jan 12-17 2026 (5-day sprint), minimal updates since. Not iteratively battle-tested.++---++## Comparison++| Aspect | dmmulroy/cloudflare-skill | Our Cloudflare skills |+|--------|--------------------------|----------------------|+| Products covered | 60 | 16 (what we use) |+| Error documentation | General gotchas | Specific issues with GitHub links |+| Code templates | Conceptual examples | Working production code |+| Decision trees | Yes (clever UX) | Via README keywords |+| Production tested | Documentation-quality | Yes, with live URLs |++---++## Potentially Useful If Needed Later++- `workers-for-platforms` (multi-tenant Workers)+- `analytics-engine` (custom analytics)+- `sandbox` (code evaluation for AI agents)+- `tail-workers` (logging/observability)++If we ever need these products, his reference docs are a reasonable starting point for research.++---++## Conclusion++Good reference material from an authoritative source, but our focused production-tested approach serves us better. No action taken.diff --git a/skills/firecrawl-scraper/README.md b/skills/firecrawl-scraper/README.mdindex a7079b43..a3c86b3c 100644--- a/skills/firecrawl-scraper/README.md+++ b/skills/firecrawl-scraper/README.md@@ -1,7 +1,7 @@# Firecrawl Web Scraper-**Status**: ✅ Production Ready-**Last Updated**: 2025-10-24+**Status**: Production Ready+**Last Updated**: 2026-01-20**API Version**: v2**Official Docs**: https://docs.firecrawl.dev@@ -9,17 +9,21 @@## What This Skill Does-Provides complete knowledge for using Firecrawl v2 API - a web scraping service that converts websites into LLM-ready markdown or structured data. This skill covers:--- **Single page scraping** with `/v2/scrape` endpoint-- **Full site crawling** with `/v2/crawl` endpoint-- **URL discovery** with `/v2/map` endpoint-- **Structured data extraction** with `/v2/extract` endpoint-- **Python SDK** (firecrawl-py v4.5.0+)-- **TypeScript/Node.js SDK** (firecrawl-js v1.7.x+)-- **JavaScript rendering**, anti-bot bypass, screenshot capture-- **Error handling**, rate limits, and best practices-- **Cloudflare Workers integration**+Provides complete knowledge for using Firecrawl API - a web data platform that converts websites into LLM-ready markdown or structured data. This skill covers:++- **Single page scraping** with `/scrape` endpoint+- **Full site crawling** with `/crawl` endpoint+- **URL discovery** with `/map` endpoint+- **Web search + scrape** with `/search` endpoint (NEW)+- **Structured data extraction** with `/extract` endpoint+- **Autonomous AI agent** with `/agent` endpoint (NEW)+- **Batch operations** for multiple URLs (NEW)+- **Change tracking** to monitor content changes (NEW)+- **Branding extraction** for design systems (NEW)+- **Python SDK** (firecrawl-py v4.13.0+)+- **TypeScript/Node.js SDK** (@mendable/firecrawl-js v4.11.1+)+- **JavaScript rendering**, anti-bot bypass, PDF/DOCX parsing+- **Cloudflare Workers integration** (REST API)**Prevents common issues** with API authentication, rate limiting, timeout errors, and content extraction failures.@@ -40,6 +44,8 @@ Claude automatically uses this skill when you mention:- scrape website- crawl website- web scraper+- firecrawl agent+- firecrawl search### Secondary Triggers (Use Cases)- extract web content@@ -57,6 +63,14 @@ Claude automatically uses this skill when you mention:- scrape articles- extract product data- map website urls+- batch scrape+- scrape multiple urls+- monitor website changes+- track content changes+- extract brand colors+- extract design system+- autonomous web scraping+- ai web agent### Error-Based Triggers- "content not loading"@@ -87,61 +101,66 @@ Claude automatically uses this skill when you mention:| Issue | Error Message | Prevention ||-------|---------------|------------|-| **#1: API Key Not Set** | "Invalid API Key" | Proper environment variable setup with examples |-| **#2: Rate Limits** | "Rate limit exceeded" | Best practices for credit optimization |-| **#3: Timeout Errors** | "Request timeout" | `waitFor` parameter configuration |-| **#4: Empty Content** | "Content is empty" | JavaScript rendering with actions/wait strategies |-| **#5: Bot Detection** | "Access denied" | Firecrawl's built-in anti-bot bypass |+| **#1: API Key Not Set** | "Invalid API Key" | Proper environment variable setup |+| **#2: Rate Limits** | "Rate limit exceeded" | Credit optimization best practices |+| **#3: Timeout Errors** | "Request timeout" | `waitFor` and `timeout` configuration |+| **#4: Empty Content** | "Content is empty" | JS rendering with actions/wait |+| **#5: Bot Detection** | "Access denied" | Stealth mode and location options || **#6: Hardcoded API Keys** | Security vulnerability | Environment variable patterns |---+## API Endpoints Overview++| Endpoint | Purpose | Use Case |+|----------|---------|----------|+| `/scrape` | Single page | Extract article, product page |+| `/crawl` | Full site | Index docs, archive sites |+| `/map` | URL discovery | Find all pages, plan strategy |+| `/search` | Web search + scrape | Research with live data |+| `/extract` | Structured data | Product prices, contacts |+| `/agent` | Autonomous AI | No URLs needed, AI navigates |+| `/batch-scrape` | Multiple URLs | Bulk processing |++---+## Quick Start### Python```bash-# Installpip install firecrawl-py--# Set API keyexport FIRECRAWL_API_KEY=fc-your-api-key``````python+from firecrawl import Firecrawlimport os-from firecrawl import FirecrawlApp-app = FirecrawlApp(api_key=os.environ.get("FIRECRAWL_API_KEY"))+app = Firecrawl(api_key=os.environ.get("FIRECRAWL_API_KEY"))# Scrape single page-result = app.scrape_url("https://example.com", params={- "formats": ["markdown"],- "onlyMainContent": True-})+doc = app.scrape(+ url="https://example.com",+ formats=["markdown"],+ only_main_content=True+)-print(result.get("markdown"))+print(doc.markdown)```### TypeScript/Node.js```bash-# Installnpm install @mendable/firecrawl-js-# or: npm install firecrawl--# Set API keyexport FIRECRAWL_API_KEY=fc-your-api-key``````typescriptimport FirecrawlApp from '@mendable/firecrawl-js';-const app = new FirecrawlApp({- apiKey: process.env.FIRECRAWL_API_KEY-});+const app = new FirecrawlApp({ apiKey: process.env.FIRECRAWL_API_KEY });-// Scrape single pageconst result = await app.scrapeUrl('https://example.com', {formats: ['markdown'],onlyMainContent: true@@ -154,152 +173,63 @@ console.log(result.markdown);----## ⚠️ Cloudflare Workers Compatibility--**Important**: The Firecrawl SDK uses Node.js dependencies (`axios`) and **cannot run in Cloudflare Workers**.--**For Cloudflare Workers**, use one of these approaches:-- ✅ **Direct REST API** with `fetch` (recommended - see `templates/firecrawl-worker-fetch.ts`)-- ✅ **Self-hosted**: [workers-firecrawl](https://github.com/G4brym/workers-firecrawl) (requires Workers Paid Plan)--**For other environments** (Node.js, serverless functions, Python):-- ✅ Use the SDK normally as documented above--See the **Cloudflare Workers Integration** section in `SKILL.md` for complete working examples.-------## Token Savings Estimate+## Cloudflare Workers Compatibility-**Without this skill**: ~10,000 tokens (API docs lookup + trial-and-error + debugging)-**With this skill**: ~4,000 tokens (direct implementation with best practices)+**The Firecrawl SDK cannot run in Cloudflare Workers** (requires Node.js).-**Savings**: ~60% token reduction + prevents all 6 common issues+**For Cloudflare Workers**, use the REST API directly with `fetch`:------## File Structure--```-firecrawl-scraper/-├── SKILL.md # Full instructions (read this first)-├── README.md # This file-├── templates/ # Copy-ready code templates-│ ├── firecrawl-scrape-python.py # Basic Python scraping (Node.js/Python)-│ ├── firecrawl-scrape-typescript.ts # Basic TypeScript scraping (Node.js)-│ ├── firecrawl-worker-fetch.ts # Cloudflare Workers (fetch API)-│ └── firecrawl-crawl-example.py # Full crawl with storage-└── reference/ # Deep-dive documentation- ├── endpoints.md # All 4 API endpoints explained- └── common-patterns.md # Error handling, retries, batching+```typescript+const response = await fetch('https://api.firecrawl.dev/v2/scrape', {+ method: 'POST',+ headers: {+ 'Authorization': `Bearer ${env.FIRECRAWL_API_KEY}`,+ 'Content-Type': 'application/json',+ },+ body: JSON.stringify({ url, formats: ['markdown'] })+});```+See **Cloudflare Workers Integration** section in `SKILL.md` for complete examples.+----## Package Versions (Verified 2025-10-24)+## Package Versions (Verified 2026-01-20)| Package | Version | Status ||---------|---------|--------|-| firecrawl-py | 4.5.0+ | ✅ Latest stable |-| @mendable/firecrawl-js (or firecrawl) | 4.4.1+ | ✅ Latest stable (Node.js >=22.0.0) |-| API Version | v2 | ✅ Current |--**Note**: Node.js SDK cannot run in Cloudflare Workers. Use direct REST API (see templates/firecrawl-worker-fetch.ts).+| firecrawl-py | 4.13.0+ | Latest stable |+| @mendable/firecrawl-js | 4.11.1+ | Latest stable |+| API Version | v2 | Current |---## When to Use This Skill-✅ **Use this skill when:**+**Use this skill when:**- Scraping modern websites with JavaScript- Converting websites to markdown for RAG/LLMs- Extracting structured data from web pages-- Building documentation scrapers+- Performing web search + scrape in one call+- Autonomous data gathering without URLs (Agent)+- Monitoring content changes over time+- Batch processing multiple URLs+- Extracting brand/design systems- Need to bypass bot protection-- Crawling entire sites-- Handling dynamic content-❌ **Don't use this skill for:**+**Don't use this skill for:**- Simple static HTML scraping (use BeautifulSoup/Cheerio)- APIs with official SDKs (use the SDK directly)- Sites you control (just export the data)-- Real-time live data (consider WebSockets/SSE)-------## API Endpoints Overview--1. **`/v2/scrape`** - Scrape a single webpage- - Best for: Articles, product pages, specific URLs- - Returns: Markdown, HTML, screenshot--2. **`/v2/crawl`** - Crawl entire website- - Best for: Documentation sites, full site archives- - Returns: Array of scraped pages--3. **`/v2/map`** - Discover all URLs on site- - Best for: Sitemap generation, planning crawls- - Returns: List of URLs found--4. **`/v2/extract`** - Extract structured data with AI- - Best for: Product catalogs, directory listings- - Returns: JSON matching your schema-------## Common Use Cases--### 1. Documentation Scraping for RAG-```python-docs = app.crawl_url("https://docs.example.com", params={- "limit": 500,- "scrapeOptions": {"formats": ["markdown"]}-})-```--### 2. Product Data Extraction-```typescript-const schema = z.object({- title: z.string(),- price: z.number(),- in_stock: z.boolean()-});--const products = await app.extract({- urls: productUrls,- schema: schema-});-```--### 3. News Article Scraping-```python-article = app.scrape_url("https://news.com/article", params={- "formats": ["markdown"],- "onlyMainContent": True-})-```----## Cloudflare Workers Integration+## Token Savings Estimate-Works seamlessly with Cloudflare Workers for serverless scraping:+**Without this skill**: ~10,000 tokens (API docs lookup + trial-and-error)+**With this skill**: ~3,500 tokens (direct implementation)-```typescript-export default {- async fetch(request: Request, env: Env): Promise<Response> {- const app = new FirecrawlApp({ apiKey: env.FIRECRAWL_API_KEY });-- const { url } = await request.json();- const result = await app.scrapeUrl(url, {- formats: ['markdown'],- onlyMainContent: true- });-- return Response.json({ markdown: result.markdown });- }-};-```+**Savings**: ~65% token reduction + prevents common issues---@@ -314,16 +244,6 @@ export default {----## Research Validation--- ✅ API v2 verified (2025-10-20)-- ✅ Python SDK v4.5.0+ verified on PyPI-- ✅ Node.js SDK v1.7.x+ verified on npm-- ✅ All endpoints documented from official docs-- ✅ Rate limits and best practices confirmed------## Next Steps After Using This Skill1. **Store scraped data**: Use `cloudflare-d1` skill for database storage@@ -333,9 +253,7 @@ export default {----**Production Tested**: ✅-**Token Efficiency**: ~60% savings+**Production Tested**: Yes+**Token Efficiency**: ~65% savings**Error Prevention**: 6 common issues prevented**Composable**: Works with other Cloudflare skills--**Ready to use!** Start with `SKILL.md` for complete instructions.diff --git a/skills/firecrawl-scraper/SKILL.md b/skills/firecrawl-scraper/SKILL.mdindex 6eafb5d1..ceba0bb9 100644--- a/skills/firecrawl-scraper/SKILL.md+++ b/skills/firecrawl-scraper/SKILL.md@@ -1,644 +1,586 @@---name: firecrawl-scraperdescription: |- Convert websites into LLM-ready markdown with Firecrawl v4 API. Handles JavaScript rendering, anti-bot bypass, and structured data extraction for RAG and AI applications.+ Convert websites into LLM-ready data with Firecrawl API. Features: scrape, crawl, map, search, extract, agent (autonomous), batch operations, and change tracking. Handles JavaScript, anti-bot bypass, PDF/DOCX parsing, and branding extraction.- Use when: scraping websites, crawling sites, or troubleshooting content not loading, JavaScript rendering, or bot detection.+ Use when: scraping websites, crawling sites, web search + scrape, autonomous data gathering, monitoring content changes, extracting brand/design systems, or troubleshooting content not loading, JavaScript rendering, or bot detection.user-invocable: true---# Firecrawl Web Scraper Skill-**Status**: Production Ready ✅-**Last Updated**: 2026-01-09+**Status**: Production Ready+**Last Updated**: 2026-01-20**Official Docs**: https://docs.firecrawl.dev-**API Version**: v4 (firecrawl-py 4.12.0+)+**API Version**: v2+**SDK Versions**: firecrawl-py 4.13.0+, @mendable/firecrawl-js 4.11.1+---## What is Firecrawl?-Firecrawl is a **Web Data API for AI** that turns entire websites into LLM-ready markdown or structured data. It handles:+Firecrawl is a **Web Data API for AI** that turns websites into LLM-ready markdown or structured data. It handles:- **JavaScript rendering** - Executes client-side JavaScript to capture dynamic content- **Anti-bot bypass** - Gets past CAPTCHA and bot detection systems-- **Format conversion** - Outputs as markdown, JSON, or structured data-- **Screenshot capture** - Saves visual representations of pages-- **Browser automation** - Full headless browser capabilities+- **Format conversion** - Outputs as markdown, HTML, JSON, screenshots, summaries+- **Document parsing** - Processes PDFs, DOCX files, and images+- **Autonomous agents** - AI-powered web data gathering without URLs+- **Change tracking** - Monitor content changes over time+- **Branding extraction** - Extract color schemes, typography, logos----## API Endpoints+## API Endpoints Overview-### 1. `/v2/scrape` - Single Page Scraping-Scrapes a single webpage and returns clean, structured content.+| Endpoint | Purpose | Use Case |+|----------|---------|----------|+| `/scrape` | Single page | Extract article, product page |+| `/crawl` | Full site | Index docs, archive sites |+| `/map` | URL discovery | Find all pages, plan strategy |+| `/search` | Web search + scrape | Research with live data |+| `/extract` | Structured data | Product prices, contacts |+| `/agent` | Autonomous gathering | No URLs needed, AI navigates |+| `/batch-scrape` | Multiple URLs | Bulk processing |-**Use Cases**:-- Extract article content-- Get product details-- Scrape specific pages-- Convert HTML to markdown+----**Key Options**:-- `formats`: ["markdown", "html", "screenshot"]-- `onlyMainContent`: true/false (removes nav, footer, ads)-- `waitFor`: milliseconds to wait before scraping-- `actions`: browser automation actions (click, scroll, etc.)+## 1. Scrape Endpoint (`/v2/scrape`)-### 2. `/v2/crawl` - Full Site Crawling-Crawls all accessible pages from a starting URL.+Scrapes a single webpage and returns clean, structured content.-**Use Cases**:-- Index entire documentation sites-- Archive website content-- Build knowledge bases-- Scrape multi-page content+### Basic Usage-**Key Options**:-- `limit`: max pages to crawl-- `maxDepth`: how many links deep to follow-- `allowedDomains`: restrict to specific domains-- `excludePaths`: skip certain URL patterns+```python+from firecrawl import Firecrawl+import os-### 3. `/v2/map` - URL Discovery-Maps all URLs on a website without scraping content.+app = Firecrawl(api_key=os.environ.get("FIRECRAWL_API_KEY"))-**Use Cases**:-- Find sitemap-- Discover all pages-- Plan crawling strategy-- Audit website structure+# Basic scrape+doc = app.scrape(+ url="https://example.com/article",+ formats=["markdown", "html"],+ only_main_content=True+)-### 4. `/v2/extract` - Structured Data Extraction-Uses AI to extract specific data fields from pages.+print(doc.markdown)+print(doc.metadata)+```-**Use Cases**:-- Extract product prices and names-- Parse contact information-- Build structured datasets-- Custom data schemas+```typescript+import FirecrawlApp from '@mendable/firecrawl-js';-**Key Options**:-- `schema`: Zod or JSON schema defining desired structure-- `systemPrompt`: guide AI extraction behavior+const app = new FirecrawlApp({ apiKey: process.env.FIRECRAWL_API_KEY });----+const result = await app.scrapeUrl('https://example.com/article', {+ formats: ['markdown', 'html'],+ onlyMainContent: true+});-## Authentication+console.log(result.markdown);+```-Firecrawl requires an API key for all requests.+### Output Formats-### Get API Key-1. Sign up at https://www.firecrawl.dev-2. Go to dashboard → API Keys-3. Copy your API key (starts with `fc-`)+| Format | Description |+|--------|-------------|+| `markdown` | LLM-optimized content |+| `html` | Full HTML |+| `rawHtml` | Unprocessed HTML |+| `screenshot` | Page capture (with viewport options) |+| `links` | All URLs on page |+| `json` | Structured data extraction |+| `summary` | AI-generated summary |+| `branding` | Design system data |+| `changeTracking` | Content change detection |-### Store Securely-**NEVER hardcode API keys in code!**+### Advanced Options-```bash-# .env file-FIRECRAWL_API_KEY=fc-your-api-key-here+```python+doc = app.scrape(+ url="https://example.com",+ formats=["markdown", "screenshot"],+ only_main_content=True,+ remove_base64_images=True,+ wait_for=5000, # Wait 5s for JS+ timeout=30000,+ # Location & language+ location={"country": "AU", "languages": ["en-AU"]},+ # Cache control+ max_age=0, # Fresh content (no cache)+ store_in_cache=True,+ # Stealth mode for complex sites+ stealth=True,+ # Custom headers+ headers={"User-Agent": "Custom Bot 1.0"}+)```-```bash-# .env.local (for local development)-FIRECRAWL_API_KEY=fc-your-api-key-here-```+### Browser Actions----+Perform interactions before scraping:-## Python SDK Usage+```python+doc = app.scrape(+ url="https://example.com",+ actions=[+ {"type": "click", "selector": "button.load-more"},+ {"type": "wait", "milliseconds": 2000},+ {"type": "scroll", "direction": "down"},+ {"type": "write", "selector": "input#search", "text": "query"},+ {"type": "press", "key": "Enter"},+ {"type": "screenshot"} # Capture state mid-action+ ]+)+```-### Installation+### JSON Mode (Structured Extraction)-```bash-pip install firecrawl-py+```python+# With schema+doc = app.scrape(+ url="https://example.com/product",+ formats=["json"],+ json_options={+ "schema": {+ "type": "object",+ "properties": {+ "title": {"type": "string"},+ "price": {"type": "number"},+ "in_stock": {"type": "boolean"}+ }+ }+ }+)++# Without schema (prompt-only)+doc = app.scrape(+ url="https://example.com/product",+ formats=["json"],+ json_options={+ "prompt": "Extract the product name, price, and availability"+ }+)```-**Latest Version**: `firecrawl-py v4.12.0+` (Jan 2026)+### Branding Extraction-### Basic Scrape (v4 API)+Extract design system and brand identity:```python-import os-from firecrawl import Firecrawl--# Initialize client (reads FIRECRAWL_API_KEY from env automatically)-app = Firecrawl(api_key=os.environ.get("FIRECRAWL_API_KEY"))--# Scrape a single page - returns Pydantic Document objectdoc = app.scrape(- url="https://example.com/article",- formats=["markdown", "html"],- only_main_content=True+ url="https://example.com",+ formats=["branding"])-# Access content via attributes (not .get())-print(doc.markdown)-print(doc.metadata) # Page metadata (title, description, etc.)+# Returns:+# - Color schemes and palettes+# - Typography (fonts, sizes, weights)+# - Spacing and layout metrics+# - UI component styles+# - Logo and imagery URLs+# - Brand personality traits```-### Crawl Multiple Pages+----```python-import os-from firecrawl import Firecrawl+## 2. Crawl Endpoint (`/v2/crawl`)-app = Firecrawl(api_key=os.environ.get("FIRECRAWL_API_KEY"))+Crawls all accessible pages from a starting URL.-# Start crawl - returns Pydantic CrawlResult+```pythonresult = app.crawl(url="https://docs.example.com",limit=100,+ max_depth=3,+ allowed_domains=["docs.example.com"],+ exclude_paths=["/api/*", "/admin/*"],scrape_options={- "formats": ["markdown"]+ "formats": ["markdown"],+ "only_main_content": True})-# Process results - result.data is list of Document objectsfor page in result.data:print(f"Scraped: {page.metadata.source_url}")print(f"Content: {page.markdown[:200]}...")```-### Extract Structured Data+### Async Crawl with Webhooks```python-import os-from firecrawl import Firecrawl--app = Firecrawl(api_key=os.environ.get("FIRECRAWL_API_KEY"))--# Define schema (JSON Schema format)-schema = {- "type": "object",- "properties": {- "company_name": {"type": "string"},- "product_price": {"type": "number"},- "availability": {"type": "string"}- },- "required": ["company_name", "product_price"]-}--# Extract data-result = app.extract(- urls=["https://example.com/product"],- schema=schema,- system_prompt="Extract product information from the page"+# Start crawl (returns immediately)+job = app.start_crawl(+ url="https://docs.example.com",+ limit=1000,+ webhook="https://your-domain.com/webhook")-print(result)-```-------## TypeScript/Node.js SDK Usage+print(f"Job ID: {job.id}")-### Installation--```bash-npm install @mendable/firecrawl-js-# or-pnpm add @mendable/firecrawl-js-# or use the unscoped package:-npm install firecrawl+# Or poll for status+status = app.check_crawl_status(job.id)```-**Latest Version**: `@mendable/firecrawl-js v4.4.1+` (or `firecrawl v4.4.1+`)+----### Basic Scrape+## 3. Map Endpoint (`/v2/map`)-```typescript-import FirecrawlApp from '@mendable/firecrawl-js';+Rapidly discover all URLs on a website without scraping content.-// Initialize client-const app = new FirecrawlApp({- apiKey: process.env.FIRECRAWL_API_KEY-});--// Scrape a single page-const result = await app.scrapeUrl('https://example.com/article', {- formats: ['markdown', 'html'],- onlyMainContent: true-});+```python+urls = app.map(url="https://example.com")-// Access markdown content-const markdown = result.markdown;-console.log(markdown);+print(f"Found {len(urls)} pages")+for url in urls[:10]:+ print(url)```-### Crawl Multiple Pages+Use for: sitemap discovery, crawl planning, website audits.-```typescript-import FirecrawlApp from '@mendable/firecrawl-js';+----const app = new FirecrawlApp({- apiKey: process.env.FIRECRAWL_API_KEY-});+## 4. Search Endpoint (`/search`) - NEW-// Start crawl-const crawlResult = await app.crawlUrl('https://docs.example.com', {- limit: 100,- scrapeOptions: {- formats: ['markdown']- }-});--// Process results-for (const page of crawlResult.data) {- console.log(`Scraped: ${page.url}`);- console.log(page.markdown);-}-```+Perform web searches and optionally scrape the results in one operation.-### Extract Structured Data with Zod+```python+# Basic search+results = app.search(+ query="best practices for React server components",+ limit=10+)-```typescript-import FirecrawlApp from '@mendable/firecrawl-js';-import { z } from 'zod';+for result in results:+ print(f"{result.title}: {result.url}")-const app = new FirecrawlApp({- apiKey: process.env.FIRECRAWL_API_KEY-});+# Search + scrape results+results = app.search(+ query="React server components tutorial",+ limit=5,+ scrape_options={+ "formats": ["markdown"],+ "only_main_content": True+ }+)-// Define schema with Zod-const schema = z.object({- company_name: z.string(),- product_price: z.number(),- availability: z.string()-});+for result in results:+ print(f"{result.title}")+ print(result.markdown[:500])+```-// Extract data-const result = await app.extract({- urls: ['https://example.com/product'],- schema: schema,- systemPrompt: 'Extract product information from the page'-});+### Search Options-console.log(result);+```python+results = app.search(+ query="machine learning papers",+ limit=20,+ # Filter by source type+ sources=["web", "news", "images"],+ # Filter by category+ categories=["github", "research", "pdf"],+ # Location+ location={"country": "US"},+ # Time filter+ tbs="qdr:m", # Past month (qdr:h=hour, qdr:d=day, qdr:w=week, qdr:y=year)+ timeout=30000+)```+**Cost**: 2 credits per 10 results + scraping costs if enabled.+----## Common Use Cases+## 5. Extract Endpoint (`/v2/extract`)-### 1. Documentation Scraping+AI-powered structured data extraction from single pages, multiple pages, or entire domains.-**Scenario**: Convert entire documentation site to markdown for RAG/chatbot+### Single Page```python-app = FirecrawlApp(api_key=os.environ.get("FIRECRAWL_API_KEY"))--docs = app.crawl_url(- url="https://docs.myapi.com",- params={- "limit": 500,- "scrapeOptions": {- "formats": ["markdown"],- "onlyMainContent": True- },- "allowedDomains": ["docs.myapi.com"]- }+from pydantic import BaseModel++class Product(BaseModel):+ name: str+ price: float+ description: str+ in_stock: bool++result = app.extract(+ urls=["https://example.com/product"],+ schema=Product,+ system_prompt="Extract product information")-# Save to files-for page in docs.get("data", []):- filename = page["url"].replace("https://", "").replace("/", "_") + ".md"- with open(f"docs/{filename}", "w") as f:- f.write(page["markdown"])+print(result.data)```-### 2. Product Data Extraction+### Multi-Page / Domain Extraction-**Scenario**: Extract structured product data for e-commerce--```typescript-const schema = z.object({- title: z.string(),- price: z.number(),- description: z.string(),- images: z.array(z.string()),- in_stock: z.boolean()-});+```python+# Extract from entire domain using wildcard+result = app.extract(+ urls=["example.com/*"], # All pages on domain+ schema=Product,+ system_prompt="Extract all products"+)-const products = await app.extract({- urls: productUrls,- schema: schema,- systemPrompt: 'Extract all product details including price and availability'-});+# Enable web search for additional context+result = app.extract(+ urls=["example.com/products"],+ schema=Product,+ enable_web_search=True # Follow external links+)```-### 3. News Article Scraping--**Scenario**: Extract clean article content without ads/navigation+### Prompt-Only Extraction (No Schema)```python-article = app.scrape_url(- url="https://news.com/article",- params={- "formats": ["markdown"],- "onlyMainContent": True,- "removeBase64Images": True- }+result = app.extract(+ urls=["https://example.com/about"],+ prompt="Extract the company name, founding year, and key executives")--# Get clean markdown-content = article.get("markdown")+# LLM determines output structure```----## Error Handling+## 6. Agent Endpoint (`/agent`) - NEW-### Python+Autonomous web data gathering without requiring specific URLs. The agent searches, navigates, and gathers data using natural language prompts.```python-from firecrawl import FirecrawlApp-from firecrawl.exceptions import FirecrawlException--app = FirecrawlApp(api_key=os.environ.get("FIRECRAWL_API_KEY"))+# Basic agent usage+result = app.agent(+ prompt="Find the pricing plans for the top 3 headless CMS platforms and compare their features"+)-try:- result = app.scrape_url("https://example.com")-except FirecrawlException as e:- print(f"Firecrawl error: {e}")-except Exception as e:- print(f"Unexpected error: {e}")-```+print(result.data)-### TypeScript+# With schema for structured output+from pydantic import BaseModel+from typing import List-```typescript-import FirecrawlApp from '@mendable/firecrawl-js';+class CMSPricing(BaseModel):+ name: str+ free_tier: bool+ starter_price: float+ features: List[str]-const app = new FirecrawlApp({- apiKey: process.env.FIRECRAWL_API_KEY-});+result = app.agent(+ prompt="Find pricing for Contentful, Sanity, and Strapi",+ schema=CMSPricing+)-try {- const result = await app.scrapeUrl('https://example.com');-} catch (error) {- if (error.response) {- // API error- console.error('API Error:', error.response.data);- } else {- // Network or other error- console.error('Error:', error.message);- }-}+# Optional: focus on specific URLs+result = app.agent(+ prompt="Extract the enterprise pricing details",+ urls=["https://contentful.com/pricing", "https://sanity.io/pricing"]+)```----+### Agent Models-## Rate Limits & Best Practices+| Model | Best For | Cost |+|-------|----------|------|+| `spark-1-mini` (default) | Simple extractions, high volume | Standard |+| `spark-1-pro` | Complex analysis, ambiguous data | 60% more |-### Rate Limits-- **Free tier**: 500 credits/month-- **Paid tiers**: Higher limits based on plan-- Credits consumed vary by endpoint and options+```python+result = app.agent(+ prompt="Analyze competitive positioning...",+ model="spark-1-pro" # For complex tasks+)+```-### Best Practices+### Async Agent-1. **Use `onlyMainContent: true`** to reduce credits and get cleaner data-2. **Set reasonable limits** on crawls to avoid excessive costs-3. **Handle retries** with exponential backoff for transient errors-4. **Cache results** locally to avoid re-scraping same content-5. **Use `map` endpoint first** to plan crawling strategy-6. **Batch extract calls** when processing multiple URLs-7. **Monitor credit usage** in dashboard+```python+# Start agent (returns immediately)+job = app.start_agent(+ prompt="Research market trends..."+)++# Poll for results+status = app.check_agent_status(job.id)+if status.status == "completed":+ print(status.data)+```++**Note**: Agent is in Research Preview. 5 free daily requests, then credit-based billing.----## Cloudflare Workers Integration+## 7. Batch Scrape - NEW-### ⚠️ Important: SDK Compatibility+Process multiple URLs efficiently in a single operation.-**The Firecrawl SDK cannot run in Cloudflare Workers** due to Node.js dependencies (specifically `axios` which uses Node.js `http` module). Workers require Web Standard APIs.+### Synchronous (waits for completion)-**✅ Use the direct REST API with `fetch` instead** (see example below).+```python+results = app.batch_scrape(+ urls=[+ "https://example.com/page1",+ "https://example.com/page2",+ "https://example.com/page3"+ ],+ formats=["markdown"],+ only_main_content=True+)-**Alternative**: Self-host with [workers-firecrawl](https://github.com/G4brym/workers-firecrawl) - a Workers-native implementation (requires Workers Paid Plan, only implements `/search` endpoint).+for page in results.data:+ print(f"{page.metadata.source_url}: {len(page.markdown)} chars")+```----+### Asynchronous (with webhooks)-### Workers Example: Direct REST API+```python+job = app.start_batch_scrape(+ urls=url_list,+ formats=["markdown"],+ webhook="https://your-domain.com/webhook"+)-This example uses the `fetch` API to call Firecrawl directly - works perfectly in Cloudflare Workers:+# Webhook receives events: started, page, completed, failed+``````typescript-interface Env {- FIRECRAWL_API_KEY: string;- SCRAPED_CACHE?: KVNamespace; // Optional: for caching results-}--interface FirecrawlScrapeResponse {- success: boolean;- data: {- markdown?: string;- html?: string;- metadata: {- title?: string;- description?: string;- language?: string;- sourceURL: string;- };- };-}+const job = await app.startBatchScrape(urls, {+ formats: ['markdown'],+ webhook: 'https://your-domain.com/webhook'+});-export default {- async fetch(request: Request, env: Env): Promise<Response> {- if (request.method !== 'POST') {- return Response.json({ error: 'Method not allowed' }, { status: 405 });- }+// Poll for status+const status = await app.checkBatchScrapeStatus(job.id);+```- try {- const { url } = await request.json<{ url: string }>();+---- if (!url) {- return Response.json({ error: 'URL is required' }, { status: 400 });- }+## 8. Change Tracking - NEW- // Check cache (optional)- if (env.SCRAPED_CACHE) {- const cached = await env.SCRAPED_CACHE.get(url, 'json');- if (cached) {- return Response.json({ cached: true, data: cached });- }- }-- // Call Firecrawl API directly using fetch- const response = await fetch('https://api.firecrawl.dev/v2/scrape', {- method: 'POST',- headers: {- 'Authorization': `Bearer ${env.FIRECRAWL_API_KEY}`,- 'Content-Type': 'application/json',- },- body: JSON.stringify({- url: url,- formats: ['markdown'],- onlyMainContent: true,- removeBase64Images: true- })- });-- if (!response.ok) {- const errorText = await response.text();- throw new Error(`Firecrawl API error (${response.status}): ${errorText}`);- }-- const result = await response.json<FirecrawlScrapeResponse>();-- // Cache for 1 hour (optional)- if (env.SCRAPED_CACHE && result.success) {- await env.SCRAPED_CACHE.put(- url,- JSON.stringify(result.data),- { expirationTtl: 3600 }- );- }-- return Response.json({- cached: false,- data: result.data- });-- } catch (error) {- console.error('Scraping error:', error);- return Response.json(- { error: error instanceof Error ? error.message : 'Unknown error' },- { status: 500 }- );- }- }-};-```+Monitor content changes over time by comparing scrapes.-**Environment Setup**: Add `FIRECRAWL_API_KEY` in Wrangler secrets:+```python+# Enable change tracking+doc = app.scrape(+ url="https://example.com/pricing",+ formats=["markdown", "changeTracking"]+)-```bash-npx wrangler secret put FIRECRAWL_API_KEY+# Response includes:+print(doc.change_tracking.status) # new, same, changed, removed+print(doc.change_tracking.previous_scrape_at)+print(doc.change_tracking.visibility) # visible, hidden```-**Optional KV Binding** (for caching - add to `wrangler.jsonc`):+### Comparison Modes-```jsonc-{- "kv_namespaces": [- {- "binding": "SCRAPED_CACHE",- "id": "your-kv-namespace-id"+```python+# Git-diff mode (default)+doc = app.scrape(+ url="https://example.com/docs",+ formats=["markdown", "changeTracking"],+ change_tracking_options={+ "mode": "diff"}- ]-}+)+print(doc.change_tracking.diff) # Line-by-line changes++# JSON mode (structured comparison)+doc = app.scrape(+ url="https://example.com/pricing",+ formats=["markdown", "changeTracking"],+ change_tracking_options={+ "mode": "json",+ "schema": {"type": "object", "properties": {"price": {"type": "number"}}}+ }+)+# Costs 5 credits per page```-See `templates/firecrawl-worker-fetch.ts` for a complete production-ready example.+**Change States**:+- `new` - Page not seen before+- `same` - No changes since last scrape+- `changed` - Content modified+- `removed` - Page no longer accessible----## When to Use This Skill+## Authentication-✅ **Use Firecrawl when:**-- Scraping modern websites with JavaScript-- Need clean markdown output for LLMs-- Building RAG systems from web content-- Extracting structured data at scale-- Dealing with bot protection-- Need reliable, production-ready scraping+```bash+# Get API key from https://www.firecrawl.dev/app+# Store in environment+FIRECRAWL_API_KEY=fc-your-api-key-here+```-❌ **Don't use Firecrawl when:**-- Scraping simple static HTML (use cheerio/beautifulsoup)-- Have existing Puppeteer/Playwright setup working well-- Working with APIs (use direct API calls instead)-- Budget constraints (free tier has limits)+**Never hardcode API keys!**----## Common Issues & Solutions--### Issue: "Invalid API Key"-**Cause**: API key not set or incorrect-**Fix**:-```bash-# Check env variable is set-echo $FIRECRAWL_API_KEY--# Verify key format (should start with fc-)-```+## Cloudflare Workers Integration-### Issue: "Rate limit exceeded"-**Cause**: Exceeded monthly credits-**Fix**:-- Check usage in dashboard-- Upgrade plan or wait for reset-- Use `onlyMainContent: true` to reduce credits+**The Firecrawl SDK cannot run in Cloudflare Workers** (requires Node.js). Use the REST API directly:-### Issue: "Timeout error"-**Cause**: Page takes too long to load-**Fix**:-```python-result = app.scrape_url(url, params={"waitFor": 10000}) # Wait 10s-```+```typescript+interface Env {+ FIRECRAWL_API_KEY: string;+}-### Issue: "Content is empty"-**Cause**: Content loaded via JavaScript after initial render-**Fix**:-```python-result = app.scrape_url(url, params={- "waitFor": 5000,- "actions": [{"type": "wait", "milliseconds": 3000}]-})+export default {+ async fetch(request: Request, env: Env): Promise<Response> {+ const { url } = await request.json<{ url: string }>();++ const response = await fetch('https://api.firecrawl.dev/v2/scrape', {+ method: 'POST',+ headers: {+ 'Authorization': `Bearer ${env.FIRECRAWL_API_KEY}`,+ 'Content-Type': 'application/json',+ },+ body: JSON.stringify({+ url,+ formats: ['markdown'],+ onlyMainContent: true+ })+ });++ const result = await response.json();+ return Response.json(result);+ }+};```----## Advanced Features--### Browser Actions+## Rate Limits & Pricing-Perform interactions before scraping:+| Tier | Credits/Month | Notes |+|------|---------------|-------|+| Free | 500 | Good for testing |+| Hobby | 3,000 | $19/month |+| Standard | 100,000 | $99/month |+| Growth | 500,000 | $399/month |-```python-result = app.scrape_url(- url="https://example.com",- params={- "actions": [- {"type": "click", "selector": "button.load-more"},- {"type": "wait", "milliseconds": 2000},- {"type": "scroll", "direction": "down"}- ]- }-)-```--### Custom Headers--```python-result = app.scrape_url(- url="https://example.com",- params={- "headers": {- "User-Agent": "Custom Bot 1.0",- "Accept-Language": "en-US"- }- }-)-```+**Credit Costs**:+- Scrape: 1-4 credits (depends on options)+- Crawl: 1 credit per page+- Search: 2 credits per 10 results+- Extract: 5 credits per page+- Agent: Dynamic (complexity-based)+- Change Tracking JSON mode: +5 credits-### Webhooks for Long Crawls+----Instead of polling, receive results via webhook:+## Common Issues & Solutions-```python-crawl = app.crawl_url(- url="https://docs.example.com",- params={- "limit": 1000,- "webhook": "https://your-domain.com/webhook"- }-)-```+| Issue | Cause | Solution |+|-------|-------|----------|+| Empty content | JS not loaded | Add `wait_for: 5000` or use `actions` |+| Rate limit exceeded | Over quota | Check dashboard, upgrade plan |+| Timeout error | Slow page | Increase `timeout`, use `stealth: true` |+| Bot detection | Anti-scraping | Use `stealth: true`, add `location` |+| Invalid API key | Wrong format | Must start with `fc-` |---@@ -646,12 +588,10 @@ crawl = app.crawl_url(| Package | Version | Last Checked ||---------|---------|--------------|-| firecrawl-py | 4.5.0+ | 2025-10-20 |-| @mendable/firecrawl-js (or firecrawl) | 4.4.1+ | 2025-10-24 |+| firecrawl-py | 4.13.0+ | 2026-01-20 |+| @mendable/firecrawl-js | 4.11.1+ | 2026-01-20 || API Version | v2 | Current |-**Note**: The Node.js SDK requires Node.js >=22.0.0 and cannot run in Cloudflare Workers. Use direct REST API calls in Workers (see Cloudflare Workers Integration section).----## Official Documentation@@ -665,15 +605,6 @@ crawl = app.crawl_url(----## Next Steps After Using This Skill--1. **Store scraped data**: Use Cloudflare D1, R2, or KV to persist results-2. **Build RAG system**: Combine with Vectorize for semantic search-3. **Add scheduling**: Use Cloudflare Queues for recurring scrapes-4. **Process content**: Use Workers AI to analyze scraped data-------**Token Savings**: ~60% vs manual integration-**Error Prevention**: API authentication, rate limiting, format handling-**Production Ready**: ✅+**Token Savings**: ~65% vs manual integration+**Error Prevention**: API auth, rate limiting, format handling, JS rendering+**Production Ready**: Yes