Code Snippet Images logo

Code Snippet Images

CommunityPopular
freekmurze
code-snippet-images

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.

Overview

Publisherfreekmurze
Repositorydotfiles
Skill namecode-snippet-images
Stars
1K
Forks
203
Bundled files
3
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by freekmurze on GitHub. Read the source before you install it.

Installation

Install the Code Snippet Images AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/freekmurze/dotfiles/tree/main/config/claude/skills/code-snippet-images
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/freekmurze/dotfiles.git /tmp/dotfiles
mkdir -p .claude/skills
cp -r /tmp/dotfiles/config/claude/skills/code-snippet-images .claude/skills/code-snippet-images
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Code Snippet Images in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Code Snippet Images on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Code Snippet Images is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Code Snippet Images

Generate high-resolution code snippet PNGs using HTML templates rendered with Chrome headless at 2x scale.

Quick Start

  1. Copy the template from assets/template.html to a temp file
  2. Replace <!-- FILENAME --> with the title bar text (e.g., filename or description)
  3. Replace <!-- CODE CONTENT --> with syntax-highlighted HTML (see Syntax Highlighting below)
  4. Render with scripts/render.sh:
bash
scripts/render.sh /tmp/snippet.html /tmp/snippet.png
# Produces 2400x1350 PNG (1200x675 at 2x scale)

Design Specs

  • Viewport: 1200×675px, rendered at 2x scale → 2400×1350px output
  • Style: Light theme, warm off-white (#f0ece8 background, #faf8f6 card)
  • Window chrome: macOS-style red/yellow/green dots, no badges or pills
  • Font: JetBrains Mono (loaded from Google Fonts), ligatures disabled
  • Code font size: 25px default (23px if code is longer, 20px if very dense). Use large fonts to fill the card.
  • No footer text below the code card
  • Color scheme: GitHub-light inspired syntax highlighting

Syntax Highlighting

Wrap code tokens in <span> with these classes:

ClassColorUse for
.keywordgreen #22863ause, function, class, return, new, fn
.stringblue #032f62'quoted strings'
.methodpurple #6f42c1method/function names
.class-namepurple #6f42c1class and namespace names
.facadepurple #6f42c1Facade names like Pdf
.commentgray italic #6a737d// comments and # comments
.variableorange #e36209$variables
.named-argorange #e36209PHP named args key:
.arrowdark #24292e-> and =>
.punctuationdark #24292e(), {}, [], ;, ::
.env-keygreen bold #22863a.env keys
.env-valblue #032f62.env values
.numberblue #005cc5numeric literals
.typepurple #6f42c1type hints

Use <br> for line breaks. Use &nbsp; for indentation (4× per level).

Example

html
<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">)-&gt;</span><span class="method">get</span><span class="punctuation">();</span>

Grid Composite (2×2)

For combining 4 snippets into one image (e.g., LinkedIn posts):

  1. Copy assets/grid-2x2.html to a temp file
  2. Fill in the 4 <!-- FILENAME N --> and <!-- CODE N --> placeholders
  3. Render at 2400×1350 native (no scaling needed since the grid is already 2400px wide):
bash
scripts/render.sh /tmp/grid.html /tmp/grid.png 2400 1350 1

Grid uses slightly smaller fonts (17px) and padding to fit 4 cards.

Render Script

scripts/render.sh <input.html> <output.png> [width] [height] [scale]

ParamDefaultNotes
width1200Viewport width in px
height675Viewport height in px
scale2Device scale factor (2 = retina)

Tips

  • Adjust font size if code doesn't fit: change .code { font-size } in the HTML
  • Adjust card height: the card auto-sizes to content; body height may need increasing for long snippets
  • Arrow ligatures: template already disables ligatures (font-variant-ligatures: none) to prevent -> from rendering as →
  • Multiple images: create separate HTML files per snippet, render each independently
  • PHP code: prefer pdf() helper style over Pdf facade when showing Laravel examples (Spatie convention)
  • Keep code concise — these are for social media, not documentation

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Code Snippet Images AI skill do?

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.

Why use Code Snippet Images on TypingMind?

Because you install it once and use it with any model. Code Snippet Images is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Code Snippet Images in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/freekmurze/dotfiles/tree/main/config/claude/skills/code-snippet-images. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Code Snippet Images?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Code Snippet Images?

As many as you like. As long as a model supports skills, you can use Code Snippet Images with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Code Snippet Images AI skill free?

It is published on GitHub by freekmurze. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