.claude/skills/ts-cheerio/SKILL.md
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.
npx skillsauth add eliferjunior/Claude cheerioInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
npm install cheerio
// 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' }, ...]
// 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 }
}
// 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
// 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' }]
// 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.development
Expert guidance for Fireworks AI, the platform for running open-source LLMs (Llama, Mixtral, Qwen, etc.) with enterprise-grade speed and reliability. Helps developers integrate Fireworks' inference API, fine-tune models, and deploy custom model endpoints with function calling and structured output support.
development
Convert any website into clean, structured data with Firecrawl — API-first web scraping service. Use when someone asks to "turn a website into markdown", "scrape website for LLM", "Firecrawl", "extract website content as clean text", "crawl and convert to structured data", or "scrape website for RAG". Covers single-page scraping, full-site crawling, structured extraction, and LLM-ready output.
tools
Expert guidance for Firebase, Google's platform for building and scaling web and mobile applications. Helps developers set up authentication, Firestore/Realtime Database, Cloud Functions, hosting, storage, and analytics using Firebase's SDK and CLI.
development
When the user needs to build file upload functionality for a web application. Use when the user mentions "file upload," "image upload," "upload endpoint," "multipart upload," "presigned URL," "S3 upload," "file validation," "upload to cloud storage," or "accept user files." Handles upload endpoints, file validation (type, size, magic bytes), cloud storage integration, and upload status tracking. For image/video processing after upload, see media-transcoder.