Agent skill

SnapDOM Capture Guide

by 2025Emma in 2025Emma/vibe-coding-cn

Explains how to use the snapDOM library to turn an HTML element into an SVG, PNG, JPG or WebP image while keeping its fonts, pseudo-elements and shadows.

MITAuto-check passedFrontend & Design

Install SnapDOM Capture Guide

skills CLI
$ npx skills add 2025Emma/vibe-coding-cn --skill snapdom -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install 2025Emma/vibe-coding-cn snapdom --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/2025Emma/vibe-coding-cn.git skills-src && mkdir -p .claude/skills && cp -r skills-src/i18n/zh/skills/snapdom .claude/skills/snapdom && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
snapdom
GitHub stars
23k
Used in
1 other repo
Token cost
~1.9k tokens
SKILL.md length
549 words
Files
3 (incl. references)
Skills in repo
13
Repo updated
First seen
Licence
MIT

At a glance

Explains how to use the snapDOM library to turn an HTML element into an SVG, PNG, JPG or WebP image while keeping its fonts, pseudo-elements and shadows.

  • Works in 6 steps: Performance: Use scale instead of… → Fonts: Set embedFonts: true to ensure… → CORS Issues: Use useProxy: true if… → …
  • Turning a styled HTML element into a downloadable PNG, JPG or WebP image
  • SKILL.md covers When to Use This Skill, Key Features, Installation and Quick Start Examples, plus 6 more sections
  • Calls npm, yarn and git; reaches github.com and unpkg.com

What it does

Covers the snapDOM JavaScript library for converting a DOM element into a scalable SVG or a raster image, including capturing styled elements with pseudo-elements, shadow DOM content and embedded fonts or icon fonts, and exporting at custom dimensions or scale. It also covers a CORS proxy fallback for blocked assets and a plugin system for custom rendering steps.

Installation is through `npm install @zumer/snapdom` or a CDN script tag as either an ES module or a UMD bundle. Usage examples cover creating a reusable capture object, one-step exports such as `snapdom.toPng()` and `snapdom.toSvg()`, and downloading a captured element directly as a file with `snapdom.download()`. The library has no runtime dependencies beyond standard Web APIs.

When your agent uses it

  • Turning a styled HTML element into a downloadable PNG, JPG or WebP image
  • Exporting a DOM element as a scalable SVG that preserves its CSS styling
  • Capturing an element that uses pseudo-elements, custom fonts or shadow DOM
  • Generating a screenshot-like image of a page section without a headless browser

Example prompts

  • “Add a button that exports the #report element as a PNG using snapDOM.”
  • “Capture this card component as an SVG that keeps its icon font.”
  • “Use snapDOM to download the chart div as image.png when the user clicks export.”

Requirements

  • The @zumer/snapdom package or its CDN build

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Performance: Use scale instead of width/height for better performance
  2. Fonts: Set embedFonts: true to ensure custom fonts appear correctly
  3. CORS Issues: Use useProxy: true if images fail to load
  4. Large Elements: Break into smaller chunks for complex pages
  5. Quality: For PNG/JPG, use quality: 0.95 for best quality
  6. SVG Vectors: Prefer SVG export for charts and graphics

What it can do on your machine

Read from SKILL.md and the folder at commit 9b42dd1. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm
    • yarn
    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • github.com
    • unpkg.com

    Also links to:

    • snapdom.dev
    • npmjs.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

SnapDOM Capture Guide loads about 1.9k tokens when it runs, and up to ~2.2k if it reads all its reference files. Until then it costs about 61 tokens; SKILL.md has 549 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~61
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from 2025Emma/vibe-coding-cn at commit 9b42dd1, republished under its MIT licence (© 2025Emma). 549 words, ~1,916 tokens.

Download SKILL.mdSave it as .claude/skills/snapdom/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
snapdom
description
snapDOM is a fast, accurate DOM-to-image capture tool that converts HTML elements into scalable SVG images. Use for capturing HTML elements, converting DOM to images (SVG, PNG, JPG, WebP), preserving styles, fonts, and pseudo-elements.

SnapDOM Skill

Fast, dependency-free DOM-to-image capture library for converting HTML elements into scalable SVG or raster image formats.

When to Use This Skill

Use SnapDOM when you need to:

  • Convert HTML elements to images (SVG, PNG, JPG, WebP)
  • Capture styled DOM with pseudo-elements and shadows
  • Export elements with embedded fonts and icons
  • Create screenshots with custom dimensions or scaling
  • Handle CORS-blocked resources using proxy fallback
  • Implement custom rendering pipelines with plugins
  • Optimize performance on large or complex elements

Key Features

Universal Export Options
  • SVG - Scalable vector format, embeds all styles
  • PNG, JPG, WebP - Raster formats with configurable quality
  • Canvas - Get raw Canvas element for further processing
  • Blob - Raw binary data for custom handling
