Draw diagram

From pipecrew-ai/pipecrew · View interactive version

Draw diagram is an AI agent skill from the GitHub repository pipecrew-ai/pipecrew. Generate or refresh architecture diagrams for a workspace. Default mode regenerates the canonical Mermaid file (architecture-overview.mmd) for an onboarded workspace by re-dispatching the solution-architect in discovery mode. Optional --topic flag produces a focused diagram on a specific concern (au

How to use this skill

Skill file

/draw-diagram

Standalone skill for generating or refreshing architecture diagrams. The canonical workspace diagram (architecture-overview.mmd) is normally produced by /discover Phase B; this skill lets you regenerate it without re-running discovery, or produce focused topic diagrams off the canonical file.

When to use

Two source modes

Workspace mode (default — uses pre-discovered metadata):

Code-scan mode (truly standalone — reads code directly):

Usage

# Workspace mode (default — fast, narrative-grounded)
/draw-diagram                              refresh the canonical diagram for the auto-detected workspace
/draw-diagram --workspace=<slug>           target a specific workspace
/draw-diagram --topic=<name>               focused topic diagram (workspace mode)

# Code-scan mode (standalone — works without /discover)
/draw-diagram --scan=<dir>                 scan all repos under <dir>, infer topology from code
/draw-diagram --repos="<a>,<b>,<c>"        scan an explicit list of repo paths
/draw-diagram --scan=<dir> --topic=<name>  focused topic diagram in code-scan mode

# Diagram style (any source)
/draw-diagram --c4                         emit Mermaid C4 syntax (Context + Container) instead of flowchart
/draw-diagram --c4 --c4-level=all          add component-level C4 for every container
/draw-diagram --c4 --c4-level=component:<system>  add component diagram for a specific system

# Modes (any source)
/draw-diagram --output=<path>              write to a custom path (with --topic)
/draw-diagram --audit                      read-only staleness report (no writes)

Flags:

Modes

Refresh canonical diagram (default — no `--topic`)

Re-runs the same logic /discover Phase B uses to produce the canonical file. The existing diagram is rewritten (not merged) — the architect produces a fresh view of the current code.

Output path:

The conventions live in {plugin_dir}/rules/discovery-diagrams.md. The architect reads that file at the start of the run.

Topic diagram (`--topic=<name>`)

Produces a focused single-file diagram. The canonical file is not modified. Default output path is {workspace_root}/{slug}/context/diagrams/{topic}.mmd; override with --output.

Topics the architect knows how to handle out-of-the-box (interpreted from the --topic argument as a hint):

Audit mode (`--audit`)

Read-only. The architect reads the existing .mmd files and the current code, reports staleness:

Output is a report saved to {workspace_root}/{slug}/context/diagrams/audit-{date}.md. No diagrams are modified.

Instructions for the orchestrator

When the user invokes /draw-diagram:

  1. Decide the source mode.
  1. Resolve inputs.
  1. Dispatch the right agent.

Workspace mode — solution-architect in discovery mode:

Code-scan mode — architecture-mapper:

  1. Extract the agent's output:
  1. Present a diff summary — what files were written or compared, line counts before/after, and (code-scan mode only) high-level scan stats from the MAPPER_REPORT.

Standalone agent invocation (without the slash-command)

Workspace mode:

Use the pipecrew:solution-architect agent in discovery mode for workspace
{slug}. Diagram-only refresh — do NOT rewrite platform.md. Read
{plugin_dir}/rules/discovery-diagrams.md first. Produce
architecture-overview.mmd inside the documented delimiters.

Code-scan mode:

Use the pipecrew:architecture-mapper agent. Repo paths: /path/to/repo1,
/path/to/repo2, /path/to/repo3. Workspace name: {dir-name}. Output mode:
canonical. Read {plugin_dir}/rules/discovery-diagrams.md first, then
follow your four-tier scan process.

What this skill does NOT do

Quality tradeoff: workspace mode vs. code-scan mode

| Aspect | Workspace mode (default) | Code-scan mode (--scan / --repos) |

|---|---|---|

| Source of truth | platform.md + config.json (narrative + structured) | Code itself (OpenAPI specs, HTTP client calls, event pub/sub, configs) |

| Setup needed | Workspace onboarded via /discover | Just repo paths |

| Token cost | Lower (concentrated in pre-extracted docs) | Higher (per-repo scan, but bounded by HARD RULE R1 — ~38 reads max per repo) |

| Quality | High where platform.md is current; degrades with staleness | Tiered confidence (high/medium/low) per edge — never fabricates targets |

| Best for | Active workspaces where /discover is current | Brand-new projects, archived projects, second-opinion checks against platform.md |

Code-scan mode is honest about uncertainty — unresolved hosts emit (unknown-host) nodes rather than guesses. Workspace mode trusts platform.md. Pick the source that matches what you actually have.

See also

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.