Agent skill

Code To Diagram

by zebbern in zebbern/claude-code-guide

Analyze codebases and automatically generate architecture diagrams, flowcharts, and org charts.

MITAuto-check passedDevelopment

Install Code To Diagram

skills CLI
$ npx skills add zebbern/claude-code-guide --skill code-to-diagram -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install zebbern/claude-code-guide code-to-diagram --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/zebbern/claude-code-guide.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/code-to-diagram .claude/skills/code-to-diagram && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
code-to-diagram
GitHub stars
4.6k
Token cost
~972 tokens
SKILL.md length
331 words
Files
3 (incl. scripts)
Skills in repo
46
Repo updated
First seen
Licence
MIT

At a glance

Analyze codebases and automatically generate architecture diagrams, flowcharts, and org charts.

  • Works in 3 steps: Architecture Diagram —… → Flowchart — File-level import call chains → Org Chart — Directory/file hierarchy…
  • Tasks that involve Diagrams
  • SKILL.md covers Usage, How It Works, Use Cases and Dependencies, plus 1 more section
  • Runs Python scripts from its folder; calls python3

What it does

Code To Diagram is an agent skill from zebbern/claude-code-guide. Analyze codebases and automatically generate architecture diagrams, flowcharts, and org charts. Uses AST parsing to map import dependencies for Python, JS/TS, Go, and Java, outputting Mermaid or SVG files. Triggered when users ask to visualize code architecture, understand dependencies, draw a flowchart, or create a module diagram from source code.

Its SKILL.md is about 970 tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including scripts (for example `scripts/analyze_codebase.py`).

It sits in Development, covering Diagrams. It works with Mermaid, Java and Python. The repository describes itself as: Claude Code Guide - Setup, Commands, workflows, agents, skills & tips-n-tricks from beginner to power user! The licence is MIT.

When your agent uses it

  • Tasks that involve Diagrams

Example prompts

  • “/code-to-diagram”

Requirements

  • Python 3

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Architecture Diagram — Module/directory-level dependency relationships
  2. Flowchart — File-level import call chains
  3. Org Chart — Directory/file hierarchy structure

What it can do on your machine

Read from SKILL.md and the folder at commit 4698e3b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python3

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Code To Diagram loads about 972 tokens when it runs. Until then it costs about 92 tokens; SKILL.md has 331 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~92
When it runs · the whole SKILL.md, loaded when a task matches
~972

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from zebbern/claude-code-guide at commit 4698e3b, republished under its MIT licence (© zebbern). 331 words, ~972 tokens.

Download SKILL.mdSave it as .claude/skills/code-to-diagram/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
code-to-diagram
description
Analyze codebases and automatically generate architecture diagrams, flowcharts, and org charts. Uses AST parsing to map import dependencies for Python, JS/TS, Go, and Java, outputting Mermaid or SVG files. Triggered when users ask to visualize code architecture, understand dependencies, draw a flowchart, or create a module diagram from source code.
license
MIT
type
tool
tags
visualization, architecture, mermaid, ast, diagram

Code to Diagram

Extract import and dependency relationships from a codebase via AST parsing, and automatically generate three types of diagrams:

  1. Architecture Diagram — Module/directory-level dependency relationships
  2. Flowchart — File-level import call chains
  3. Org Chart — Directory/file hierarchy structure

Supported languages: Python, JavaScript, TypeScript, Go, Java

Output formats: Mermaid text (.mmd) or SVG images (requires mmdc installed on the system)

Usage

Basic: Analyze an Entire Project
bash
python3 scripts/analyze_codebase.py /path/to/project

Outputs three Mermaid diagrams to stdout and writes .mmd files to the current directory.

Specify Diagram Type
bash
# Architecture diagram only
python3 scripts/analyze_codebase.py /path/to/project --type architecture

# Flowchart only
python3 scripts/analyze_codebase.py /path/to/project --type flowchart

# Org chart only
python3 scripts/analyze_codebase.py /path/to/project --type org
Specify Output Directory and Format
bash
# Output to a specific directory
python3 scripts/analyze_codebase.py /path/to/project --output /tmp/diagrams

# Output as SVG (requires mmdc)
python3 scripts/analyze_codebase.py /path/to/project --format svg

