Skip to main content
skill CX Codex

snipgrapher — Claude Code skill: what it does, how to install

Generates polished code snippet images in PNG, SVG, and WebP using the snipgrapher CLI. Useful for documentation, release notes, and social media posts.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add mcollina/skills --skill snipgrapher -a claude-code
Open on GitHub

What snipgrapher does

This skill directs the agent to produce syntax-highlighted code screenshots via npx snipgrapher or a local binary. It handles single source files, batch jobs, and watch mode. The CLI supports PNG, SVG, and WebP. Shared styling options live in snipgrapher.config.json as named profiles.

Run npx snipgrapher init before batch tasks. Explicit profiles prevent unexpected layout shifts across exports. After rendering, the agent runs ls -lh to verify the generated image is non-empty. Any custom font declared in your profile must be installed on the host system, or the render process crashes.

What it helps with

  • render syntax-highlighted code snippets to PNG, SVG, or WebP
  • create snipgrapher.config.json with reusable named styling profiles
  • batch-render snippet assets for project documentation and changelogs
  • monitor source files with watch mode to regenerate snippet images automatically

Example prompts for the agent

  • Render a PNG image from src/index.ts using snipgrapher
  • Initialize snipgrapher.config.json and export docs/snippet.py to SVG with the default profile
  • Batch render all code examples in the snippets folder to WebP

How to install snipgrapher

1Skills CLI (Vercel)

npx skills add mcollina/skills --skill snipgrapher -a claude-code

2Manually: put the files in place

~/.claude/skills/snipgrapher/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/snipgrapher/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about snipgrapher

How to install snipgrapher in Claude Code?

Run npx skills add mcollina/skills --skill snipgrapher -a claude-code.

What output formats does snipgrapher support?

It renders code snippets into PNG, SVG, and WebP images with syntax highlighting.

Why does snipgrapher fail during a render?

Failures typically occur when a custom font specified in snipgrapher.config.json is missing from the system, or when the input file is empty.

Source text

SKILL.md · MIT
---
name: snipgrapher
description: Configures and uses snipgrapher to generate polished code snippet images, including syntax-highlighted PNGs, SVGs, and WebP exports with custom themes, profiles, and styling options. Use when the user wants to create code screenshots, turn code into shareable images, generate pretty code snippets for docs or social posts, produce syntax-highlighted images from source files, or explicitly mentions snipgrapher. Supports single-file renders, batch jobs, watch mode, and reusable named profiles via the snipgrapher CLI or npx.
metadata:
  tags: snipgrapher, snippets, images, svg, png, webp, cli
---

## When to use

Use this skill when you need to:
- Generate image snippets from source code
- Configure reusable snippet rendering defaults
- Batch-render snippet assets for docs, social posts, or changelogs
- Use published `snipgrapher` from npm to generate snippet images

## Quick start

Render a single file to a PNG immediately with no config required:

```bash
npx snipgrapher render file.ts -o output.png
```

For ongoing use, initialise a project config first, then render:

```bash
npx snipgrapher init          # creates snipgrapher.config.json
npx snipgrapher render file.ts --profile default -o output.png
```

After rendering, verify the output exists and is non-zero in size before treating the job as successful:

```bash
ls -lh output.png   # confirm file exists and size > 0
```

## How to use

Read these rule files in order:

- [rules/setup-and-configuration.md](rules/setup-and-configuration.md) - Install, select executable, initialize config, and define profiles
- [rules/rendering-workflows.md](rules/rendering-workflows.md) - Render single snippets, batch jobs, watch mode, and output practices

## Core principles

- **Configure first**: establish a project config before repeated renders
- **Reproducible output**: prefer named profiles and explicit output paths
- **Portable commands**: use command patterns that work with installed binaries and `npx`
- **Automation-friendly**: rely on CLI flags/config/env precedence intentionally

## Troubleshooting common render failures

If a render fails or produces an unexpected output, check for these common causes:

- **Missing fonts**: ensure any custom font specified in the profile or config is installed on the system
- **Unsupported syntax**: confirm the language/extension is supported by snipgrapher; fall back to plain text highlighting if not
- **Empty or corrupt output**: re-run with `--verbose` (if supported) to surface error details, and verify the input file is readable and non-empty
- **Profile not found**: run `npx snipgrapher init` to regenerate `snipgrapher.config.json` if the config file is missing or malformed

© mcollina · MIT · mcollina/skills

Similar skills

Everything for Writing and docs →

From the same set11

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor