AgentSkillsCN

drawio-delegate

借助 drawio MCP,将图表创建任务委托给 GitHub Copilot CLI。在“创建图表”“架构图”“委托 drawio”等场景中使用。以子进程方式运行——当前会话无需 MCP。

SKILL.md
--- frontmatter
name: drawio-delegate
description: "Delegate diagram creation to GitHub Copilot CLI with drawio MCP. Use on 'create diagram', 'architecture diagram', 'delegate drawio'. Runs as subprocess - no MCP required in current session."

Draw.io Delegation Skill

Delegate diagram creation to a separate GitHub Copilot CLI session that has the draw.io MCP server enabled.

Prerequisites

  1. Start the draw.io container (if not already running):

    bash
    cd ~/dotfiles/ai && docker compose up -d
    
  2. Verify container is ready:

    bash
    curl -sf http://localhost:8098/ > /dev/null && echo "ready" || echo "not ready"
    

Usage

To create a diagram, use the bash tool to call drawio-copilot-task with a detailed prompt:

bash
drawio-copilot-task "Your detailed diagram description here"

How It Works

  1. drawio-copilot-task is a shell function in ~/dotfiles/zsh/.zshrc (stowed to ~/.zshrc)
  2. It starts GitHub Copilot CLI with:
    • --additional-mcp-config @~/.copilot/drawio-only.json (enables drawio MCP)
    • --disable-builtin-mcps (disables github-mcp-server)
    • --allow-all-tools --no-ask-user --silent (non-interactive mode)
  3. Copilot receives your prompt, uses drawio MCP tools to create the diagram
  4. The diagram appears in the user's browser (via draw.io container at localhost:8098)
  5. Copilot exits after completing the task

Prompt Guidelines

Be specific - include components, connections, and layout hints:

bash
# Good: specific components and relationships
drawio-copilot-task "Create an AWS architecture diagram showing:
- VPC with public and private subnets
- ALB in public subnet
- EKS cluster with 3 pods in private subnet
- RDS PostgreSQL in private subnet
- Show arrows: ALB -> EKS -> RDS"

# Good: Kubernetes with specific resources
drawio-copilot-task "Create a Kubernetes diagram with:
- Ingress controller
- Service (ClusterIP)
- Deployment with 3 replicas
- ConfigMap and Secret
- PersistentVolumeClaim
Show the namespace boundary"

# Bad: too vague
drawio-copilot-task "make a diagram"

Troubleshooting

Function not found

The drawio-copilot-task function is defined in ~/dotfiles/zsh/.zshrc.

  • The function should be available in any interactive zsh session

Container not running

bash
cd ~/dotfiles/ai && docker compose up -d
docker ps | grep drawio

MCP server can't connect

  • Verify http://localhost:8098/ is accessible in browser
  • Check container logs: docker logs drawio

Diagram not appearing

  • The browser should open automatically via start_session
  • If not, open http://localhost:8098/ manually

Limitations

  • Runs as separate process - no context from current session
  • Non-interactive (auto-approves all tools)
  • For iterative work, user should run drawio-copilot alias directly

Interactive Mode

For interactive diagram work (user-facing), use the shell alias directly:

bash
drawio-copilot

This opens an interactive Copilot session with drawio MCP enabled.