D2Snap
Description
Beyond Pixels: Exploring DOM Downsampling for LLM-Based Web Agents
Installation
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open the source below and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
README
D2Snap

**D2Snap** is a first-of-its-kind DOM downsampling algorithm, designed for use with LLM-based web agents.
Integrate
D2Snap.d2Snap(
dom: DOM,
rE: number, rA: number, rT: number,
options?: Options
): Promise<{
html: string;
meta: {};
}>
D2Snap.adaptiveD2Snap(
dom: DOM,
maxTokens: number = 4096,
maxIterations: number = 5,
options?: Options
): Promise<{
html: string;
meta: {};
parameters: {};
adaptiveIterations: number;
}>
type DOM = Document | Element | string;
type Options = {
debug?: boolean; // false
attributeScoring?: { // compare src/var.ATTRIBUTE_SCORING.ts
[ name: string ]: number;
};
skipMarkdown?: boolean; // false
skipTextRank?: boolean; // false
uniqueIDs?: boolean; // false
};
The attribute scoring lookup table supports wildcards for `aria` and `data` (`{aria-|data-}*`).
Browser
Module
npm install webfuse-com/D2Snap
Install [jsdom](https://github.com/jsdom/jsdom) to use the library with Node.js:
npm install jsdom
import * as D2Snap from "@webfuse-com/d2snap";
Example
Our Pizza
Margherita
A simple classic: mozzarella, tomatoes and basil.
An everyday choice!
Add
Capricciosa
A rich taste: mozzarella, ham, mushrooms, artichokes and olives.
A true fav
Related Skills
Agency Agents
A complete AI agency at your fingertips - From frontend wizards to Reddit community ninjas, from whimsy inject
AI
Firecrawl
🔥 The API to search, scrape, and interact with the web for AI
AI
Artifacts Builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web tech
AI
Headroom
Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agen
AI
CrewAI
Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewA
AI
TrendRadar
⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的
AI