Generate beautiful code snippet images (PNG) for social media, tweets, LinkedIn, and documentation. Creates light-themed, macOS-style window chrome screenshots from code using HTML templates and Chrome headless. Use when asked to create code images, tweet images, snippet screenshots, code cards, or visual code examples for sharing. Supports single snippets, multi-image sets, and 2x2 grid composites.
74
91%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Generate high-resolution code snippet PNGs using HTML templates rendered with Chrome headless at 2x scale.
assets/template.html to a temp file<!-- FILENAME --> with the title bar text (e.g., filename or description)<!-- CODE CONTENT --> with syntax-highlighted HTML (see Syntax Highlighting below)scripts/render.sh:scripts/render.sh /tmp/snippet.html /tmp/snippet.png
# Produces 2400x1350 PNG (1200x675 at 2x scale)Wrap code tokens in <span> with these classes:
| Class | Color | Use for |
|---|---|---|
.keyword | green #22863a | use, function, class, return, new, fn |
.string | blue #032f62 | 'quoted strings' |
.method | purple #6f42c1 | method/function names |
.class-name | purple #6f42c1 | class and namespace names |
.facade | purple #6f42c1 | Facade names like Pdf |
.comment | gray italic #6a737d | // comments and # comments |
.variable | orange #e36209 | $variables |
.named-arg | orange #e36209 | PHP named args key: |
.arrow | dark #24292e | -> and => |
.punctuation | dark #24292e | (), {}, [], ;, :: |
.env-key | green bold #22863a | .env keys |
.env-val | blue #032f62 | .env values |
.number | blue #005cc5 | numeric literals |
.type | purple #6f42c1 | type hints |
Use <br> for line breaks. Use for indentation (4× per level).
<span class="keyword">use</span> <span class="class-name">App\Models\User</span><span class="punctuation">;</span><br><br>
<span class="variable">$users</span> <span class="punctuation">=</span> <span class="class-name">User</span><span class="punctuation">::</span><span class="method">where</span><span class="punctuation">(</span><span class="string">'active'</span><span class="punctuation">,</span> <span class="keyword">true</span><span class="punctuation">)-></span><span class="method">get</span><span class="punctuation">();</span>For combining 4 snippets into one image (e.g., LinkedIn posts):
assets/grid-2x2.html to a temp file<!-- FILENAME N --> and <!-- CODE N --> placeholdersscripts/render.sh /tmp/grid.html /tmp/grid.png 2400 1350 1Grid uses slightly smaller fonts (17px) and padding to fit 4 cards.
scripts/render.sh <input.html> <output.png> [width] [height] [scale]
| Param | Default | Notes |
|---|---|---|
| width | 1200 | Viewport width in px |
| height | 675 | Viewport height in px |
| scale | 2 | Device scale factor (2 = retina) |
.code { font-size } in the HTMLfont-variant-ligatures: none) to prevent -> from rendering as →pdf() helper style over Pdf facade when showing Laravel examples (Spatie convention)50345d3
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.