OpenParable
Skip to content
← Back to skills

DOM Reader

Research

DOM Reader is an Agent Skill for research published in the majiayu000/claude-skill-registry repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Use when extracting specific HTML elements (h1, h2, links, images, etc.), scraping page content, or inspecting DOM structure. Also preferred for JavaScript-rendered content or when WebFetch returns incomplete results.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/majiayu000/claude-skill-registry/blob/HEAD/skills/data/dom-reader/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/dom-reader, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

DOM Reader

Extract the rendered HTML from a web page after JavaScript execution.

Overview

This skill provides guidance for extracting the real DOM content from web pages. Unlike static HTML fetching, this captures the DOM after JavaScript has modified it, revealing dynamically loaded content.

When to Use

  • Extract HTML content from JavaScript-heavy pages (SPAs, React, Vue, etc.)
  • Get the rendered DOM of a specific element using CSS selectors
  • Inspect the actual structure of a page after client-side rendering

Parameters

  • url (required): The URL of the page to read
  • selector (optional): CSS selector to extract specific elements. If omitted, returns the entire page HTML. When provided, returns ALL matching elements.

Implementation

Use the read-dom.js script with Puppeteer to extract DOM content. The script is in the plugin's shared scripts/ directory.

Pre-execution Check

Before running the script, check if node_modules exists in the plugin's scripts directory. If not, install dependencies:

# Check and install if needed (run from plugin root)
[ -d "scripts/node_modules" ] || (cd scripts && npm install)

Basic Usage

Run from plugin root directory:

node scripts/read-dom.js "https://example.com"

To read all elements matching a selector:

node scripts/read-dom.js "https://example.com" "h2"

To read a specific element by ID:

node scripts/read-dom.js "https://example.com" "#main-content"

Script Location

The script is located at scripts/read-dom.js in the plugin root directory (shared across skills).

Output

Returns the HTML string of the requested content:

  • Full page: Complete document HTML
  • With selector: outerHTML of ALL matching elements, separated by newlines

Error Handling

  • Invalid URL: Report the URL format error
  • Selector not found: Report that the selector matched no elements
  • Page load timeout: Report timeout and suggest retrying or checking the URL
  • Missing dependencies: Run pre-execution check to install