Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Parse and extract data from HTML with Cheerio. Use when a user asks to scrape static web pages, parse HTML files, extract data from HTML, build a web scraper for server-rendered pages, extract text or links from HTML documents, parse RSS/XML feeds, transform HTML content, or process HTML emails. Covers jQuery-style selectors, DOM traversal, text extraction, attribute parsing, and integration with HTTP clients for web scraping pipelines.
.claude/skills/terminalskills-cheerio/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-03 | ✗→✓ | ▲ Improved | 72% | 0% |
| case-01 | ✓→✓ | = Same ✓ | 42% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 53% | 0% |
| case-05 | ✓→✓ | = Same ✓ | 157% | 0% |
| case-06 | ✓→✓ | = Same ✓ | 386% | 0% |
Cheerio is a fast, lightweight HTML/XML parser for Node.js that implements a jQuery-like API. Unlike Puppeteer, it does not run a browser — it parses raw HTML strings, making it 100x faster and ideal for scraping server-rendered pages, parsing HTML files, and transforming HTML content. Pair it with fetch or axios for web scraping, or use it standalone for HTML processing.
bashnpm install cheerio
javascript// parse_html.js — Load HTML and extract structured data with CSS selectors import * as cheerio from 'cheerio' const html = ` <html> <body> <h1>Products</h1> <div class="product" data-id="1"> <h2>Widget Pro</h2> <span class="price">$29.99</span> <a href="/products/widget-pro">Details</a> </div> <div class="product" data-id="2"> <h2>Gadget Max</h2> <span class="price">$49.99</span> <a href="/products/gadget-max">Details</a> </div> </body> </html>` const $ = cheerio.load(html) // Extract all products const products = [] $('.product').each((i, el) => { products.push({ id: $(el).attr('data-id'), title: $(el).find('h2').text().trim(), price: $(el).find('.price').text().trim(), link: $(el).find('a').attr('href'), }) }) console.log(products) // [{ id: '1', title: 'Widget Pro', price: '$29.99', link: '/products/widget-pro' }, ...]
javascript// scrape_site.js — Fetch a page and extract data import * as cheerio from 'cheerio' async function scrape(url) { const response = await fetch(url) const html = await response.text() const $ = cheerio.load(html) // Extract all links const links = [] $('a[href]').each((i, el) => { links.push({ text: $(el).text().trim(), href: $(el).attr('href'), }) }) // Extract meta tags const meta = { title: $('title').text(), description: $('meta[name="description"]').attr('content'), ogImage: $('meta[property="og:image"]').attr('content'), } return { links, meta } }
javascript// selectors.js — Complex CSS selectors and DOM traversal const $ = cheerio.load(html) // Attribute selectors $('a[href^="https"]') // links starting with https $('img[src$=".png"]') // PNG images $('div[class*="product"]') // divs with "product" in class // Traversal $('.product').first() // first product $('.product').last() // last product $('.product').eq(2) // third product (0-indexed) $('.price').parent() // parent of each .price element $('.product').children('h2') // direct h2 children $('.product').find('.price') // descendants matching .price $('.product').next() // next sibling $('.product').prev() // previous sibling // Filtering $('.product').filter((i, el) => { const price = parseFloat($(el).find('.price').text().replace('$', '')) return price < 50 }) // Text and HTML $('.product').first().text() // all text content, flattened $('.product').first().html() // inner HTML
javascript// extract_table.js — Parse HTML tables into structured data function extractTable($, tableSelector) { /** * Convert an HTML table to an array of objects using headers as keys. * Args: * $: Cheerio instance * tableSelector: CSS selector for the table element */ const headers = [] $(`${tableSelector} thead th`).each((i, el) => { headers.push($(el).text().trim()) }) const rows = [] $(`${tableSelector} tbody tr`).each((i, tr) => { const row = {} $(tr).find('td').each((j, td) => { row[headers[j]] = $(td).text().trim() }) rows.push(row) }) return rows } // Usage const tableData = extractTable($, '#pricing-table') // [{ Plan: 'Free', Price: '$0', Users: '1' }, { Plan: 'Pro', Price: '$29', Users: '10' }]
javascript// transform.js — Modify HTML content const $ = cheerio.load(html) // Add class $('.product').addClass('featured') // Remove elements $('.ad-banner').remove() // Replace content $('h1').text('Updated Title') // Wrap elements $('.product').wrap('<section class="product-section"></section>') // Add attributes $('a').attr('target', '_blank') $('img').attr('loading', 'lazy') // Get modified HTML const modifiedHtml = $.html()
User prompt: "Scrape product prices from 5 competitor websites daily and save to a CSV. The sites are server-rendered (no JavaScript needed)."
The agent will:
fetch + cheerio for each site (no browser overhead).User prompt: "I have 1,000 saved HTML pages from a blog. Extract just the article title, author, date, and body text from each, ignoring navigation, ads, and footers."
The agent will:
article, .post-content, etc.)..trim() on extracted text — HTML often contains whitespace, newlines, and indentation that clutters results..attr('href') and .attr('src') to get link/image URLs. Remember these may be relative — resolve them against the base URL.fetch or axios for scraping, and add delays between requests to avoid overwhelming target servers.| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | pass→pass | 13,737 | 8,550 | -38% | 1 | 1 | 0% | 2,396 | 3,400 | +42% | 0 | 0 | — |
case-02 | pass→pass | 9,869 | 5,750 | -42% | 1 | 1 | 0% | 1,805 | 2,758 | +53% | 0 | 0 | — |
case-03 | fail→pass | 9,151 | 6,960 | -24% | 1 | 1 | 0% | 1,722 | 2,956 | +72% | 0 | 0 | — |
case-04 | fail→fail | 17,093 | 9,898 | -42% | 1 | 1 | 0% | 3,194 | 3,716 | +16% | 0 | 0 | — |
case-05 | pass→pass | 4,634 | 2,487 | -46% | 1 | 1 | 0% | 874 | 2,245 | +157% | 0 | 0 | — |
case-06 | pass→pass | 2,354 | 2,174 | -8% | 1 | 1 | 0% | 442 | 2,150 | +386% | 0 | 0 | — |
case-07 | pass→pass | 4,752 | 3,798 | -20% | 1 | 1 | 0% | 845 | 2,455 | +191% | 0 | 0 | — |
case-08 | pass→pass | 2,724 | 2,373 | -13% | 1 | 1 | 0% | 508 | 2,092 | +312% | 0 | 0 | — |
case-09 | pass→pass | 2,218 | 1,808 | -18% | 1 | 1 | 0% | 351 | 2,037 | +480% | 0 | 0 | — |
case-10 | pass→pass | 2,700 | 2,603 | -4% | 1 | 1 | 0% | 516 | 2,190 | +324% | 0 | 0 | — |
case-11 | pass→pass | 3,335 | 2,131 | -36% | 1 | 1 | 0% | 600 | 2,034 | +239% | 0 | 0 | — |
case-12 | pass→pass | 2,642 | 2,377 | -10% | 1 | 1 | 0% | 448 | 2,158 | +382% | 0 | 0 | — |
case-13 | pass→pass | 3,169 | 2,592 | -18% | 1 | 1 | 0% | 522 | 2,153 | +312% | 0 | 0 | — |
case-14 | pass→pass | 5,566 | 3,343 | -40% | 1 | 1 | 0% | 1,122 | 2,391 | +113% | 0 | 0 | — |
case-15 | pass→pass | 4,339 | 3,153 | -27% | 1 | 1 | 0% | 687 | 2,269 | +230% | 0 | 0 | — |
case-16 | pass→pass | 7,028 | 5,840 | -17% | 1 | 1 | 0% | 1,283 | 2,779 | +117% | 0 | 0 | — |
case-17 | pass→pass | 2,832 | 3,043 | +7% | 1 | 1 | 0% | 499 | 2,144 | +330% | 0 | 0 | — |
case-18 | pass→pass | 9,845 | 6,550 | -33% | 1 | 1 | 0% | 2,017 | 2,989 | +48% | 0 | 0 | — |
case-19 | pass→pass | 1,834 | 1,611 | -12% | 1 | 1 | 0% | 276 | 1,946 | +605% | 0 | 0 | — |
case-20 | pass→pass | 2,948 | 2,681 | -9% | 1 | 1 | 0% | 526 | 2,144 | +308% | 0 | 0 | — |
case-21 | pass→pass | 2,208 | 1,804 | -18% | 1 | 1 | 0% | 365 | 2,020 | +453% | 0 | 0 | — |
case-22 | pass→pass | 2,649 | 1,250 | -53% | 1 | 1 | 0% | 502 | 1,891 | +277% | 0 | 0 | — |
case-23 | pass→pass | 5,448 | 3,396 | -38% | 1 | 1 | 0% | 1,208 | 2,383 | +97% | 0 | 0 | — |
case-24 | pass→pass | 4,810 | 2,769 | -42% | 1 | 1 | 0% | 782 | 2,154 | +175% | 0 | 0 | — |
case-25 | pass→pass | 5,233 | 2,813 | -46% | 1 | 1 | 0% | 1,081 | 2,248 | +108% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 25 cases were attempted. The headline lift of +4 percentage points is the difference between those two pass rates over the 25 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.