Performance
  • Ultra-fast capture (1.6ms for small elements, ~171ms for 4000×2000)
  • No dependencies - Uses standard Web APIs only
  • Outperforms html2canvas by 10-40x on complex elements
Style Support
  • Embedded fonts (including icon fonts)
  • CSS pseudo-elements (::before, ::after)
  • CSS counters
  • CSS line-clamp
  • Transform and shadow effects
  • Shadow DOM content
Advanced Capabilities
  • Same-origin iframe support
  • CORS proxy fallback for blocked assets
  • Plugin system for custom transformations
  • Straighten transforms (remove rotate/translate)
  • Selective element exclusion
  • Tight bounding box calculation

Installation

NPM/Yarn
bash
npm install @zumer/snapdom
# or
yarn add @zumer/snapdom
CDN (ES Module)
html
<script type="module">
  import { snapdom } from "https://unpkg.com/@zumer/snapdom/dist/snapdom.mjs";
</script>
CDN (UMD)
html
<script src="https://unpkg.com/@zumer/snapdom/dist/snapdom.umd.js"></script>

Quick Start Examples

Basic Reusable Capture
javascript
// Create reusable capture object
const result = await snapdom(document.querySelector('#target'));

// Export to different formats
const png = await result.toPng();
const jpg = await result.toJpg();
const svg = await result.toSvg();
const canvas = await result.toCanvas();
const blob = await result.toBlob();

// Use the result
document.body.appendChild(png);
One-Step Export
javascript
// Direct export without intermediate object
const png = await snapdom.toPng(document.querySelector('#target'));
const svg = await snapdom.toSvg(element);
Download Element
javascript
// Automatically download as file
await snapdom.download(element, 'screenshot.png');
await snapdom.download(element, 'image.svg');
With Options
javascript
const result = await snapdom(element, {
  scale: 2,                    // 2x resolution
  width: 800,                  // Custom width
  height: 600,                 // Custom height
  embedFonts: true,            // Include @font-face
  exclude: '.no-capture',      // Hide elements
  useProxy: true,              // Enable CORS proxy
  straighten: true,            // Remove transforms
  noShadows: false             // Keep shadows
});

const png = await result.toPng({ quality: 0.95 });

Essential Options Reference

OptionTypePurpose
scaleNumberScale output (e.g., 2 for 2x resolution)
widthNumberCustom output width in pixels
heightNumberCustom output height in pixels
embedFontsBooleanInclude non-icon @font-face rules
useProxyString|BooleanEnable CORS proxy (URL or true for default)
excludeStringCSS selector for elements to hide
straightenBooleanRemove translate/rotate transforms
noShadowsBooleanStrip shadow effects

Common Patterns

Responsive Screenshots
javascript
// Capture at different scales
const mobile = await snapdom.toPng(element, { scale: 1 });
const tablet = await snapdom.toPng(element, { scale: 1.5 });
const desktop = await snapdom.toPng(element, { scale: 2 });
Exclude Elements
javascript
// Hide specific elements from capture
const png = await snapdom.toPng(element, {
  exclude: '.controls, .watermark, [data-no-capture]'
});
Fixed Dimensions
javascript
// Capture with specific size
const result = await snapdom(element, {
  width: 1200,
  height: 630  // Standard social media size
});
CORS Handling
javascript
// Fallback for CORS-blocked resources
const png = await snapdom.toPng(element, {
  useProxy: 'https://cors.example.com/?' // Custom proxy
});
Plugin System (Beta)
javascript
// Extend with custom exporters
snapdom.plugins([pluginFactory, { colorOverlay: true }]);

// Hook into lifecycle
defineExports(context) {
  return {
    pdf: async (ctx, opts) => { /* generate PDF */ }
  };
}

// Lifecycle hooks available:
// beforeSnap → beforeClone → afterClone →
// beforeRender → beforeExport → afterExport

Performance Comparison

SnapDOM significantly outperforms html2canvas:

ScenarioSnapDOMhtml2canvasImprovement
Small (200×100)1.6ms68ms42x faster
Medium (800×600)12ms280ms23x faster
Large (4000×2000)171ms1,800ms10x faster

Development

Setup
bash
git clone https://github.com/zumerlab/snapdom.git
cd snapdom
npm install
Build
bash
npm run compile
Testing
bash
npm test

Browser Support

  • Chrome/Edge 90+
  • Firefox 88+
  • Safari 14+
  • Mobile browsers (iOS Safari 14+, Chrome Mobile)

Resources

Show full SKILL.md (220 more words)Show less
Documentation
scripts/

