svg-prep

A tool that prepares supplied SVG files for use as colour-aware icons in a web project. SVG is a format for scalable vector graphics.

In plain words
What is it for?
Use it on individual SVG files or one-level icon directories before adding icons, after broken rendering, or after a designer re-exports an icon.
Why use it?
It fixes mechanical SVG problems that can make icons render blank or ignore light and dark colour schemes, while reporting choices that need human judgement.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/aemsites/author-kit/svg-prep
Any agent
npx skills add aemsites/author-kit --skill svg-prep
Clone the repo
git clone --depth 1 https://github.com/aemsites/author-kit

Made for: Claude Code, Codex.

Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,159 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00061 $0.02159
Opus 5 $0.00030 $0.01079
Sonnet 5 $0.00012 $0.00432
Haiku 4.5 $0.00006 $0.00216

Measured 2d ago against content hash 738160a9e0df, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

svg-prep scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (normalise.js, prep.js), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/svg-prep/SKILL.md · 141 lines

How it starts

The opening of the file, as written. The whole thing — 141 lines — stays where its author put it; the contents beside it link to each section on GitHub.

SVG prep

Icons are referenced, never inlined: <use href="/img/icons/<name>.svg#icon">. Only inherited properties cross that shadow boundary, which makes two things in the file load-bearing rather than stylistic — the root id="icon", because a fragment that resolves to nothing renders nothing, and currentColor, because a fill="#1a1a1a" is not a default that CSS can override later, it is permanent. An editor export satisfies neither.

This skill rewrites what is mechanical and reports what is a decision. A finding never silently becomes an edit.

Running it

node .agents/skills/svg-prep/prep.js <path…> [--flatten] [--keep=<value>] [--palette]

A path is a file or a directory — its .svg children, one level, no recursion. Files are rewritten where they sit, so git diff is the review. Nothing is moved and nothing is renamed.

--palette takes one path, never a directory. It suppresses paint conversion on every file in the run, not only on the one that needed it — a monochrome icon caught in a --palette run over img/icons/ is written with its hex fill intact. Each file it suppressed says so, so read the report rather than the exit code, and point the flag at the single file that earned it.

img/icons/globe.svg  713 → 662 bytes
  ℹ viewbox-grid: viewBox "0 0 20 20" — renders correctly; re-export on 0 0 24 24 if stroke weight has to match the set

img/icons/helix-color.svg  not written
  ℹ viewbox-grid: viewBox "0 0 512 512" — renders correctly; re-export on 0 0 24 24 if stroke weight has to match the set
  ✗ multi-colour: 2 distinct colours: #ed2c85, #b64aa1

means that file was left untouched and the run exits 1. Every other file in the run is still written, so working an error is a re-run of the one file, not of the set. and are on a file that is already written — read them, then decide.

Rewritten silently

Root id set to icon, whatever it was
viewBox required; synthesised from width/height when absent
width/height removed from root
xmlns added when absent; xmlns:xlink dropped, xlink:hrefhref
Paint every fill, stroke and stop-color colour → currentColor; none preserved
Illustrator classes <defs><style>.cls-1{fill:#ed2c85}</style></defs> resolved onto elements, then <style> and class dropped
Inline style paint declarations treated as paint, then the attribute removed
<script>, on* stripped
<metadata>, <title>, <desc>, comments, data-name, xml:space, serif:id stripped
Descendant id stripped when unreferenced, kept when a url(#…) points at it
XML prolog dropped
Formatting one element per line, two-space indent

Read the full file on GitHub · 141 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 141 lines · 61 tokens per session scan A 738160a9e0df

Subscribe to this mod's changes

svg-prep is a skill published in the GitHub repository aemsites/author-kit (12 stars, last pushed 19d ago), licensed Apache-2.0. It adds 61 tokens to every session and 2,159 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.