원클릭으로
d2-diagram
Generate a D2 diagram from a text description
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Generate a D2 diagram from a text description
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Use when checking Paperclip org health, reviewing agent efficiency, diagnosing token waste, verifying governance compliance, or before and after making org changes. Also use when agents seem idle or unproductive, costs spike, tasks stall, heartbeats fail silently, you see 409 conflicts, stale locks, blocked deadlocks, or suspect agents burning tokens with no progress.
This skill should be used when the user asks to "show dev-setup config", "change the worktrees directory", "update the port pattern", "configure dev-setup settings", or wants to view or update settings in .claude/dev-setup.json.
Generate dev server lifecycle scripts (start/stop/status/ports) from detected project structure
This skill should be used when the user asks to "create a worktree", "set up an isolated workspace", "create a branch for a feature", "start working on a new branch", or before executing an implementation plan that needs an isolated git workspace.
Scan a codebase and auto-generate relevant diagrams from its structure
Internal routing hub for d2 diagram skills
| name | d2-diagram |
| description | Generate a D2 diagram from a text description |
| argument-hint | ["description"] |
| allowed-tools | Read, Bash, Write |
User request: "$ARGUMENTS"
Generate a well-composed D2 diagram from the user's description.
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:
First time using the d2 plugin? Run
/d2-configto pick a theme. Using defaults for now.
Determine diagram type from the description:
| Intent | Type |
|---|---|
| API calls, request/response, message passing | Sequence |
| System components, microservices, infrastructure, pipelines, workflows | Architecture |
| Database tables, schema, foreign keys, entities | ER |
| Class hierarchy, OOP, interfaces, data models | Class |
If ambiguous between 2 types, ask one clarifying question. If clear, proceed.
Before writing any D2, build this plan internally. Apply the policies from $PLUGIN_DIR/SKILL.md.
Determine:
Visibility rule: If the budget check passes and there is no ambiguity in level or grouping, proceed directly to Step 4. If split is required OR the abstraction level or grouping is ambiguous, present a summary to the user:
I'm planning to generate:
- Type: {type} at {abstraction_level} level
- Grouping: by {criterion}
- Direction: {direction}
- {N} nodes in {M} groups
- Split: {overview + N detail diagrams | single diagram}
Proceed, or want to adjust?
Read the specialist for the classified type:
$PLUGIN_DIR/specialists/d2-sequence.md$PLUGIN_DIR/specialists/d2-architecture.md$PLUGIN_DIR/specialists/d2-er.md$PLUGIN_DIR/specialists/d2-class.mdUse the specialist's compositional patterns and D2 syntax conventions. The structural plan from Step 3 governs the structure — the specialist provides type-specific syntax.
Write the diagram following:
Order in the .d2 file:
vars block (theme, engine, sketch from config)direction declarationclasses block (if >4 nodes of same type)Non-negotiable conventions:
api_gw, user_svc, orders_dbapi_gw: "API Gateway" — emojis allowed in labels onlyvars block — direction: right for flows, direction: down for hierarchies. If unsure, use direction: right. Never omit.Before delivering, run the 10-point repair checklist from $PLUGIN_DIR/SKILL.md:
Fix any violations silently. Do not ask the user — just fix them.
d2 validate {output_file}
Fix syntax errors using $PLUGIN_DIR/references/guides/troubleshooting.md.
mkdir -p {output_directory}
Filename: {type}-{short-description}-{YYYYMMDD}.d2
Render if auto_render=true or user asks:
d2 {output_file} {output_directory}/{basename}.svg
Output:
{d2 code block}
**What this shows:** {1-2 sentences describing the diagram}
**Saved to:** {filename}
**Elements:** {N} nodes, {M} connections
**Layout:** {engine}, direction {direction}
Want to adjust? I can change the detail level, scope, grouping, or type.
If split was required, list all generated files.
If the user asks to "diagram the flow" of a file or script: