Crawl4ai
Use when scraping JavaScript-heavy pages or SPAs, crawling multiple URLs concurrently, extracting structured data with reusable CSS/JSON schemas, or building automated web data pipelines. Wraps the Crawl4AI library (`crwl` CLI and Python SDK) with schema-generation patterns for LLM-free extraction. Triggers on crawl4ai, crwl, scrape JS-heavy site, scrape SPA, headless browser scrape, schema-based extraction, batch crawl, sitemap crawl, web data pipeline. SKIP when a static HTML page can be read with `defuddle` / `fetch-web` — those are faster cold-start and don't need a browser.
- Skill ID
- brettdavies/crawl4ai-skill/crawl4ai
- Publisher
- brettdavies
- Repository
- crawl4ai-skill
- Installs
- 0
- Files
- 51
- Synced
- Sep 23, 2026
Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.
brettdavies/crawl4ai-skill/crawl4aiInstalls these files- .github/pull_request_template.md
- .gitignore
- .markdownlint-cli2.yaml
- AGENTS.md
- CHANGELOG.md
- CONTRIBUTING.md
- LICENSE
- LICENSE-APACHE
- LICENSE-MIT
- README.md
- SKILL.md
- VERSION
- evals/README.md
- evals/eval-01-spa-markdown.md
- evals/eval-02-extract-products.md
- evals/eval-03-topic-domain-crawl.md
- evals/eval-04-render-cached-html.md
- fixtures/README.md
- fixtures/sample-products-expected.json
- fixtures/sample-products-schema.json
- fixtures/sample-products.html
- references/anti-detection.md
- references/cli-guide.md
- references/complete-sdk-reference.md
- references/content-filters.md
- references/escalation.md
- references/recipes.md
- references/sdk-guide.md
- references/troubleshooting.md
- references/url-discovery.md
- scripts/basic_crawler.py
- scripts/batch_crawl.py
- scripts/batch_extract.py
- scripts/extract_with_llm.py
- scripts/extract_with_schema.py
- scripts/generate_schema.py
- templates/browser.yml
- templates/crawler.yml
- templates/css_schema.json
- templates/extract_css.yml
- templates/extract_llm.yml
- templates/filter_bm25.yml
- templates/filter_pruning.yml
- templates/login_crawler.yml
- tests/README.md
- tests/run_all_tests.py
- tests/test_advanced_patterns.py
- tests/test_basic_crawling.py
- tests/test_data_extraction.py
- tests/test_fixtures.py
- tests/test_markdown_generation.py
What this skill tells the agent
Crawl4AI
Verified against `crawl4ai` `VERSION`. PEP 723 pins in scripts/*.py and tests/*.py floor at that version.
Overview
Crawl4AI wraps a headless browser (Playwright) plus a markdown-aware content pipeline. Use it when defuddle/curl can't reach the content — JavaScript-rendered pages, login-gated content, infinite scroll, multi-URL concurrency, repeatable schema-based extraction.
This skill exposes both interfaces of the underlying library:
- CLI (
crwl) — quick, scriptable commands: CLI Guide - Python SDK — full programmatic control: SDK Guide
Invoked with a URL argument
When the user runs /crawl4ai <url> with a single URL and no further qualifier, treat it as the JS-heavy fetch case and default to:
crwl <url> -c "wait_until=networkidle,page_timeout=60000" -o markdownwait_until=networkidle waits for the network to be quiet for ~500ms post-load — the right default when the user hasn't named a specific element on a JS-rendered page. (Avoid wait_for=css:body: <body> exists at t=0 on every HTML response, so it's satisfied before JS renders content.) Then return the markdown to the agent context. Adjust to wait_for=css:<selector> if the user named a specific element. Skip the default and route to the relevant section below for any task that names extraction, batch / multi-URL, login / session, screenshot / PDF, or URL discovery — those each have their own pipeline. If the URL is clearly static (a docs page, a blog post), route the user to /fetch-web instead per the "When NOT to use" section below.
When NOT to use this skill
- Static HTML pages (most documentation sites, blog posts, news articles, tweets) — use
/fetch-webordefuddledirectly. Static extraction is ~0ms cold start; crawl4ai pays a ~2s browser startup tax. - Local file conversion (
.pdf,.docx,.pptx,.epub) — use/markdown-convert. - One-URL agent-context reads (the agent just needs to read this page) — use
/fetch-weband let it route todefuddle. - Mutating UI flows (form fills, multi-step clicks, login + navigation) —
/browse(gstack's persistent headless Chromium) is built for that.
When stuck
For unknown crwl/SDK flags, scrape failures, or extraction edge cases the references don't cover, see references/escalation.md for the lookup order (qmd solutions → upstream docs → GitHub issues → ask the user) and worked examples.
Quick Start
Installation
pip install crawl4ai
crawl4ai-setup
# Verify installation
crawl4ai-doctorCLI (Recommended)
# Basic crawling - returns markdown
crwl https://example.com
# Get markdown output
crwl https://example.com -o markdown
# JSON output with cache bypass
crwl https://example.com -o json -v --bypass-cache
# See more examples
crwl --examplePython SDK
import asyncio
from crawl4ai import AsyncWebCrawler
async def main():
async with AsyncWebCrawler() as crawler:
result = await crawler.arun("https://example.com")
print(result.markdown[:500])
asyncio.run(main())For SDK configuration details: SDK Guide - Configuration.
Core Concepts
Configuration Layers
Both CLI and SDK use the same underlying configuration:
| Concept | CLI | SDK |
|---|---|---|
| Browser settings | -B browser.yml or -b "param=value" | BrowserConfig(...) |
| Crawl settings | -C crawler.yml or -c "param=value" | CrawlerRunConfig(...) |
| Extraction | -e extract.yml -s schema.json | extraction_strategy=... |
| Content filter | -f filter.yml | markdown_generator=... |
Key Parameters
Browser Configuration:
headless: Run with/without GUIviewport_width/height: Browser dimensionsuser_agent: Custom user agentproxy_config: Proxy settings
Crawler Configuration:
page_timeout: Max page load time (ms)wait_for: CSS selector or JS condition to wait forcache_mode: bypass, enabled, disabledjs_code: JavaScript to executecss_selector: Focus on specific element
For complete parameters: CLI Config | SDK Config
Output Content
Every crawl returns:
- markdown - Clean, formatted markdown
- html - Raw HTML
- links - Internal and external links discovered
- media - Images, videos, audio found
- extracted_content - Structured data (if extraction configured)
Markdown Generation (Primary Use Case)
Crawl4AI excels at generating clean, well-formatted markdown.
CLI
crwl https://docs.example.com -o markdown # raw markdown
crwl https://docs.example.com -o markdown-fit # filtered (noise removed)
crwl https://docs.example.com -f templates/filter_bm25.yml -o markdown-fit # BM25-relevance filter
crwl https://docs.example.com -f templates/filter_pruning.yml -o markdown-fit # quality-based filterFilter templates: `templates/filter_bm25.yml` (relevance-scored against a query), `templates/filter_pruning.yml` (no query, prunes low-quality blocks).
Python SDK
from crawl4ai.content_filter_strategy import BM25ContentFilter
from crawl4ai.markdown_generation_strategy import DefaultMarkdownGenerator
bm25_filter = BM25ContentFilter(user_query="machine learning", bm25_threshold=1.0)
md_generator = DefaultMarkdownGenerator(content_filter=bm25_filter)
config = CrawlerRunConfig(markdown_generator=md_generator)
result = await crawler.arun(url, config=config)
print(result.markdown.fit_markdown) # Filtered
print(result.markdown.raw_markdown) # OriginalFor filter selection and config field reference, see Content Filters.
Data Extraction
1. Schema-Based CSS Extraction (Most Efficient)
No LLM required at extract time — fast, deterministic, cost-free. One-time LLM cost to derive the schema, then reuse indefinitely. The bundled scripts split the pipeline by responsibility:
./scripts/generate_schema.py https://shop.example.com "products with name, price, image" shop_schema.json
./scripts/extract_with_schema.py https://shop.example.com shop_schema.json products.jsonOr via the CLI with the YAML strategy template + the saved schema:
crwl https://shop.example.com -e templates/extract_css.yml -s shop_schema.json -o jsonSchema skeleton: `templates/css_schema.json`. Strategy YAML: `templates/extract_css.yml`.
2. LLM-Based Extraction
For one-off / irregular content where a CSS schema is too brittle:
./scripts/extract_with_llm.py https://news.example.com "Extract headlines, dates, summaries" news.jsonOr via the CLI with the strategy template:
crwl https://news.example.com -e templates/extract_llm.yml -o jsonStrategy YAML: `templates/extract_llm.yml`. Pays an LLM call per URL — for repeat extraction, prefer the schema pipeline above.
For extraction strategy reference: Extraction Strategies.
Advanced Patterns
Dynamic Content (JavaScript-Heavy Sites)
crwl https://example.com -c "wait_for=css:.ajax-content,scan_full_page=true,page_timeout=60000"
crwl https://example.com -C templates/crawler.yml # all options in a YAML fileCrawler config template: `templates/crawler.yml`.
Multi-URL Processing
Use this skill in a project
Open any RiverX project, search the Skills panel for brettdavies/crawl4ai-skill/crawl4ai, and install it in one click.
