Install this skill
npx skills add vercel-labs/agent-skillsWorks across Claude Code, Cursor, Codex, Copilot & Antigravity
SVG files exported from design software often contain excessive coordinate data, sometimes extending to ten or more decimal places. This bloated numerical data significantly increases file size without providing any visible benefit to the rendered quality on typical high-DPI displays. The Optimize SVG Precision skill specifically targets these coordinate values, stripping unnecessary digits to balance visual fidelity with minimized byte counts. By setting a specific precision threshold, agents can prune redundant path data, resulting in faster load times and improved rendering performance for web applications. This process involves mathematical rounding of path commands, arc segments, and transformation attributes. It is a critical step for preparing iconography and illustrative assets for production, ensuring that vector files remain lightweight and performant while maintaining their intended geometric integrity across various browsers and viewports.
When to Use This Skill
- •Reducing the footprint of complex SVG illustrations for faster website loading
- •Standardizing icon sets to ensure consistent file size and formatting
- •Preparing large vector graphics for high-performance dashboard visualizations
- •Optimizing inline SVG strings to keep HTML payloads under size budgets
How to Invoke This Skill
Example prompts that trigger this skill in Claude Code, Cursor, or Antigravity:
- “Shrink this SVG file size by adjusting precision
- “Optimize my SVG coordinates to one decimal place
- “Clean up the path data in this vector graphic
- “Run SVGO with a precision limit of 1
- “Reduce the coordinate bloating in this icon file
What this skill does
- •Truncates numerical coordinate values in path data
- •Configures precision levels based on specific viewBox constraints
- •Applies multipass optimization to ensure consistent file reduction
- •Removes redundant floating-point data from SVG elements
- •Automates the compression of vector markup via command-line interfaces
When not to use it
- ✕When preserving high-precision paths for scientific or engineering CAD exports
- ✕If the SVG uses extremely small viewboxes where rounding could cause visual misalignment
Example workflow
- Identify target SVG files within the repository
- Evaluate current viewBox scale to determine safe rounding limits
- Execute the optimization command with the defined precision flag
- Verify visual fidelity by comparing the rendered output against the original
- Commit the optimized assets to the project build directory
Prerequisites
- –Node.js installed on the host machine
- –svgo package available via npm
Pitfalls & limitations
- !Aggressive rounding can distort intricate shapes or snap-to-grid alignment
- !Large-scale rounding on very small graphics may cause visible gaps in paths
- !Over-optimizing may lead to loss of coordinate accuracy needed for animation interpolation
FAQ
How it compares
Unlike manual editing, which is prone to human error, this automated skill applies consistent mathematical rounding rules across every node in the SVG path data.
📄 Full skill instructions — original source: vercel-labs/agent-skills
Reduce SVG coordinate precision to decrease file size. The optimal precision depends on the viewBox size, but in general reducing precision should be considered.
**Incorrect (excessive precision):**
<path d="M 10.293847 20.847362 L 30.938472 40.192837" />**Correct (1 decimal place):**
<path d="M 10.3 20.8 L 30.9 40.2" />**Automate with SVGO:**
npx svgo --precision=1 --multipass icon.svgHow to Use This Skill Unit
Option A: Project-Specific (Recommended)
- Click "Download" above
- In your project, create the directory:
.agent/skills/rendering-svg-precision/ - Save the file as
SKILL.md - The agent will automatically discover the skill based on its description.
Option B: Global Installation (All Agents)
Save the file to these locations to make it available across all projects:
- Claude Code:
~/.claude/skills/vercel-labs/agent-skills/rendering-svg-precision/SKILL.md - Cursor:
~/.cursor/skills/vercel-labs/agent-skills/rendering-svg-precision/SKILL.md - Antigravity:
~/.gemini/antigravity/skills/vercel-labs/agent-skills/rendering-svg-precision/SKILL.md
🚀 Install with CLI:npx skills add vercel-labs/agent-skills