d2-diagram
Installation
SKILL.md
/d2-diagram
User request: "$ARGUMENTS"
Task
Generate a well-composed D2 diagram from the user's description.
Step 1: Setup
Resolve plugin path and read config:
PLUGIN_DIR=$(find "$HOME/.claude/plugins/cache" -type d -name "d2" -path "*/skills/d2" 2>/dev/null | head -1)
[ -z "$PLUGIN_DIR" ] && PLUGIN_DIR=$(find "$HOME" -maxdepth 8 -type d -name "d2" -path "*/skills/d2" 2>/dev/null | head -1)
bash "$PLUGIN_DIR/scripts/ensure-deps.sh"
Read .claude/d2.json if it exists (theme_id, layout, sketch, output_directory, auto_validate, auto_render). If it does not exist, display a one-time nudge: