diagram

diagram is a command for Claude Code from ruslan-korneev/claude-plugins. It costs 11 tokens per session (1,445 once invoked), scanned A, original, MIT.

A command that turns a codebase’s structure into architecture diagrams written in Mermaid, a text format that can be rendered as diagrams. It can describe components, data movement, or step-by-step interactions.

In plain words
What is it for?
Use it to document system components, trace data from clients through services and databases, or show the interactions involved in a specific use case.
Why use it?
It gives you a visual summary of how the system is organised and how its parts communicate, without drawing the diagram by hand.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the tech-lead plugin — 14 commands, 9 agents shipped together

Good fit Use it to document system components, trace data from clients through services and databases, or show the interactions involved in a specific use case.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/ruslan-korneev/claude-plugins/diagram
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/ruslan-korneev/claude-plugins

Made for: Claude Code.

Or install tech-lead, the plugin that ships this one along with the rest of its 14 commands, 9 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for diagram

README.md
[![agentmods](https://agentmods.dev/badge/commands/ruslan-korneev/claude-plugins/diagram.svg)](https://agentmods.dev/commands/ruslan-korneev/claude-plugins/diagram)
Your own site
<a href="https://agentmods.dev/commands/ruslan-korneev/claude-plugins/diagram"><img src="https://agentmods.dev/badge/commands/ruslan-korneev/claude-plugins/diagram.svg" alt="Measured on agentmods" height="20"></a>
Per session 11 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,445 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00011 $0.01445
Opus 5 $0.00005 $0.00723
Sonnet 5 $0.00002 $0.00289
Haiku 4.5 $0.00001 $0.00145

Measured 7d ago against content hash 915db07fada2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

diagram scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/tech-lead/commands/diagram.md · 297 lines

How it starts

The opening of the file, as written. The whole thing — 297 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Command /architect:diagram

Generate architecture diagrams in Mermaid format based on codebase analysis.

Diagram Types

1. Component Diagram

Shows high-level system components and their relationships.

graph TD
    subgraph Presentation
        R[Routers]
        DTO[DTOs]
    end

    subgraph Application
        S[Services]
        E[Events]
    end

    subgraph Domain
        M[Models]
        VO[Value Objects]
    end

    subgraph Infrastructure
        REPO[Repositories]
        EXT[External APIs]
        CACHE[Cache]
    end

    R --> S
    S --> REPO
    S --> E
    REPO --> M
    S --> EXT
    S --> CACHE

2. Data Flow Diagram

Shows how data flows through the system.

flowchart LR
    Client([Client])
    API[FastAPI]
    Auth{Auth}
    Service[Service]
    DB[(Database)]
    Cache[(Redis)]
    Queue[Message Queue]

    Client -->|HTTP Request| API
    API --> Auth
    Auth -->|Valid| Service
    Auth -->|Invalid| Client
    Service -->|Query| DB
    Service -->|Cache| Cache
    Service -->|Event| Queue
    Service -->|Response| API
    API -->|HTTP Response| Client

3. Sequence Diagram

Shows interaction between components for a specific use case.

sequenceDiagram
    participant C as Client
    participant R as Router
    participant S as Service
    participant REPO as Repository
    participant DB as Database

    C->>R: POST /orders
    R->>R: Validate DTO
    R->>S: create_order(data)
    S->>S: Apply business rules
    S->>REPO: save(order)
    REPO->>DB: INSERT
    DB-->>REPO: order_id
    REPO-->>S: Order
    S->>S: Publish OrderCreated event
    S-->>R: OrderReadDTO
    R-->>C: 201 Created

4. ER Diagram

Shows database entity relationships.

erDiagram
    users {
        int id PK
        string email UK
        string name
        string password_hash
        boolean is_active
        datetime created_at
    }

    orders {
        int id PK
        int user_id FK
        string status
        decimal total
        datetime created_at
    }

    order_items {
        int order_id PK,FK
        int product_id PK,FK
        int quantity
        decimal unit_price
    }

    products {
        int id PK
        string name
        string sku UK
        decimal price
        int stock
    }

    users ||--o{ orders : places
    orders ||--|{ order_items : contains
    products ||--o{ order_items : "included in"

Read the full file on GitHub · 297 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 297 lines · 11 tokens per session scan A 915db07fada2

Subscribe to this mod's changes

diagram is a command published in the GitHub repository ruslan-korneev/claude-plugins (4 stars, last pushed 6mo ago), licensed MIT. It adds 11 tokens to every session and 1,445 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.