---
name: "beautifulsoup4-html-extractor"
description: "Extract, filter, and clean data from messy HTML documents using Python BeautifulSoup4."
metadata:
  author: "Leonard Richardson"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "parse html with beautifulsoup"
  - "find elements by class bs4"
  - "extract table data python bs4"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# BeautifulSoup4 Python DOM Parser & Scraper

Parses HTML and XML using bs4 with lxml backend: navigating DOM hierarchies, searching by CSS class and regex, handling broken markup, and normalizing character encodings.

## When to Invoke
Invoke this skill whenever you need to:
- parse html with beautifulsoup
- find elements by class bs4
- extract table data python bs4

## Execution SOP & Rules
1. Initialize BeautifulSoup with soup = BeautifulSoup(html, 'lxml') for peak parsing speed.
2. Search using soup.find_all('div', class_='product') with specific attribute dictionaries.
3. Strip non-content tags before text extraction: for tag in soup(['script', 'style']): tag.decompose().
4. Handle non-ASCII character encodings cleanly using soup.prettify() or .get_text().

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