# Output both Mermaid and SVG
python3 scripts/analyze_codebase.py /path/to/project --format both
Output JSON Analysis Results
bash
python3 scripts/analyze_codebase.py /path/to/project --json
Parameters
ParameterDescription
directoryCode directory to analyze (required)
--type, -tDiagram type: architecture, flowchart, org, all (default: all)
--output, -oOutput directory (default: current directory)
--format, -fOutput format: mermaid, svg, both (default: mermaid)
--max-filesMaximum number of files to scan (default: 500)
--max-depthMaximum depth for org chart (default: 4)
--jsonOutput analysis results in JSON format

How It Works

  1. Scan phase: Recursively traverse the directory, skipping node_modules, .git, __pycache__, etc.
  2. Parse phase:
    • Python files: uses the ast module to parse import and from ... import statements
    • JS/TS files: uses regex to match import, require, and export from
    • Go files: uses regex to match import statements
    • Java files: uses regex to match import statements
  3. Resolve internal dependencies: Maps import paths to actual files within the project
  4. Generate diagrams: Converts dependency relationships into Mermaid diagram syntax
  5. Render (optional): Calls mmdc (Mermaid CLI) to render .mmd files as SVG

Use Cases

  • Quickly understand the module structure of an unfamiliar project
  • Visualize dependencies during code review
  • Create architecture diagrams for technical documentation
  • Detect circular dependencies or excessive coupling
  • Analyze project structure before refactoring

Dependencies

  • Python 3.7+ (standard library only, no extra packages needed)
  • SVG output requires @mermaid-js/mermaid-cli (optional)

Notes

  • Only analyzes static import relationships; dynamic imports are not tracked
  • For large projects, use --max-files to limit the scan scope
  • Mermaid diagrams with too many nodes may be hard to render; use --type to generate diagrams separately

© zebbern, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (scripts) in skills/code-to-diagram of zebbern/claude-code-guide.

  • SKILL.md
  • LICENSE
  • scripts/analyze_codebase.py

Open the folder on GitHubat commit 4698e3b

Compare with similar skills

Code To Diagram next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Code To Diagram compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Code To Diagram this skillzebbern/claude-code-guide4.6k—~972Automated safety check: PassMIT
Code To Chartrongxinzy/RongxinAI154—~596Automated safety check: PassMIT
Code Graph Mermaid Diagramstrailofbits/skills7.4k—~1.7kAutomated safety check: PassCC-BY-SA-4.0
Design Doc MermaidSpillwaveSolutions/design-doc-mermaid1751 repos~5.6kAutomated safety check: PassNone
Markdown Mermaid Writingneflibata-feng/MyArxiv-Agent1265 repos~3.8kAutomated safety check: NotesApache-2.0
Generate Readmedivar-ir/ai-doc-gen765—~996Automated safety check: PassMIT

Similar skills

  • Code To Chart

    rongxinzy/RongxinAI

    解析代码仓库的 import/依赖关系,自动生成架构图、流程图和组织架构图,输出 Mermaid 文本或 SVG 图片。支持 Python、JavaScript、TypeScript、Go 和 Java 项目。当用户需要可视化代码结构、分析模块依赖、生成架构文档,或提及“代码架构图”、“依赖关系图”、“流程图”、“组织架构图”、“Mermaid 图”等关键词时触发。

    154 GitHub stars~596 tokensUpdated today
    DevelopmentAuto-check passed
  • Code Graph Mermaid Diagrams

    trailofbits/skills

    Official

    Generates Mermaid diagrams from Trailmark code graphs, including call graphs, class hierarchies, module dependency maps, complexity heatmaps and attack surface data flows.

    7.4k GitHub stars~1.7k tokensUpdated 5 days ago
    DevelopmentAuto-check passed
  • Design Doc Mermaid

    SpillwaveSolutions/design-doc-mermaid

    Create Mermaid diagrams (flowchart, sequence, class, ER, state, C4, architecture) from text or source code.

    175 GitHub starsUsed in 1 repo~5.6k tokens
    DevelopmentAuto-check passed
  • Markdown Mermaid Writing

    neflibata-feng/MyArxiv-Agent

    Comprehensive markdown and Mermaid diagram writing skill that establishes text-based diagrams as the DEFAULT documentation standard.

    126 GitHub starsUsed in 5 repos~3.8k tokens
    DevelopmentAuto-check: notes
  • Generate Readme

    divar-ir/ai-doc-gen

    Generate or refresh a comprehensive, professional README.md for a repository, with architecture overview, mermaid and optional C4 diagrams, repository structure, dependencies, and API documentation.

    765 GitHub stars~996 tokensUpdated 2 mo ago
    DevelopmentAuto-check passed
  • Book Writer

    aospbooks/aosp-internal-book

    Patterns for writing technical book chapters in Markdown with Mermaid diagrams, served via ProperDocs (a MkDocs fork).

    138 GitHub stars~3.1k tokensUpdated 2 days ago
    DevelopmentAuto-check passed

More from zebbern/claude-code-guide

All 46 skills in this repo
  • Localization Toolkit

    zebbern/claude-code-guide

    This skill should be used when setting up, auditing, or enforcing internationalization/localization in UI codebases (React/TS, i18next or similar, JSON locales), including installing/configuring the…

    4.6k GitHub starsUsed in 1 repo~1.3k tokens
    Auto-check passed
  • Audit Flow

    zebbern/claude-code-guide

    Interactive system flow tracing across CODE, API, AUTH, DATA, NETWORK layers with SQLite persistence and Mermaid export.

    4.6k GitHub stars~4.2k tokensUpdated yesterday
    Auto-check passed
  • Chart Image

    zebbern/claude-code-guide

    Generate publication-quality PNG chart images from data, supporting line, bar, area, candlestick, pie, and heatmap charts.

    4.6k GitHub stars~2.7k tokensUpdated yesterday
    Auto-check passed
  • Code Vuln Audit

    zebbern/claude-code-guide

    Scan code for security issues: dependency vulnerabilities (npm/pip audit), secret leaks (regex and entropy analysis), and OWASP anti-patterns like SQL injection, XSS, or command injection.

    4.6k GitHub stars~1.3k tokensUpdated yesterday
    Auto-check passed
  • Data Viz Renderer

    zebbern/claude-code-guide

    Generate self-contained HTML/SVG infographics from JSON data, including stat cards, bar charts, flow diagrams, and mixed dashboards.

    4.6k GitHub stars~1.3k tokensUpdated yesterday
    Auto-check passed
  • Idor Testing

    zebbern/claude-code-guide

    This skill should be used when the user asks to "test for insecure direct object references," "find IDOR vulnerabilities," "exploit broken access control," "enumerate user IDs or object references,"…

    4.6k GitHub starsUsed in 7 repos~3.1k tokens
    Auto-check passed

Categories

Questions about Code To Diagram

What does Code To Diagram do?

Analyze codebases and automatically generate architecture diagrams, flowcharts, and org charts. Code To Diagram is an agent skill from zebbern/claude-code-guide. Analyze codebases and automatically generate architecture diagrams, flowcharts, and org charts.

When should I use Code To Diagram?

Code To Diagram fits situations like: tasks that involve Diagrams.

How do I install Code To Diagram in Claude Code?

Run `npx skills add zebbern/claude-code-guide --skill code-to-diagram -a claude-code`. Or copy the skill folder (skills/code-to-diagram in zebbern/claude-code-guide) into .claude/skills/code-to-diagram in your project. Claude Code loads it when a task matches its description.

How do I install Code To Diagram in Codex?

Run `npx skills add zebbern/claude-code-guide --skill code-to-diagram -a codex`. Or copy the skill folder (skills/code-to-diagram in zebbern/claude-code-guide) into .agents/skills/code-to-diagram in your project. Codex loads it when a task matches its description.

Can I use Code To Diagram in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add zebbern/claude-code-guide --skill code-to-diagram -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/code-to-diagram, .gemini/skills/code-to-diagram, .github/skills/code-to-diagram and .opencode/skills/code-to-diagram in your project.

What does Code To Diagram need to run?

Going by SKILL.md and its folder, Code To Diagram needs Python for the scripts in its folder and the command-line tools its instructions call (python3). Our summary lists: Python 3.

Does Code To Diagram access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Code To Diagram safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Code To Diagram use?

Code To Diagram is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Code To Diagram use?

About 972 tokens (SKILL.md is roughly 3.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Code To Diagram?

Skills that share tags, products or a category with Code To Diagram: Code To Chart (rongxinzy/RongxinAI, 154 stars), Code Graph Mermaid Diagrams (trailofbits/skills, 7.4k stars), Design Doc Mermaid (SpillwaveSolutions/design-doc-mermaid, 175 stars) and Markdown Mermaid Writing (neflibata-feng/MyArxiv-Agent, 126 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Code To Diagram?

zebbern (a GitHub user) maintains it in zebbern/claude-code-guide, which has 4,648 GitHub stars. The repository holds 46 skills in this directory. The repository was last updated on October 7, 2026.

Source: zebbern/claude-code-guide on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.