Creates diagrams from the current context using D2, outputting PNG images. Invoked via /d2. Integrates with Emacs for theme-aware styling.
Ships in emacs-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Create a diagram from the most recent interaction context using D2. Generate a PNG image and output it as a markdown image so it renders inline.
emacsclient --eval '(face-foreground (quote default))'
emacsclient --eval '(frame-parameter nil (quote background-mode))'
The first returns a hex color like "#eeffff". The second returns dark or light. Reuse both for all subsequent diagrams.--theme 200 if background mode is dark, or --theme 0 if light.
# Use --theme 200 for dark, --theme 0 for light
d2 --theme 200 --pad 40 /tmp/agent-diagram-XXXX.d2 /tmp/agent-diagram-XXXX.png
Use --theme 200 for dark or --theme 0 for light, based on the Emacs background mode. Apply the queried foreground color to style.font-color and style.stroke on nodes and edges.
direction: right
node1: Label {
style.font-color: "#eeffff"
style.fill: "#2d3748"
style.stroke: "#eeffff"
}
node2: Label {
style.font-color: "#eeffff"
style.fill: "#2d3748"
style.stroke: "#eeffff"
}
node1 -> node2: label {style.stroke: "#eeffff"; style.font-color: "#eeffff"}
(frame-parameter nil 'background-mode). Use --theme 200 for dark or --theme 0 for light. Always use --pad 40./tmp/agent-diagram-$(date +%s).png). Never use descriptive names.style.font-color and style.stroke for all nodes and edges so the diagram is readable on the user's Emacs background.) on its own line.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
d2, diagram-generation, emacs-integration, png-output, visualization
/emacs-skills:d2from emacs-skills
npx claudepluginhub xenodium/emacs-skills --plugin emacs-skills19 skills in this plugin
/describeThis skill should be used when the user invokes "/describe" to look up Emacs documentation via emacsclient./diredThis skill should be used when the user invokes "/dired" to open files from the latest interaction in an Emacs dired buffer via emacsclient./emacsclientAlways use emacsclient instead of emacs. This applies to all Emacs operations: user requests, byte compilation, check-parens, running ERT tests, and any other elisp evaluation./file-linksWhen referencing files, format them as markdown links with line numbers using GitHub-style #L syntax./github-activityThis skill should be used when the user invokes "/github-activity" to analyze a GitHub project's recent activity (PRs and issues) and produce a succinct, chart-backed health report./gnuplotThis skill should be used when the user invokes "/gnuplot" to plot data from the current context using gnuplot and output the resulting image path.Other plugins' skills for the same job