Add helper scripts here for automation, e.g.:

  • batch-screenshot.js - Capture multiple elements
  • pdf-export.js - Convert snapshots to PDF
  • compare-outputs.js - Compare SVG vs PNG quality
assets/

Add templates and examples:

  • HTML templates for common capture scenarios
  • CSS frameworks pre-configured with snapdom
  • Boilerplate projects integrating snapdom

Tips & Best Practices

  1. Performance: Use scale instead of width/height for better performance
  2. Fonts: Set embedFonts: true to ensure custom fonts appear correctly
  3. CORS Issues: Use useProxy: true if images fail to load
  4. Large Elements: Break into smaller chunks for complex pages
  5. Quality: For PNG/JPG, use quality: 0.95 for best quality
  6. SVG Vectors: Prefer SVG export for charts and graphics

Troubleshooting

Elements Not Rendering
  • Check if element has sufficient height/width
  • Verify CSS is fully loaded before capture
  • Try straighten: false if transforms are causing issues
Missing Fonts
  • Set embedFonts: true
  • Ensure fonts are loaded before calling snapdom
  • Check browser console for font loading errors
CORS Issues
  • Enable useProxy: true
  • Use custom proxy URL if default fails
  • Check if resources are from same origin
Performance Issues
  • Reduce scale value
  • Use noShadows: true to skip shadow rendering
  • Consider splitting large captures into smaller sections

© 2025Emma, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in i18n/zh/skills/snapdom of 2025Emma/vibe-coding-cn.

  • SKILL.md
  • references/index.md
  • references/other.md

Open the folder on GitHubat commit 9b42dd1

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in 2025Emma/vibe-coding-cn, which our catalogue first saw on October 7, 2026.

Compare with similar skills

SnapDOM Capture Guide next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

SnapDOM Capture Guide compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
SnapDOM Capture Guide this skill2025Emma/vibe-coding-cn23k1 repos~1.9kAutomated safety check: PassMIT
Skin Developerningbainb/deepseek-harness-desktop789—~1.4kAutomated safety check: PassBSD-3-Clause
Tabler Dashboard UI Kittabler/tabler42k—~1.5kAutomated safety check: PassMIT
Front-End Checklist npm Package Finderthedaviddias/Front-End-Checklist74k—~989Automated safety check: PassMIT
Preact Developeroaustegard/claude-skills150—~4.6kAutomated safety check: PassMIT
Aholo Viewer Integrationmanycoretech/aholo-viewer1.1k—~2.2kAutomated safety check: PassMIT

Similar skills

  • Skin Developer

    ningbainb/deepseek-harness-desktop

    Build a new skin for the dsh-web-ui skin collection (DSH Web GUI) and publish it into the skin-center plugin — scaffold with scripts/dsh-skin-new, author skin.json plus the apply/dispose +…

    789 GitHub stars~1.4k tokensUpdated 4 days ago
    Frontend & DesignAuto-check passed
  • Creates admin dashboards and app pages with the Tabler UI kit on Bootstrap 5, using the published docs for real markup instead of guessed class names.

    42k GitHub stars~1.5k tokensUpdated yesterday
    Frontend & DesignAuto-check passed
  • Front-End Checklist npm Package Finder

    thedaviddias/Front-End-Checklist

    Finds two or three well-maintained npm packages for a Front-End Checklist rule, checks download and release thresholds, and adds them to the rule's frontmatter.

    74k GitHub stars~989 tokensUpdated 4 days ago
    Frontend & DesignAuto-check passed
  • Preact Developer

    oaustegard/claude-skills

    Guides building standards-based Preact apps with native-first choices, HTM syntax, import maps and vendored ESM, from single-file demos to larger builds.

    150 GitHub stars~4.6k tokensUpdated yesterday
    Frontend & DesignAuto-check passed
  • Aholo Viewer Integration

    manycoretech/aholo-viewer

    Guides building browser apps with the @manycore/aholo-viewer npm package to render 3D Gaussian Splatting and mesh content from TypeScript.

    1.1k GitHub stars~2.2k tokensUpdated yesterday
    Game DevelopmentAuto-check passed
  • AO Desktop App Launcher

    OrchestratorInc/agent-orchestrator

    Launches, restarts and troubleshoots the real AO Electron desktop app from a checkout, with isolated or real local data and checks for stale processes.

    13k GitHub stars~2.4k tokensUpdated today
    DevelopmentAuto-check passed

More from 2025Emma/vibe-coding-cn

All 13 skills in this repo
  • Claude Cookbooks Reference

    2025Emma/vibe-coding-cn

    Reference of Claude API examples and guides covering tool use, vision, RAG, classification, summarization, text-to-SQL, prompt caching and agent patterns.

    23k GitHub starsUsed in 1 repo~2.2k tokens
    Auto-check passed
  • Proxychains Network Fallback

    2025Emma/vibe-coding-cn

    Retries failed network commands through proxychains4 and a local proxy when it sees timeouts, DNS failures or blocked access.

    23k GitHub starsUsed in 1 repo~1.1k tokens
    Auto-check: notes
  • Skill Authoring and Refactoring

    2025Emma/vibe-coding-cn

    Builds new skills from scattered docs, specs or code, and refactors existing skills for clear triggers, reliable activation and a quality checklist.

    23k GitHub starsUsed in 2 repos~2k tokens
    Auto-check passed
  • CCXT Crypto Exchange Library

    2025Emma/vibe-coding-cn

    Reference help for the CCXT library covering crypto exchange APIs, market data, trading and order management across 150+ exchanges in JavaScript, Python and PHP.

    23k GitHub starsUsed in 1 repo~4.4k tokens
    Auto-check passed
  • CoinGecko API Reference

    2025Emma/vibe-coding-cn

    CoinGecko API documentation - cryptocurrency market data API, price feeds, market cap, volume, historical data. Use when integrating CoinGecko API, building…

    23k GitHub starsUsed in 1 repo~646 tokens
    Auto-check passed
  • Hummingbot Trading Bot Reference

    2025Emma/vibe-coding-cn

    Reference documentation for building, configuring and debugging automated trading strategies, market making and exchange connectors with Hummingbot.

    23k GitHub starsUsed in 1 repo~998 tokens
    Auto-check passed

Works with

Questions about SnapDOM Capture Guide

What does SnapDOM Capture Guide do?

Explains how to use the snapDOM library to turn an HTML element into an SVG, PNG, JPG or WebP image while keeping its fonts, pseudo-elements and shadows. Covers the snapDOM JavaScript library for converting a DOM element into a scalable SVG or a raster image, including capturing styled elements with pseudo-elements, shadow DOM content and embedded fonts or icon fonts, and exporting at custom dimensions or scale. It also covers a CORS proxy fallback for blocked assets and a plugin system for custom rendering steps.

When should I use SnapDOM Capture Guide?

SnapDOM Capture Guide fits situations like: turning a styled HTML element into a downloadable PNG, JPG or WebP image; exporting a DOM element as a scalable SVG that preserves its CSS styling; capturing an element that uses pseudo-elements, custom fonts or shadow DOM; generating a screenshot-like image of a page section without a headless browser.

How do I install SnapDOM Capture Guide in Claude Code?

Run `npx skills add 2025Emma/vibe-coding-cn --skill snapdom -a claude-code`. Or copy the skill folder (i18n/zh/skills/snapdom in 2025Emma/vibe-coding-cn) into .claude/skills/snapdom in your project. Claude Code loads it when a task matches its description.

How do I install SnapDOM Capture Guide in Codex?

Run `npx skills add 2025Emma/vibe-coding-cn --skill snapdom -a codex`. Or copy the skill folder (i18n/zh/skills/snapdom in 2025Emma/vibe-coding-cn) into .agents/skills/snapdom in your project. Codex loads it when a task matches its description.

Can I use SnapDOM Capture Guide in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add 2025Emma/vibe-coding-cn --skill snapdom -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/snapdom, .gemini/skills/snapdom, .github/skills/snapdom and .opencode/skills/snapdom in your project.

What does SnapDOM Capture Guide need to run?

Going by SKILL.md and its folder, SnapDOM Capture Guide needs the command-line tools its instructions call (npm, yarn and git). Our summary lists: The @zumer/snapdom package or its CDN build.

Does SnapDOM Capture Guide access the network?

SKILL.md names 4 domains. In commands or code: github.com and unpkg.com; the agent is likely to contact these when it follows the instructions. As links in the text: snapdom.dev and npmjs.com. This is read from the text; nothing was executed.

Is SnapDOM Capture Guide safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does SnapDOM Capture Guide use?

SnapDOM Capture Guide is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does SnapDOM Capture Guide use?

About 1.9k tokens (SKILL.md is roughly 7.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 244 tokens, read only when the agent opens those files.

What are the alternatives to SnapDOM Capture Guide?

Skills that share tags, products or a category with SnapDOM Capture Guide: Skin Developer (ningbainb/deepseek-harness-desktop, 789 stars), Tabler Dashboard UI Kit (tabler/tabler, 42k stars), Front-End Checklist npm Package Finder (thedaviddias/Front-End-Checklist, 74k stars) and Preact Developer (oaustegard/claude-skills, 150 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains SnapDOM Capture Guide?

2025Emma (a GitHub user) maintains it in 2025Emma/vibe-coding-cn, which has 23,041 GitHub stars. The repository holds 13 skills in this directory. The repository was last updated on December 17, 2025.

Source: 2025Emma/vibe-coding-cn on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.