内容に応じて最適な図表形式を自動選択し、ローカルで画像生成(Pillow)またはコード出力(Mermaid/PlantUML)。フローチャート、アーキテクチャ図、階層図などを生成。資料作成、システム設計時に使用。
npx skills add https://github.com/karaage0703/ai-assistant-workspace --skill xs-diagram-generator
内容に応じて最適な図表形式を自動選択し、画像を生成する。
Mermaidコードがすでにある?
├─ YES → Docker mermaid-cli で画像化(最優先)
└─ NO → 内容に応じて選択
├─ フロー/シーケンス → Mermaidコード作成 → Docker mermaid-cli
└─ アーキテクチャ/階層 → Pillow(uv run)で直接生成
Mermaidコードがある場合はこれを最優先で使う。
# 1. Mermaidファイルを作成
cat > /tmp/diagram.mmd << 'EOF'
flowchart TB
A[開始] --> B[処理]
B --> C{判断}
C -->|Yes| D[完了]
C -->|No| B
EOF
# 2. Docker版 mermaid-cli で画像生成
docker run --rm -u $(id -u):$(id -g) \
-v /tmp:/data \
minlag/mermaid-cli \
-i /data/diagram.mmd -o /data/diagram.png -b white
ポイント:
-u $(id -u):$(id -g) でパーミッション問題を回避-b white で白背景(スライド向け)-o /data/diagram.svg改行は <br> を使う! \n は使わない!
# NG(\n がそのまま表示される)
A["Gateway\nRust / Axum"]
# OK(ちゃんと改行される)
A["Gateway<br>Rust / Axum"]
subgraphのタイトルが長いと途中で改行される:
線の交差を減らすコツ:
direction LR / direction TB をsubgraph内で使い分けるsubgraphのネスト例(包含関係の表現):
subgraph outer["親システム"]
subgraph inner["子システム"]
A["コンポーネントA"]
end
B["コンポーネントB"] --> A
end
for f in /tmp/*.mmd; do
docker run --rm -u $(id -u):$(id -g) \
-v /tmp:/data \
minlag/mermaid-cli \
-i /data/$(basename "$f") -o /data/$(basename "$f" .mmd).png -b white
done
Mermaidを経由せず、直接画像を生成したい場合に使用。
uv run --with pillow python [SKILL_DIR]/draw_diagram.py <type> -o <output.png> -d '<json>'
architecture)uv run --with pillow python [SKILL_DIR]/draw_diagram.py architecture \
-o /tmp/arch.png -d '{
"title": "システム構成",
"boxes": [
{"id": "api", "label": "API Server", "color": "blue", "row": 0, "col": 1},
{"id": "db", "label": "Database", "sublabel": "PostgreSQL", "color": "green", "row": 1, "col": 0},
{"id": "cache", "label": "Cache", "sublabel": "Redis", "color": "orange", "row": 1, "col": 2}
],
"arrows": [
{"from": "api", "to": "db", "label": "query"},
{"from": "api", "to": "cache", "label": "read/write"}
]
}'
パラメータ:
boxes[].id: 識別子(矢印の接続に使用)boxes[].label: メインラベルboxes[].sublabel: サブラベル(オプション)boxes[].color: blue/orange/purple/green/red/gray/tealboxes[].row, boxes[].col: グリッド位置arrows[].from, arrows[].to: 接続元・先の idarrows[].label: 矢印のラベル(オプション)flowchart)uv run --with pillow python [SKILL_DIR]/draw_diagram.py flowchart \
-o /tmp/flow.png -d '{
"title": "ユーザー登録フロー",
"steps": [
{"id": "s1", "label": "開始", "type": "start"},
{"id": "s2", "label": "フォーム入力", "type": "process"},
{"id": "s3", "label": "バリデーション", "type": "decision"},
{"id": "s4", "label": "DB保存", "type": "process"},
{"id": "s5", "label": "完了", "type": "end"}
],
"connections": [
{"from": "s1", "to": "s2"},
{"from": "s2", "to": "s3"},
{"from": "s3", "to": "s4", "label": "OK"},
{"from": "s4", "to": "s5"}
]
}'
ステップの type: start(緑)/ end(赤)/ process(青)/ decision(オレンジ)
hierarchy)uv run --with pillow python [SKILL_DIR]/draw_diagram.py hierarchy \
-o /tmp/org.png -d '{
"title": "組織図",
"root": {
"label": "CEO",
"color": "purple",
"children": [
{"label": "CTO", "color": "blue", "children": [
{"label": "Dev Team", "color": "green"},
{"label": "Infra Team", "color": "green"}
]},
{"label": "CFO", "color": "orange", "children": [
{"label": "Finance", "color": "gray"}
]}
]
}
}'
| 色名 | 用途の目安 |
|------|-----------|
| blue | 技術系、API、サーバー |
| green | 正常系、開始、データベース |
| orange | 条件分岐、警告、キャッシュ |
| purple | 重要、トップレベル |
| red | 終了、エラー、削除 |
| gray | 補助、外部システム |
| teal | その他 |
「このMermaidを画像にして」
→ .mmdファイルに保存 → docker mermaid-cli → PNG送信
「APIサーバー、DB、キャッシュの構成図を作って」
→ Pillow architecture で JSON 生成 → uv run → PNG送信
「ユーザー登録の流れをフローチャートにして」
→ Mermaidコード作成 → docker mermaid-cli → PNG送信
Integration with protocols.io API for managing scientific protocols. This skill should be used when working with protocols.io to search, create, update, or publish protocols; manage protocol steps and materials; handle discussions and comments; organize workspaces; upload and manage files; or integrate protocols.io functionality into workflows. Applicable for protocol discovery, collaborative protocol development, experiment tracking, lab protocol management, and scientific documentation.
Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances
Generate Excalidraw diagrams from natural language descriptions. Use when asked to "create a diagram", "make a flowchart", "visualize a process", "draw a system architecture", "create a mind map", or "generate an Excalidraw file". Supports flowcharts, relationship diagrams, mind maps, and system architecture diagrams. Outputs .excalidraw JSON files that can be opened directly in Excalidraw.
Build and distribute Expo development clients locally or via TestFlight
Use when you have a written implementation plan to execute in a separate session with review checkpoints
Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.
Benchling R&D platform integration. Access registry (DNA, proteins), inventory, ELN entries, workflows via API, build Benchling Apps, query Data Warehouse, for lab data management automation.
Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.
Take karaage0703/xs-diagram-generator from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference docker.
Without those the skill loads but fails at the first command.